You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1143 lines
38 KiB
XML
1143 lines
38 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
|
|
<POU Name="MAIN" Id="{ca897de5-675e-4a68-ac91-07fbc348cb2b}" SpecialFunc="None">
|
|
<Declaration><![CDATA[PROGRAM MAIN
|
|
VAR
|
|
Startup_Enabled: BOOL;
|
|
Zone : ARRAY[1..Set.iNoZones] OF fbZone;
|
|
x : ARRAY[1..Set.iNoZones] OF INT; // Need for initialization to spread apartments into zones
|
|
xf : ARRAY[1..Set.iNoOfFloors] OF INT; // Need for initialization to spread apartments into floors
|
|
a,i,k,z,iz,tmp : INT;
|
|
af,f : INT;
|
|
fs: INT := 1;
|
|
is: INT := 1;
|
|
zs: INT;
|
|
as: INT;
|
|
SortTmp : HMI_ApartmDisplay;
|
|
// tDC : T_DCTIME64;
|
|
// tCurrentTime : DCTIMESTRUCT;
|
|
|
|
tSSRDelay : TIME; // For Zone calculated SSR delay activation
|
|
fbGetTime : NT_GetTime;
|
|
iCurrentTimeSec : LINT; // Current system time in seconds Year+Month+Day+Hour+Minute+Seconds
|
|
|
|
// Wind Sensor Variables
|
|
// MasterRTU : ModbusRtuMasterV2_KL6x5B; // serial Bus Terminal KL6001, KL6011 or KL6021.
|
|
MasterRTU : ModbusRtuMasterV2_KL6x22B; // serial Bus Terminal KL6031 or KL6041
|
|
MBRTUExecute : BOOL;
|
|
MBRTUExecStep : INT := 1;
|
|
MBRTUMBAddress : BYTE := 41;
|
|
MBRTUQuantity : WORD := 11; // 22 bytes, 11 registers
|
|
MBRTUStartReg : WORD := 18;
|
|
// MBRTUReadValue : ARRAY[0..10] OF INT;
|
|
MBRTUReadValue : ARRAY[0..10] OF WORD;
|
|
MBRTUReadErrID : MODBUS_ERRORS;
|
|
MBRTUReadExecute : BOOL;
|
|
MBRTUReadBusy : BOOL;
|
|
MBRTUReadErr : BOOL;
|
|
MBRTUcbRead : UINT;
|
|
MBTON : TON;
|
|
bMBTON : BOOL;
|
|
tModBusRTURead : TON;
|
|
|
|
appCounter: INT;
|
|
zoneSeeker: INT;
|
|
appSeeker: INT;
|
|
|
|
floor: INT;
|
|
n: INT;
|
|
|
|
// MAU 1 NORTH
|
|
MAU1: fbMAU;
|
|
// MAU 2 SOUTH
|
|
MAU2: fbMAU;
|
|
END_VAR]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Look at the main power and Save Persistent data if power is OFF and we are running on the build-in UPS (big capacitor, 1sec UPS)
|
|
//
|
|
|
|
SavePersistent();
|
|
Cell_Startup();
|
|
GVL.tx := TIME(); // System time in ms.
|
|
|
|
IF GVL.System.bFirst_Scan_Bit THEN
|
|
IO.outPLCIOLoopQX := TRUE;
|
|
Init();
|
|
Init_Apartments();
|
|
END_IF
|
|
|
|
IF _TaskInfo[GETCURTASKINDEXEX()].FirstCycle THEN
|
|
;
|
|
END_IF
|
|
|
|
// Write default temperature Set Point into each apartment
|
|
// Do if HMI button is pressed
|
|
IF GVL.bHMI_AptTSP_PB THEN
|
|
FOR f := 1 TO Set.iNoOfFloors DO
|
|
FOR i := 1 TO Set.iNoApFloorMax DO
|
|
Set.arApt_T_SP[f,i] := Set.iSetT; // Write default temperature Set Point into each apartment
|
|
END_FOR
|
|
END_FOR;
|
|
// GVL.bHMI_AptTSP_PB := FALSE;
|
|
END_IF
|
|
|
|
|
|
//tDC := F_GetCurDcTickTime64();
|
|
//tCurrentTime := DCTIME64_TO_DCTIMESTRUCT(in:= tDC);
|
|
|
|
fbGetTime(
|
|
NETID:= GVL.System.AMS_ID,
|
|
START:= GVL.System.bHalfSecondFlasher,
|
|
TMOUT:= ,
|
|
BUSY=> ,
|
|
ERR=> ,
|
|
ERRID=> ,
|
|
TIMESTR=> GVL.tCurrentTime);
|
|
iCurrentTimeSec := GVL.tCurrentTime.wHour*3600 + GVL.tCurrentTime.wMinute*60 + GVL.tCurrentTime.wSecond;
|
|
|
|
WindSensor();
|
|
|
|
(****************************)
|
|
// link to the outside temperature
|
|
// NEED TO ADD ERROR CHECKING
|
|
|
|
IF IO.TS3003_OutT1 <= IO.TS3007_OutT2 AND NOT GVL.bHMI_DisableOut1T_TC AND NOT GVL.bHMI_DisableOut2T_TC THEN
|
|
GVL.iTempOutside := IO.TS3003_OutT1;
|
|
ELSIF IO.TS3003_OutT1 > IO.TS3007_OutT2 AND NOT GVL.bHMI_DisableOut1T_TC AND NOT GVL.bHMI_DisableOut2T_TC THEN
|
|
GVL.iTempOutside := IO.TS3007_OutT2;
|
|
ELSIF GVL.bHMI_DisableOut1T_TC THEN
|
|
GVL.iTempOutside := IO.TS3007_OutT2;
|
|
ELSIF GVL.bHMI_DisableOut2T_TC THEN
|
|
GVL.iTempOutside := IO.TS3003_OutT1;
|
|
ELSE
|
|
GVL.iTempOutside := -200;
|
|
END_IF
|
|
|
|
|
|
IF GVL.iTempOutside > 1000 OR (IO.TS3003_OutT1>1000 AND IO.TS3007_OutT2>1000) THEN
|
|
GVL.iTempOutside := -200; // If for any reason outside temperature is out of the reasonable range, set it -20°C
|
|
END_IF
|
|
|
|
// Apply Chill Factor
|
|
//
|
|
GVL.iTempOutsideChill := GVL.iTempOutside + REAL_TO_INT((INT_TO_REAL((GVL.W.iWindChillT - GVL.iTempOutside)) * INT_TO_REAL(Set.iChillFactorUsage)/100.0));
|
|
|
|
Set.iSetMaxOper := REAL_TO_INT(Set.fHMI_SetMaxOper*10.0);
|
|
|
|
(****************************)
|
|
// Init Heat table from default values for each zone table
|
|
//
|
|
IF GVL.bHMI_HeatTableInit THEN
|
|
Init_HeatLevels();
|
|
END_IF
|
|
(****************************)
|
|
|
|
// Activate Heat Enable if Main Mode Switch is in AUTO Mode.
|
|
//
|
|
IF IO.inCR1024_SftyBACREL AND GVL.iTempOutside <= Set.iSetMaxOper THEN // Set.iSetMaxOperHyst
|
|
Set.HeatEnabled := TRUE;
|
|
END_IF
|
|
IF GVL.iTempOutside > Set.iSetMaxOper + Set.iSetMaxOperHyst THEN
|
|
Set.HeatEnabled := FALSE;
|
|
END_IF
|
|
|
|
// Set Heat enable for each zone
|
|
//
|
|
IF Set.HeatEnabled THEN
|
|
FOR i:=1 TO Set.iNoZones DO
|
|
Set.arApInZone[i].bHeatEnabled := TRUE;
|
|
END_FOR
|
|
ELSE
|
|
FOR i:=1 TO Set.iNoZones DO
|
|
Set.arApInZone[i].bHeatEnabled := FALSE;
|
|
END_FOR
|
|
END_IF
|
|
|
|
// Calculate required heat per each zone
|
|
//
|
|
FOR i := 1 TO Set.iNoZones DO
|
|
Zone[i].iZoneNo := i;
|
|
Zone[i]();
|
|
END_FOR
|
|
|
|
// Calculate Building Avarage Temperature
|
|
//
|
|
tmp := 0;
|
|
FOR i:=1 TO Set.iNoZones DO
|
|
tmp:= GVL.arZoneData[i].iTAver + tmp;
|
|
END_FOR
|
|
GVL.iTempAverage := tmp / Set.iNoZones; // Sum Zone's temperature and divide by nomber of zones
|
|
|
|
HMI_SortApartments();
|
|
SSR_Outputs();
|
|
RelayOutputs();
|
|
MAU();
|
|
GVL.currentUserName:=visuelems.CurrentUserName;
|
|
// Send_email();
|
|
Alarms();]]></ST>
|
|
</Implementation>
|
|
<Action Name="HMI_SortApartments" Id="{8da119cd-2532-4e4b-bea8-4ec3063a38eb}">
|
|
<Implementation>
|
|
<ST><![CDATA[
|
|
// Write SSR ON commands and Set Point Values from arHMIApt (written by HMI Mapping Test) to PLC working array arZoneData
|
|
//
|
|
FOR fs := 1 TO Set.iNoOfFloors DO
|
|
FOR is := 1 TO Set.iNoApFloorMax DO
|
|
IF GVL.arHMIApt[fs,is].bVisible THEN
|
|
zs := GVL.arHMIApt[fs,is].iZoneNo;
|
|
as := GVL.arHMIApt[fs,is].iInZoneNo;
|
|
GVL.arZoneData[zs].arAp[as].bHMISSR_ON:=GVL.arHMIApt[fs,is].bHMISSR_ON;
|
|
Set.arApt_T_SP[fs,is] := REAL_TO_INT(GVL.arHMIApt[fs,is].fT_SP*10);
|
|
GVL.arZoneData[zs].arAp[as].iT_SP:=Set.arApt_T_SP[fs,is];
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
|
|
// IF Mapping Test is OFF, reset all bHMISSR_ON
|
|
//
|
|
FOR fs := 1 TO Set.iNoOfFloors DO
|
|
FOR is := 1 TO Set.iNoApFloorMax DO
|
|
IF GVL.arHMIApt[fs,is].bVisible AND NOT GVL.bHMISSR_Manual THEN
|
|
GVL.arHMIApt[fs,is].bHMISSR_ON := FALSE;
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
|
|
|
|
//
|
|
// Init apartments in array counters. Write 1 as the start point in the array
|
|
FOR i := 1 TO Set.iNoOfFloors DO
|
|
xf[i] := 1; // Initialization. Index of the next apartment on the floor
|
|
FOR a := 1 TO Set.iNoApFloorMax DO
|
|
GVL.arHMIApt[i,a].iAp := i*100+50; // i Should be floor in range 1..Set.iNoOfFloors
|
|
GVL.arHMIApt[i,a].bVisible := FALSE;
|
|
END_FOR
|
|
END_FOR
|
|
|
|
//Scan all apartments in the each zone and fill-up array of apartments on the floors
|
|
//
|
|
|
|
FOR z := 1 TO Set.iNoZones DO
|
|
FOR a := 1 TO Set.iNoApZoneMax DO
|
|
IF GVL.arZoneData[z].arAp[a].HMI_Visible THEN
|
|
floor := GVL.arZoneData[z].arAp[a].iFloor;
|
|
IF floor >0 AND floor <= Set.iNoOfFloors THEN
|
|
// n := xf[floor];
|
|
n := GVL.arZoneData[z].arAp[a].iFloorIndex;
|
|
IF n>0 AND n<=Set.iNoApFloorMax THEN
|
|
GVL.arHMIApt[floor,n].bSSR := GVL.arZoneData[z].arAp[a].bSSR;
|
|
GVL.arHMIApt[floor,n].iAp := GVL.arZoneData[z].arAp[a].iAp;
|
|
GVL.arHMIApt[floor,n].fValue := GVL.arZoneData[z].arAp[a].HMI_Value;
|
|
GVL.arHMIApt[floor,n].bVisible := GVL.arZoneData[z].arAp[a].HMI_Visible;
|
|
GVL.arHMIApt[floor,n].fT_SP := INT_TO_REAL(GVL.arZoneData[z].arAp[a].iT_SP)/10;
|
|
GVL.arHMIApt[floor,n].iZoneNo := z;
|
|
GVL.arHMIApt[floor,n].iInZoneNo := a;
|
|
// xf[floor] := xf[floor]+1; // Increase index to write next apartment data into floor array of apartments
|
|
END_IF
|
|
END_IF
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
|
|
IF Set.fSetT_HMI > 0.0 AND Set.fSetT_HMI<> REAL_TO_INT(Set.fSetT_HMI*10.0) THEN
|
|
FOR f := 1 TO Set.iNoOfFloors DO
|
|
FOR k:=1 TO Set.iNoApFloorMax DO
|
|
IF GVL.arHMIApt[f,k].fT_SP = INT_TO_REAL(Set.iSetT)/10.0 THEN//check accordance of apt sp to building sp
|
|
GVL.arHMIApt[f,k].fT_SP:=Set.fSetT_HMI;
|
|
Set.arApt_T_SP[f,k]:=REAL_TO_INT(Set.fSetT_HMI*10.0);
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
Set.iSetT:=REAL_TO_INT(Set.fSetT_HMI*10.0);
|
|
END_IF]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="Init" Id="{52beee72-42c5-4314-8cdb-14e2ac3ac115}">
|
|
<Implementation>
|
|
<ST><![CDATA[
|
|
// Set.arApInZone[1].ApsNo := 7;
|
|
Set.arApInZone[1].iLowHigh := 1;
|
|
Set.arApInZone[1].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[2].ApsNo := 28;
|
|
Set.arApInZone[2].iLowHigh := 3;
|
|
Set.arApInZone[2].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[3].ApsNo := 7;
|
|
Set.arApInZone[3].iLowHigh := 1;
|
|
Set.arApInZone[3].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[4].ApsNo := 22;
|
|
Set.arApInZone[4].iLowHigh := 3;
|
|
Set.arApInZone[4].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[5].ApsNo := 8;
|
|
Set.arApInZone[5].iLowHigh := 2;
|
|
Set.arApInZone[5].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[6].ApsNo := 8;
|
|
Set.arApInZone[6].iLowHigh := 2;
|
|
Set.arApInZone[6].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[7].ApsNo := 15;
|
|
Set.arApInZone[7].iLowHigh := 3;
|
|
Set.arApInZone[7].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[8].ApsNo := 7;
|
|
Set.arApInZone[8].iLowHigh := 1;
|
|
Set.arApInZone[8].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[9].ApsNo := 21;
|
|
Set.arApInZone[9].iLowHigh := 3;
|
|
Set.arApInZone[9].fDCCorrection := 0.9;
|
|
|
|
// Set.arApInZone[10].ApsNo := 7;
|
|
Set.arApInZone[10].iLowHigh := 1;
|
|
Set.arApInZone[10].fDCCorrection := 0.9;
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="Init_Apartments" Id="{3dd408a1-d80e-4d45-8d04-4616f597af97}">
|
|
<Implementation>
|
|
<ST><![CDATA[//
|
|
// FLOOR 1
|
|
Set.arApartInit[1,1].iAp := 101;
|
|
Set.arApartInit[1,1].iZone := 4;
|
|
Set.arApartInit[1,2].iAp := 102;
|
|
Set.arApartInit[1,2].iZone := 5;
|
|
Set.arApartInit[1,3].iAp := 103;
|
|
Set.arApartInit[1,3].iZone := 6;
|
|
Set.arApartInit[1,4].iAp := 104;
|
|
Set.arApartInit[1,4].iZone := 7;
|
|
Set.arApartInit[1,5].iAp := 105;
|
|
Set.arApartInit[1,5].iZone := 10;
|
|
// FLOOR 2
|
|
Set.arApartInit[2,1].iAp := 201;
|
|
Set.arApartInit[2,1].iZone := 4;
|
|
Set.arApartInit[2,2].iAp := 202;
|
|
Set.arApartInit[2,2].iZone := 4;
|
|
Set.arApartInit[2,3].iAp := 203;
|
|
Set.arApartInit[2,3].iZone := 4;
|
|
Set.arApartInit[2,4].iAp := 204;
|
|
Set.arApartInit[2,4].iZone := 5;
|
|
Set.arApartInit[2,5].iAp := 205;
|
|
Set.arApartInit[2,5].iZone := 6;
|
|
Set.arApartInit[2,6].iAp := 206;
|
|
Set.arApartInit[2,6].iZone := 7;
|
|
Set.arApartInit[2,7].iAp := 207;
|
|
Set.arApartInit[2,7].iZone := 7;
|
|
Set.arApartInit[2,8].iAp := 208;
|
|
Set.arApartInit[2,8].iZone := 8;
|
|
Set.arApartInit[2,9].iAp := 209;
|
|
Set.arApartInit[2,9].iZone := 9;
|
|
Set.arApartInit[2,10].iAp := 210;
|
|
Set.arApartInit[2,10].iZone := 9;
|
|
Set.arApartInit[2,11].iAp := 211;
|
|
Set.arApartInit[2,11].iZone := 9;
|
|
Set.arApartInit[2,12].iAp := 212;
|
|
Set.arApartInit[2,12].iZone := 10;
|
|
Set.arApartInit[2,13].iAp := 214;
|
|
Set.arApartInit[2,13].iZone := 1;
|
|
Set.arApartInit[2,14].iAp := 215;
|
|
Set.arApartInit[2,14].iZone := 2;
|
|
Set.arApartInit[2,15].iAp := 216;
|
|
Set.arApartInit[2,15].iZone := 2;
|
|
Set.arApartInit[2,16].iAp := 217;
|
|
Set.arApartInit[2,16].iZone := 2;
|
|
Set.arApartInit[2,17].iAp := 218;
|
|
Set.arApartInit[2,17].iZone := 2;
|
|
Set.arApartInit[2,18].iAp := 219;
|
|
Set.arApartInit[2,18].iZone := 3;
|
|
|
|
// FLOOR 3
|
|
Set.arApartInit[3,1].iAp := 301;
|
|
Set.arApartInit[3,1].iZone := 4;
|
|
Set.arApartInit[3,2].iAp := 302;
|
|
Set.arApartInit[3,2].iZone := 4;
|
|
Set.arApartInit[3,3].iAp := 303;
|
|
Set.arApartInit[3,3].iZone := 4;
|
|
Set.arApartInit[3,4].iAp := 304;
|
|
Set.arApartInit[3,4].iZone := 5;
|
|
Set.arApartInit[3,5].iAp := 305;
|
|
Set.arApartInit[3,5].iZone := 6;
|
|
Set.arApartInit[3,6].iAp := 306;
|
|
Set.arApartInit[3,6].iZone := 7;
|
|
Set.arApartInit[3,7].iAp := 307;
|
|
Set.arApartInit[3,7].iZone := 7;
|
|
Set.arApartInit[3,8].iAp := 308;
|
|
Set.arApartInit[3,8].iZone := 8;
|
|
Set.arApartInit[3,9].iAp := 309;
|
|
Set.arApartInit[3,9].iZone := 9;
|
|
Set.arApartInit[3,10].iAp := 310;
|
|
Set.arApartInit[3,10].iZone := 9;
|
|
Set.arApartInit[3,11].iAp := 311;
|
|
Set.arApartInit[3,11].iZone := 9;
|
|
Set.arApartInit[3,12].iAp := 312;
|
|
Set.arApartInit[3,12].iZone := 10;
|
|
Set.arApartInit[3,13].iAp := 314;
|
|
Set.arApartInit[3,13].iZone := 1;
|
|
Set.arApartInit[3,14].iAp := 315;
|
|
Set.arApartInit[3,14].iZone := 2;
|
|
Set.arApartInit[3,15].iAp := 316;
|
|
Set.arApartInit[3,15].iZone := 2;
|
|
Set.arApartInit[3,16].iAp := 317;
|
|
Set.arApartInit[3,16].iZone := 2;
|
|
Set.arApartInit[3,17].iAp := 318;
|
|
Set.arApartInit[3,17].iZone := 2;
|
|
Set.arApartInit[3,18].iAp := 319;
|
|
Set.arApartInit[3,18].iZone := 3;
|
|
|
|
// FLOOR 4
|
|
Set.arApartInit[4,1].iAp := 401;
|
|
Set.arApartInit[4,1].iZone := 4;
|
|
Set.arApartInit[4,2].iAp := 402;
|
|
Set.arApartInit[4,2].iZone := 4;
|
|
Set.arApartInit[4,3].iAp := 403;
|
|
Set.arApartInit[4,3].iZone := 4;
|
|
Set.arApartInit[4,4].iAp := 404;
|
|
Set.arApartInit[4,4].iZone := 5;
|
|
Set.arApartInit[4,5].iAp := 405;
|
|
Set.arApartInit[4,5].iZone := 6;
|
|
Set.arApartInit[4,6].iAp := 406;
|
|
Set.arApartInit[4,6].iZone := 7;
|
|
Set.arApartInit[4,7].iAp := 407;
|
|
Set.arApartInit[4,7].iZone := 7;
|
|
Set.arApartInit[4,8].iAp := 408;
|
|
Set.arApartInit[4,8].iZone := 8;
|
|
Set.arApartInit[4,9].iAp := 409;
|
|
Set.arApartInit[4,9].iZone := 9;
|
|
Set.arApartInit[4,10].iAp := 410;
|
|
Set.arApartInit[4,10].iZone := 9;
|
|
Set.arApartInit[4,11].iAp := 411;
|
|
Set.arApartInit[4,11].iZone := 9;
|
|
Set.arApartInit[4,12].iAp := 412;
|
|
Set.arApartInit[4,12].iZone := 10;
|
|
Set.arApartInit[4,13].iAp := 414;
|
|
Set.arApartInit[4,13].iZone := 1;
|
|
Set.arApartInit[4,14].iAp := 415;
|
|
Set.arApartInit[4,14].iZone := 2;
|
|
Set.arApartInit[4,15].iAp := 416;
|
|
Set.arApartInit[4,15].iZone := 2;
|
|
Set.arApartInit[4,16].iAp := 417;
|
|
Set.arApartInit[4,16].iZone := 2;
|
|
Set.arApartInit[4,17].iAp := 418;
|
|
Set.arApartInit[4,17].iZone := 2;
|
|
Set.arApartInit[4,18].iAp := 419;
|
|
Set.arApartInit[4,18].iZone := 3;
|
|
|
|
// FLOOR 5
|
|
Set.arApartInit[5,1].iAp := 501;
|
|
Set.arApartInit[5,1].iZone := 4;
|
|
Set.arApartInit[5,2].iAp := 502;
|
|
Set.arApartInit[5,2].iZone := 4;
|
|
Set.arApartInit[5,3].iAp := 503;
|
|
Set.arApartInit[5,3].iZone := 4;
|
|
Set.arApartInit[5,4].iAp := 504;
|
|
Set.arApartInit[5,4].iZone := 5;
|
|
Set.arApartInit[5,5].iAp := 505;
|
|
Set.arApartInit[5,5].iZone := 6;
|
|
Set.arApartInit[5,6].iAp := 506;
|
|
Set.arApartInit[5,6].iZone := 7;
|
|
Set.arApartInit[5,7].iAp := 507;
|
|
Set.arApartInit[5,7].iZone := 7;
|
|
Set.arApartInit[5,8].iAp := 508;
|
|
Set.arApartInit[5,8].iZone := 8;
|
|
Set.arApartInit[5,9].iAp := 509;
|
|
Set.arApartInit[5,9].iZone := 9;
|
|
Set.arApartInit[5,10].iAp := 510;
|
|
Set.arApartInit[5,10].iZone := 9;
|
|
Set.arApartInit[5,11].iAp := 511;
|
|
Set.arApartInit[5,11].iZone := 9;
|
|
Set.arApartInit[5,12].iAp := 512;
|
|
Set.arApartInit[5,12].iZone := 10;
|
|
Set.arApartInit[5,13].iAp := 514;
|
|
Set.arApartInit[5,13].iZone := 1;
|
|
Set.arApartInit[5,14].iAp := 515;
|
|
Set.arApartInit[5,14].iZone := 2;
|
|
Set.arApartInit[5,15].iAp := 516;
|
|
Set.arApartInit[5,15].iZone := 2;
|
|
Set.arApartInit[5,16].iAp := 517;
|
|
Set.arApartInit[5,16].iZone := 2;
|
|
Set.arApartInit[5,17].iAp := 518;
|
|
Set.arApartInit[5,17].iZone := 2;
|
|
Set.arApartInit[5,18].iAp := 519;
|
|
Set.arApartInit[5,18].iZone := 3;
|
|
|
|
// FLOOR 6
|
|
Set.arApartInit[6,1].iAp := 601;
|
|
Set.arApartInit[6,1].iZone := 4;
|
|
Set.arApartInit[6,2].iAp := 602;
|
|
Set.arApartInit[6,2].iZone := 4;
|
|
Set.arApartInit[6,3].iAp := 603;
|
|
Set.arApartInit[6,3].iZone := 4;
|
|
Set.arApartInit[6,4].iAp := 604;
|
|
Set.arApartInit[6,4].iZone := 5;
|
|
Set.arApartInit[6,5].iAp := 605;
|
|
Set.arApartInit[6,5].iZone := 6;
|
|
Set.arApartInit[6,6].iAp := 606;
|
|
Set.arApartInit[6,6].iZone := 7;
|
|
Set.arApartInit[6,7].iAp := 607;
|
|
Set.arApartInit[6,7].iZone := 7;
|
|
Set.arApartInit[6,8].iAp := 608;
|
|
Set.arApartInit[6,8].iZone := 8;
|
|
Set.arApartInit[6,9].iAp := 609;
|
|
Set.arApartInit[6,9].iZone := 9;
|
|
Set.arApartInit[6,10].iAp := 610;
|
|
Set.arApartInit[6,10].iZone := 9;
|
|
Set.arApartInit[6,11].iAp := 611;
|
|
Set.arApartInit[6,11].iZone := 9;
|
|
Set.arApartInit[6,12].iAp := 612;
|
|
Set.arApartInit[6,12].iZone := 10;
|
|
Set.arApartInit[6,13].iAp := 614;
|
|
Set.arApartInit[6,13].iZone := 1;
|
|
Set.arApartInit[6,14].iAp := 615;
|
|
Set.arApartInit[6,14].iZone := 2;
|
|
Set.arApartInit[6,15].iAp := 616;
|
|
Set.arApartInit[6,15].iZone := 2;
|
|
Set.arApartInit[6,16].iAp := 617;
|
|
Set.arApartInit[6,16].iZone := 2;
|
|
Set.arApartInit[6,17].iAp := 618;
|
|
Set.arApartInit[6,17].iZone := 2;
|
|
Set.arApartInit[6,18].iAp := 619;
|
|
Set.arApartInit[6,18].iZone := 3;
|
|
// FLOOR 7
|
|
Set.arApartInit[7,1].iAp := 701;
|
|
Set.arApartInit[7,1].iZone := 4;
|
|
Set.arApartInit[7,2].iAp := 702;
|
|
Set.arApartInit[7,2].iZone := 4;
|
|
Set.arApartInit[7,3].iAp := 703;
|
|
Set.arApartInit[7,3].iZone := 4;
|
|
Set.arApartInit[7,4].iAp := 704;
|
|
Set.arApartInit[7,4].iZone := 5;
|
|
Set.arApartInit[7,5].iAp := 705;
|
|
Set.arApartInit[7,5].iZone := 6;
|
|
Set.arApartInit[7,6].iAp := 706;
|
|
Set.arApartInit[7,6].iZone := 7;
|
|
Set.arApartInit[7,7].iAp := 707;
|
|
Set.arApartInit[7,7].iZone := 7;
|
|
Set.arApartInit[7,8].iAp := 708;
|
|
Set.arApartInit[7,8].iZone := 8;
|
|
Set.arApartInit[7,9].iAp := 709;
|
|
Set.arApartInit[7,9].iZone := 9;
|
|
Set.arApartInit[7,10].iAp := 710;
|
|
Set.arApartInit[7,10].iZone := 9;
|
|
Set.arApartInit[7,11].iAp := 711;
|
|
Set.arApartInit[7,11].iZone := 9;
|
|
Set.arApartInit[7,12].iAp := 712;
|
|
Set.arApartInit[7,12].iZone := 10;
|
|
Set.arApartInit[7,13].iAp := 714;
|
|
Set.arApartInit[7,13].iZone := 1;
|
|
Set.arApartInit[7,14].iAp := 715;
|
|
Set.arApartInit[7,14].iZone := 2;
|
|
Set.arApartInit[7,15].iAp := 716;
|
|
Set.arApartInit[7,15].iZone := 2;
|
|
Set.arApartInit[7,16].iAp := 717;
|
|
Set.arApartInit[7,16].iZone := 2;
|
|
Set.arApartInit[7,17].iAp := 718;
|
|
Set.arApartInit[7,17].iZone := 2;
|
|
Set.arApartInit[7,18].iAp := 719;
|
|
Set.arApartInit[7,18].iZone := 3;
|
|
// FLOOR 8
|
|
Set.arApartInit[8,1].iAp := 801;
|
|
Set.arApartInit[8,1].iZone := 4;
|
|
Set.arApartInit[8,2].iAp := 802;
|
|
Set.arApartInit[8,2].iZone := 4;
|
|
Set.arApartInit[8,3].iAp := 803;
|
|
Set.arApartInit[8,3].iZone := 4;
|
|
Set.arApartInit[8,4].iAp := 804;
|
|
Set.arApartInit[8,4].iZone := 5;
|
|
Set.arApartInit[8,5].iAp := 805;
|
|
Set.arApartInit[8,5].iZone := 6;
|
|
Set.arApartInit[8,6].iAp := 806;
|
|
Set.arApartInit[8,6].iZone := 7;
|
|
Set.arApartInit[8,7].iAp := 807;
|
|
Set.arApartInit[8,7].iZone := 7;
|
|
Set.arApartInit[8,8].iAp := 808;
|
|
Set.arApartInit[8,8].iZone := 8;
|
|
Set.arApartInit[8,9].iAp := 809;
|
|
Set.arApartInit[8,9].iZone := 9;
|
|
Set.arApartInit[8,10].iAp := 810;
|
|
Set.arApartInit[8,10].iZone := 9;
|
|
Set.arApartInit[8,11].iAp := 811;
|
|
Set.arApartInit[8,11].iZone := 9;
|
|
Set.arApartInit[8,12].iAp := 812;
|
|
Set.arApartInit[8,12].iZone := 10;
|
|
Set.arApartInit[8,13].iAp := 814;
|
|
Set.arApartInit[8,13].iZone := 1;
|
|
Set.arApartInit[8,14].iAp := 815;
|
|
Set.arApartInit[8,14].iZone := 2;
|
|
Set.arApartInit[8,15].iAp := 816;
|
|
Set.arApartInit[8,15].iZone := 2;
|
|
Set.arApartInit[8,16].iAp := 817;
|
|
Set.arApartInit[8,16].iZone := 2;
|
|
Set.arApartInit[8,17].iAp := 818;
|
|
Set.arApartInit[8,17].iZone := 2;
|
|
Set.arApartInit[8,18].iAp := 819;
|
|
Set.arApartInit[8,18].iZone := 3;
|
|
|
|
|
|
// Fill up data with Apartment number and Floor number into working array arZoneData
|
|
//
|
|
// Init apartments in array counters. Write 1 as the start point in the array
|
|
FOR i := 1 TO Set.iNoZones DO
|
|
x[i] := 1; // Initial Index value. Apartment sequential number in array
|
|
GVL.arZoneData[i].iZone := i;
|
|
// FOR a := 1 TO Set.iNoApZoneMax DO
|
|
// GVL.arZoneData[i].arAp[a].iAp := 150; // To help future sorting, mark all apartments as number 150 //10001 Floor 10 is out of the range
|
|
// GVL.arZoneData[i].arAp[a].HMI_Visible := FALSE; // Reset HMI Visibility flag
|
|
// END_FOR
|
|
END_FOR
|
|
|
|
|
|
// Scan each apartment data and place it in the correspondent place in arZoneData
|
|
FOR i := 1 TO Set.iNoOfFloors DO
|
|
FOR a := 1 TO Set.iNoApFloorMax DO
|
|
IF Set.arApartInit[i,a].iAp > 100 THEN
|
|
z := Set.arApartInit[i,a].iZone; // Read Zone number
|
|
GVL.arZoneData[z].arAp[x[z]].iZone := z; // Fill up iZone Zone number where the appartment is
|
|
GVL.arZoneData[z].arAp[x[z]].iAp := Set.arApartInit[i,a].iAp;
|
|
GVL.arZoneData[z].arAp[x[z]].iFloor := ABS(Set.arApartInit[i,a].iAp/100);
|
|
GVL.arZoneData[z].arAp[x[z]].iFloorIndex := Set.arApartInit[i,a].iAp - GVL.arZoneData[z].arAp[x[z]].iFloor * 100;
|
|
// Shift index if Apartment number is >12 as Apartment 13 doesn't exist
|
|
IF GVL.arZoneData[z].arAp[x[z]].iFloorIndex >12 THEN
|
|
GVL.arZoneData[z].arAp[x[z]].iFloorIndex := GVL.arZoneData[z].arAp[x[z]].iFloorIndex -1;
|
|
END_IF
|
|
GVL.arZoneData[z].arAp[x[z]].iT_SP := Set.iSetT; // Need to move it out to make set different per apartment
|
|
GVL.arZoneData[z].arAp[x[z]].HMI_Visible := TRUE;
|
|
x[z] := x[z]+1; // Increase index to write next apartment data into zone array of apartments
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
|
|
FOR i := 1 TO Set.iNoZones DO
|
|
Set.arApInZone[i].iApsNo := x[i] - 1; // Automatically fill up number of apartments in the each zone
|
|
END_FOR
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="Init_HeatLevels" Id="{6d94367e-132f-48f7-9ba3-0d4ca951a06d}">
|
|
<Implementation>
|
|
<ST><![CDATA[// Write default values into Building HeatLevel Table/Array
|
|
//
|
|
FOR i := 1 TO Set.iNoZones DO
|
|
Set.arHeatLevel[i] := Set.arHeatLevelDefault;
|
|
END_FOR]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="MAU" Id="{f6711653-2edb-4d47-aa61-2d1541978432}">
|
|
<Implementation>
|
|
<ST><![CDATA[// ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ MAU NORTH ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
|
// MAU 1
|
|
// NORTH
|
|
// 10..30°C scale
|
|
|
|
(*
|
|
MAU1(
|
|
PV:= IO.MAU1_AirT,
|
|
SP:= REAL_TO_INT(Set.fSetTMAU_N*10),
|
|
Manual:= Set.bSetMAU_N_Manual,
|
|
Man_Y:= Set.fSetTMAU_Man_N,
|
|
Reset:= GVL.bHMI_MAU1_Reset,
|
|
PID_Y_Value=> ,
|
|
PID_Y=> IO.MAU1_BoilerCTRL);
|
|
*)
|
|
IF GVL.iTempOutside < Set.iSetMaxOper THEN
|
|
IO.MAU1_TemperatureSET := REAL_TO_INT(SCALE_R( // Scale set temperature to proper integer 0..32767
|
|
X:= Set.fSetTMAU_N,
|
|
I_LO:= Set.MAU_N_0V, // 10
|
|
I_HI:= Set.MAU_N_10V, // 35
|
|
O_LO:= 0.0,
|
|
O_HI:= 32767.0));
|
|
GVL.bHMI_MAU1_HeatON := TRUE;
|
|
END_IF
|
|
|
|
IF GVL.iTempOutside > Set.iSetMaxOper +10 THEN
|
|
IO.MAU1_TemperatureSET := 0; // If Outside temperature is high, turn OFF MAU heater T command, 0VDC
|
|
GVL.bHMI_MAU1_HeatON := FALSE;
|
|
END_IF
|
|
|
|
|
|
|
|
// ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ MAU SOUTH ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
|
// MAU 2
|
|
// SOUTH
|
|
// 10..35°C scale
|
|
|
|
IF GVL.iTempOutside < Set.iSetMaxOper THEN
|
|
IO.CR2544_MAU_S_CTRL := TRUE;
|
|
IO.MAU2_TemperatureSET := REAL_TO_INT(SCALE_R( // Scale set temperature to proper integer 0..32767
|
|
X:= Set.fSetTMAU_S,
|
|
I_LO:= Set.MAU_S_0V, // 10°C
|
|
I_HI:= Set.MAU_S_10V, // 35°C
|
|
O_LO:= 0.0,
|
|
O_HI:= 32767.0));
|
|
GVL.bHMI_MAU2_HeatON := TRUE;
|
|
END_IF
|
|
|
|
IF GVL.iTempOutside > Set.iSetMaxOper +10 THEN
|
|
IO.CR2544_MAU_S_CTRL := FALSE; // If Outside temperature is high, turn OFF MAU heater
|
|
IO.MAU2_TemperatureSET := 0; // If Outside temperature is high, turn OFF MAU heater T command, 0VDC
|
|
GVL.bHMI_MAU2_HeatON := FALSE;
|
|
END_IF
|
|
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="RelayOutputs" Id="{09f92b87-2381-4df2-ad03-cf1921f86dbb}">
|
|
<Implementation>
|
|
<ST><![CDATA[//
|
|
// PLC Running
|
|
IO.CR2516_PLCRunning := TRUE;
|
|
IO.CR2512_HeatersEnable := Set.HeatEnabled;
|
|
IO.CR2552_MAU_N_3WAY_VALVE := IO.inCR1024_SftyBACREL;]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="SSR_Outputs" Id="{080c74cc-b6b6-4cf2-9c1e-9ae694d9c98f}">
|
|
<Implementation>
|
|
<ST><![CDATA[// SSR Output Control
|
|
//
|
|
|
|
// If System is in Running Mode and Panel switch is in AUTO mode,
|
|
// Look at HMI commands for Global or Zone only SSR Mapping (Manual ON/OFF)
|
|
|
|
// Need to Add shifted SSR activation to avoid big load on the electrical system
|
|
//
|
|
|
|
|
|
IF GVL.System.bStart_Up_Done THEN // AND IO.inCR1024_SftyBACREL
|
|
FOR i := 1 TO Set.iNoZones DO
|
|
// Do not start all SSR at the same time. Spreat ON/OFF cycle over duty cycle period
|
|
tSSRDelay := REAL_TO_TIME((Set.tPWMCycle*1000.0 * (1 - Set.arApInZone[i].fDutyCycle))/Set.arApInZone[i].iApsNo);
|
|
FOR k := 1 TO Set.arApInZone[i].iApsNo DO
|
|
IF GVL.bHMISSR_Manual OR GVL.arZoneData[i].bHMISSR_Manual THEN
|
|
GVL.arZoneData[i].arAp[k].bSSR := GVL.arZoneData[i].arAp[k].bHMISSR_ON;
|
|
ELSE
|
|
GVL.arZoneData[i].arAp[k].fbSSR_Delay.PulseIN := GVL.arZoneData[i].arAp[k].bPWMSSR_ON;
|
|
GVL.arZoneData[i].arAp[k].fbSSR_Delay.Tx := GVL.tx;
|
|
GVL.arZoneData[i].arAp[k].fbSSR_Delay.DelayTime := tSSRDelay * k;
|
|
GVL.arZoneData[i].arAp[k].fbSSR_Delay();
|
|
GVL.arZoneData[i].arAp[k].bSSR := GVL.arZoneData[i].arAp[k].fbSSR_Delay.PulseOut;
|
|
// GVL.arZoneData[i].arAp[k].bSSR := GVL.arZoneData[i].arAp[k].bPWMSSR_ON;
|
|
// GVL.arZoneData[i].arAp[k].bHMISSR_ON := FALSE; // Automatically reset HMI command if not in Manual
|
|
END_IF
|
|
END_FOR
|
|
END_FOR
|
|
|
|
END_IF
|
|
|
|
(*
|
|
// For testing, one zone only
|
|
iz := 2;
|
|
tSSRDelay := REAL_TO_TIME((Set.tPWMCycle*1000.0 * (1 - Set.arApInZone[iz].DutyCycle))/Set.arApInZone[iz].ApsNo);
|
|
FOR k := 1 TO Set.arApInZone[iz].ApsNo DO // Set.arApInZone[i].ApsNo
|
|
IF GVL.bHMISSR_Manual OR GVL.arZoneData[iz].bHMISSR_Manual THEN
|
|
GVL.arZoneData[iz].arAp[k].bSSR := GVL.arZoneData[iz].arAp[k].bHMISSR_ON;
|
|
ELSE
|
|
GVL.arZoneData[iz].arAp[k].fbSSR_Delay.PulseIN := GVL.arZoneData[iz].arAp[k].bPWMSSR_ON;
|
|
GVL.arZoneData[iz].arAp[k].fbSSR_Delay.Tx := GVL.tx;
|
|
GVL.arZoneData[iz].arAp[k].fbSSR_Delay.DelayTime := tSSRDelay * k;
|
|
GVL.arZoneData[iz].arAp[k].fbSSR_Delay();
|
|
GVL.arZoneData[iz].arAp[k].bSSR := GVL.arZoneData[iz].arAp[k].fbSSR_Delay.PulseOut;
|
|
// GVL.arZoneData[iz].arAp[k].bSSR := GVL.arZoneData[iz].arAp[k].bPWMSSR_ON;
|
|
GVL.arZoneData[iz].arAp[k].bHMISSR_ON := FALSE; // Automatically reset HMI command if not in Manual
|
|
END_IF
|
|
END_FOR
|
|
*)
|
|
|
|
(*
|
|
// FOR k := 1 TO Set.arApInZone[1].ApsNo DO
|
|
k := 1;
|
|
IF GVL.bHMISSR_Manual OR GVL.arZoneData[1].bHMISSR_Manual THEN
|
|
GVL.arZoneData[1].arAp[k].bSSR := GVL.arZoneData[1].arAp[k].bHMISSR_ON;
|
|
ELSE
|
|
GVL.arZoneData[1].arAp[k].bSSR := GVL.arZoneData[1].arAp[k].bPWMSSR_ON;
|
|
GVL.arZoneData[1].arAp[k].bHMISSR_ON := FALSE; // Automatically reset HMI command if not in Manual
|
|
END_IF
|
|
// END_FOR
|
|
*)]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<Action Name="WindSensor" Id="{7d7b3e30-fb7e-463e-997b-69202d6c5043}">
|
|
<Implementation>
|
|
<ST><![CDATA[// Read Data from the VAISALA Transmitter. Modbus Address is 41.
|
|
// The function block ModbusRtuMasterV2_KL6x22B realizes a Modbus master,
|
|
// which communicates via a serial Bus Terminal KL6031 or KL6041.
|
|
// Serial EtherCAT Terminals with 22 bytes of data process image are also supported.
|
|
// The function block ModbusRtuMasterV2_PcCOM is available for communication via a serial PC interface (COM port).
|
|
//
|
|
|
|
// MBRTUReadValue : ARRAY[0..10] OF INT; In program MAIN variables declaration
|
|
|
|
// Need to run it once in 15sec
|
|
tModBusRTURead(IN:= NOT tModBusRTURead.Q, PT:= T#15S, Q=> , ET=> ); // Generate a pulse every 20sec
|
|
|
|
MBRTUExecute := tModBusRTURead.Q;
|
|
|
|
IF MBRTUExecute THEN
|
|
IF NOT MBRTUReadBusy THEN
|
|
MBRTUReadExecute := TRUE;
|
|
ELSE
|
|
MBRTUReadExecute := FALSE;
|
|
END_IF
|
|
ELSE
|
|
MBRTUReadExecute := FALSE;
|
|
END_IF
|
|
|
|
IF MBRTUExecute THEN
|
|
IF MBRTUExecStep = 1 AND NOT MBRTUReadBusy THEN
|
|
MBRTUStartReg := 41; // dec-41, hex-0x0029
|
|
MBRTUExecStep := 2;
|
|
ELSIF
|
|
MBRTUExecStep = 2 AND NOT MBRTUReadBusy THEN
|
|
MBRTUStartReg := 0; // dec-17, hex-0x0011
|
|
MBRTUExecStep := 3;
|
|
ELSIF
|
|
MBRTUExecStep = 3 AND NOT MBRTUReadBusy THEN
|
|
MBRTUStartReg := 17; // dec-17, hex-0x0011
|
|
MBRTUExecStep := 1;
|
|
END_IF
|
|
END_IF
|
|
|
|
MasterRTU.ReadInputRegs(
|
|
UnitID:= MBRTUMBAddress, // 41
|
|
Quantity:= MBRTUQuantity, // 11. 22 bytes or 11 registers as a max
|
|
MBAddr:= MBRTUStartReg, // 18 and 42
|
|
cbLength:= SIZEOF(MBRTUReadValue),
|
|
pMemoryAddr:= ADR(MBRTUReadValue),
|
|
AuxQuantity:= ,
|
|
AuxMBAddr:= ,
|
|
AuxcbLength:= ,
|
|
pAuxMemoryAddr:= ,
|
|
Execute:= MBRTUReadExecute,
|
|
Timeout:= T#5S,
|
|
BUSY=> MBRTUReadBusy,
|
|
Error=> MBRTUReadErr,
|
|
ErrorId=> MBRTUReadErrID,
|
|
cbRead=> MBRTUcbRead);
|
|
|
|
IF MBRTUReadErr THEN
|
|
MBRTUReadExecute := FALSE;
|
|
MBRTUExecute := FALSE;
|
|
END_IF
|
|
|
|
IF MBRTUExecStep = 1 AND NOT MBRTUReadBusy AND NOT MBRTUReadErr THEN // Starts from Addr 17
|
|
GVL.W.iAirPressureAver := WORD_TO_INT(MBRTUReadValue[0]); // Reg:18 Addr:0x0011, 3000..12000, 300..1200 hPa, Err:32767
|
|
GVL.W.iWindDirectionInst := WORD_TO_INT(MBRTUReadValue[1]); // Reg:19 Addr:0x0012; 0..3599, 0..359.9° x0.1°, Err:32767
|
|
GVL.W.iWindDirectionMin := WORD_TO_INT(MBRTUReadValue[2]); // Reg:20 Addr:0x0013; 0..3599, 0..359.9° x0.1°, Err:32767
|
|
GVL.W.iWindDirectionMax := WORD_TO_INT(MBRTUReadValue[3]); // Reg:21 Addr:0x0014; 0..3599, 0..359.9° x0.1°, Err:32767
|
|
GVL.W.iWindDirectionAver := WORD_TO_INT(MBRTUReadValue[4]); // Reg:22 Addr:0x0015; 0..3599, 0..359.9° x0.1°, Err:32767
|
|
GVL.W.iWindDirectionGust := WORD_TO_INT(MBRTUReadValue[5]); // Reg:23 Addr:0x0016; 0..3599, 0..359.9° x0.1°, Err:32767
|
|
END_IF
|
|
|
|
IF MBRTUExecStep = 2 AND NOT MBRTUReadBusy AND NOT MBRTUReadErr THEN // // Starts from Addr 41
|
|
GVL.W.iHeaterTemperature := WORD_TO_INT(MBRTUReadValue[0]); // Reg:42 Addr:0x0029 , -500..1500, -50..150°C, Err:32767
|
|
GVL.W.iWindSpeedInst := WORD_TO_INT(MBRTUReadValue[1]); // Reg:43 Addr:0x002A; 0..750 x0.1 m/s ; 0..75 m/s
|
|
GVL.W.iWindSpeedMin := WORD_TO_INT(MBRTUReadValue[2]); // Reg:44 Addr:0x002B; 0..750 x0.1 m/s ; 0..75 m/s
|
|
GVL.W.iWindSpeedMax := WORD_TO_INT(MBRTUReadValue[3]); // Reg:45 Addr:0x002C; 0..750 x0.1 m/s ; 0..75 m/s
|
|
GVL.W.iWindSpeedAver := WORD_TO_INT(MBRTUReadValue[4]); // Reg:46 Addr:0x002D; 0..750 x0.1 m/s ; 0..75 m/s
|
|
GVL.W.iWindSpeedGust := WORD_TO_INT(MBRTUReadValue[6]); // Reg:48 Addr:0x002F, m/s, 0..750, 0..75 m/s, Err:32767
|
|
GVL.W.iWindChillT := LREAL_TO_INT((13.12+0.6215*INT_TO_LREAL(GVL.iTempOutside)/10-(11.37-0.3965*INT_TO_LREAL(GVL.iTempOutside)/10)*EXPT(GVL.W.iWindSpeedAver,0.16))*10);
|
|
END_IF
|
|
|
|
|
|
]]></ST>
|
|
</Implementation>
|
|
</Action>
|
|
<LineIds Name="MAIN">
|
|
<LineId Id="75" Count="1" />
|
|
<LineId Id="321" Count="0" />
|
|
<LineId Id="74" Count="0" />
|
|
<LineId Id="111" Count="0" />
|
|
<LineId Id="387" Count="0" />
|
|
<LineId Id="184" Count="3" />
|
|
<LineId Id="225" Count="0" />
|
|
<LineId Id="188" Count="1" />
|
|
<LineId Id="113" Count="0" />
|
|
<LineId Id="190" Count="1" />
|
|
<LineId Id="1140" Count="0" />
|
|
<LineId Id="680" Count="0" />
|
|
<LineId Id="698" Count="0" />
|
|
<LineId Id="682" Count="0" />
|
|
<LineId Id="684" Count="0" />
|
|
<LineId Id="692" Count="2" />
|
|
<LineId Id="690" Count="0" />
|
|
<LineId Id="699" Count="0" />
|
|
<LineId Id="681" Count="0" />
|
|
<LineId Id="874" Count="0" />
|
|
<LineId Id="192" Count="0" />
|
|
<LineId Id="94" Count="1" />
|
|
<LineId Id="110" Count="0" />
|
|
<LineId Id="99" Count="6" />
|
|
<LineId Id="98" Count="0" />
|
|
<LineId Id="108" Count="0" />
|
|
<LineId Id="72" Count="0" />
|
|
<LineId Id="143" Count="0" />
|
|
<LineId Id="90" Count="0" />
|
|
<LineId Id="87" Count="0" />
|
|
<LineId Id="85" Count="0" />
|
|
<LineId Id="426" Count="1" />
|
|
<LineId Id="420" Count="1" />
|
|
<LineId Id="423" Count="0" />
|
|
<LineId Id="585" Count="0" />
|
|
<LineId Id="583" Count="0" />
|
|
<LineId Id="586" Count="1" />
|
|
<LineId Id="584" Count="0" />
|
|
<LineId Id="588" Count="1" />
|
|
<LineId Id="424" Count="0" />
|
|
<LineId Id="982" Count="0" />
|
|
<LineId Id="592" Count="0" />
|
|
<LineId Id="591" Count="0" />
|
|
<LineId Id="593" Count="1" />
|
|
<LineId Id="928" Count="3" />
|
|
<LineId Id="983" Count="1" />
|
|
<LineId Id="70" Count="0" />
|
|
<LineId Id="89" Count="0" />
|
|
<LineId Id="174" Count="0" />
|
|
<LineId Id="876" Count="0" />
|
|
<LineId Id="175" Count="2" />
|
|
<LineId Id="858" Count="0" />
|
|
<LineId Id="875" Count="0" />
|
|
<LineId Id="852" Count="0" />
|
|
<LineId Id="859" Count="0" />
|
|
<LineId Id="851" Count="0" />
|
|
<LineId Id="853" Count="1" />
|
|
<LineId Id="1036" Count="1" />
|
|
<LineId Id="1035" Count="0" />
|
|
<LineId Id="872" Count="0" />
|
|
<LineId Id="865" Count="0" />
|
|
<LineId Id="873" Count="0" />
|
|
<LineId Id="862" Count="2" />
|
|
<LineId Id="861" Count="0" />
|
|
<LineId Id="866" Count="0" />
|
|
<LineId Id="869" Count="1" />
|
|
<LineId Id="867" Count="0" />
|
|
<LineId Id="29" Count="0" />
|
|
<LineId Id="871" Count="0" />
|
|
<LineId Id="354" Count="1" />
|
|
<LineId Id="39" Count="0" />
|
|
<LineId Id="30" Count="1" />
|
|
<LineId Id="7" Count="0" />
|
|
<LineId Id="461" Count="0" />
|
|
<LineId Id="460" Count="0" />
|
|
<LineId Id="462" Count="0" />
|
|
<LineId Id="464" Count="0" />
|
|
<LineId Id="466" Count="1" />
|
|
<LineId Id="463" Count="0" />
|
|
<LineId Id="469" Count="0" />
|
|
<LineId Id="750" Count="0" />
|
|
<LineId Id="179" Count="2" />
|
|
<LineId Id="799" Count="0" />
|
|
<LineId Id="637" Count="0" />
|
|
<LineId Id="590" Count="0" />
|
|
<LineId Id="860" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.HMI_SortApartments">
|
|
<LineId Id="125" Count="0" />
|
|
<LineId Id="129" Count="11" />
|
|
<LineId Id="126" Count="0" />
|
|
<LineId Id="227" Count="1" />
|
|
<LineId Id="231" Count="4" />
|
|
<LineId Id="240" Count="1" />
|
|
<LineId Id="230" Count="0" />
|
|
<LineId Id="229" Count="0" />
|
|
<LineId Id="128" Count="0" />
|
|
<LineId Id="24" Count="0" />
|
|
<LineId Id="20" Count="2" />
|
|
<LineId Id="51" Count="0" />
|
|
<LineId Id="53" Count="0" />
|
|
<LineId Id="50" Count="0" />
|
|
<LineId Id="52" Count="0" />
|
|
<LineId Id="18" Count="0" />
|
|
<LineId Id="118" Count="0" />
|
|
<LineId Id="28" Count="0" />
|
|
<LineId Id="19" Count="0" />
|
|
<LineId Id="119" Count="0" />
|
|
<LineId Id="73" Count="5" />
|
|
<LineId Id="243" Count="0" />
|
|
<LineId Id="79" Count="4" />
|
|
<LineId Id="105" Count="0" />
|
|
<LineId Id="89" Count="1" />
|
|
<LineId Id="84" Count="4" />
|
|
<LineId Id="70" Count="0" />
|
|
<LineId Id="30" Count="0" />
|
|
<LineId Id="197" Count="0" />
|
|
<LineId Id="216" Count="1" />
|
|
<LineId Id="222" Count="1" />
|
|
<LineId Id="225" Count="0" />
|
|
<LineId Id="224" Count="0" />
|
|
<LineId Id="220" Count="0" />
|
|
<LineId Id="218" Count="0" />
|
|
<LineId Id="215" Count="0" />
|
|
<LineId Id="97" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.Init">
|
|
<LineId Id="51" Count="0" />
|
|
<LineId Id="1" Count="2" />
|
|
<LineId Id="5" Count="2" />
|
|
<LineId Id="4" Count="0" />
|
|
<LineId Id="9" Count="2" />
|
|
<LineId Id="8" Count="0" />
|
|
<LineId Id="15" Count="0" />
|
|
<LineId Id="13" Count="1" />
|
|
<LineId Id="12" Count="0" />
|
|
<LineId Id="17" Count="2" />
|
|
<LineId Id="16" Count="0" />
|
|
<LineId Id="21" Count="2" />
|
|
<LineId Id="20" Count="0" />
|
|
<LineId Id="25" Count="2" />
|
|
<LineId Id="24" Count="0" />
|
|
<LineId Id="29" Count="2" />
|
|
<LineId Id="28" Count="0" />
|
|
<LineId Id="33" Count="2" />
|
|
<LineId Id="32" Count="0" />
|
|
<LineId Id="37" Count="2" />
|
|
<LineId Id="36" Count="0" />
|
|
<LineId Id="50" Count="0" />
|
|
<LineId Id="42" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.Init_Apartments">
|
|
<LineId Id="1" Count="0" />
|
|
<LineId Id="377" Count="8" />
|
|
<LineId Id="724" Count="0" />
|
|
<LineId Id="386" Count="189" />
|
|
<LineId Id="648" Count="73" />
|
|
<LineId Id="301" Count="0" />
|
|
<LineId Id="723" Count="0" />
|
|
<LineId Id="342" Count="34" />
|
|
<LineId Id="304" Count="1" />
|
|
<LineId Id="298" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.Init_HeatLevels">
|
|
<LineId Id="2" Count="3" />
|
|
<LineId Id="1" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.MAU">
|
|
<LineId Id="25" Count="0" />
|
|
<LineId Id="1" Count="1" />
|
|
<LineId Id="41" Count="0" />
|
|
<LineId Id="4" Count="1" />
|
|
<LineId Id="43" Count="0" />
|
|
<LineId Id="6" Count="5" />
|
|
<LineId Id="3" Count="0" />
|
|
<LineId Id="12" Count="0" />
|
|
<LineId Id="47" Count="1" />
|
|
<LineId Id="50" Count="4" />
|
|
<LineId Id="64" Count="0" />
|
|
<LineId Id="55" Count="2" />
|
|
<LineId Id="59" Count="0" />
|
|
<LineId Id="63" Count="0" />
|
|
<LineId Id="60" Count="0" />
|
|
<LineId Id="45" Count="1" />
|
|
<LineId Id="44" Count="0" />
|
|
<LineId Id="13" Count="0" />
|
|
<LineId Id="15" Count="0" />
|
|
<LineId Id="26" Count="0" />
|
|
<LineId Id="18" Count="0" />
|
|
<LineId Id="42" Count="0" />
|
|
<LineId Id="17" Count="0" />
|
|
<LineId Id="19" Count="0" />
|
|
<LineId Id="36" Count="4" />
|
|
<LineId Id="35" Count="0" />
|
|
<LineId Id="61" Count="0" />
|
|
<LineId Id="20" Count="4" />
|
|
<LineId Id="62" Count="0" />
|
|
<LineId Id="14" Count="0" />
|
|
<LineId Id="28" Count="0" />
|
|
<LineId Id="27" Count="0" />
|
|
<LineId Id="34" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.RelayOutputs">
|
|
<LineId Id="1" Count="0" />
|
|
<LineId Id="22" Count="1" />
|
|
<LineId Id="21" Count="0" />
|
|
<LineId Id="3" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.SSR_Outputs">
|
|
<LineId Id="1" Count="1" />
|
|
<LineId Id="4" Count="2" />
|
|
<LineId Id="38" Count="0" />
|
|
<LineId Id="37" Count="0" />
|
|
<LineId Id="39" Count="0" />
|
|
<LineId Id="84" Count="0" />
|
|
<LineId Id="40" Count="0" />
|
|
<LineId Id="7" Count="1" />
|
|
<LineId Id="86" Count="0" />
|
|
<LineId Id="56" Count="1" />
|
|
<LineId Id="9" Count="0" />
|
|
<LineId Id="11" Count="0" />
|
|
<LineId Id="13" Count="0" />
|
|
<LineId Id="51" Count="0" />
|
|
<LineId Id="54" Count="0" />
|
|
<LineId Id="58" Count="0" />
|
|
<LineId Id="53" Count="0" />
|
|
<LineId Id="55" Count="0" />
|
|
<LineId Id="15" Count="1" />
|
|
<LineId Id="18" Count="0" />
|
|
<LineId Id="42" Count="0" />
|
|
<LineId Id="19" Count="2" />
|
|
<LineId Id="36" Count="0" />
|
|
<LineId Id="60" Count="0" />
|
|
<LineId Id="79" Count="0" />
|
|
<LineId Id="77" Count="0" />
|
|
<LineId Id="64" Count="12" />
|
|
<LineId Id="61" Count="2" />
|
|
<LineId Id="59" Count="0" />
|
|
<LineId Id="43" Count="0" />
|
|
<LineId Id="50" Count="0" />
|
|
<LineId Id="44" Count="5" />
|
|
<LineId Id="3" Count="0" />
|
|
<LineId Id="78" Count="0" />
|
|
</LineIds>
|
|
<LineIds Name="MAIN.WindSensor">
|
|
<LineId Id="45" Count="1" />
|
|
<LineId Id="55" Count="3" />
|
|
<LineId Id="60" Count="0" />
|
|
<LineId Id="59" Count="0" />
|
|
<LineId Id="120" Count="0" />
|
|
<LineId Id="119" Count="0" />
|
|
<LineId Id="62" Count="0" />
|
|
<LineId Id="122" Count="0" />
|
|
<LineId Id="121" Count="0" />
|
|
<LineId Id="61" Count="0" />
|
|
<LineId Id="51" Count="0" />
|
|
<LineId Id="41" Count="3" />
|
|
<LineId Id="40" Count="0" />
|
|
<LineId Id="108" Count="1" />
|
|
<LineId Id="31" Count="0" />
|
|
<LineId Id="75" Count="0" />
|
|
<LineId Id="117" Count="0" />
|
|
<LineId Id="95" Count="2" />
|
|
<LineId Id="113" Count="0" />
|
|
<LineId Id="115" Count="1" />
|
|
<LineId Id="114" Count="0" />
|
|
<LineId Id="124" Count="2" />
|
|
<LineId Id="123" Count="0" />
|
|
<LineId Id="98" Count="0" />
|
|
<LineId Id="79" Count="0" />
|
|
<LineId Id="118" Count="0" />
|
|
<LineId Id="2" Count="14" />
|
|
<LineId Id="1" Count="0" />
|
|
<LineId Id="103" Count="2" />
|
|
<LineId Id="107" Count="0" />
|
|
<LineId Id="106" Count="0" />
|
|
<LineId Id="17" Count="0" />
|
|
<LineId Id="33" Count="0" />
|
|
<LineId Id="112" Count="0" />
|
|
<LineId Id="63" Count="0" />
|
|
<LineId Id="65" Count="2" />
|
|
<LineId Id="110" Count="0" />
|
|
<LineId Id="64" Count="0" />
|
|
<LineId Id="54" Count="0" />
|
|
<LineId Id="68" Count="5" />
|
|
<LineId Id="111" Count="0" />
|
|
<LineId Id="127" Count="0" />
|
|
<LineId Id="52" Count="0" />
|
|
<LineId Id="85" Count="0" />
|
|
<LineId Id="90" Count="0" />
|
|
<LineId Id="89" Count="0" />
|
|
</LineIds>
|
|
</POU>
|
|
</TcPlcObject> |