/// <summary>
        ///
        /// </summary>
        /// <param name="lpiResult" type="Itron.Metering.DeviceDataTypes.LPInterval">
        /// </param>
        /// <param name="lpiContributor" type="Itron.Metering.DeviceDataTypes.LPInterval">
        /// </param>
        /// <param name="eCalculation" type="Itron.Metering.Datafiles.TotalizationContributorList.CalculationType">
        /// </param>
        /// <returns>
        ///     A bool value...
        /// </returns>
        private Boolean CombineIntervals(LPInterval lpiResult,
                                         LPInterval lpiContributor,
                                         TotalizationDataSource.CalculationType eCalculation)
        {
            Boolean boolSuccessful = false;

            if (lpiContributor.Time == lpiResult.Time)
            {
                for (int nChannelIndex = 0; nChannelIndex < NumProfileChannels; nChannelIndex++)
                {
                    if (eCalculation == TotalizationDataSource.CalculationType.Addition)
                    {
                        lpiResult.Data[nChannelIndex] += lpiContributor.Data[nChannelIndex];
                    }
                    else
                    {
                        lpiResult.Data[nChannelIndex] -= lpiContributor.Data[nChannelIndex];
                    }
                }

                // Combine the interval statuses - assuming the new contributor has a
                // status value...
                if (!String.IsNullOrEmpty(lpiContributor.IntervalStatus))
                {
                    CombineIntervalStatuses(lpiResult, lpiContributor);
                }

                boolSuccessful = true;
            }

            return(boolSuccessful);
        }
Example #2
0
        /// <summary>
        /// Merge the data from the given source to the destination structure
        /// </summary>
        /// <param name="lpDestination" type="Itron.Metering.DeviceDataTypes.LoadProfilePulseData">
        /// </param>
        /// <param name="lpSource" type="Itron.Metering.DeviceDataTypes.LoadProfileData">
        /// </param>
        /// <param name="dtCurrentInterval" type="System.DateTime">
        /// </param>
        /// <remarks>
        ///  Revision History
        ///  MM/DD/YY Who Version Issue# Description
        ///  -------- --- ------- ------ ---------------------------------------------
        ///  12/15/08 mah 9.50.26 CQ124360	Incremented the interval end time to advance
        ///                                 to the next interval
        ///
        /// </remarks>
        private void MergeContributorData(LoadProfilePulseData lpDestination, LoadProfileData lpSource, ref DateTime dtCurrentInterval)
        {
            int nIntervalIndex = lpSource.GetIntervalIndexAt(dtCurrentInterval);

            while (nIntervalIndex < lpSource.NumberIntervals)
            {
                // We found useful data - now add all that we can to the result data.
                // We don't have to worry about the end date since the whole purpose of
                // aggregation is to join as much data as possible
                LPInterval nextInterval = lpSource.Intervals[nIntervalIndex];

                lpDestination.AddInterval(
                    nextInterval.Data,
                    nextInterval.ChannelStatuses,
                    nextInterval.IntervalStatus,
                    nextInterval.Time,
                    DisplayScaleOptions.UNITS);

                dtCurrentInterval = lpDestination.EndTime;
                nIntervalIndex++;
            }

            // Advance the clock to the next interval
            dtCurrentInterval = dtCurrentInterval.AddMinutes((double)IntervalLength);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="lpResult" type="Itron.Metering.DeviceDataTypes.LoadProfileEnergyData">
        ///     <para>
        ///
        ///     </para>
        /// </param>
        private void NegateLastInterval(LoadProfileEnergyData lpResult)
        {
            LPInterval lpiLastInterval = lpResult.Intervals[lpResult.Intervals.Count - 1];

            // Negate each interval
            for (int nChannelIndex = 0; nChannelIndex < NumProfileChannels; nChannelIndex++)
            {
                lpiLastInterval.Data[nChannelIndex] = -lpiLastInterval.Data[nChannelIndex];
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="lpiResult" type="Itron.Metering.DeviceDataTypes.LPInterval">
 /// </param>
 /// <param name="lpiContributor" type="Itron.Metering.DeviceDataTypes.LPInterval">
 /// </param>
 private static void CombineIntervalStatuses(LPInterval lpiResult, LPInterval lpiContributor)
 {
     if (String.IsNullOrEmpty(lpiResult.IntervalStatus))
     {
         lpiResult.IntervalStatus = lpiContributor.IntervalStatus;
     }
     else             // both the totalized data and the new contributor have statuses
     {
         for (int nStatusIndex = 0; nStatusIndex < lpiContributor.IntervalStatus.Length; nStatusIndex++)
         {
             if (lpiResult.IntervalStatus.IndexOf(lpiContributor.IntervalStatus[nStatusIndex]) < 0)
             {
                 lpiResult.IntervalStatus += lpiContributor.IntervalStatus[nStatusIndex].ToString();
             }
         }
     }
 }