/// <summary> /// Racuna prosecnu potrosnju u intervalu odredjenom funkcijama CalculateStartInterval, CalculateEndInterval /// za aktivnu i reaktivnu snagu, pri tom vrsi skladistenje u odgovarajucu tabelu tabelu, /// takodje metoda vrsi konverziju podataka izmedju dve tabele /// </summary> /// <typeparam name="READ"> Tip podatka tabele iz koje se citaju podaci </typeparam> /// <typeparam name="WRITE"> Tip podatka tabele u koju se upisuju podaci </typeparam> /// <param name="startTime"> Pocetak intervala </param> /// <param name="endTime"> Kraj intervala </param> public void CalculateAndStore <READ, WRITE>(DateTime startTime, DateTime endTime) where READ : HistorianItem where WRITE : HistorianItem { // Liste potrebne za proracun List <READ> activeValues = null; List <READ> reactiveValues = null; // Tabele za smestanje prosecnih vrednosti List <WRITE> activeAverageValues = null; List <WRITE> reactiveAverageValues = null; using (AccessDB access = new AccessDB()) { activeValues = dbHelper.GetRangeByPowerType <READ>(PowerType.Active, startTime.Ticks, endTime.Ticks); reactiveValues = dbHelper.GetRangeByPowerType <READ>(PowerType.Reactive, startTime.Ticks, endTime.Ticks); activeAverageValues = Average <READ, WRITE>(activeValues, startTime.Ticks); reactiveAverageValues = Average <READ, WRITE>(reactiveValues, startTime.Ticks); dbHelper.AddRange <WRITE>(activeAverageValues); dbHelper.AddRange <WRITE>(reactiveAverageValues); } }