Swegon Golden Gate 2008
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-28
- Skapad
- 2013-08-28
- Kategori
- Modbus, Ventilation
- Visningar
- 3670
Beskrivning
Drivrutin
Bruksanvisning
Hur man installerar typdefinitionerna och driftsätter modulerna finns beskrivet i användarmanualen, kapitel 18.7.
Juridisk information
Alla skript tillhandahålls i befintligt skick och all användning sker på eget ansvar. Felaktig använding kan leda till skadad eller förstörd utrustning.
Skript kod
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read input registers 1-20
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading Analog status
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGAnalog1 NAMED "Swegon GG AI1" TYPEID 21213 IS
PARAMETER
Id : "Address";
PUBLIC
% Ver A(4) Ver B
R1 : "Operation mode" [" "]; %Ver A: AHU handterminal menu 1-200
%Ver B: Operationstatus for the AHU 00 = Stop alarm
% 01 = Manual stop
% 02 = Ext.stop
% 03 = RS232 stop
% 04 = S-CL stop
% 10 = Manual LS
% 11 = S-CL LS
% 12 = Ext.LS
% 13 = RS232 LS
% 14 = Prolonged LS
% 20 = Manual HS
% 21 = Ext.HS
% 22 = RS232 HS
% 23 = S-CL HS
% 24 = Prolonged HS
% 30 = SN-Cool
% 31 = Reecooling
% 40 = Manual test OP
% 41 = Duct airflow adj
% 42 = Filtercalibration
%
% Ver A(4) Ver B
R2 : "Delay HS_min" ["m"]; %Remaining time highspeed 0-59 0-59
R3 : "Delay HS_hour" ["h"]; %Remaining time highspeed 0-23 0-23
R4 : "Delay LS_min" ["m"]; %Remaining time lowspeed Not used 0-59
R5 : "Delay LS_hour" ["h"]; %Remaining time lowspeed Not used 0-23
R6 : "SF flow" ["l/s"]; %Supply air fan flow 0-4000l/s 0-8000l/s
R7 : "EF flow" ["l/s"]; %Exhaust air fan flow 0-4000l/s 0-8000l/s
R8 : "SF VAV level" ["%"]; %SA input signal VAV/Forcing func 0-100.0% 0-100.0%
R9 : "EF VAV level" ["%"]; %EA input signal VAV/Forcing func 0-100.0% 0-100.0%
R10 : "SF level" ["%"]; %Running level supply air fan 0-100.0% 0-100.0%
R11 : "EF level" ["%"]; %Running level exhaust air fan 0-100.0% 0-100.0%
R12 : "Heat exch.lev." ["%"]; %Running level heat exchanger 0-100.0% 0-100.0%
R13 : "SA temp" ["°C"]; %Supply air temp 0-40.00°C -55.00-125.00°C
R14 : "OUT-D temp" ["°C"]; %Outdoor air temp -20.00-40.00°C -55.00-125.00°C
R15 : "EA temp" ["°C"]; %Exhaust air temp 0-40.00°C -55.00-125.00°C
R16 : "SA temp setp" ["°C"]; %Supply air regulator temp setpoint 0-40.00°C -55.00-125.00°C
R17 : "FP temp" ["°C"]; %Frost protection temp 0-40.00°C -55.00-125.00°C
R18 : "Reheat level" ["%"]; %Level for reheater coi 0-100.0% 0-100.0%
R19 : "Cooling level" ["%"]; %Level for cooling 0-100.0% 0-100.0%
R20 : "SA filt level" ["%(Pa)"]; %Level for supply air filter 0-100.0% 0-2000Pa
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput1 NAMED "Register 1-20" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Start address register
DATA[4] := RWORD(20); % Number of registers
ANSWER SIZE 45
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(40); % Byte count
DATA[3] -> RWORD(R1 := DATA;);
DATA[5] -> RWORD(R2 := DATA;);
DATA[7] -> RWORD(R3 := DATA;);
DATA[9] -> RWORD(R4 := DATA;);
DATA[11] -> RWORD(R5 := DATA;);
DATA[13] -> RWORD(R6 := DATA;); % 0-4000l/s 0-8000l/s
DATA[15] -> RWORD(R7 := DATA;); % 0-4000l/s 0-8000l/s
DATA[17] -> RWORD(R8 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[19] -> RWORD(R9 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[21] -> RWORD(R10 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[23] -> RWORD(R11 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[25] -> RWORD(R12 := DATA / 10;); % 0-100.0% 0-100.0%
% 0-40.00°C -55.00-125.00°C
DATA[27] -> RWORD(IF DATA > 32767 THEN R13 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R13 := DATA /100;
ENDIF;
);
%-20.00-40.00°C -55.00-125.00°C
DATA[29] -> RWORD(IF DATA > 32767 THEN R14 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R14 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[31] -> RWORD(IF DATA > 32767 THEN R15 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R15 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[33] -> RWORD(IF DATA > 32767 THEN R16 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R16 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[35] -> RWORD(IF DATA > 32767 THEN R17 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R17 := DATA /100;
ENDIF;
);
DATA[37] -> RWORD(R18 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[39] -> RWORD(R19 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[41] -> RWORD(R20 := DATA / 10;); % 0-100.0% 0-2000Pa
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLD GATE read input registers 21-38
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading Analog status
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGAnalog2 NAMED "Swegon GG AI2" TYPEID 21214 IS
PARAMETER
Id : "Address";
PUBLIC
% Ver A(4) Ver B
R21 : "EA filt level" ["%(Pa)"]; %Level for exhaust air filter 0-100.0% 0-2000Pa
R22 : "SF filt alarm" ["Pa"]; %Alarm level for supply air filter Not used 0-2000Pa
R23 : "EF filt alarm" ["Pa"]; %Alarm level for exhaust air filter Not used 0-2000Pa
R24 : "Active alarm" [" "]; %Active alarm No 0-48 0-49
R25 : "Unit version" [" "]; %0=No communication 0-1 0,2
%1=Version 4 or A
%2=Version B
R26 : "Input sts 1-16 " [" "];
R27 : "Input sts 17-32" [" "];
R28 : "Input sts 33-48" [" "];
R29 : "Input sts 49-64" [" "];
R30 : "Input sts 65-77" [" "];
R31 : "SF flow setp" ["l/s"]; %Setpoint supply fan flow 0-4000l/s 0-8000l/s
R32 : "EF flow setp" ["l/s"]; %Setpoint exhaust fan flow 0-4000l/s 0-8000l/s
R33 : "EA temp setp" ["°C"]; %Setpoint exhaust air temperature 0-40.00°C 0-40.00°C
R34 : "SF VAV level" ["%"]; %Level supply fan VAV regulator Not used 0-100.0%
R35 : "EF VAV level" ["%"]; %Level exhaust fan VAV regulator Not used 0-100.0%
R36 : "Operating time" ["days"]; %Operating days 0-9999 0-9999
R37 : "Program version" [" "]; %Program version in GOLD AHU Not used 0-65535
R38 : "Coolforcing lev" ["%"]; %Coolforcing level 0-100.0% 0-100.0%
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput2 NAMED "Register 21-38" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(20); % Start address register
DATA[4] := RWORD(18); % Number of registers
ANSWER SIZE 41
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(36); % Byte count
DATA[3] -> RWORD(R21 := DATA / 10;); % 0-100.0% 0-2000Pa
DATA[5] -> RWORD(R22 := DATA;); % Not used 0-2000Pa
DATA[7] -> RWORD(R23 := DATA;); % Not used 0-2000Pa
DATA[9] -> RWORD(R24 := DATA;); % 0-48 0-49
DATA[11] -> RWORD(R25 := DATA;); % 0-1 0,2
DATA[13] -> RWORD(R26 := DATA;); %
DATA[15] -> RWORD(R27 := DATA;); %
DATA[17] -> RWORD(R28 := DATA;); %
DATA[19] -> RWORD(R29 := DATA;); %
DATA[21] -> RWORD(R30 := DATA;); %
DATA[23] -> RWORD(R31 := DATA;); % 0-4000l/s 0-8000l/s
DATA[25] -> RWORD(R32 := DATA;); % 0-4000l/s 0-8000l/s
DATA[27] -> RWORD(R33 := DATA /100;); % 0-40.00°C 0-40.00°C
DATA[29] -> RWORD(R34 := DATA / 10;); % Not used 0-100.0%
DATA[31] -> RWORD(R35 := DATA / 10;); % Not used 0-100.0%
DATA[33] -> RWORD(R36 := DATA;); % 0-9999 0-9999
DATA[35] -> RWORD(R37 := DATA;); % Not used 0-65535
DATA[37] -> RWORD(R38 := DATA / 10;); % 0-100.0% 0-100.0%
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 1-20
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital1 NAMED "Swegon GG DI1" TYPEID 21215 IS
PARAMETER
Id : "Address";
PUBLIC
DI1 : "Cool energy rec"; %Cool energy recovery function
DI2 : "S.Night cooling"; %Summer night cooling
DI3 : "Group alarm A"; %Alarm relay output-A
DI4 : "Group alarm B"; %Alarm relay output-B
DI5 : "Highspeed"; %Operating cases.
DI6 : "Lowspeed"; %Operating cases.
DI7 : "Stop"; %Operating cases.
DI8 : "Heating relay"; %Heating function is active.
DI9 : "Cooling relay 1"; %Cooling function stage 1 is active.
DI10 : "Cooling relay 2"; %Cooling function stage 2 is active.
DI11 : "Cooling cpr 1"; %Compressor 1, in Cooler is active.
DI12 : "Cooling cpr 2"; %Compressor 2, in Cooler is active.
DI13 : "Reserve 1"; %Not used in this version.
DI14 : "Reserve 2"; %Not used in this version.
DI15 : "Digital In 1"; %Input 1, on Ethernet module is active.
DI16 : "Digital In 2"; %Input 2, on Ethernet module is active.
DI17 : "Alarm no. 1"; %
DI18 : "Alarm no. 2"; %
DI19 : "Alarm no. 3"; %
DI20 : "Alarm no. 4"; %
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput1 NAMED "DI 1-20" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 4) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 8) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 16) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 32) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 64) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
IF (DATA & 128) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
IF (DATA & 2) THEN DI10:= 1; ELSE DI10:= 0; ENDIF;
IF (DATA & 4) THEN DI11:= 1; ELSE DI11:= 0; ENDIF;
IF (DATA & 8) THEN DI12:= 1; ELSE DI12:= 0; ENDIF;
IF (DATA & 16) THEN DI13:= 1; ELSE DI13:= 0; ENDIF;
IF (DATA & 32) THEN DI14:= 1; ELSE DI14:= 0; ENDIF;
IF (DATA & 64) THEN DI15:= 1; ELSE DI15:= 0; ENDIF;
IF (DATA & 128) THEN DI16:= 1; ELSE DI16:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI17:= 1; ELSE DI17:= 0; ENDIF;
IF (DATA & 2) THEN DI18:= 1; ELSE DI18:= 0; ENDIF;
IF (DATA & 4) THEN DI19:= 1; ELSE DI19:= 0; ENDIF;
IF (DATA & 8) THEN DI20:= 1; ELSE DI20:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 21-40
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital2 NAMED "Swegon GG DI2" TYPEID 21216 IS
PARAMETER
Id : "Address";
PUBLIC
DI21 : "Alarm no. 5";
DI22 : "Alarm no. 6";
DI23 : "Alarm no. 7";
DI24 : "Alarm no. 8";
DI25 : "Alarm no. 9";
DI26 : "Alarm no. 10";
DI27 : "Alarm no. 11";
DI28 : "Alarm no. 12";
DI29 : "Alarm no. 13";
DI30 : "Alarm no. 14";
DI31 : "Alarm no. 15";
DI32 : "Alarm no. 16";
DI33 : "Alarm no. 17";
DI34 : "Alarm no. 18";
DI35 : "Alarm no. 19";
DI36 : "Alarm no. 20";
DI37 : "Alarm no. 21";
DI38 : "Alarm no. 22";
DI39 : "Alarm no. 23";
DI40 : "Alarm no. 24";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput2 NAMED "DI 21-40" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(20); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI21:= 1; ELSE DI21:= 0; ENDIF;
IF (DATA & 2) THEN DI22:= 1; ELSE DI22:= 0; ENDIF;
IF (DATA & 4) THEN DI23:= 1; ELSE DI23:= 0; ENDIF;
IF (DATA & 8) THEN DI24:= 1; ELSE DI24:= 0; ENDIF;
IF (DATA & 16) THEN DI25:= 1; ELSE DI25:= 0; ENDIF;
IF (DATA & 32) THEN DI26:= 1; ELSE DI26:= 0; ENDIF;
IF (DATA & 64) THEN DI27:= 1; ELSE DI27:= 0; ENDIF;
IF (DATA & 128) THEN DI28:= 1; ELSE DI28:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI29:= 1; ELSE DI29:= 0; ENDIF;
IF (DATA & 2) THEN DI30:= 1; ELSE DI30:= 0; ENDIF;
IF (DATA & 4) THEN DI31:= 1; ELSE DI31:= 0; ENDIF;
IF (DATA & 8) THEN DI32:= 1; ELSE DI32:= 0; ENDIF;
IF (DATA & 16) THEN DI33:= 1; ELSE DI33:= 0; ENDIF;
IF (DATA & 32) THEN DI34:= 1; ELSE DI34:= 0; ENDIF;
IF (DATA & 64) THEN DI35:= 1; ELSE DI35:= 0; ENDIF;
IF (DATA & 128) THEN DI36:= 1; ELSE DI36:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI37:= 1; ELSE DI37:= 0; ENDIF;
IF (DATA & 2) THEN DI38:= 1; ELSE DI38:= 0; ENDIF;
IF (DATA & 4) THEN DI39:= 1; ELSE DI39:= 0; ENDIF;
IF (DATA & 8) THEN DI40:= 1; ELSE DI40:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 41-60
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital2 NAMED "Swegon GG DI3" TYPEID 21217 IS
PARAMETER
Id : "Address";
PUBLIC
DI41 : "Alarm no. 25";
DI42 : "Alarm no. 26";
DI43 : "Alarm no. 27";
DI44 : "Alarm no. 28";
DI45 : "Alarm no. 29";
DI46 : "Alarm no. 30";
DI47 : "Alarm no. 31";
DI48 : "Alarm no. 32";
DI49 : "Alarm no. 33";
DI50 : "Alarm no. 34";
DI51 : "Alarm no. 35";
DI52 : "Alarm no. 36";
DI53 : "Alarm no. 37";
DI54 : "Alarm no. 38";
DI55 : "Alarm no. 39";
DI56 : "Alarm no. 40";
DI57 : "Alarm no. 41";
DI58 : "Alarm no. 42";
DI59 : "Alarm no. 43";
DI60 : "Alarm no. 44";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput3 NAMED "DI 41-60" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(40); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI41:= 1; ELSE DI41:= 0; ENDIF;
IF (DATA & 2) THEN DI42:= 1; ELSE DI42:= 0; ENDIF;
IF (DATA & 4) THEN DI43:= 1; ELSE DI43:= 0; ENDIF;
IF (DATA & 8) THEN DI44:= 1; ELSE DI44:= 0; ENDIF;
IF (DATA & 16) THEN DI45:= 1; ELSE DI45:= 0; ENDIF;
IF (DATA & 32) THEN DI46:= 1; ELSE DI46:= 0; ENDIF;
IF (DATA & 64) THEN DI47:= 1; ELSE DI47:= 0; ENDIF;
IF (DATA & 128) THEN DI48:= 1; ELSE DI48:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI49:= 1; ELSE DI49:= 0; ENDIF;
IF (DATA & 2) THEN DI50:= 1; ELSE DI50:= 0; ENDIF;
IF (DATA & 4) THEN DI51:= 1; ELSE DI51:= 0; ENDIF;
IF (DATA & 8) THEN DI52:= 1; ELSE DI52:= 0; ENDIF;
IF (DATA & 16) THEN DI53:= 1; ELSE DI53:= 0; ENDIF;
IF (DATA & 32) THEN DI54:= 1; ELSE DI54:= 0; ENDIF;
IF (DATA & 64) THEN DI55:= 1; ELSE DI55:= 0; ENDIF;
IF (DATA & 128) THEN DI56:= 1; ELSE DI56:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI57:= 1; ELSE DI57:= 0; ENDIF;
IF (DATA & 2) THEN DI58:= 1; ELSE DI58:= 0; ENDIF;
IF (DATA & 4) THEN DI59:= 1; ELSE DI59:= 0; ENDIF;
IF (DATA & 8) THEN DI60:= 1; ELSE DI60:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 60
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital4 NAMED "Swegon GG DI4" TYPEID 21218 IS
PARAMETER
Id : "Address";
PUBLIC
DI61 : "Alarm no. 45";
DI62 : "Alarm no. 46";
DI63 : "Alarm no. 47";
DI64 : "Alarm no. 48";
DI65 : "Alarm no. 49";
DI66 : "Alarm no. 50";
DI67 : "Alarm no. 51";
DI68 : "Alarm no. 52";
DI69 : "Alarm no. 53";
DI70 : "Alarm no. 54";
DI71 : "Alarm no. 55";
DI72 : "Alarm no. 56";
DI73 : "Alarm no. 57";
DI74 : "Alarm no. 58";
DI75 : "Alarm no. 59";
DI76 : "Alarm no. 60";
DI77 : "Alarm no. 61";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput4 NAMED "DI 60" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(60); % Start adress
DATA[4] := RWORD(17); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI61:= 1; ELSE DI61:= 0; ENDIF;
IF (DATA & 2) THEN DI62:= 1; ELSE DI62:= 0; ENDIF;
IF (DATA & 4) THEN DI63:= 1; ELSE DI63:= 0; ENDIF;
IF (DATA & 8) THEN DI64:= 1; ELSE DI64:= 0; ENDIF;
IF (DATA & 16) THEN DI65:= 1; ELSE DI65:= 0; ENDIF;
IF (DATA & 32) THEN DI66:= 1; ELSE DI66:= 0; ENDIF;
IF (DATA & 64) THEN DI67:= 1; ELSE DI67:= 0; ENDIF;
IF (DATA & 128) THEN DI68:= 1; ELSE DI68:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI69:= 1; ELSE DI69:= 0; ENDIF;
IF (DATA & 2) THEN DI70:= 1; ELSE DI70:= 0; ENDIF;
IF (DATA & 4) THEN DI71:= 1; ELSE DI71:= 0; ENDIF;
IF (DATA & 8) THEN DI72:= 1; ELSE DI72:= 0; ENDIF;
IF (DATA & 16) THEN DI73:= 1; ELSE DI73:= 0; ENDIF;
IF (DATA & 32) THEN DI74:= 1; ELSE DI74:= 0; ENDIF;
IF (DATA & 64) THEN DI75:= 1; ELSE DI75:= 0; ENDIF;
IF (DATA & 128) THEN DI76:= 1; ELSE DI76:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI77:= 1; ELSE DI77:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
% Device definition for SWEGON GOLDEN GATE read input registers 1-20
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading Analog status
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGAnalog1 NAMED "Swegon GG AI1" TYPEID 21213 IS
PARAMETER
Id : "Address";
PUBLIC
% Ver A(4) Ver B
R1 : "Operation mode" [" "]; %Ver A: AHU handterminal menu 1-200
%Ver B: Operationstatus for the AHU 00 = Stop alarm
% 01 = Manual stop
% 02 = Ext.stop
% 03 = RS232 stop
% 04 = S-CL stop
% 10 = Manual LS
% 11 = S-CL LS
% 12 = Ext.LS
% 13 = RS232 LS
% 14 = Prolonged LS
% 20 = Manual HS
% 21 = Ext.HS
% 22 = RS232 HS
% 23 = S-CL HS
% 24 = Prolonged HS
% 30 = SN-Cool
% 31 = Reecooling
% 40 = Manual test OP
% 41 = Duct airflow adj
% 42 = Filtercalibration
%
% Ver A(4) Ver B
R2 : "Delay HS_min" ["m"]; %Remaining time highspeed 0-59 0-59
R3 : "Delay HS_hour" ["h"]; %Remaining time highspeed 0-23 0-23
R4 : "Delay LS_min" ["m"]; %Remaining time lowspeed Not used 0-59
R5 : "Delay LS_hour" ["h"]; %Remaining time lowspeed Not used 0-23
R6 : "SF flow" ["l/s"]; %Supply air fan flow 0-4000l/s 0-8000l/s
R7 : "EF flow" ["l/s"]; %Exhaust air fan flow 0-4000l/s 0-8000l/s
R8 : "SF VAV level" ["%"]; %SA input signal VAV/Forcing func 0-100.0% 0-100.0%
R9 : "EF VAV level" ["%"]; %EA input signal VAV/Forcing func 0-100.0% 0-100.0%
R10 : "SF level" ["%"]; %Running level supply air fan 0-100.0% 0-100.0%
R11 : "EF level" ["%"]; %Running level exhaust air fan 0-100.0% 0-100.0%
R12 : "Heat exch.lev." ["%"]; %Running level heat exchanger 0-100.0% 0-100.0%
R13 : "SA temp" ["°C"]; %Supply air temp 0-40.00°C -55.00-125.00°C
R14 : "OUT-D temp" ["°C"]; %Outdoor air temp -20.00-40.00°C -55.00-125.00°C
R15 : "EA temp" ["°C"]; %Exhaust air temp 0-40.00°C -55.00-125.00°C
R16 : "SA temp setp" ["°C"]; %Supply air regulator temp setpoint 0-40.00°C -55.00-125.00°C
R17 : "FP temp" ["°C"]; %Frost protection temp 0-40.00°C -55.00-125.00°C
R18 : "Reheat level" ["%"]; %Level for reheater coi 0-100.0% 0-100.0%
R19 : "Cooling level" ["%"]; %Level for cooling 0-100.0% 0-100.0%
R20 : "SA filt level" ["%(Pa)"]; %Level for supply air filter 0-100.0% 0-2000Pa
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput1 NAMED "Register 1-20" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Start address register
DATA[4] := RWORD(20); % Number of registers
ANSWER SIZE 45
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(40); % Byte count
DATA[3] -> RWORD(R1 := DATA;);
DATA[5] -> RWORD(R2 := DATA;);
DATA[7] -> RWORD(R3 := DATA;);
DATA[9] -> RWORD(R4 := DATA;);
DATA[11] -> RWORD(R5 := DATA;);
DATA[13] -> RWORD(R6 := DATA;); % 0-4000l/s 0-8000l/s
DATA[15] -> RWORD(R7 := DATA;); % 0-4000l/s 0-8000l/s
DATA[17] -> RWORD(R8 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[19] -> RWORD(R9 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[21] -> RWORD(R10 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[23] -> RWORD(R11 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[25] -> RWORD(R12 := DATA / 10;); % 0-100.0% 0-100.0%
% 0-40.00°C -55.00-125.00°C
DATA[27] -> RWORD(IF DATA > 32767 THEN R13 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R13 := DATA /100;
ENDIF;
);
%-20.00-40.00°C -55.00-125.00°C
DATA[29] -> RWORD(IF DATA > 32767 THEN R14 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R14 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[31] -> RWORD(IF DATA > 32767 THEN R15 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R15 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[33] -> RWORD(IF DATA > 32767 THEN R16 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R16 := DATA /100;
ENDIF;
);
% 0-40.00°C -55.00-125.00°C
DATA[35] -> RWORD(IF DATA > 32767 THEN R17 := 0 - (1 + (65535-DATA)) / 100; % Negativ ?
ELSE R17 := DATA /100;
ENDIF;
);
DATA[37] -> RWORD(R18 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[39] -> RWORD(R19 := DATA / 10;); % 0-100.0% 0-100.0%
DATA[41] -> RWORD(R20 := DATA / 10;); % 0-100.0% 0-2000Pa
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLD GATE read input registers 21-38
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading Analog status
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGAnalog2 NAMED "Swegon GG AI2" TYPEID 21214 IS
PARAMETER
Id : "Address";
PUBLIC
% Ver A(4) Ver B
R21 : "EA filt level" ["%(Pa)"]; %Level for exhaust air filter 0-100.0% 0-2000Pa
R22 : "SF filt alarm" ["Pa"]; %Alarm level for supply air filter Not used 0-2000Pa
R23 : "EF filt alarm" ["Pa"]; %Alarm level for exhaust air filter Not used 0-2000Pa
R24 : "Active alarm" [" "]; %Active alarm No 0-48 0-49
R25 : "Unit version" [" "]; %0=No communication 0-1 0,2
%1=Version 4 or A
%2=Version B
R26 : "Input sts 1-16 " [" "];
R27 : "Input sts 17-32" [" "];
R28 : "Input sts 33-48" [" "];
R29 : "Input sts 49-64" [" "];
R30 : "Input sts 65-77" [" "];
R31 : "SF flow setp" ["l/s"]; %Setpoint supply fan flow 0-4000l/s 0-8000l/s
R32 : "EF flow setp" ["l/s"]; %Setpoint exhaust fan flow 0-4000l/s 0-8000l/s
R33 : "EA temp setp" ["°C"]; %Setpoint exhaust air temperature 0-40.00°C 0-40.00°C
R34 : "SF VAV level" ["%"]; %Level supply fan VAV regulator Not used 0-100.0%
R35 : "EF VAV level" ["%"]; %Level exhaust fan VAV regulator Not used 0-100.0%
R36 : "Operating time" ["days"]; %Operating days 0-9999 0-9999
R37 : "Program version" [" "]; %Program version in GOLD AHU Not used 0-65535
R38 : "Coolforcing lev" ["%"]; %Coolforcing level 0-100.0% 0-100.0%
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput2 NAMED "Register 21-38" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(20); % Start address register
DATA[4] := RWORD(18); % Number of registers
ANSWER SIZE 41
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(36); % Byte count
DATA[3] -> RWORD(R21 := DATA / 10;); % 0-100.0% 0-2000Pa
DATA[5] -> RWORD(R22 := DATA;); % Not used 0-2000Pa
DATA[7] -> RWORD(R23 := DATA;); % Not used 0-2000Pa
DATA[9] -> RWORD(R24 := DATA;); % 0-48 0-49
DATA[11] -> RWORD(R25 := DATA;); % 0-1 0,2
DATA[13] -> RWORD(R26 := DATA;); %
DATA[15] -> RWORD(R27 := DATA;); %
DATA[17] -> RWORD(R28 := DATA;); %
DATA[19] -> RWORD(R29 := DATA;); %
DATA[21] -> RWORD(R30 := DATA;); %
DATA[23] -> RWORD(R31 := DATA;); % 0-4000l/s 0-8000l/s
DATA[25] -> RWORD(R32 := DATA;); % 0-4000l/s 0-8000l/s
DATA[27] -> RWORD(R33 := DATA /100;); % 0-40.00°C 0-40.00°C
DATA[29] -> RWORD(R34 := DATA / 10;); % Not used 0-100.0%
DATA[31] -> RWORD(R35 := DATA / 10;); % Not used 0-100.0%
DATA[33] -> RWORD(R36 := DATA;); % 0-9999 0-9999
DATA[35] -> RWORD(R37 := DATA;); % Not used 0-65535
DATA[37] -> RWORD(R38 := DATA / 10;); % 0-100.0% 0-100.0%
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 1-20
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital1 NAMED "Swegon GG DI1" TYPEID 21215 IS
PARAMETER
Id : "Address";
PUBLIC
DI1 : "Cool energy rec"; %Cool energy recovery function
DI2 : "S.Night cooling"; %Summer night cooling
DI3 : "Group alarm A"; %Alarm relay output-A
DI4 : "Group alarm B"; %Alarm relay output-B
DI5 : "Highspeed"; %Operating cases.
DI6 : "Lowspeed"; %Operating cases.
DI7 : "Stop"; %Operating cases.
DI8 : "Heating relay"; %Heating function is active.
DI9 : "Cooling relay 1"; %Cooling function stage 1 is active.
DI10 : "Cooling relay 2"; %Cooling function stage 2 is active.
DI11 : "Cooling cpr 1"; %Compressor 1, in Cooler is active.
DI12 : "Cooling cpr 2"; %Compressor 2, in Cooler is active.
DI13 : "Reserve 1"; %Not used in this version.
DI14 : "Reserve 2"; %Not used in this version.
DI15 : "Digital In 1"; %Input 1, on Ethernet module is active.
DI16 : "Digital In 2"; %Input 2, on Ethernet module is active.
DI17 : "Alarm no. 1"; %
DI18 : "Alarm no. 2"; %
DI19 : "Alarm no. 3"; %
DI20 : "Alarm no. 4"; %
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput1 NAMED "DI 1-20" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 4) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 8) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 16) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 32) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 64) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
IF (DATA & 128) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
IF (DATA & 2) THEN DI10:= 1; ELSE DI10:= 0; ENDIF;
IF (DATA & 4) THEN DI11:= 1; ELSE DI11:= 0; ENDIF;
IF (DATA & 8) THEN DI12:= 1; ELSE DI12:= 0; ENDIF;
IF (DATA & 16) THEN DI13:= 1; ELSE DI13:= 0; ENDIF;
IF (DATA & 32) THEN DI14:= 1; ELSE DI14:= 0; ENDIF;
IF (DATA & 64) THEN DI15:= 1; ELSE DI15:= 0; ENDIF;
IF (DATA & 128) THEN DI16:= 1; ELSE DI16:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI17:= 1; ELSE DI17:= 0; ENDIF;
IF (DATA & 2) THEN DI18:= 1; ELSE DI18:= 0; ENDIF;
IF (DATA & 4) THEN DI19:= 1; ELSE DI19:= 0; ENDIF;
IF (DATA & 8) THEN DI20:= 1; ELSE DI20:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 21-40
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital2 NAMED "Swegon GG DI2" TYPEID 21216 IS
PARAMETER
Id : "Address";
PUBLIC
DI21 : "Alarm no. 5";
DI22 : "Alarm no. 6";
DI23 : "Alarm no. 7";
DI24 : "Alarm no. 8";
DI25 : "Alarm no. 9";
DI26 : "Alarm no. 10";
DI27 : "Alarm no. 11";
DI28 : "Alarm no. 12";
DI29 : "Alarm no. 13";
DI30 : "Alarm no. 14";
DI31 : "Alarm no. 15";
DI32 : "Alarm no. 16";
DI33 : "Alarm no. 17";
DI34 : "Alarm no. 18";
DI35 : "Alarm no. 19";
DI36 : "Alarm no. 20";
DI37 : "Alarm no. 21";
DI38 : "Alarm no. 22";
DI39 : "Alarm no. 23";
DI40 : "Alarm no. 24";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput2 NAMED "DI 21-40" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(20); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI21:= 1; ELSE DI21:= 0; ENDIF;
IF (DATA & 2) THEN DI22:= 1; ELSE DI22:= 0; ENDIF;
IF (DATA & 4) THEN DI23:= 1; ELSE DI23:= 0; ENDIF;
IF (DATA & 8) THEN DI24:= 1; ELSE DI24:= 0; ENDIF;
IF (DATA & 16) THEN DI25:= 1; ELSE DI25:= 0; ENDIF;
IF (DATA & 32) THEN DI26:= 1; ELSE DI26:= 0; ENDIF;
IF (DATA & 64) THEN DI27:= 1; ELSE DI27:= 0; ENDIF;
IF (DATA & 128) THEN DI28:= 1; ELSE DI28:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI29:= 1; ELSE DI29:= 0; ENDIF;
IF (DATA & 2) THEN DI30:= 1; ELSE DI30:= 0; ENDIF;
IF (DATA & 4) THEN DI31:= 1; ELSE DI31:= 0; ENDIF;
IF (DATA & 8) THEN DI32:= 1; ELSE DI32:= 0; ENDIF;
IF (DATA & 16) THEN DI33:= 1; ELSE DI33:= 0; ENDIF;
IF (DATA & 32) THEN DI34:= 1; ELSE DI34:= 0; ENDIF;
IF (DATA & 64) THEN DI35:= 1; ELSE DI35:= 0; ENDIF;
IF (DATA & 128) THEN DI36:= 1; ELSE DI36:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI37:= 1; ELSE DI37:= 0; ENDIF;
IF (DATA & 2) THEN DI38:= 1; ELSE DI38:= 0; ENDIF;
IF (DATA & 4) THEN DI39:= 1; ELSE DI39:= 0; ENDIF;
IF (DATA & 8) THEN DI40:= 1; ELSE DI40:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 41-60
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital2 NAMED "Swegon GG DI3" TYPEID 21217 IS
PARAMETER
Id : "Address";
PUBLIC
DI41 : "Alarm no. 25";
DI42 : "Alarm no. 26";
DI43 : "Alarm no. 27";
DI44 : "Alarm no. 28";
DI45 : "Alarm no. 29";
DI46 : "Alarm no. 30";
DI47 : "Alarm no. 31";
DI48 : "Alarm no. 32";
DI49 : "Alarm no. 33";
DI50 : "Alarm no. 34";
DI51 : "Alarm no. 35";
DI52 : "Alarm no. 36";
DI53 : "Alarm no. 37";
DI54 : "Alarm no. 38";
DI55 : "Alarm no. 39";
DI56 : "Alarm no. 40";
DI57 : "Alarm no. 41";
DI58 : "Alarm no. 42";
DI59 : "Alarm no. 43";
DI60 : "Alarm no. 44";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput3 NAMED "DI 41-60" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(40); % Start adress
DATA[4] := RWORD(20); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI41:= 1; ELSE DI41:= 0; ENDIF;
IF (DATA & 2) THEN DI42:= 1; ELSE DI42:= 0; ENDIF;
IF (DATA & 4) THEN DI43:= 1; ELSE DI43:= 0; ENDIF;
IF (DATA & 8) THEN DI44:= 1; ELSE DI44:= 0; ENDIF;
IF (DATA & 16) THEN DI45:= 1; ELSE DI45:= 0; ENDIF;
IF (DATA & 32) THEN DI46:= 1; ELSE DI46:= 0; ENDIF;
IF (DATA & 64) THEN DI47:= 1; ELSE DI47:= 0; ENDIF;
IF (DATA & 128) THEN DI48:= 1; ELSE DI48:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI49:= 1; ELSE DI49:= 0; ENDIF;
IF (DATA & 2) THEN DI50:= 1; ELSE DI50:= 0; ENDIF;
IF (DATA & 4) THEN DI51:= 1; ELSE DI51:= 0; ENDIF;
IF (DATA & 8) THEN DI52:= 1; ELSE DI52:= 0; ENDIF;
IF (DATA & 16) THEN DI53:= 1; ELSE DI53:= 0; ENDIF;
IF (DATA & 32) THEN DI54:= 1; ELSE DI54:= 0; ENDIF;
IF (DATA & 64) THEN DI55:= 1; ELSE DI55:= 0; ENDIF;
IF (DATA & 128) THEN DI56:= 1; ELSE DI56:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI57:= 1; ELSE DI57:= 0; ENDIF;
IF (DATA & 2) THEN DI58:= 1; ELSE DI58:= 0; ENDIF;
IF (DATA & 4) THEN DI59:= 1; ELSE DI59:= 0; ENDIF;
IF (DATA & 8) THEN DI60:= 1; ELSE DI60:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for SWEGON GOLDEN GATE read digital inputs 60
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Note! Telegram for reading digital inputs
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-08-08 new script
%
DEVICETYPE SwegonGGDigital4 NAMED "Swegon GG DI4" TYPEID 21218 IS
PARAMETER
Id : "Address";
PUBLIC
DI61 : "Alarm no. 45";
DI62 : "Alarm no. 46";
DI63 : "Alarm no. 47";
DI64 : "Alarm no. 48";
DI65 : "Alarm no. 49";
DI66 : "Alarm no. 50";
DI67 : "Alarm no. 51";
DI68 : "Alarm no. 52";
DI69 : "Alarm no. 53";
DI70 : "Alarm no. 54";
DI71 : "Alarm no. 55";
DI72 : "Alarm no. 56";
DI73 : "Alarm no. 57";
DI74 : "Alarm no. 58";
DI75 : "Alarm no. 59";
DI76 : "Alarm no. 60";
DI77 : "Alarm no. 61";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput4 NAMED "DI 60" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(60); % Start adress
DATA[4] := RWORD(17); % Number of inputs
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(3);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI61:= 1; ELSE DI61:= 0; ENDIF;
IF (DATA & 2) THEN DI62:= 1; ELSE DI62:= 0; ENDIF;
IF (DATA & 4) THEN DI63:= 1; ELSE DI63:= 0; ENDIF;
IF (DATA & 8) THEN DI64:= 1; ELSE DI64:= 0; ENDIF;
IF (DATA & 16) THEN DI65:= 1; ELSE DI65:= 0; ENDIF;
IF (DATA & 32) THEN DI66:= 1; ELSE DI66:= 0; ENDIF;
IF (DATA & 64) THEN DI67:= 1; ELSE DI67:= 0; ENDIF;
IF (DATA & 128) THEN DI68:= 1; ELSE DI68:= 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI69:= 1; ELSE DI69:= 0; ENDIF;
IF (DATA & 2) THEN DI70:= 1; ELSE DI70:= 0; ENDIF;
IF (DATA & 4) THEN DI71:= 1; ELSE DI71:= 0; ENDIF;
IF (DATA & 8) THEN DI72:= 1; ELSE DI72:= 0; ENDIF;
IF (DATA & 16) THEN DI73:= 1; ELSE DI73:= 0; ENDIF;
IF (DATA & 32) THEN DI74:= 1; ELSE DI74:= 0; ENDIF;
IF (DATA & 64) THEN DI75:= 1; ELSE DI75:= 0; ENDIF;
IF (DATA & 128) THEN DI76:= 1; ELSE DI76:= 0; ENDIF;
);
DATA[5] -> BYTE(IF (DATA & 1) THEN DI77:= 1; ELSE DI77:= 0; ENDIF;
);
TIMEOUT 2000
END;
END;
Användarnas noteringar
Du måste vara inloggad för att göra en notering. Bli medlem eller logga in. Vi använder en moderator som godkänner noteringarna innan de visas.