123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539 |
- BemsWebApplication.EnthalpyControl = function (params, viewInfo) {
- "use strict";
- //전역 변수 선언
- var endpointSelector = "";
- var currentTabIndex = ko.observable(0);
- if (BemsWebApplication.config.mode == "production") {
- endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
- } else {
- endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
- }
- var initialized = false, inoutdoorinitialized = false, Etcinitialized = false;
- var SiteId = BWA.UserInfo.SiteId();
- var today = new Date();
- var searchday = new Date();
- var eq = BWA.DataUtil.constructEqualFilter;
- var AIR_HANDLING = $Code.FacilityType.AIR_HANDLING;
- var OUTDOOR = $Code.FacilityType.OUTDOOR;
- var temp_facility_DataSource = [{
- Name: "",
- Nickname: "",
- FacilityUsage: "",
- FacilityCode: 0
- }];
- var ONOFF = $Code.Formula[AIR_HANDLING].ONOFF; //onoff
- var facilityname = "", facilitynickname = "", facilityusage = "", facilitycode = 0;
- var formulaGet = new BWA.Chart.FormulaGet(SiteId);
- var CO2 = $Code.Formula[AIR_HANDLING].CO2;
- var ENTHALPY_ONOFF = $Code.Formula[AIR_HANDLING].ENTHALPY_ONOFF;
- var CO = $Code.Formula[AIR_HANDLING].CO;
- var DUST = $Code.Formula[AIR_HANDLING].DUST;
- var OZONE = $Code.Formula[AIR_HANDLING].OZONE;
- var S_VOLUME = $Code.Formula[AIR_HANDLING].S_VOLUME;
- var F_TEMP = $Code.Formula[AIR_HANDLING].F_TEMP; //환기
- var F_HUMY = $Code.Formula[AIR_HANDLING].F_HUMY;
- var S_TEMP = $Code.Formula[AIR_HANDLING].S_TEMP; //급기
- var S_HUMY = $Code.Formula[AIR_HANDLING].S_HUMY;
- var M_TEMP = $Code.Formula[AIR_HANDLING].M_TEMP; //혼합
- var timeIntervalType = $Code.TimeIntervalType.QUARTERMIN;
- var M_OPENING_RATE = $Code.Formula[AIR_HANDLING].M_OPENING_RATE //혼합 댐퍼 개도율
- var OUT_TEMPERATURE = $Code.Formula[OUTDOOR].TEMPERATURE;
- var OUT_HUMIDITY = $Code.Formula[OUTDOOR].HUMIDITY;
- var chartEnthalpy = BWA.Chart.Instance('chartEnthalpyES', 'dxChart');
- var chartCoilLoad = BWA.Chart.Instance('chartCoilLoad', 'dxChart');
- var chartInOut = BWA.Chart.Instance('chartInOutdoor', 'dxChart');
- var chartEtc = BWA.Chart.Instance('chartEtc', 'dxChart');
- var InOutSupplyEnthalpySource = [], MixEnthalpySource = [];
- var chartLayout = new BWA.ChartLayout({
- divs: [
- {
- id: 'Enthalpy',
- chartId: 'chartEnthalpyES'
- },
- {
- id: 'InOutDoor',
- chartId: 'chartInOutdoor'
- },
- ,
- {
- id: 'CoilLoad',
- chartId: 'chartCoilLoad'
- }
- ],
- multiViewOptions: {
- viewIndex: currentTabIndex,
- viewCount: 1
- }
- });
- var humydataArray = [], IndoorOn = false, OutdoorOn = false;;
- var IndoorhumyOn = false, OutdoorhumyOn = false;
- var OutdataArray = [], CoilSource = [];
- var SupplyVolumedataArray = [];
- var MixtempdataArray = [], MixdataArray = [], MixhumydataArray = [];
- var SupplytempdataArray = [], SupplyhumydataArray = [], SupplydataArray = [];
- var Supplyhumy = false, Supplytemp = false, Supplyenthalpy = false;
- var IndoordataArray = [], IndoorhumydataArray = [], IndoortempdataArray = [], Indoortemp = false, Indoorhumy = false;
- var CodataArray = [], Co2dataArray = [], DustdataArray = [], OzonedataArray = [], EtcdataArray = [];
- var Codata = false, Co2data = false, Dustdata = false, Ozonedata = false;
- var outdoordataArray = [], outdoorhumydataArray = [], outdoortempdataArray = [], outdoortemp = false, outdoorhumy = false;
- var outdoorenthalpy = false, Indoorenthalpy = false, Mixenthalpy = false;
- var QUARTERMIN = $Code.TimeType.QUARTERMIN;
- var Altitude = 50; //대구은행 고도 50
- var InOutdoorDataGridPopup_Visible = ko.observable(false), EtcDataGridPopup_Visible = ko.observable(false);
- function facilitydataSourceAdd(cnt) { // 설비 개수만큼 추가
- for (var i = 0; i < cnt ; i++) {
- temp_facility_DataSource.push({
- Name: "",
- Nickname: "",
- FacilityUsage: "",
- FacilityCode: 0
- });
- }
- }
- //엔탈피 공식
- // 대기압 Function
- function AmbientPress(Altitude) {
- return 101325 * Math.pow((1 - 2.25577 * Math.pow(10, -5) * Altitude), 5.2559);
- }
- // B Function
- function B_Function(T) {
- return Math.exp(-5800.2206 / (T + 273.15) + 1.3914993 - 0.048640239 * (T + 273.15) + (0.0000417648) * Math.pow(T + 273.15, 2) + Math.pow(T + 273.15, 3) * (-0.0000000144521) + 6.5459673 * Math.log(T + 273.15));
- }
- // A Function
- function A_Function(T, H, Altitude) {
- return 0.62198 * (H / 100) * B_Function(T) / (AmbientPress(Altitude) - (H / 100) * B_Function(T));
- }
- // 엔탈피 Function
- function Enthalphy_Function(T, H, Altitude) {
- return 1.006 * T + (2501 + (1.86 * T)) * A_Function(T, H, Altitude);
- }
- // 절대습도 얻기(상대습도 이용) Function
- function AbsH_Function(T, H, Altitude) {
- return A_Function(T, 100, 50) * H / 100;
- }
- // 상대습도 얻기(절대습도 이용) Function
- function RelH_Function(T, Abs_H, Altitude) {
- return 100 * Abs_H / A_Function(T, 100, 50);
- }
- function GetDataSource(FacilityCode, FormulaId) { // 설비 개수만큼 추가
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var Temp = BemsTemp[0].CurrentValue;
- if (FormulaId == CO2) {
- Co2dataArray = [];
- var state;
- if (Temp <= 1000) {
- state = "(적정)";
- }
- else {
- state = "(부적정)";
- }
- $("#co2").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
- for (var i = 0; i < BemsTemp.length; i++) {
- Co2dataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- Co2: BemsTemp[i].CurrentValue
- });
- }
- Co2data = true;
- }
- else if (FormulaId == CO) {
- CodataArray = [];
- var state;
- if (Temp <= 2) {
- state = "(좋음)";
- }
- else if ((2 < Temp) && (Temp <= 9)) {
- state = "(보통)";
- }
- else if ((9 < Temp) && (Temp <= 15)) {
- state = "(나쁨)";
- }
- else {
- state = "(매우나쁨)";
- }
- $("#co").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
- for (var i = 0; i < BemsTemp.length; i++) {
- CodataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- Co: BemsTemp[i].CurrentValue
- });
- }
- Codata = true;
- }
- else if (FormulaId == DUST) {
- DustdataArray = [];
- var state;
- if (Temp <= 30) {
- state = "(좋음)";
- }
- else if ((30 < Temp) && (Temp <= 80)) {
- state = "(보통)";
- }
- else if ((80 < Temp) && (Temp <= 150)) {
- state = "(나쁨)";
- }
- else {
- state = "(매우나쁨)";
- }
- $("#dust").dxTextBox("instance").option('value', Temp.toFixed(2) + "㎍/㎥" + state);
- for (var i = 0; i < BemsTemp.length; i++) {
- DustdataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- Dust: BemsTemp[i].CurrentValue
- });
- }
- Dustdata = true;
- }
- else if (FormulaId == OZONE) {
- OzonedataArray = [];
- var state;
- if (Temp <= 0.03) {
- state = "(좋음)";
- }
- else if ((0.03 < Temp) && (Temp <= 0.09)) {
- state = "(보통)";
- }
- else if ((0.09 < Temp) && (Temp <= 0.150)) {
- state = "(나쁨)";
- }
- else {
- state = "(매우나쁨)";
- }
- $("#ozone").dxTextBox("instance").option('value', Temp.toFixed(2) + "ppm" + state);
- for (var i = 0; i < BemsTemp.length; i++) {
- OzonedataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- Ozone: BemsTemp[i].CurrentValue
- });
- }
- Ozonedata = true;
- }
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- function GetMixEnthalpyDataSource(FacilityCode) { // 온도, 습도
- humydataArray = [];
- var array_length_size = Math.max(IndoordataArray.length, outdoordataArray.length);
- if (IndoordataArray.length == outdoordataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- humydataArray.push(
- {
- DateTime: IndoordataArray[i].DateTime,
- IndoorAbsoluteHumy: AbsH_Function(IndoordataArray[i].IndoorTemp, IndoordataArray[i].IndoorHumy, Altitude),
- OutdoorAbsoluteHumy: AbsH_Function(outdoordataArray[i].outdoorTemp, outdoordataArray[i].outdoorHumy),
- });
- }
- IndoorOn = false, OutdoorOn = false;
- }
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', M_OPENING_RATE)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var OpeningRatedataArray = [];
- for (var i = 0; i < BemsTemp.length; i++) {
- OpeningRatedataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- M_OPENING_RATE: BemsTemp[i].CurrentValue
- });
- }
- var humytempdataArray = [];
- var array_length_size = Math.max(humydataArray.length, OpeningRatedataArray.length);
- if (humydataArray.length == OpeningRatedataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- humytempdataArray.push(
- {
- DateTime: humydataArray[i].DateTime,
- M_AbsoluteHumy: humydataArray[i].IndoorAbsoluteHumy * (OpeningRatedataArray[i].M_OPENING_RATE / 100) + humydataArray[i].OutdoorAbsoluteHumy * ((100 - OpeningRatedataArray[i].M_OPENING_RATE) / 100)
- });
- }
- }
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', M_TEMP)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var MixtempdataArray = [], MixdataArray = [], MixdataArray = [], MixEnthalpySource = [];
- for (var i = 0; i < BemsTemp.length; i++) {
- MixtempdataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- MixTemp: BemsTemp[i].CurrentValue
- });
- }
- var array_length_size = Math.max(humytempdataArray.length, MixtempdataArray.length);
- if (humytempdataArray.length == MixtempdataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- MixdataArray.push(
- {
- DateTime: humytempdataArray[i].DateTime,
- MixTemp: MixtempdataArray[i].MixTemp,
- MixHumy: RelH_Function(MixtempdataArray[i].MixTemp, humytempdataArray[i].M_AbsoluteHumy, Altitude),
- });
- }
- for (var i = 0; i < array_length_size; i++) {
- MixEnthalpySource.push(
- {
- DateTime: MixdataArray[i].DateTime,
- MixEnthalphy: Enthalphy_Function(MixdataArray[i].MixTemp, MixdataArray[i].MixHumy, Altitude)
- });
- Mixenthalpy = true;
- }
- if (Indoorenthalpy && outdoorenthalpy && Supplyenthalpy && Mixenthalpy) {
- InOutSupplyEnthalpySource = [];
- var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length, SupplydataArray.length, MixEnthalpySource.length);
- if (IndoordataArray.length == outdoordataArray.length && outdoordataArray.length == SupplydataArray.length && SupplydataArray.length == MixEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- InOutSupplyEnthalpySource.push(
- {
- DateTime: MixEnthalpySource[i].DateTime,
- IndoorEnthalpy: IndoordataArray[i].IndoorEnthalpy,
- outdoorEnthalpy: outdoordataArray[i].outdoorEnthalpy,
- SupplyEnthalpy: SupplydataArray[i].SupplyEnthalpy,
- MixEnthalphy: MixEnthalpySource[i].MixEnthalphy
- });
- }
- }
- GetVolumeDataSource(facilitycode, S_VOLUME);
- var options = BWA.ChartOptions.EnthalpyControl.getChartControlEnthalpyOptions(QUARTERMIN);
- options.dataSource = InOutSupplyEnthalpySource;
- chartEnthalpy().option(options);
- Indoorenthalpy = false, outdoorenthalpy = false, Supplyenthalpy = false, Mixenthalpy = false;
- }
- }
- }
- });
- }
- }
- });
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- function GetEnthalpyDataSource(FacilityCode, FormulaId, FormulaId2) { // 온도, 습도
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var Temp = BemsTemp[0].CurrentValue;
- if (FormulaId == F_TEMP) { // 환기 엔탈피
- IndoortempdataArray = [], IndoorhumydataArray = [], IndoordataArray = [];
- $("#indoor_temp").dxTextBox("instance").option('value', Temp.toFixed(2) + "℃");
- for (var i = 0; i < BemsTemp.length; i++) {
- IndoortempdataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- IndoorTemp: BemsTemp[i].CurrentValue
- });
- }
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId2)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var Temp = BemsTemp[0].CurrentValue;
- $("#indoor_humy").dxTextBox("instance").option('value', Temp.toFixed(2) + "%");
- for (var i = 0; i < BemsTemp.length; i++) {
- IndoorhumydataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- IndoorHumy: BemsTemp[i].CurrentValue
- });
- }
- var array_length_size = Math.max(IndoortempdataArray.length, IndoorhumydataArray.length);
- if (IndoortempdataArray.length == IndoorhumydataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- IndoordataArray.push(
- {
- DateTime: IndoortempdataArray[i].DateTime,
- IndoorTemp: IndoortempdataArray[i].IndoorTemp,
- IndoorHumy: IndoorhumydataArray[i].IndoorHumy,
- IndoorEnthalpy: Enthalphy_Function(IndoortempdataArray[i].IndoorTemp, IndoorhumydataArray[i].IndoorHumy, Altitude)
- });
- }
- Indoorenthalpy = true;
- IndoorOn = true;
- if (IndoorOn && OutdoorOn) {
- GetMixEnthalpyDataSource(facilitycode);
- }
- }
- if (Indoorenthalpy && outdoorenthalpy && Supplyenthalpy && Mixenthalpy) {
- InOutSupplyEnthalpySource = [];
- var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length, SupplydataArray.length, MixEnthalpySource.length);
- if (IndoordataArray.length == outdoordataArray.length && outdoordataArray.length == SupplydataArray.length && SupplydataArray.length == MixEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- InOutSupplyEnthalpySource.push(
- {
- DateTime: MixEnthalpySource[i].DateTime,
- IndoorEnthalpy: IndoordataArray[i].IndoorEnthalpy,
- outdoorEnthalpy: outdoordataArray[i].outdoorEnthalpy,
- SupplyEnthalpy: SupplydataArray[i].SupplyEnthalpy,
- MixEnthalphy: MixEnthalpySource[i].MixEnthalphy
- });
- }
- }
- GetVolumeDataSource(facilitycode, S_VOLUME);
- var options = BWA.ChartOptions.EnthalpyControl.getChartControlEnthalpyOptions(QUARTERMIN);
- options.dataSource = InOutSupplyEnthalpySource;
- chartEnthalpy().option(options);
- Indoorenthalpy = false, outdoorenthalpy = false, Supplyenthalpy = false, Mixenthalpy = false;
- }
- }
- });
- }
- }
- });
- }
- else if (FormulaId == S_TEMP) { //급기 엔탈피
- SupplytempdataArray = [], SupplydataArray = [], SupplyhumydataArray = [];
- for (var i = 0; i < BemsTemp.length; i++) {
- SupplytempdataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- SupplyTemp: BemsTemp[i].CurrentValue
- });
- }
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId2)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- for (var i = 0; i < BemsTemp.length; i++) {
- SupplyhumydataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- SupplyHumy: BemsTemp[i].CurrentValue
- });
- }
- var array_length_size = Math.max(SupplytempdataArray.length, SupplyhumydataArray.length);
- if (SupplytempdataArray.length == SupplyhumydataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- SupplydataArray.push(
- {
- DateTime: SupplytempdataArray[i].DateTime,
- SupplyTemp: SupplytempdataArray[i].SupplyTemp,
- SupplyHumy: SupplyhumydataArray[i].SupplyHumy,
- SupplyEnthalpy: Enthalphy_Function(SupplytempdataArray[i].SupplyTemp, SupplyhumydataArray[i].SupplyHumy, Altitude)
- });
- }
- Supplyenthalpy = true;
- }
- if (Indoorenthalpy && outdoorenthalpy && Supplyenthalpy && Mixenthalpy) {
- InOutSupplyEnthalpySource = [];
- var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length, SupplydataArray.length, MixEnthalpySource.length);
- if (IndoordataArray.length == outdoordataArray.length && outdoordataArray.length == SupplydataArray.length && SupplydataArray.length == MixEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- InOutSupplyEnthalpySource.push(
- {
- DateTime: Mixenthalpy[i].DateTime,
- IndoorEnthalpy: IndoordataArray[i].IndoorEnthalpy,
- outdoorEnthalpy: outdoordataArray[i].outdoorEnthalpy,
- SupplyEnthalpy: SupplydataArray[i].SupplyEnthalpy,
- MixEnthalphy: MixEnthalpySource[i].MixEnthalphy
- });
- }
- }
- GetVolumeDataSource(facilitycode, S_VOLUME);
- var options = BWA.ChartOptions.EnthalpyControl.getChartControlEnthalpyOptions(QUARTERMIN);
- options.dataSource = InOutSupplyEnthalpySource;
- chartEnthalpy().option(options);
- Indoorenthalpy = false, outdoorenthalpy = false, Supplyenthalpy = false, Mixenthalpy = false;
- }
- }
- });
- }
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- function GetVolumeDataSource(FacilityCode, FormulaId) { // 설비 개수만큼 추가
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormula"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula[0].Formula.length == 1) {
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('FormulaId', FormulaId)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- if (FormulaId == S_VOLUME) {
- SupplyVolumedataArray = [], CoilSource = [];
- for (var i = 0; i < BemsTemp.length; i++) {
- SupplyVolumedataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- S_VOLUME: BemsTemp[i].CurrentValue
- });
- }
- var enthalpy_length_size = Math.max(SupplyVolumedataArray.length, InOutSupplyEnthalpySource.length);
- if (SupplyVolumedataArray.length == InOutSupplyEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- CoilSource.push(
- {
- DateTime: SupplyVolumedataArray[i].DateTime,
- OutCoil: ((InOutSupplyEnthalpySource[i].outdoorEnthalpy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2,
- InCoil: ((InOutSupplyEnthalpySource[i].IndoorEnthalpy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2,
- Coil: ((InOutSupplyEnthalpySource[i].MixEnthalphy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2
- });
- }
- }
- var formula = $Code.Formula[$Code.FacilityType.AIR_HANDLING];
- var formulaIds = _.values(formula);
- var promises = [];
- _.each(formulaIds, function () {
- var p = formulaGet.apiGet({
- SiteId: SiteId,
- FacilityTypeId: AIR_HANDLING,
- FacilityCode: facilitycode,
- FormulaId: ONOFF,
- TimeIntervalType: timeIntervalType,
- StartDate: new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0),
- EndDate: new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 23, 59, 59)
- });
- promises.push(p);
- });
- $.when.apply(this, promises)
- .done(function (ONOFF) {
- ONOFF = ONOFF[0];//가동시간
- var dataArray_Temp = [];
- var dataArray_temp1 = [];
- var dataArray_Temp2 = [];
- var dataArray_Final = [];
- _.each(ONOFF, function (x) {
- dataArray_Temp.push({
- DateTime: new Date(x.DateTime),// BWA.Chart.getCustermTimeArgumentAxisString(QUARTERMIN, moment(x.DateTime).toDate())
- ONOFF: x.Value
- });
- });
- for (var i = 0; i < dataArray_Temp.length; i++) {
- if (dataArray_Temp[i].DateTime <= new Date()) {
- dataArray_Temp2.push({
- DateTime: dataArray_Temp[i].DateTime,
- ONOFF: dataArray_Temp[i].ONOFF
- });
- }
- }
- var array_length_size = Math.max(dataArray_Temp2.length, CoilSource.length);
- if (dataArray_Temp2.length == CoilSource.length) {
- for (var i = 0; i < array_length_size; i++) {
- dataArray_temp1.push(
- {
- DateTime: CoilSource[i].DateTime,
- OutCoil: CoilSource[i].OutCoil,
- InCoil: CoilSource[i].InCoil,
- Coil: CoilSource[i].Coil,
- ONOFF: dataArray_Temp2[i].ONOFF
- });
- }
- for (var i = 0; i < dataArray_temp1.length; i++) {
- if (dataArray_temp1[i].ONOFF) {
- var tempoutcoil = 0;
- var tempincoil = 0;
- var tempcoil = 0;
- if (dataArray_temp1[i].OutCoil > 0) {
- tempoutcoil = dataArray_temp1[i].OutCoil / 2300;
- }
- else {
- tempoutcoil = 0;
- }
- if (dataArray_temp1[i].InCoil > 0) {
- tempincoil = dataArray_temp1[i].InCoil / 2300;
- }
- else {
- tempincoil = 0;
- }
- if (dataArray_temp1[i].Coil > 0) {
- tempcoil = dataArray_temp1[i].Coil / 2300
- }
- else {
- tempcoil = 0;
- }
- dataArray_Final.push(
- {
- DateTime: dataArray_temp1[i].DateTime,
- OutCoil: tempoutcoil,
- InCoil: tempincoil,
- Coil: tempcoil,
- });
- }
- else {
- dataArray_Final.push(
- {
- DateTime: dataArray_temp1[i].DateTime,
- OutCoil: 0,
- InCoil: 0,
- Coil: 0,
- });
- }
- }
- }
- var options = BWA.ChartOptions.EnthalpyControl.getChartCoilLoadOptions(QUARTERMIN);
- options.dataSource = dataArray_Final;
- chartCoilLoad().option(options);
- var coilreduction = 0, coilfuture = 0, coilnow = 0;
- for (var i = 0; i < dataArray_Final.length; i++) {
- if (dataArray_Final[i].OutCoil >= dataArray_Final[i].InCoil) {
- coilfuture += dataArray_Final[i].OutCoil;
- }
- else {
- coilfuture += dataArray_Final[i].InCoil;
- }
- coilnow += dataArray_Final[i].Coil;
- }
- if (coilfuture == 0) {
- coilreduction = 0;
- }
- else {
- coilreduction = 100 - ((coilnow / coilfuture) * 100);
- }
- $("#coilfuture").dxTextBox("instance").option('value', coilfuture.toFixed(2) + "Kwh");
- $("#coilnow").dxTextBox("instance").option('value', coilnow.toFixed(2) + "Kwh");
- $("#coilreduction").dxTextBox("instance").option('value', coilreduction.toFixed(2) + "%");
- })
- .fail(function (error) {
- utils.toast.show("[BemsMonitoringPointHistory15min] 데이터조회를 실패하였습니다.");
- });
- }
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- else {
- var num = parseFloat(BemsFormula[0].Formula.replace(/[a-z,*, ]/gi, ""));
- var formula = BemsFormula[0].Formula.replace(/[0-9,*, ]/gi, "");
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityCode', FacilityCode),
- 'and',
- eq('ParameterId', formula),
- 'and',
- eq('FormulaId', FormulaId)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var ParameterFacilityCode = BemsFormula[0].ParameterFacilityCode;
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", ParameterFacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- if (FormulaId == S_VOLUME) {
- SupplyVolumedataArray = [], CoilSource = [];
- var dataArray_Final = [];
- for (var i = 0; i < BemsTemp.length; i++) {
- SupplyVolumedataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- S_VOLUME: BemsTemp[i].CurrentValue * num
- });
- }
- var enthalpy_length_size = Math.max(SupplyVolumedataArray.length, InOutSupplyEnthalpySource.length);
- if (SupplyVolumedataArray.length == InOutSupplyEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- CoilSource.push(
- {
- DateTime: SupplyVolumedataArray[i].DateTime,
- OutCoil: (((InOutSupplyEnthalpySource[i].outdoorEnthalpy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2) / 2300,
- InCoil: (((InOutSupplyEnthalpySource[i].IndoorEnthalpy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2) / 2300,
- Coil: (((InOutSupplyEnthalpySource[i].MixEnthalphy - InOutSupplyEnthalpySource[i].SupplyEnthalpy) / 4.2) * SupplyVolumedataArray[i].S_VOLUME * 1.2) / 2300
- });
- }
- for (var i = 0; i < CoilSource.length; i++) {
- var tempoutcoil = 0;
- var tempincoil = 0;
- var tempcoil = 0;
- if (CoilSource[i].OutCoil > 0) {
- tempoutcoil = CoilSource[i].OutCoil / 2300;
- }
- else {
- tempoutcoil = 0;
- }
- if (CoilSource[i].InCoil > 0) {
- tempincoil = CoilSource[i].InCoil / 2300;
- }
- else {
- tempincoil = 0;
- }
- if (CoilSource[i].Coil > 0) {
- tempcoil = CoilSource[i].Coil / 2300
- }
- else {
- tempcoil = 0;
- }
- dataArray_Final.push(
- {
- DateTime: CoilSource[i].DateTime,
- OutCoil: tempoutcoil,
- InCoil: tempincoil,
- Coil: tempcoil,
- });
- }
- var options = BWA.ChartOptions.EnthalpyControl.getChartCoilLoadOptions(QUARTERMIN);
- options.dataSource = dataArray_Final;
- chartCoilLoad().option(options);
- var coilreduction = 0, coilfuture = 0, coilnow = 0;
- for (var i = 0; i < dataArray_Final.length; i++) {
- if (dataArray_Final[i].OutCoil >= dataArray_Final[i].InCoil) {
- coilfuture += dataArray_Final[i].OutCoil;
- }
- else {
- coilfuture += dataArray_Final[i].InCoil;
- }
- coilnow += dataArray_Final[i].Coil;
- }
- if (coilfuture == 0) {
- coilreduction = 0;
- }
- else {
- coilreduction = 100 - ((coilnow / coilfuture) * 100);
- }
- $("#coilfuture").dxTextBox("instance").option('value', coilfuture.toFixed(2) + "Kwh");
- $("#coilnow").dxTextBox("instance").option('value', coilnow.toFixed(2) + "Kwh");
- $("#coilreduction").dxTextBox("instance").option('value', coilreduction.toFixed(2) + "%");
- }
- }
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- function GetOutDataSource() { // 온도, 습도
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityTypeId', OUTDOOR),
- 'and',
- eq('FormulaId', OUT_TEMPERATURE)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var FacilityCode = BemsFormula[0].ParameterFacilityCode;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", FacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var Temp = BemsTemp[0].CurrentValue;
- outdoortempdataArray = [], outdoorhumydataArray = [], outdoordataArray = [];;
- outdoortemp = true;
- $("#outdoor_temp").dxTextBox("instance").option('value', Temp.toFixed(2) + "℃");
- for (var i = 0; i < BemsTemp.length; i++) {
- outdoortempdataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- outdoorTemp: BemsTemp[i].CurrentValue
- });
- }
- var BemsTempFormulaDataSource = new DevExpress.data.DataSource({ // 실내온도 가져오기
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 5
- });
- BemsTempFormulaDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityTypeId', OUTDOOR),
- 'and',
- eq('FormulaId', OUT_HUMIDITY)
- ]);
- BemsTempFormulaDataSource.load()
- .done(function (BemsFormula) {
- if (BemsFormula.length != 0) {
- if (BemsFormula.length == 1) {
- var parameterpropertyId = BemsFormula[0].ParameterPropertyId;
- var FacilityCode = BemsFormula[0].ParameterFacilityCode;
- var BemsTempDataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistory15min"
- },
- requireTotalCount: true,
- pageSize: 1440
- });
- BemsTempDataSource.filter([
- ['CreatedDateTime', ">=", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate(), 0, 0, 0)],
- 'and',
- ['CreatedDateTime', "<", new Date(searchday.getFullYear(), searchday.getMonth(), searchday.getDate() + 1, 0, 0, 0)],
- 'and',
- ['SiteId', "=", SiteId],
- 'and',
- ['FacilityCode', "=", FacilityCode],
- 'and',
- ['PropertyId', "=", parameterpropertyId]
- ]);
- BemsTempDataSource.sort({ getter: "CreatedDateTime", desc: true });
- BemsTempDataSource.load()
- .done(function (BemsTemp) {
- if (BemsTemp.length != 0) {
- var Temp = BemsTemp[0].CurrentValue;
- $("#outdoor_humy").dxTextBox("instance").option('value', Temp.toFixed(2) + "%");
- for (var i = 0; i < BemsTemp.length; i++) {
- outdoorhumydataArray.push({
- DateTime: BemsTemp[i].CreatedDateTime,
- outdoorHumy: BemsTemp[i].CurrentValue
- });
- }
- var array_length_size = Math.max(outdoortempdataArray.length, outdoorhumydataArray.length);
- if (outdoortempdataArray.length == outdoorhumydataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- outdoordataArray.push(
- {
- DateTime: outdoortempdataArray[i].DateTime,
- outdoorTemp: outdoortempdataArray[i].outdoorTemp,
- outdoorHumy: outdoorhumydataArray[i].outdoorHumy,
- outdoorEnthalpy: Enthalphy_Function(outdoortempdataArray[i].outdoorTemp, outdoorhumydataArray[i].outdoorHumy, Altitude)
- });
- }
- outdoorenthalpy = true;
- OutdoorOn = true;
- if (IndoorOn && OutdoorOn) {
- GetMixEnthalpyDataSource(facilitycode);
- }
- }
- if (Indoorenthalpy && outdoorenthalpy && Supplyenthalpy && Mixenthalpy) {
- InOutSupplyEnthalpySource = [];
- var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length, SupplydataArray.length, MixEnthalpySource.length);
- if (IndoordataArray.length == outdoordataArray.length && outdoordataArray.length == SupplydataArray.length && SupplydataArray.length == MixEnthalpySource.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- InOutSupplyEnthalpySource.push(
- {
- DateTime: MixEnthalpySource[i].DateTime,
- IndoorEnthalpy: IndoordataArray[i].IndoorEnthalpy,
- outdoorEnthalpy: outdoordataArray[i].outdoorEnthalpy,
- SupplyEnthalpy: SupplydataArray[i].SupplyEnthalpy,
- MixEnthalphy: MixEnthalpySource[i].MixEnthalphy
- });
- }
- }
- GetVolumeDataSource(facilitycode, S_VOLUME);
- var options = BWA.ChartOptions.EnthalpyControl.getChartControlEnthalpyOptions(QUARTERMIN);
- options.dataSource = InOutSupplyEnthalpySource;
- chartEnthalpy().option(options);
- Indoorenthalpy = false, outdoorenthalpy = false, Supplyenthalpy = false, Mixenthalpy = false;
- }
- }
- });
- }
- }
- });
- }
- else {
- utils.toast.show("[BemsMonitoringPointHistory15min] 정보가 없습니다.");
- }
- });
- }
- }
- else {
- utils.toast.show("[BemsFormulaParameter] 실내외 정보가 없습니다.");
- }
- });
- }
- function handleViewShown() {
- if (initialized === false) {
- var chartOption = BWA.ChartOptions.EnthalpyControl;
- chartEnthalpy = chartEnthalpy(chartOption.getChartControlEnthalpyOptions(QUARTERMIN));
- chartCoilLoad = chartCoilLoad(chartOption.getChartCoilLoadOptions(QUARTERMIN));
- initialized = true;
- }
- $("#Enthalpy_onoff").dxSwitch({
- value: false,
- onText: 'On',
- offText: 'Off'
- });
- $("#Enthalpy_control").dxButton({
- text: "제어",
- onClick: function () {
- var Enthalpyonoff = $("#Enthalpy_onoff").dxSwitch("instance").option('value');
- if (Enthalpyonoff)
- Enthalpyonoff = 1;
- else
- Enthalpyonoff = 0;
- var FacilityTypeId = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityTypeId();
- var FacilityCode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
- var param = {
- SiteId: SiteId,
- FacilityTypeId: FacilityTypeId,
- FacilityCode: FacilityCode,
- FormulaId: ENTHALPY_ONOFF,
- ControlValue: Enthalpyonoff,
- };
- BWA.api.post('BemsFormula/ControlPoint', null, param).done(function () {
- utils.toast.show('엔탈피제어 완료');
- }).fail(function (error) {
- utils.toast.show('엔탈피 제어를 실패하였습니다.');
- });
- }
- });
- $("#inoutdoor_inform").dxButton({
- text: "차트",
- onClick: function () {
- InOutdoorDataGridPopup_Visible(true);
- }
- });
- $("#etc_inform").dxButton({
- text: "차트",
- onClick: function () {
- EtcDataGridPopup_Visible(true);
- }
- });
- $("#Airconfitioner_date").dxDateBox({
- displayFormat: "yyyy-MM-dd",
- value: today,
- max: today,
- onValueChanged: function (e) {
- if (e.value != null) {
- searchday = e.value;
- facilityname = $("#Airconfitioner_select").dxSelectBox("instance").option('value').Name();
- facilitynickname = $("#Airconfitioner_select").dxSelectBox("instance").option('value').Nickname();
- facilityusage = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityUsage();
- facilitycode = $("#Airconfitioner_select").dxSelectBox("instance").option('value').FacilityCode();
- $("#facilityname").dxTextBox("instance").option('value', facilityname);
- $("#facilitynickname").dxTextBox("instance").option('value', facilitynickname);
- $("#facilityusage").dxTextBox("instance").option('value', facilityusage);
- GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
- GetEnthalpyDataSource(facilitycode, S_TEMP, S_HUMY);
- GetOutDataSource();
- GetDataSource(facilitycode, CO2);
- GetDataSource(facilitycode, CO);
- GetDataSource(facilitycode, DUST);
- GetDataSource(facilitycode, OZONE);
- }
- }
- });
- $("#Airconfitioner_select").dxSelectBox({
- dataSource: temp_facility_DataSource,
- displayExpr: "Nickname",
- onValueChanged: function (e) {
- if (e.value != null) {
- facilityname = e.value.Name();
- facilitynickname = e.value.Nickname();
- facilityusage = e.value.FacilityUsage();
- facilitycode = e.value.FacilityCode();
- $("#facilityname").dxTextBox("instance").option('value', facilityname);
- $("#facilitynickname").dxTextBox("instance").option('value', facilitynickname);
- $("#facilityusage").dxTextBox("instance").option('value', facilityusage);
- GetEnthalpyDataSource(facilitycode, F_TEMP, F_HUMY);
- GetEnthalpyDataSource(facilitycode, S_TEMP, S_HUMY);
- GetOutDataSource();
- GetDataSource(facilitycode, CO2);
- GetDataSource(facilitycode, CO);
- GetDataSource(facilitycode, DUST);
- GetDataSource(facilitycode, OZONE);
- }
- }
- });
- $("#co").dxTextBox({
- readOnly: true
- });
- $("#co2").dxTextBox({
- readOnly: true
- });
- $("#dust").dxTextBox({
- readOnly: true
- });
- $("#ozone").dxTextBox({
- readOnly: true
- });
- $("#coilfuture").dxTextBox({
- readOnly: true
- });
- $("#coilnow").dxTextBox({
- readOnly: true
- });
- $("#coilreduction").dxTextBox({
- readOnly: true
- });
- $("#outdoor_humy").dxTextBox({
- readOnly: true
- });
- $("#outdoor_temp").dxTextBox({
- readOnly: true
- });
- $("#indoor_humy").dxTextBox({
- readOnly: true
- });
- $("#indoor_temp").dxTextBox({
- readOnly: true
- });
- $("#enthalpy_content").dxTextBox({
- readOnly: true
- });
- $("#facilityname").dxTextBox({
- readOnly: true,
- });
- $("#facilitynickname").dxTextBox({
- readOnly: true,
- });
- $("#facilityusage").dxTextBox({
- readOnly: true,
- });
- }
- function handleViewHidden() {
- var paging = BWA.ChartLayout.Paging;
- paging.sideOverlayVisible(false);
- }
- function handleViewShowing() {
- var facilityDataSource = BWA.db.createDataSource('CmFacility');
- facilityDataSource.filter([
- eq('SiteId', SiteId),
- 'and',
- eq('FacilityTypeId', AIR_HANDLING)
- ]);
- facilityDataSource.load().done(function (facilities) {
- var cnt = 0, k = 0;
- if (facilities.length != 0) {
- for (var i = 0; i < facilities.length; i++) {
- if ((facilities[i].Nickname().substring(0, 3) != "OHU") && (facilities[i].Nickname().substring(0, 3) != "OAU")) {
- cnt++;
- }
- }
- var tempfacilities = new Array(cnt);
- for (var i = 0; i < facilities.length; i++) {
- if ((facilities[i].Nickname().substring(0, 3) != "OHU") && (facilities[i].Nickname().substring(0, 3) != "OAU")) {
- tempfacilities[k] = facilities[i];
- k++;
- }
- }
- if (tempfacilities.length > 1) {
- facilitydataSourceAdd(tempfacilities.length - 1);
- }
- temp_facility_DataSource = tempfacilities;
- $("#Airconfitioner_select").dxSelectBox({
- dataSource: temp_facility_DataSource,
- displayExpr: "Nickname",
- });
- $("#Airconfitioner_select").dxSelectBox("instance").option('value', temp_facility_DataSource[0]);
- }
- else {
- utils.toast.show("[CmFacility] 공조기 정보가 없습니다.");
- }
- });
- }
- function InoutDoorhandlePopupShown() {
- if (inoutdoorinitialized === false) {
- var chartOption = BWA.ChartOptions.EnthalpyControl;
- chartInOut = chartInOut(chartOption.getChartInOutDoorOptions(QUARTERMIN));
- inoutdoorinitialized = true;
- }
- var Array = [];
- var enthalpy_length_size = Math.max(IndoordataArray.length, outdoordataArray.length);
- if (IndoordataArray.length == outdoordataArray.length) {
- for (var i = 0; i < enthalpy_length_size; i++) {
- Array.push(
- {
- DateTime: IndoordataArray[i].DateTime,
- IndoorTemp: IndoortempdataArray[i].IndoorTemp,
- IndoorHumy: IndoorhumydataArray[i].IndoorHumy,
- outdoorTemp: outdoordataArray[i].outdoorTemp,
- outdoorHumy: outdoordataArray[i].outdoorHumy
- });
- }
- var options = BWA.ChartOptions.EnthalpyControl.getChartInOutDoorOptions(QUARTERMIN);
- options.dataSource = Array;
- chartInOut().option(options);
- }
- }
- function EtchandlePopupShown() {
- if (Etcinitialized === false) {
- var chartOption = BWA.ChartOptions.EnthalpyControl;
- chartEtc = chartEtc(chartOption.getChartEtcOptions(QUARTERMIN));
- Etcinitialized = true;
- }
- if (Ozonedata && Dustdata && Codata && Co2data) {
- EtcdataArray = [];
- var array_length_size = Math.max(OzonedataArray.length, DustdataArray.length, CodataArray.length, Co2dataArray.length);
- if (OzonedataArray.length == DustdataArray.length && CodataArray.length == Co2dataArray.length && DustdataArray.length == CodataArray.length) {
- for (var i = 0; i < array_length_size; i++) {
- EtcdataArray.push(
- {
- DateTime: OzonedataArray[i].DateTime,
- Ozone: OzonedataArray[i].Ozone,
- Dust: DustdataArray[i].Dust,
- Co: CodataArray[i].Co,
- Co2: Co2dataArray[i].Co2
- });
- }
- }
- Ozonedata = false, Dustdata = false, Codata = false, Co2data = false;
- var options = BWA.ChartOptions.EnthalpyControl.getChartEtcOptions(QUARTERMIN);
- options.dataSource = EtcdataArray;
- chartEtc().option(options);
- }
- }
- function handleSearchInSearchView(filter, searchViewItems) {
- }
- var searchViewOptions = {
- }
- var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView, undefined, chartLayout), {
- viewHidden: handleViewHidden,
- viewShowing: handleViewShowing,
- onHidden: function () {
- },
- });
- viewModel.InoutDoorDataGridPopupOptions = {
- width: '1000px',
- height: '550px',
- contentTemplate: "content",
- showTitle: true,
- title: "차트",
- visible: InOutdoorDataGridPopup_Visible,
- dragEnabled: true,
- closeOnOutsideClick: true,
- shownAction: InoutDoorhandlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- viewModel.EtcDataGridPopupOptions = {
- width: '1000px',
- height: '550px',
- contentTemplate: "content",
- showTitle: true,
- title: "차트",
- visible: EtcDataGridPopup_Visible,
- dragEnabled: true,
- closeOnOutsideClick: true,
- shownAction: EtchandlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- viewModel.currentTabIndex = currentTabIndex;
- return viewModel;
- };
|