function FillObjects()
 {
     /*план*/
     $irup = new EstRequest("rup-plan", array(152206), false, true);
     /*константы генирации*/
     $const = new EstRequest("const-gen", array(175048), false, true);
     $pol_glub = new EstRequest('ВЛ-110кВ Полоцк-Глубокое 1,2', array(170014, 170020, 169942, 169948), true);
     $bps_disna = new EstRequest('ВЛ-110кВ на БПС Дисна', array(169810, 169816), true);
     $glub_oev = new EstRequest('ОЭВ-110 кВ', array(169978, 169984), true);
     $iaes_vidzy = new EstRequest('ВЛ-110кВ на БПС Дисна', array(164818, 164824), true);
     $miory_verdvinsk = new EstRequest('ВЛ-110кВ на БПС Дисна', array(177677, 177683), true, false, false);
     $lyntupy_shvench = new EstRequest('ВЛ-110кВ на БПС Дисна', array(177677, 177683), true);
     $komy_kupa = new EstRequest('ВЛ-110кВ на БПС Дисна', array(164722, 164728), true);
     $begoml_zestyan = new EstRequest('ВЛ-110кВ на БПС Дисна', array(164926, 164932), true);
     $drisvaty_v1 = new EstRequest('ВЛ-110кВ на БПС Дисна', array(170266, 170272), true);
     $constOevGlub = new EstRequest("const-oev-glub", array(175162, 175166, 175170), false, true);
     $pol_disna = new EstRequest("ВЛ-110кВ", array(169810, 169816), true);
     $iaes_opsa = new EstRequest("ВЛ-110кВ", array(164866, 164872), true);
     /*константы перетоков*/
     $constPer = new EstRequest("const-peretok", array(175064), true);
     $mGen = array($irup, $const, $pol_glub, $bps_disna, $glub_oev, $constOevGlub, $iaes_vidzy, $iaes_opsa, $miory_verdvinsk, $lyntupy_shvench, $komy_kupa, $begoml_zestyan, $drisvaty_v1, $constPer);
     //GetObjectEstData($mGen,new DateTime('now'));
     if (!isset($this->date)) {
         EstDataRequest::GetObjectEstData($mGen, new \DateTime('now'));
     } else {
         $reqdt = date('Y-m-d', $this->date / 1000);
         $tmreq = new \DateTime($reqdt);
         $tmnow = new \DateTime('now');
         $arreq = getdate($this->date / 1000);
         $arrnow = getdate($tmnow->getTimestamp());
         if ($arreq['mday'] != $arrnow['mday'] || $arreq['mon'] != $arreq['mon']) {
             EstDataRequest::GetObjectEstData($mGen, $tmreq);
         } else {
             EstDataRequest::GetObjectEstData($mGen, $tmnow);
         }
     }
     $row = null;
     foreach ($irup->data as $key => $item) {
         $row = new \stdClass();
         $row->datetime = $key;
         $row->plan = isset($irup->data[$key]) ? $irup->data[$key][$irup->items[0]]['VAL'] : 0;
         $row->constPes = isset($const->data[$key]) ? $const->data[$key]['175048']['VAL'] : 0;
         $row->pol_glub_1_o = $this->setCheckedValue($pol_glub, $key, '170014');
         $row->pol_glub_1_p = $this->setCheckedValue($pol_glub, $key, '170020');
         $row->pol_glub_2_o = $this->setCheckedValue($pol_glub, $key, '169942');
         $row->pol_glub_2_p = $this->setCheckedValue($pol_glub, $key, '169948');
         $row->pol_glub_sum_o = $row->pol_glub_1_o + $row->pol_glub_2_o;
         $row->pol_glub_sum_p = $row->pol_glub_1_p + $row->pol_glub_2_p;
         $row->bps_disna_o = $this->setCheckedValue($bps_disna, $key, '169810');
         $row->bps_disna_p = $this->setCheckedValue($bps_disna, $key, '169816');
         $row->glub_oev_o = $this->setCheckedValue($glub_oev, $key, '169978');
         $row->glub_oev_p = $this->setCheckedValue($glub_oev, $key, '169984');
         $val1 = $this->setCheckedValue($constOevGlub, $key, '175162', 'VAL');
         $val2 = $this->setCheckedValue($constOevGlub, $key, '175166', 'VAL');
         $val3 = $this->setCheckedValue($constOevGlub, $key, '175170', 'VAL');
         $row->glub_oev_1_o = $row->glub_oev_o * $val1;
         $row->glub_oev_2_o = $row->glub_oev_o * $val2;
         $row->disna_oev_o = $row->glub_oev_o * $val3;
         $row->glub_oev_1_p = $row->glub_oev_p * $val1;
         $row->glub_oev_2_p = $row->glub_oev_p * $val2;
         $row->disna_oev_p = $row->glub_oev_o * $val3;
         $row->iaes_vidzy_p = $this->setCheckedValue($iaes_vidzy, $key, '164824', 'IVAL');
         $row->iaes_vidzy_o = $this->setCheckedValue($iaes_vidzy, $key, '164818', 'IVAL');
         $row->iaes_opsa_p = $this->setCheckedValue($iaes_opsa, $key, '164872', 'IVAL');
         $row->iaes_opsa_o = $this->setCheckedValue($iaes_opsa, $key, '164866', 'IVAL');
         $row->miory_verdvinsk_o = round($this->setCheckedValue($miory_verdvinsk, $key, '177677', 'IVAL') * 66, 1);
         $row->miory_verdvinsk_p = round($this->setCheckedValue($miory_verdvinsk, $key, '177683', 'IVAL') * 66, 1);
         $row->lyntupy_shvench_o = $this->setCheckedValue($lyntupy_shvench, $key, '177677', 'IVAL');
         $row->lyntupy_shvench_p = $this->setCheckedValue($lyntupy_shvench, $key, '177683', 'IVAL');
         $row->komy_kupa_o = $this->setCheckedValue($komy_kupa, $key, '164722', 'IVAL');
         $row->komy_kupa_p = $this->setCheckedValue($komy_kupa, $key, '164728', 'IVAL');
         $row->begoml_zestyan_o = $this->setCheckedValue($begoml_zestyan, $key, '164926', 'IVAL');
         $row->begoml_zestyan_p = $this->setCheckedValue($begoml_zestyan, $key, '164932', 'IVAL');
         $row->drisvaty_v1_o = $this->setCheckedValue($drisvaty_v1, $key, '170266', 'IVAL');
         $row->drisvaty_v1_p = $this->setCheckedValue($drisvaty_v1, $key, '170272', 'IVAL');
         $row->cost_per = $this->setCheckedValue($constPer, $key, '175064', 'VAL');
         $this->calcPotr(null, $row);
         $recordIntake = new \stdClass();
         $recordIntake->datetime = $row->datetime;
         $recordIntake->plan = $row->plan;
         $recordIntake->fact = $row->fact;
         $recordIntake->deviation = $row->otcl;
         $recordIntake->percent = $row->percent;
         $this->add($row, $recordIntake);
     }
 }
 function FillObjects()
 {
     /*план*/
     $irup = new EstRequest("rup-plan", array(152194), false, true);
     /*Лукомль генираторы А+ 30 мин.*/
     $luk = new EstRequest("luk-gen", array(166078, 166126, 166174, 166222, 166270, 166318, 166366, 166414), true);
     /*Новополоцкая ТЭЦ*/
     $nov = new EstRequest("nov-gen", array(165544, 165592, 171716, 171764, 171812, 171860, 171956), true);
     /*ПГУ 400*/
     $pgu400 = new EstRequest("luc-pgu-gen", array(184717, 184789), true);
     /*ДГУ*/
     $dgu = new EstRequest("luc-dgu-gen", array(166462, 166510), true);
     /*КГТУ Нафтан*/
     $kgtu = new EstRequest("kgtu-gen", array(165640, 165688), true);
     /*Полоцкая ТЭЦ*/
     $polgen = new EstRequest("pol-gen", array(165310, 172634), true);
     /*константы генирации*/
     $const = new EstRequest("const-gen", array(175040, 175044, 175036, 175048), false, true);
     /*330кВт*/
     /*345,350*/
     $line = new EstRequest("line", array(164242, 164248, 164146, 164152, 170498, 170504, 170954, 170960, 165784, 165796, 165886, 165892, 165838, 165844, 165736, 198539), true);
     $luk_krup = new EstRequest('ВЛ-110 кВ Крупки 1,2,3', array(165934, 165940, 165982, 165988, 166030, 166036), true);
     $luk_senno = new EstRequest('ВЛ-110кВ Лукомль-Сенно', array(170546, 170552), true);
     $luk_oev = new EstRequest('ОЭВ-110 кВ', array(170582, 170588, 175182), true);
     $constLukKrup = new EstRequest("const-luk-krup", array(175186, 175190, 175194, 175182), false, true);
     $pol_glub = new EstRequest("ВЛ-110кВ Полоцк-Глубокое", array(170014, 170020, 169942, 169948), true);
     $pol_disna = new EstRequest("ВЛ-110кВ", array(169810, 169816), true);
     $pol_ovv = new EstRequest("ОЭВ-110кВ", array(169978, 169984), true);
     $pol_110 = new EstRequest("Гравийная,Новолукомль,Мясокомбинат,Миоры,Чашники", array(164434, 164440, 164338, 164344, 164596, 164602, 164530, 164536), true);
     $pol_cacl = new EstRequest("Мясокомбинат,Миоры,Чашники", array(178725, 178731, 177677, 177683, 210864, 210870), true, false, false);
     $constOvvGlub = new EstRequest("ОЭВ-110кВ на Глубокое", array(175162, 175166, 175170), false, true);
     /*константы перетоков*/
     $constPer = new EstRequest("const-peretok", array(175056), true);
     $mGen = array($irup, $luk, $pgu400, $dgu, $kgtu, $nov, $polgen, $const, $line, $luk_krup, $luk_senno, $luk_oev, $constLukKrup, $pol_glub, $pol_disna, $pol_ovv, $constOvvGlub, $pol_110, $pol_cacl, $constPer);
     if (!isset($this->date)) {
         EstDataRequest::GetObjectEstData($mGen, new \DateTime('now'));
     } else {
         $reqdt = date('Y-m-d', $this->date / 1000);
         $tmreq = new \DateTime($reqdt);
         $tmnow = new \DateTime('now');
         $arreq = getdate($this->date / 1000);
         $arrnow = getdate($tmnow->getTimestamp());
         if ($arreq['mday'] != $arrnow['mday'] || $arreq['mon'] != $arreq['mon']) {
             EstDataRequest::GetObjectEstData($mGen, $tmreq);
         } else {
             EstDataRequest::GetObjectEstData($mGen, $tmnow);
         }
     }
     $row = null;
     foreach ($irup->data as $key => $item) {
         $row = new \stdClass();
         $row->datetime = $key;
         $summ = 0;
         $row->plan = isset($irup->data[$key]) ? $irup->data[$key][$irup->items[0]]['VAL'] : 0;
         $row->lucgen = isset($luk->data[$key]) ? $luk->data[$key]['ISUM'] : 0;
         $row->novgen = isset($nov->data[$key]) ? $nov->data[$key]['ISUM'] : 0;
         $row->pgugen = isset($pgu400->data[$key]) ? $pgu400->data[$key]['ISUM'] : 0;
         $row->dgugen = isset($dgu->data[$key]) ? $dgu->data[$key]['ISUM'] : 0;
         $row->kgtugen = isset($kgtu->data[$key]) ? $kgtu->data[$key]['ISUM'] : 0;
         $row->polgen = isset($polgen->data[$key]) ? $polgen->data[$key]['ISUM'] : 0;
         $row->sumgen = $row->lucgen + $row->novgen + $row->pgugen + $row->dgugen + $row->kgtugen + $row->polgen;
         $row->constPes = $this->setCheckedValue($const, $key, '175040', 'VAL');
         $summ = $row->sumgen + $row->constPes;
         $row->line345O = $this->setCheckedValue($line, $key, '164242');
         $row->line345P = $this->setCheckedValue($line, $key, '164248');
         $summ += $row->line345P - $row->line345O;
         $row->line348O = $this->setCheckedValue($line, $key, '170498');
         $row->line348P = $this->setCheckedValue($line, $key, '170504');
         $summ += $row->line348P - $row->line348O;
         $row->line450O = $this->setCheckedValue($line, $key, '164146');
         $row->line450P = $this->setCheckedValue($line, $key, '164152');
         $summ += $row->line450P - $row->line450O;
         $row->line337O = $this->setCheckedValue($line, $key, '170954');
         $row->line337P = $this->setCheckedValue($line, $key, '170960');
         $summ += $row->line337P - $row->line337O;
         $row->line432O = $this->setCheckedValue($line, $key, '165784');
         $row->line432P = $this->setCheckedValue($line, $key, '165796');
         $summ += $row->line432P - $row->line432O;
         $row->line335O = $this->setCheckedValue($line, $key, '165886');
         $row->line335P = $this->setCheckedValue($line, $key, '165892');
         $summ += $row->line335P - $row->line335O;
         $row->line428O = $this->setCheckedValue($line, $key, '165838');
         $row->line428P = $this->setCheckedValue($line, $key, '165844');
         $summ += $row->line428P - $row->line428O;
         $row->line336O = $this->setCheckedValue($line, $key, '165736');
         $row->line336P = $this->setCheckedValue($line, $key, '198539');
         $summ += $row->line336P - $row->line336O;
         $row->luk_krup_1O = $this->setCheckedValue($luk_krup, $key, '165934');
         $row->luk_krup_1p = $this->setCheckedValue($luk_krup, $key, '165940');
         $row->luk_krup_2O = $this->setCheckedValue($luk_krup, $key, '165982');
         $row->luk_krup_2p = $this->setCheckedValue($luk_krup, $key, '165988');
         $row->luk_krup_3O = $this->setCheckedValue($luk_krup, $key, '166030');
         $row->luk_krup_3p = $this->setCheckedValue($luk_krup, $key, '166036');
         $row->luk_krup_sum_O = $row->luk_krup_1O + $row->luk_krup_2O + $row->luk_krup_3O;
         $row->luk_krup_sum_p = $row->luk_krup_1p + $row->luk_krup_2p + $row->luk_krup_3p;
         $summ += $row->luk_krup_sum_p - $row->luk_krup_sum_O;
         $row->luk_senno_O = $this->setCheckedValue($luk_senno, $key, '170546');
         $row->luk_senno_p = $this->setCheckedValue($luk_senno, $key, '170552');
         $summ += $row->luk_senno_p - $row->luk_senno_O;
         $row->luc_oev_O = $this->setCheckedValue($luk_oev, $key, '170582');
         $row->luc_oev_p = $this->setCheckedValue($luk_oev, $key, '170588');
         $val1 = $this->setCheckedValue($constLukKrup, $key, '175186', 'VAL');
         $val2 = $this->setCheckedValue($constLukKrup, $key, '175190', 'VAL');
         $val3 = $this->setCheckedValue($constLukKrup, $key, '175194', 'VAL');
         $val4 = $this->setCheckedValue($constLukKrup, $key, '175182', 'VAL');
         $row->luc_oev_krup_1_O = $row->luc_oev_O * $val1;
         $row->luc_oev_krup_2_O = $row->luc_oev_O * $val2;
         $row->luc_oev_krup_3_O = $row->luc_oev_O * $val3;
         $row->luc_oev_senno_O = $row->luc_oev_O * $val4;
         $row->luc_oev_krup_1_p = $row->luc_oev_p * $val1;
         $row->luc_oev_krup_2_p = $row->luc_oev_p * $val2;
         $row->luc_oev_krup_3_p = $row->luc_oev_p * $val3;
         $row->luc_oev_senno_p = $row->luc_oev_p * $val4;
         $summ += $row->luc_oev_krup_1_p - $row->luc_oev_krup_1_O;
         $summ += $row->luc_oev_krup_2_p - $row->luc_oev_krup_2_O;
         $summ += $row->luc_oev_krup_3_p - $row->luc_oev_krup_3_O;
         $summ += $row->luc_oev_senno_p - $row->luc_oev_senno_O;
         $row->pol_glub_1_O = $this->setCheckedValue($pol_glub, $key, '170014');
         $row->pol_glub_1_p = $this->setCheckedValue($pol_glub, $key, '170020');
         $row->pol_glub_2_O = $this->setCheckedValue($pol_glub, $key, '169942');
         $row->pol_glub_2_p = $this->setCheckedValue($pol_glub, $key, '169948');
         $row->pol_glub_sum_O = $row->pol_glub_1_O + $row->pol_glub_2_O;
         $row->pol_glub_sum_p = $row->pol_glub_1_p + $row->pol_glub_2_p;
         $summ += $row->pol_glub_sum_p - $row->pol_glub_sum_O;
         $row->pol_disna_O = $this->setCheckedValue($pol_disna, $key, '169810');
         $row->pol_disna_p = $this->setCheckedValue($pol_disna, $key, '169816');
         $summ += $row->pol_disna_p - $row->pol_disna_O;
         $row->pol_ovv_O = $this->setCheckedValue($pol_ovv, $key, '169978');
         $row->pol_ovv_p = $this->setCheckedValue($pol_ovv, $key, '169984');
         $val1 = $this->setCheckedValue($constLukKrup, $key, '175162', 'VAL');
         $val2 = $this->setCheckedValue($constLukKrup, $key, '175166', 'VAL');
         $val3 = $this->setCheckedValue($constLukKrup, $key, '175170', 'VAL');
         $row->pol_ovv_glub_1_O = $row->pol_ovv_O * $val1;
         $row->pol_ovv_glub_1_p = $row->pol_ovv_p * $val1;
         $row->pol_ovv_glub_2_O = $row->pol_ovv_O * $val2;
         $row->pol_ovv_glub_2_p = $row->pol_ovv_p * $val2;
         $row->pol_ovv_disna_O = $row->pol_ovv_O * $val2;
         $row->pol_ovv_disna_p = $row->pol_ovv_p * $val2;
         $summ += $row->pol_ovv_glub_1_p - $row->pol_ovv_glub_1_O;
         $summ += $row->pol_ovv_glub_2_p - $row->pol_ovv_glub_2_O;
         $summ += $row->pol_ovv_disna_p - $row->pol_ovv_disna_O;
         $row->pol_grav_v1_O = $this->setCheckedValue($pol_110, $key, '164434');
         $row->pol_grav_v1_p = $this->setCheckedValue($pol_110, $key, '164440');
         $row->pol_grav_v2_O = $this->setCheckedValue($pol_110, $key, '164338');
         $row->pol_grav_v2_p = $this->setCheckedValue($pol_110, $key, '164344');
         $summ += $row->pol_grav_v1_O - $row->pol_grav_v1_p;
         $summ += $row->pol_grav_v2_O - $row->pol_grav_v2_p;
         $row->pol_novol_v1_O = $this->setCheckedValue($pol_110, $key, '164596');
         $row->pol_novol_v1_p = $this->setCheckedValue($pol_110, $key, '164602');
         $row->pol_novol_v2_O = $this->setCheckedValue($pol_110, $key, '164530');
         $row->pol_novol_v2_p = $this->setCheckedValue($pol_110, $key, '164536');
         $summ += $row->pol_novol_v1_O - $row->pol_novol_v1_p;
         $summ += $row->pol_novol_v2_O - $row->pol_novol_v2_p;
         $row->pol_myso_O = round($this->setCheckedValue($pol_cacl, $key, '178725') / 1000, 1);
         $row->pol_myso_p = round($this->setCheckedValue($pol_cacl, $key, '178731') / 1000, 1);
         $summ += $row->pol_myso_p - $row->pol_myso_O;
         $row->pol_chashniki_O = round($this->setCheckedValue($pol_cacl, $key, '210864') / 1000, 1);
         $row->pol_chashniki_p = round($this->setCheckedValue($pol_cacl, $key, '210870') / 1000, 1);
         $summ += $row->pol_chashniki_p - $row->pol_chashniki_O;
         $row->pol_miory_O = round($this->setCheckedValue($pol_cacl, $key, '177677') * 66, 1);
         $row->pol_miory_p = round($this->setCheckedValue($pol_cacl, $key, '177683') * 66, 1);
         $summ += $row->pol_miory_O - $row->pol_miory_p;
         $row->const_per_pes = $this->setCheckedValue($constPer, $key, '175056', 'VAL');
         $summ += $row->const_per_pes;
         $this->calcPotr($summ, $row);
         $recordIntake = new \stdClass();
         $recordIntake->datetime = $row->datetime;
         $recordIntake->plan = $row->plan;
         $recordIntake->fact = $row->fact;
         $recordIntake->deviation = $row->otcl;
         $recordIntake->percent = $row->percent;
         $this->add($row, $recordIntake);
     }
 }
 function FillObjects()
 {
     /*план*/
     $irup = new EstRequest("rup-plan", array(152198), false, true);
     /*Vitebsk tec*/
     $vittec = new EstRequest("vit-tec-gen", array(165190, 165226), true);
     $vostec = new EstRequest("voctec-gen", array(201362), true);
     /*константы генирации*/
     $const = new EstRequest("const-gen", array(175036), false, true);
     $line348 = new EstRequest("", array(170498, 170504), true);
     $line349 = new EstRequest("", array(163954, 163960), true);
     $line_belgres = new EstRequest("", array(169666, 169672), true);
     $line_moshkany = new EstRequest("", array(169594, 169600), true);
     $oev_110 = new EstRequest("", array(169630, 169636), true);
     $constOev = new EstRequest("const-oev-glub", array(175174, 175178), false, true);
     $liozno_rudya = new EstRequest("", array(164050, 164056), true);
     $myaso_shumilino = new EstRequest("", array(178725, 178731), true, false, false);
     $chashniki_svatovka = new EstRequest("", array(210864, 210870), true, false, false);
     /*константы перетоков*/
     $constPer = new EstRequest("const-peretok", array(175052), true);
     $mGen = array($irup, $const, $vittec, $vostec, $line348, $line349, $line_belgres, $line_moshkany, $oev_110, $constOev, $liozno_rudya, $myaso_shumilino, $chashniki_svatovka, $constPer);
     if (!isset($this->date)) {
         EstDataRequest::GetObjectEstData($mGen, new \DateTime('now'));
     } else {
         $reqdt = date('Y-m-d', $this->date / 1000);
         $tmreq = new \DateTime($reqdt);
         $tmnow = new \DateTime('now');
         $arreq = getdate($this->date / 1000);
         $arrnow = getdate($tmnow->getTimestamp());
         if ($arreq['mday'] != $arrnow['mday'] || $arreq['mon'] != $arreq['mon']) {
             EstDataRequest::GetObjectEstData($mGen, $tmreq);
         } else {
             EstDataRequest::GetObjectEstData($mGen, $tmnow);
         }
     }
     $row = null;
     foreach ($irup->data as $key => $item) {
         $row = new \stdClass();
         $row->datetime = $key;
         $summ = 0;
         $row->plan = isset($irup->data[$key]) ? $irup->data[$key][$irup->items[0]]['VAL'] : 0;
         $row->vit_tec = isset($vittec->data[$key]) ? $vittec->data[$key]['ISUM'] : 0;
         $row->vost_tec = isset($vostec->data[$key]) ? $vostec->data[$key]['ISUM'] : 0;
         $row->constVes = $this->setCheckedValue($const, $key, '175036', 'VAL');
         $summ += $row->vit_tec + $row->vost_tec + $row->constVes;
         $row->line348_o = $this->setCheckedValue($line348, $key, '170498');
         $row->line348_p = $this->setCheckedValue($line348, $key, '170504');
         $summ += $row->line348_o - $row->line348_p;
         $row->line349_o = $this->setCheckedValue($line349, $key, '163954');
         $row->line349_p = $this->setCheckedValue($line349, $key, '163960');
         $summ += $row->line349_p - $row->line349_o;
         $row->line_belgres_o = $this->setCheckedValue($line_belgres, $key, '169666');
         $row->line_belgres_p = $this->setCheckedValue($line_belgres, $key, '169672');
         $summ += $row->line_belgres_p - $row->line_belgres_o;
         $row->line_moshkany_o = $this->setCheckedValue($line_moshkany, $key, '169594');
         $row->line_moshkany_p = $this->setCheckedValue($line_moshkany, $key, '169600');
         $summ += $row->line_moshkany_p - $row->line_moshkany_o;
         $row->oev_110_o = $this->setCheckedValue($oev_110, $key, '169630');
         $row->oev_110_p = $this->setCheckedValue($oev_110, $key, '169636');
         $val1 = $this->setCheckedValue($constOev, $key, '175174', 'VAL');
         $val2 = $this->setCheckedValue($constOev, $key, '175178', 'VAL');
         $row->oev_110_belgress_o = $row->oev_110_o * $val1;
         $row->oev_110_belgress_p = $row->oev_110_p * $val1;
         $row->oev_110_moshkany_o = $row->oev_110_o * $val2;
         $row->oev_110_moshkany_p = $row->oev_110_p * $val2;
         $summ += $row->oev_110_belgress_p - $row->oev_110_belgress_o;
         $summ += $row->oev_110_moshkany_p - $row->oev_110_moshkany_o;
         $row->liozno_rudya_o = $this->setCheckedValue($liozno_rudya, $key, '164050');
         $row->liozno_rudya_p = $this->setCheckedValue($liozno_rudya, $key, '164056');
         $summ += $row->liozno_rudya_p - $row->liozno_rudya_o;
         $row->myaso_shumilino_o = round($this->setCheckedValue($myaso_shumilino, $key, '178725') / 1000, 1);
         $row->myaso_shumilino_p = round($this->setCheckedValue($myaso_shumilino, $key, '178731') / 1000, 1);
         $summ += $row->myaso_shumilino_o - $row->myaso_shumilino_p;
         $row->chashniki_svatovka_o = round($this->setCheckedValue($chashniki_svatovka, $key, '210864') / 1000, 1);
         $row->chashniki_svatovka_p = round($this->setCheckedValue($chashniki_svatovka, $key, '210870') / 1000, 1);
         $summ += $row->chashniki_svatovka_o - $row->chashniki_svatovka_p;
         $row->cost_per = $this->setCheckedValue($constPer, $key, '175052', 'VAL');
         $summ += $row->cost_per;
         $this->calcPotr($summ, $row);
         $recordIntake = new \stdClass();
         $recordIntake->datetime = $row->datetime;
         $recordIntake->plan = $row->plan;
         $recordIntake->fact = $row->fact;
         $recordIntake->deviation = $row->otcl;
         $recordIntake->percent = $row->percent;
         $this->add($row, $recordIntake);
     }
 }
