/// <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); }
/// <summary> /// /// </summary> /// <param name="lpResult" type="Itron.Metering.DeviceDataTypes.LoadProfileEnergyData"> /// </param> /// <param name="lpContributor" type="Itron.Metering.DeviceDataTypes.LoadProfileEnergyData"> /// </param> /// <param name="eCalculation" type="Itron.Metering.Datafiles.TotalizationContributorList.CalculationType"> /// </param> private void TotalizeIntervalData(LoadProfileEnergyData lpResult, LoadProfileEnergyData lpContributor, TotalizationDataSource.CalculationType eCalculation) { if (lpResult.NumberIntervals == 0) { // This is the first contributor // Find the starting point int nIntervalIndex = FindIntervalIndex(lpContributor, ProfileStartTime); bool boolFinished = false; if (nIntervalIndex >= 0) { while (nIntervalIndex < lpContributor.NumberIntervals && !boolFinished) { if (lpContributor.Intervals[nIntervalIndex].Time <= ProfileEndTime) { lpResult.Intervals.Add(lpContributor.Intervals[nIntervalIndex]); if (eCalculation == TotalizationDataSource.CalculationType.Subtraction) { NegateLastInterval(lpResult); } // Move to the next interval nIntervalIndex++; } else { boolFinished = true; } } } } else { // Find the starting point int nResultIndex = 0; int nContributorIndex = FindIntervalIndex(lpContributor, ProfileStartTime); bool boolFinished = false; if (nContributorIndex >= 0) { while (nContributorIndex < lpContributor.NumberIntervals && !boolFinished) { if (lpContributor.Intervals[nContributorIndex].Time <= ProfileEndTime) { // The two time stamps must match CombineIntervals(lpResult.Intervals[nResultIndex], lpContributor.Intervals[nContributorIndex], eCalculation); // Move to the next interval nResultIndex++; nContributorIndex++; } else { boolFinished = true; } } } } }