Example #1
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);
        }
Example #2
0
        public void Add(AccountingMonth month)
        {
            foreach (Register reg in this.summaryRegister)
            {
                reg.Amount = reg.Amount + month.SummaryRegister.FirstOrDefault(r => r.TariffId == reg.TariffId).Amount;
            }

            this.accountingMonths.Add(month);
        }