Exemple #4
0
 protected function FillObjects()
 {
     /*план*/
     $irup = new EstRequest("rup-plan", array(152202), false, true);
     /*Vitebsk tec*/
     $orsha_tec = new EstRequest("", array(165496, 165352, 165400, 165448), true);
     $belgres = new EstRequest("", array(166558, 166606), true);
     $baran = new EstRequest("", array(209613), true);
     /*константы генирации*/
     $const = new EstRequest("const-gen", array(175044), false, true);
     $line337 = new EstRequest("", array(170954, 170960), true);
     $luk_senno = new EstRequest("", array(170546, 170552), true);
     $luk_oev_110 = new EstRequest("", array(170582, 170588), true);
     $oev_110_senno = new EstRequest("", array(175182), false, true);
     $orsha_mogilev = new EstRequest("", array(165118, 165124), true);
     $to_belgres = new EstRequest("", array(169666, 169672), true);
     $to_moshkany = new EstRequest("", array(169594, 169600), true);
     $vit_oev = new EstRequest("", array(169630, 169636), true);
     $vit_oev_belgres_mosh = new EstRequest("", array(175174, 175178), false, true);
     $slavnoe_bobr = new EstRequest("", array(165022, 165028), true);
     $selishe_shklov = new EstRequest("", array(170402, 170408), true);
     $shklov_selishe = new EstRequest("", array(177348, 177352), true);
     $tolochin_krugloe = new EstRequest("", array(165070, 165076), true);
     $litvyaki_obchuga = new EstRequest("", array(164974, 164980), true);
     /*константы перетоков*/
     $constPer = new EstRequest("const-peretok", array(175060), true);
     $mGen = array($irup, $const, $orsha_tec, $belgres, $baran, $line337, $luk_senno, $luk_oev_110, $oev_110_senno, $orsha_mogilev, $to_moshkany, $to_belgres, $vit_oev, $slavnoe_bobr, $selishe_shklov, $shklov_selishe, $tolochin_krugloe, $litvyaki_obchuga, $constPer);
     if (!isset($this->date)) {
         EstDataRequest::GetObjectEstData($mGen, new \DateTime('now'));
     } else {
         $reqdt = date('Y-m-d', $this->date / 1000);
         $tmreq = new \DateTime($reqdt);
         $tmnow = new \DateTime('now');
         $arreq = getdate($this->date / 1000);
         $arrnow = getdate($tmnow->getTimestamp());
         if ($arreq['mday'] != $arrnow['mday'] || $arreq['mon'] != $arreq['mon']) {
             EstDataRequest::GetObjectEstData($mGen, $tmreq);
         } else {
             EstDataRequest::GetObjectEstData($mGen, $tmnow);
         }
     }
     $row = null;
     foreach ($irup->data as $key => $item) {
         $row = new \stdClass();
         $row->datetime = $key;
         $summ = 0;
         $row->plan = isset($irup->data[$key]) ? $irup->data[$key][$irup->items[0]]['VAL'] : 0;
         $row->orsha_tec = isset($orsha_tec->data[$key]) ? $orsha_tec->data[$key]['ISUM'] : 0;
         $row->belgres = isset($belgres->data[$key]) ? $belgres->data[$key]['ISUM'] : 0;
         $row->baran = isset($baran->data[$key]) ? $baran->data[$key]['ISUM'] : 0;
         $row->constOes = isset($const->data[$key]) ? $const->data[$key]['175044']['VAL'] : 0;
         $summ += $row->orsha_tec + $row->belgres + $row->baran + $row->constOes;
         $row->line337_o = $this->setCheckedValue($line337, $key, '170954');
         $row->line337_p = $this->setCheckedValue($line337, $key, '170960');
         $summ += $row->line337_o - $row->line337_p;
         $row->luk_senno_o = $this->setCheckedValue($luk_senno, $key, '170546');
         $row->luk_senno_p = $this->setCheckedValue($luk_senno, $key, '170552');
         $summ += $row->luk_senno_o - $row->luk_senno_p;
         $row->luk_oev_110_o = $this->setCheckedValue($luk_oev_110, $key, '170582');
         $row->luk_oev_110_p = $this->setCheckedValue($luk_oev_110, $key, '170588');
         $val1 = $oev_110_senno->data[$key]['175182']['VAL'];
         $row->oev_110_senno_o = $row->luk_oev_110_o * $val1;
         $row->oev_110_senno_p = $row->luk_oev_110_p * $val1;
         $summ += $row->oev_110_senno_o - $row->oev_110_senno_p;
         $row->orsha_mogilev_o = $this->setCheckedValue($orsha_mogilev, $key, '165118');
         $row->orsha_mogilev_p = $this->setCheckedValue($orsha_mogilev, $key, '165124');
         $summ += $row->orsha_mogilev_p - $row->orsha_mogilev_o;
         $row->to_belgres_o = $this->setCheckedValue($to_belgres, $key, '169666');
         $row->to_belgres_p = $this->setCheckedValue($to_belgres, $key, '169672');
         $summ += $row->to_belgres_o - $row->to_belgres_p;
         $row->to_moshkany_o = $this->setCheckedValue($to_moshkany, $key, '169594');
         $row->to_moshkany_p = $this->setCheckedValue($to_moshkany, $key, '169600');
         $summ += $row->to_moshkany_o - $row->to_moshkany_p;
         $row->vit_oev_o = $this->setCheckedValue($vit_oev, $key, '169630');
         $row->vit_oev_p = $this->setCheckedValue($vit_oev, $key, '169636');
         $val1 = $vit_oev_belgres_mosh->data[$key]['175174']['VAL'];
         $val2 = $vit_oev_belgres_mosh->data[$key]['175178']['VAL'];
         $row->vit_oev_belgres_o = $row->vit_oev_o * $val1;
         $row->vit_oev_belgres_p = $row->vit_oev_p * $val1;
         $summ += $row->vit_oev_belgres_o - $row->vit_oev_belgres_p;
         $row->vit_oev_moshkany_o = $row->vit_oev_o * $val2;
         $row->vit_oev_moshkany_p = $row->vit_oev_p * $val2;
         $summ += $row->vit_oev_moshkany_o - $row->vit_oev_moshkany_p;
         $row->slavnoe_bobr_o = $this->setCheckedValue($slavnoe_bobr, $key, '165022');
         $row->slavnoe_bobr_p = $this->setCheckedValue($slavnoe_bobr, $key, '165028');
         $summ += $row->slavnoe_bobr_p - $row->slavnoe_bobr_o;
         $row->selishe_shklov_o = $this->setCheckedValue($selishe_shklov, $key, '170402');
         $row->selishe_shklov_p = $this->setCheckedValue($selishe_shklov, $key, '170408');
         //$summ+=($row->selishe_shklov_o-$row->selishe_shklov_p);
         $row->shklov_selishe_o = $this->setCheckedValue($shklov_selishe, $key, '177348');
         $row->shklov_selishe_p = $this->setCheckedValue($shklov_selishe, $key, '177352');
         $summ += $row->shklov_selishe_o - $row->shklov_selishe_p;
         $row->tolochin_krugloe_o = $this->setCheckedValue($tolochin_krugloe, $key, '165070');
         $row->tolochin_krugloe_p = $this->setCheckedValue($tolochin_krugloe, $key, '165076');
         $summ += $row->tolochin_krugloe_p - $row->tolochin_krugloe_o;
         $row->litvyaki_obchuga_o = $this->setCheckedValue($litvyaki_obchuga, $key, '164974');
         $row->litvyaki_obchuga_p = $this->setCheckedValue($litvyaki_obchuga, $key, '164980');
         $summ += $row->litvyaki_obchuga_p - $row->litvyaki_obchuga_o;
         $row->cost_per = isset($constPer->data[$key]) ? $constPer->data[$key]['175060']['VAL'] : 0;
         $summ += $row->cost_per;
         $this->calcPotr($summ, $row);
         $recordIntake = new \stdClass();
         $recordIntake->datetime = $row->datetime;
         $recordIntake->plan = $row->plan;
         $recordIntake->fact = $row->fact;
         $recordIntake->deviation = $row->otcl;
         $recordIntake->percent = $row->percent;
         $this->add($row, $recordIntake);
     }
 }
