Swegon Golden Gate
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 2
- Uppdaterad
- 2018-11-21
- Skapad
- 2013-08-28
- Kategori
- Modbus, Ventilation
- Visningar
- 2733
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
% Skapad med Modbus Creator
% - OBS! Användaren ansvarar själv för att samma TYPID inte används flera gånger i samma apparat.
% TYPID 10000-19999 är för användardefinierade enheter
DEVICETYPE Swegon_GG NAMED "Swegon Golden Gate" TYPEID 21339 IS
PARAMETER
Id : "Adress";
V15 : "Alarm reset" [""];
PUBLIC
V1 : "Cool energy recovery" [""];
V2 : "Summer night cooling" [""];
V3 : "Group Alarm-A" [""];
V4 : "Group alarm-B" [""];
V5 : "Highspeed operation" [""];
V6 : "Lowspeed operation" [""];
V7 : "Stop" [""];
PRIVATE
count5;
BAUDRATE 4800;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read2 NAMED "Read 2" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(02); % Modbus kommando för att läsa register kod 02
DATA[2] := RWORD(1); % Start address
DATA[4] := RWORD(7); % Antal register att läsa
ANSWER SIZE 6 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(1); % Antal Bytes
DATA[3] -> BYTE(
IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF;
IF (DATA & 8) THEN V4 := 1; ELSE V4 := 0; ENDIF;
IF (DATA & 16) THEN V5 := 1; ELSE V5 := 0; ENDIF;
IF (DATA & 32) THEN V6 := 1; ELSE V6 := 0; ENDIF;
IF (DATA & 64) THEN V7 := 1; ELSE V7 := 0; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM WriteCoil NAMED "Write Coil" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(05); % Modbus kommando för att skriva en Coil
DATA[2] <- RWORD(
IF(count5>0) THEN count5 := 0; ENDIF;
IF (count5=0) THEN DATA := 7;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count5=0) THEN IF (V15 >0) THEN DATA := 65536; ELSE DATA := 0; ENDIF;
ENDIF;
count5 := count5+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(05);
TIMEOUT 300
END;
END;
DEVICETYPE Swegon_GG2 NAMED "Swegon Golden Gate2" TYPEID 21340 IS
PARAMETER
Id : "Adress";
V15 : "SA temp set" ["°C"]DEC2;
V16 : "EA temp set" ["°C"]DEC2;
V17 : "Min SA temp" ["°C"]DEC2;
V18 : "Max SA temp" ["°C"]DEC2;
PUBLIC
V1 : "Operation mode" [""];
V2 : "SF flow" ["l/s"];
V3 : "EF flow" ["l/s"];
V4 : "SF level" ["%"]DEC1;
V5 : "EF level" ["%"]DEC1;
V6 : "Heat Exch. level" ["%"]DEC1;
V7 : "SA temp" ["°C"]DEC2;
V8 : "OUT-D temp" ["°C"]DEC2;
V9 : "EA temp" ["°C"]DEC2;
V10 : "SA temp regulation" ["°C"]DEC2;
V11 : "FP temp" ["°C"]DEC2;
V12 : "Reheat level" ["%"]DEC1;
V13 : "Cooling level" ["%"]DEC1;
V14 : "Alarm level" [""];
PRIVATE
count6;
BAUDRATE 4800;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read4 NAMED "Read 4" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(1); % Start address
DATA[4] := RWORD(24); % Antal register att läsa
ANSWER SIZE 53 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(48); % Antal Bytes
DATA[3] -> RWORD(V1 := DATA;);
DATA[13] -> RWORD(V2 := DATA;);
DATA[15] -> RWORD(V3 := DATA;);
DATA[21] -> RWORD(V4 := DATA/10;);
DATA[23] -> RWORD(V5 := DATA/10;);
DATA[25] -> RWORD(V6 := DATA/10;);
DATA[27] -> RWORD(IF (DATA>=32768) THEN V7:=(DATA-65536)/100; ELSE V7:=DATA/100; ENDIF;);
DATA[29] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/100; ELSE V8:=DATA/100; ENDIF;);
DATA[31] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/100; ELSE V9:=DATA/100; ENDIF;);
DATA[33] -> RWORD(IF (DATA>=32768) THEN V10:=(DATA-65536)/100; ELSE V10:=DATA/100; ENDIF;);
DATA[35] -> RWORD(IF (DATA>=32768) THEN V11:=(DATA-65536)/100; ELSE V11:=DATA/100; ENDIF;);
DATA[37] -> RWORD(V12 := DATA/10;);
DATA[39] -> RWORD(V13 := DATA/10;);
DATA[49] -> RWORD(V14 := DATA;);
TIMEOUT 300
END;
TELEGRAM WriteRegister NAMED "Write Register" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(06); % Modbus kommando för att skriva ett register
DATA[2] <- RWORD(
IF(count6>3) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 67;
ELSIF (count6=1) THEN DATA := 68;
ELSIF (count6=2) THEN DATA := 69;
ELSIF (count6=3) THEN DATA := 70;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN IF (V15<0) THEN DATA := ROUND((V15*100)+65536); ELSE DATA := ROUND(V15*100); ENDIF;
ELSIF (count6=1) THEN IF (V16<0) THEN DATA := ROUND((V16*100)+65536); ELSE DATA := ROUND(V16*100); ENDIF;
ELSIF (count6=2) THEN IF (V17<0) THEN DATA := ROUND((V17*100)+65536); ELSE DATA := ROUND(V17*100); ENDIF;
ELSIF (count6=3) THEN IF (V18<0) THEN DATA := ROUND((V18*100)+65536); ELSE DATA := ROUND(V18*100); ENDIF;
ENDIF;
count6 := count6+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(06);
TIMEOUT 300
END;
END;
% - OBS! Användaren ansvarar själv för att samma TYPID inte används flera gånger i samma apparat.
% TYPID 10000-19999 är för användardefinierade enheter
DEVICETYPE Swegon_GG NAMED "Swegon Golden Gate" TYPEID 21339 IS
PARAMETER
Id : "Adress";
V15 : "Alarm reset" [""];
PUBLIC
V1 : "Cool energy recovery" [""];
V2 : "Summer night cooling" [""];
V3 : "Group Alarm-A" [""];
V4 : "Group alarm-B" [""];
V5 : "Highspeed operation" [""];
V6 : "Lowspeed operation" [""];
V7 : "Stop" [""];
PRIVATE
count5;
BAUDRATE 4800;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read2 NAMED "Read 2" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(02); % Modbus kommando för att läsa register kod 02
DATA[2] := RWORD(1); % Start address
DATA[4] := RWORD(7); % Antal register att läsa
ANSWER SIZE 6 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(1); % Antal Bytes
DATA[3] -> BYTE(
IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 2) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 4) THEN V3 := 1; ELSE V3 := 0; ENDIF;
IF (DATA & 8) THEN V4 := 1; ELSE V4 := 0; ENDIF;
IF (DATA & 16) THEN V5 := 1; ELSE V5 := 0; ENDIF;
IF (DATA & 32) THEN V6 := 1; ELSE V6 := 0; ENDIF;
IF (DATA & 64) THEN V7 := 1; ELSE V7 := 0; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM WriteCoil NAMED "Write Coil" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(05); % Modbus kommando för att skriva en Coil
DATA[2] <- RWORD(
IF(count5>0) THEN count5 := 0; ENDIF;
IF (count5=0) THEN DATA := 7;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count5=0) THEN IF (V15 >0) THEN DATA := 65536; ELSE DATA := 0; ENDIF;
ENDIF;
count5 := count5+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(05);
TIMEOUT 300
END;
END;
DEVICETYPE Swegon_GG2 NAMED "Swegon Golden Gate2" TYPEID 21340 IS
PARAMETER
Id : "Adress";
V15 : "SA temp set" ["°C"]DEC2;
V16 : "EA temp set" ["°C"]DEC2;
V17 : "Min SA temp" ["°C"]DEC2;
V18 : "Max SA temp" ["°C"]DEC2;
PUBLIC
V1 : "Operation mode" [""];
V2 : "SF flow" ["l/s"];
V3 : "EF flow" ["l/s"];
V4 : "SF level" ["%"]DEC1;
V5 : "EF level" ["%"]DEC1;
V6 : "Heat Exch. level" ["%"]DEC1;
V7 : "SA temp" ["°C"]DEC2;
V8 : "OUT-D temp" ["°C"]DEC2;
V9 : "EA temp" ["°C"]DEC2;
V10 : "SA temp regulation" ["°C"]DEC2;
V11 : "FP temp" ["°C"]DEC2;
V12 : "Reheat level" ["%"]DEC1;
V13 : "Cooling level" ["%"]DEC1;
V14 : "Alarm level" [""];
PRIVATE
count6;
BAUDRATE 4800;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read4 NAMED "Read 4" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); % Modbus kommando för att läsa register kod 04
DATA[2] := RWORD(1); % Start address
DATA[4] := RWORD(24); % Antal register att läsa
ANSWER SIZE 53 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(48); % Antal Bytes
DATA[3] -> RWORD(V1 := DATA;);
DATA[13] -> RWORD(V2 := DATA;);
DATA[15] -> RWORD(V3 := DATA;);
DATA[21] -> RWORD(V4 := DATA/10;);
DATA[23] -> RWORD(V5 := DATA/10;);
DATA[25] -> RWORD(V6 := DATA/10;);
DATA[27] -> RWORD(IF (DATA>=32768) THEN V7:=(DATA-65536)/100; ELSE V7:=DATA/100; ENDIF;);
DATA[29] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/100; ELSE V8:=DATA/100; ENDIF;);
DATA[31] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/100; ELSE V9:=DATA/100; ENDIF;);
DATA[33] -> RWORD(IF (DATA>=32768) THEN V10:=(DATA-65536)/100; ELSE V10:=DATA/100; ENDIF;);
DATA[35] -> RWORD(IF (DATA>=32768) THEN V11:=(DATA-65536)/100; ELSE V11:=DATA/100; ENDIF;);
DATA[37] -> RWORD(V12 := DATA/10;);
DATA[39] -> RWORD(V13 := DATA/10;);
DATA[49] -> RWORD(V14 := DATA;);
TIMEOUT 300
END;
TELEGRAM WriteRegister NAMED "Write Register" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(06); % Modbus kommando för att skriva ett register
DATA[2] <- RWORD(
IF(count6>3) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 67;
ELSIF (count6=1) THEN DATA := 68;
ELSIF (count6=2) THEN DATA := 69;
ELSIF (count6=3) THEN DATA := 70;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN IF (V15<0) THEN DATA := ROUND((V15*100)+65536); ELSE DATA := ROUND(V15*100); ENDIF;
ELSIF (count6=1) THEN IF (V16<0) THEN DATA := ROUND((V16*100)+65536); ELSE DATA := ROUND(V16*100); ENDIF;
ELSIF (count6=2) THEN IF (V17<0) THEN DATA := ROUND((V17*100)+65536); ELSE DATA := ROUND(V17*100); ENDIF;
ELSIF (count6=3) THEN IF (V18<0) THEN DATA := ROUND((V18*100)+65536); ELSE DATA := ROUND(V18*100); ENDIF;
ENDIF;
count6 := count6+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(06);
TIMEOUT 300
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.