Пример #1
0
        public void Add(MeasuringRange range)
        {
            this.measuringRanges.Add(range);

            this.summaryRegister.FirstOrDefault(r => r.TariffId == range.TariffId).Amount =
                this.summaryRegister.FirstOrDefault(r => r.TariffId == range.TariffId).Amount + range.Amount;
        }
Пример #2
0
        /// <summary>
        /// The main calculation method for the accounting period in Taf-1.
        /// </summary>
        /// <param name="supplier">Contains the calculation data.</param>
        /// <param name="meterReading">The MeterReading instance with the raw data.</param>
        /// <param name="startReading">The intervalReading at the beginning of the section.</param>
        /// <param name="endReading">The intervalReading at the end of the section.</param>
        /// <param name="tariffId">The valid tariffId.</param>
        /// <returns>The calculated AccountingSection</returns>
        public AccountingMonth GetSection(UsagePointLieferant supplier, MeterReading meterReading, IntervalReading startReading, IntervalReading endReading, ushort tariffId)
        {
            var registers = supplier.GetRegister();

            this.UpdateReadingTypeFromOriginalValueList(registers);

            var section = new AccountingMonth(registers)
            {
                Reading = new Reading()
                {
                    Amount = startReading.Value, ObisCode = new ObisId(meterReading.ReadingType.ObisCode)
                }
            };

            var  start  = startReading.TargetTime.Value;
            var  end    = endReading.TargetTime.Value;
            long amount = (long)(endReading.Value - startReading.Value);

            var range = new MeasuringRange(start, end, tariffId, amount);

            section.Add(range);
            section.Start = start;

            return(section);
        }