Exemple #5
0
 function FillObjects()
 {
     /*руп план*/
     $irup = new EstRequest("rup-plan", array(152189), false, true);
     /*Лукомль генираторы А+ 30 мин.*/
     $luk = new EstRequest("luk-gen", array(166078, 166126, 166174, 166222, 166270, 166318, 166366, 166414), true);
     /*Новополоцкая ТЭЦ*/
     $nov = new EstRequest("nov-gen", array(165544, 165592, 171716, 171764, 171812, 171860, 171956), true);
     /*ПГУ 400*/
     $pgu400 = new EstRequest("luc-pgu-gen", array(184717, 184789), true);
     /*ДГУ*/
     $dgu = new EstRequest("luc-dgu-gen", array(166462, 166510), true);
     /*Витебская ТЭЦ*/
     $vittec = new EstRequest("vit-tec-gen", array(165190, 165226), true);
     /*Орша ТЭЦ*/
     $orshatec = new EstRequest("orsha-tec-gen", array(165352, 165400, 165448, 165496), true);
     /*БелГРЭС*/
     $belgres = new EstRequest("belgres-gen", array(166558, 166606), true);
     /*Мини ТЭЦ Барань*/
     $baran = new EstRequest("baran-gen", array(209613), true);
     /*КГТУ Нафтан*/
     $kgtu = new EstRequest("kgtu-gen", array(165640, 165688), true);
     /*Восточная мини ТЭЦ*/
     $vostec = new EstRequest("voctec-gen", array(201362), true);
     /*Полоцкая ТЭЦ*/
     $poltec = new EstRequest("pol-gen", array(165310, 172634), true);
     /*константы генирации*/
     $const = new EstRequest("const-gen", array(175040, 175044, 175036, 175048), false, true);
     /*330кВт*/
     /*345,350*/
     $line = new EstRequest("line", array(164242, 164248, 164146, 164152, 163954, 163960, 170354, 170360, 165886, 165892, 165736, 165742, 165838, 165844, 165784, 165796, 164818, 164824, 164866, 164872, 164050, 164056, 165022, 165028, 177348, 177352, 165934, 165940, 165982, 165988, 166030, 166036, 164434, 164440, 164338, 164344, 164596, 164602, 164530, 164536, 165070, 165076, 164974, 164980, 164674, 164680, 164722, 164728, 164926, 164932, 170266, 170272, 170582, 170588), true);
     /*константы перетоков*/
     $constPer = new EstRequest("const-peretok", array(175056, 175060, 175052, 175064), true, true);
     $constLukKrup = new EstRequest("const-luk-krup", array(175186, 175190, 175194), false, true);
     $oevluc = new EstRequest("oev-luc", array(170582, 170588), true);
     $mGen = array($irup, $luk, $nov, $pgu400, $dgu, $vittec, $orshatec, $belgres, $baran, $kgtu, $vostec, $poltec, $const, $line, $constPer, $constLukKrup, $oevluc);
     if (!isset($this->date)) {
         EstDataRequest::GetObjectEstData($mGen, new \DateTime('now'));
     } else {
         $reqdt = date('Y-m-d', $this->date / 1000);
         $tmreq = new \DateTime($reqdt);
         $tmnow = new \DateTime('now');
         $arreq = getdate($this->date / 1000);
         $arrnow = getdate($tmnow->getTimestamp());
         if ($arreq['mday'] != $arrnow['mday'] || $arreq['mon'] != $arreq['mon']) {
             EstDataRequest::GetObjectEstData($mGen, $tmreq);
         } else {
             EstDataRequest::GetObjectEstData($mGen, $tmnow);
         }
     }
     $vitRow = new VitebskRows($name = null, $this->date);
     $orshaRow = new OrshaRows($name = null, $this->date);
     $polRow = new PolotskRows($name = null, $this->date);
     $glbRow = new GlubokoeRows($name = null, $this->date);
     $row = null;
     foreach ($irup->data as $key => $item) {
         try {
             $row = new \stdClass();
             $vitfact = $vitRow->GetItemByTime($key);
             $polfact = $polRow->GetItemByTime($key);
             $orrshafact = $orshaRow->GetItemByTime($key);
             $glubfact = $glbRow->GetItemByTime($key);
             $row->fact = $vitfact + $polfact + $orrshafact + $glubfact;
             $row->datetime = $key;
             $row->plan = $irup->data[$key][$irup->items[0]]['VAL'];
             $row->lucgen = array_key_exists($key, $luk->data) ? $luk->data[$key]['ISUM'] : 0;
             $row->novgen = array_key_exists($key, $nov->data) ? $nov->data[$key]['ISUM'] : 0;
             $row->pgugen = array_key_exists($key, $pgu400->data) ? $pgu400->data[$key]['ISUM'] : 0;
             $row->dgugen = array_key_exists($key, $pgu400->data) ? $dgu->data[$key]['ISUM'] : 0;
             $row->vitecgen = array_key_exists($key, $vittec->data) ? $vittec->data[$key]['ISUM'] : 0;
             $row->orshgen = array_key_exists($key, $orshatec->data) ? $orshatec->data[$key]['ISUM'] : 0;
             $row->belgres = array_key_exists($key, $belgres->data) ? $belgres->data[$key]['ISUM'] : 0;
             $row->barangen = array_key_exists($key, $baran->data) ? $baran->data[$key]['ISUM'] : 0;
             $row->kgtugen = array_key_exists($key, $kgtu->data) ? $kgtu->data[$key]['ISUM'] : 0;
             $row->vostgen = array_key_exists($key, $vostec->data) ? $vostec->data[$key]['ISUM'] : 0;
             $row->polgen = array_key_exists($key, $poltec->data) ? $poltec->data[$key]['ISUM'] : 0;
             $row->constPes = $this->setCheckedValue($const, $key, '175040', 'VAL');
             $row->constOes = $this->setCheckedValue($const, $key, '175044', 'VAL');
             $row->constVes = $this->setCheckedValue($const, $key, '175036', 'VAL');
             $row->constGes = $this->setCheckedValue($const, $key, '175048', 'VAL');
             $row->sumgen = $row->lucgen + $row->novgen + $row->pgugen + $row->dgugen + $row->vitecgen + $row->orshgen + $row->belgres + $row->barangen + $row->kgtugen + $row->vostgen + $row->polgen + $row->constPes + $row->constOes + $row->constVes + $row->constGes;
             $row->line345O = $this->setCheckedValue($line, $key, '164242', 'IVAL');
             $row->line345P = $this->setCheckedValue($line, $key, '164248', 'IVAL');
             $row->line450O = $this->setCheckedValue($line, $key, '164146', 'IVAL');
             $row->line450P = $this->setCheckedValue($line, $key, '164152', 'IVAL');
             $row->line349O = $this->setCheckedValue($line, $key, '163954', 'IVAL');
             $row->line349P = $this->setCheckedValue($line, $key, '163960', 'IVAL');
             $row->line347O = $this->setCheckedValue($line, $key, '170354', 'IVAL');
             $row->line347P = $this->setCheckedValue($line, $key, '170360', 'IVAL');
             $row->line335O = $this->setCheckedValue($line, $key, '165886', 'IVAL');
             $row->line335P = $this->setCheckedValue($line, $key, '165892', 'IVAL');
             $row->line336O = $this->setCheckedValue($line, $key, '165736', 'IVAL');
             $row->line336P = $this->setCheckedValue($line, $key, '165742', 'IVAL');
             $row->line428O = $this->setCheckedValue($line, $key, '165838', 'IVAL');
             $row->line428P = $this->setCheckedValue($line, $key, '165844', 'IVAL');
             $row->line432O = $this->setCheckedValue($line, $key, '165784', 'IVAL');
             $row->line432P = $this->setCheckedValue($line, $key, '165796', 'IVAL');
             $row->iaes_vidzi_o = $this->setCheckedValue($line, $key, '164818', 'IVAL');
             $row->iaes_vidzi_p = $this->setCheckedValue($line, $key, '164824', 'IVAL');
             $row->iaes_opsa_o = $this->setCheckedValue($line, $key, '164866', 'IVAL');
             $row->iaes_opsa_p = $this->setCheckedValue($line, $key, '164872', 'IVAL');
             $row->liozno_rudnya_o = $this->setCheckedValue($line, $key, '164050', 'IVAL');
             $row->liozno_rudnya_p = $this->setCheckedValue($line, $key, '164056', 'IVAL');
             $row->bobr_slavn_o = $this->setCheckedValue($line, $key, '165022', 'IVAL');
             $row->bobr_slavn_p = $this->setCheckedValue($line, $key, '165028', 'IVAL');
             $row->shklov_selise_o = $this->setCheckedValue($line, $key, '177348', 'IVAL');
             $row->shklov_selise_p = $this->setCheckedValue($line, $key, '177352', 'IVAL');
             $row->krupki_3_o = $this->setCheckedValue($line, $key, '166030', 'IVAL');
             $row->krupki_3_p = $this->setCheckedValue($line, $key, '166036', 'IVAL');
             $row->krupki_2_o = $this->setCheckedValue($line, $key, '165982', 'IVAL');
             $row->krupki_2_p = $this->setCheckedValue($line, $key, '165988', 'IVAL');
             $row->krupki_1_o = $this->setCheckedValue($line, $key, '165934', 'IVAL');
             $row->krupki_1_p = $this->setCheckedValue($line, $key, '165940', 'IVAL');
             $row->grav_v1_o = $this->setCheckedValue($line, $key, '164434', 'IVAL');
             $row->grav_v1_p = $this->setCheckedValue($line, $key, '164440', 'IVAL');
             $row->grav_v2_o = $this->setCheckedValue($line, $key, '164338', 'IVAL');
             $row->grav_v2_p = $this->setCheckedValue($line, $key, '164344', 'IVAL');
             $row->novluc_v1_o = $this->setCheckedValue($line, $key, '164596', 'IVAL');
             $row->novluc_v1_p = $this->setCheckedValue($line, $key, '164602', 'IVAL');
             $row->novluc_v2_o = $this->setCheckedValue($line, $key, '164530', 'IVAL');
             $row->novluc_v2_p = $this->setCheckedValue($line, $key, '164536', 'IVAL');
             $row->toloch_o = $this->setCheckedValue($line, $key, '165070', 'IVAL');
             $row->toloch_p = $this->setCheckedValue($line, $key, '165076', 'IVAL');
             $row->litvyaki_o = $this->setCheckedValue($line, $key, '164974', 'IVAL');
             $row->litvyaki_p = $this->setCheckedValue($line, $key, '164980', 'IVAL');
             $row->lintupi_o = $this->setCheckedValue($line, $key, '164674', 'IVAL');
             $row->lintupi_p = $this->setCheckedValue($line, $key, '164680', 'IVAL');
             $row->komai_o = $this->setCheckedValue($line, $key, '164722', 'IVAL');
             $row->komai_p = $this->setCheckedValue($line, $key, '164728', 'IVAL');
             $row->begoml_o = $this->setCheckedValue($line, $key, '164926', 'IVAL');
             $row->begoml_p = $this->setCheckedValue($line, $key, '164932', 'IVAL');
             $row->drisvyati_o = $this->setCheckedValue($line, $key, '170266', 'IVAL');
             $row->drisvyati_p = $this->setCheckedValue($line, $key, '170272', 'IVAL');
             $row->constPerPes = $this->setCheckedValue($constPer, $key, '175056', 'VAL');
             $row->constPerOes = $this->setCheckedValue($constPer, $key, '175060', 'VAL');
             $row->constPerVes = $this->setCheckedValue($constPer, $key, '175052', 'VAL');
             $row->constPerGes = $this->setCheckedValue($constPer, $key, '175064', 'VAL');
             /*ОЭВ 110 лукомль*/
             $val1 = $this->setCheckedValue($constLukKrup, $key, '175186', 'VAL');
             $val2 = $this->setCheckedValue($constLukKrup, $key, '175190', 'VAL');
             $val3 = $this->setCheckedValue($constLukKrup, $key, '175194', 'VAL');
             $row->oevLuk_krup_1_o = $this->setCheckedValue($oevluc, $key, '170582', 'IVAL') * $val1;
             $row->oevLuk_krup_1_p = $this->setCheckedValue($oevluc, $key, '170588', 'IVAL') * $val1;
             $row->oevLuk_krup_2_o = $this->setCheckedValue($oevluc, $key, '170582', 'IVAL') * $val2;
             $row->oevLuk_krup_2_p = $this->setCheckedValue($oevluc, $key, '170588', 'IVAL') * $val2;
             $row->oevLuk_krup_3_o = $this->setCheckedValue($oevluc, $key, '170582', 'IVAL') * $val3;
             $row->oevLuk_krup_3_p = $this->setCheckedValue($oevluc, $key, '170588', 'IVAL') * $val3;
             $row->otcl = round($row->fact - $row->plan, 1);
             $row->percent = $row->plan > 0 ? round($row->fact * 100 / $row->plan - 100, 1) : null;
             $recordIntake = new \stdClass();
             $recordIntake->datetime = $row->datetime;
             $recordIntake->plan = $row->plan;
             $recordIntake->fact = $row->fact;
             $recordIntake->deviation = $row->otcl;
             $recordIntake->percent = $row->percent;
             $this->add($row, $recordIntake);
         } catch (\Exception $e) {
             continue;
         }
     }
 }