Swegon GOLD E Modbus
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 4
- Uppdaterad
- 2015-03-19
- Skapad
- 2015-03-18
- Kategori
- Modbus, Ventilation
- Visningar
- 2932
Beskrivning
Drivrutin till Swegon Gold Rev E.
Ej testat
Bruksanvisning
.
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 SwegonGoldE NAMED "SwegonGoldE" TYPEID 15401 IS
PARAMETER
Id : "Adress";
V20 : "Alarm reset" [""];
PUBLIC
V1 : "OperationActive" [""]INT;
V2 : "LowSpeedOp" [""]INT;
V3 : "HighSpeedOp" [""]INT;
V4 : "AAlarm" [""]INT;
V5 : "BAlarm" [""]INT;
V6 : "Alarm1:1" [""]INT;
V7 : "Alarm1:2" [""]INT;
V8 : "Alarm1:3" [""]INT;
V9 : "Alarm5:2" [""]INT;
V10 : "Alarm5:3" [""]INT;
PRIVATE
count5;
BAUDRATE 9600;
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(0); % Start address
DATA[4] := RWORD(563); % Antal register att läsa
ANSWER SIZE 76 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(71); % Antal Bytes
DATA[3] -> BYTE(
IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 4) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 8) THEN V3 := 1; ELSE V3 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF (DATA & 16) THEN V4 := 1; ELSE V4 := 0; ENDIF;
IF (DATA & 32) THEN V5 := 1; ELSE V5 := 0; ENDIF;
);
DATA[65] -> BYTE(
IF (DATA & 16) THEN V6 := 1; ELSE V6 := 0; ENDIF;
IF (DATA & 32) THEN V7 := 1; ELSE V7 := 0; ENDIF;
IF (DATA & 64) THEN V8 := 1; ELSE V8 := 0; ENDIF;
);
DATA[73] -> BYTE(
IF (DATA & 2) THEN V9 := 1; ELSE V9 := 0; ENDIF;
IF (DATA & 4) THEN V10 := 1; ELSE V10 := 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 := 0;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count5=0) THEN IF (V20 >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 SwegonGoldE2 NAMED "SwegonGoldE2" TYPEID 15402 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "SAAirFlow" ["l/s"]INT;
V2 : "SAAirFlowReg" ["l/s"]INT;
V3 : "EAAirFlow" ["l/s"]INT;
V4 : "EAAirFlowReg" ["l/s"]INT;
V5 : "SADuctPress" ["Pa"]DEC1;
V6 : "SADuctPressReg" ["Pa"]DEC1;
V7 : "EADuctpress" ["Pa"]DEC1;
V8 : "EADuctPressReg" ["Pa"]DEC1;
V9 : "SAAirFlowPress" ["Pa"]DEC1;
V10 : "EAAirFlowPress" ["Pa"]DEC1;
V11 : "SAFanLvl" ["%"]DEC2;
V12 : "EAFanLvl" ["%"]DEC2;
V13 : "SATemp" ["°C"]DEC2;
V14 : "EATemp" ["°C"]DEC2;
V15 : "OutdoorTemp" ["°C"]DEC2;
V16 : "EADuctTemp" ["°C"]DEC2;
V17 : "SATempReg" ["°C"]DEC2;
V18 : "EATempReg" ["°C"]DEC2;
V19 : "CoolExchRegLvl" ["%"]DEC2;
V20 : "HeatExchRegLvl" ["%"]DEC2;
PRIVATE
BAUDRATE 9600;
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(3); % Start address
DATA[4] := RWORD(88); % Antal register att läsa
ANSWER SIZE 181 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(176); % Antal Bytes
DATA[3] -> RWORD(V1 := DATA;);
DATA[5] -> RWORD(V2 := DATA;);
DATA[7] -> RWORD(V3 := DATA;);
DATA[9] -> RWORD(V4 := DATA;);
DATA[11] -> RWORD(V5 := DATA/10;);
DATA[13] -> RWORD(V6 := DATA/10;);
DATA[15] -> RWORD(V7 := DATA/10;);
DATA[17] -> RWORD(V8 := DATA/10;);
DATA[23] -> RWORD(V9 := DATA/10;);
DATA[25] -> RWORD(V10 := DATA/10;);
DATA[69] -> RWORD(V11 := DATA/100;);
DATA[71] -> RWORD(V12 := DATA/100;);
DATA[123] -> RWORD(IF (DATA>=32768) THEN V13:=(DATA-65536)/100; ELSE V13:=DATA/100; ENDIF;);
DATA[127] -> RWORD(IF (DATA>=32768) THEN V14:=(DATA-65536)/100; ELSE V14:=DATA/100; ENDIF;);
DATA[141] -> RWORD(IF (DATA>=32768) THEN V15:=(DATA-65536)/100; ELSE V15:=DATA/100; ENDIF;);
DATA[155] -> RWORD(IF (DATA>=32768) THEN V16:=(DATA-65536)/100; ELSE V16:=DATA/100; ENDIF;);
DATA[169] -> RWORD(V17 := DATA/100;);
DATA[171] -> RWORD(V18 := DATA/100;);
DATA[175] -> RWORD(V19 := DATA/100;);
DATA[177] -> RWORD(V20 := DATA/100;);
TIMEOUT 300
END;
END;
DEVICETYPE SwegonGoldE3 NAMED "SwegonGoldE3" TYPEID 15403 IS
PARAMETER
Id : "Adress";
V3 : "SALowSpdSP" ["l/s"]INT;
V4 : "EALowSpdSP" ["l/s"]INT;
V5 : "SAHighSpdSP" ["l/s"]INT;
V6 : "EAHighSpdSP" ["l/s"]INT;
V7 : "SAMaxSpdSPBoost" ["l/s"]INT;
V8 : "EAMaxSpdSPBoost" ["l/s"]INT;
V9 : "SALowSpdPresSP" ["Pa"]DEC1;
V10 : "EALowSpdPresSP" ["Pa"]DEC1;
V11 : "SAHighSpdPresSP" ["Pa"]DEC1;
V12 : "EAHighSpdSP" ["Pa"]DEC1;
V13 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V14 : "EAMaxSpdPresSP" ["Pa"]DEC1;
V15 : "SATempSP" ["°C"]DEC2;
V16 : "ComOpLvl" [""]INT; % 0=auto, 1=total stop, 2=low speed, 3=high speed, 4=normal stop, 5= extended normal stop
PUBLIC
V1 : "ReheatRegLvl" ["%"]DEC2;
V2 : "ReHeatAntiFrostTemp" ["°C"]DEC2;
PRIVATE
count4;
count6;
tmp;
BAUDRATE 9600;
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
DATA[2] <- RWORD(
IF(count4>1) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 93;
ELSIF (count4=1) THEN tmp := 152;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V1 := DATA/100;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V2:=(DATA-65536)/100; ELSE V2:=DATA/100; ENDIF;
ENDIF;
count4 := count4+1;
);
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>13) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 2;
ELSIF (count6=1) THEN DATA := 3;
ELSIF (count6=2) THEN DATA := 4;
ELSIF (count6=3) THEN DATA := 5;
ELSIF (count6=4) THEN DATA := 6;
ELSIF (count6=5) THEN DATA := 7;
ELSIF (count6=6) THEN DATA := 18;
ELSIF (count6=7) THEN DATA := 19;
ELSIF (count6=8) THEN DATA := 20;
ELSIF (count6=9) THEN DATA := 21;
ELSIF (count6=10) THEN DATA := 22;
ELSIF (count6=11) THEN DATA := 23;
ELSIF (count6=12) THEN DATA := 131;
ELSIF (count6=13) THEN DATA := 792;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN DATA := V3;
ELSIF (count6=1) THEN DATA := V4;
ELSIF (count6=2) THEN DATA := V5;
ELSIF (count6=3) THEN DATA := V6;
ELSIF (count6=4) THEN DATA := V7;
ELSIF (count6=5) THEN DATA := V8;
ELSIF (count6=6) THEN DATA := V9*10;
ELSIF (count6=7) THEN DATA := V10*10;
ELSIF (count6=8) THEN DATA := V11*10;
ELSIF (count6=9) THEN DATA := V12*10;
ELSIF (count6=10) THEN DATA := V13*10;
ELSIF (count6=11) THEN DATA := V14*10;
ELSIF (count6=12) THEN DATA := V15*100;
ELSIF (count6=13) THEN DATA := V16;
ENDIF;
count6 := count6+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(06);
TIMEOUT 300
END;
END;
DEVICETYPE SwegonGoldE4 NAMED "SwegonGoldE4" TYPEID 15404 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "EAMaxSpdPresSP" ["Pa"]INT;
V2 : "SALowSpdSP" ["l/s"]INT;
V3 : "EALowSpdSP" ["l/s"]INT;
V4 : "SAHighSpdSP" ["l/s"]INT;
V5 : "EAHighSpdSP" ["l/s"]INT;
V6 : "SAMaxSpdSPBoost" ["l/s"]INT;
V7 : "EAMaxSpdSPBoost" ["l/s"]INT;
V8 : "SALowSpdPresSP" ["Pa"]DEC1;
V9 : "EALowSpdPresSP" ["Pa"]DEC1;
V10 : "EAHighSpdSP" ["Pa"]DEC1;
V11 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V12 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V13 : "SATempSP" ["°C"]DEC2;
V14 : "ComOpLvl" [""]; % 0=auto, 1=total stop, 2=low speed, 3=high speed, 4=normal stop, 5= extended normal stop
V15 : "ReheatRegLvl" ["%"]DEC2;
V16 : "ReHeatAntiFrostTemp" ["°C"]DEC1;
PRIVATE
count2;
count3;
count4;
tmp;
BAUDRATE 9600;
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
DATA[2] <- RWORD(
IF(count2>0) THEN count2 := 0; ENDIF;
IF (count2=0) THEN tmp := 23;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 6 DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[3] -> RWORD(
IF(count2>0) THEN count2 := 0; ENDIF;
IF (count2=0) THEN IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
ENDIF;
count2 := count2+1;
);
TIMEOUT 300
END;
TELEGRAM Read3 NAMED "Read 3" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register
DATA[2] <- RWORD(
IF(count3>12) THEN count3 := 0; ENDIF;
IF (count3=0) THEN tmp := 2;
ELSIF (count3=1) THEN tmp := 3;
ELSIF (count3=2) THEN tmp := 4;
ELSIF (count3=3) THEN tmp := 5;
ELSIF (count3=4) THEN tmp := 6;
ELSIF (count3=5) THEN tmp := 7;
ELSIF (count3=6) THEN tmp := 18;
ELSIF (count3=7) THEN tmp := 19;
ELSIF (count3=8) THEN tmp := 21;
ELSIF (count3=9) THEN tmp := 22;
ELSIF (count3=10) THEN tmp := 23;
ELSIF (count3=11) THEN tmp := 131;
ELSIF (count3=12) THEN tmp := 793;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[3] -> RWORD(
IF (count3=0) THEN V2 := DATA;
ELSIF (count3=1) THEN V3 := DATA;
ELSIF (count3=2) THEN V4 := DATA;
ELSIF (count3=3) THEN V5 := DATA;
ELSIF (count3=4) THEN V6 := DATA;
ELSIF (count3=5) THEN V7 := DATA;
ELSIF (count3=6) THEN V8 := DATA/10;
ELSIF (count3=7) THEN V9 := DATA/10;
ELSIF (count3=8) THEN V10 := DATA/10;
ELSIF (count3=9) THEN V11 := DATA/10;
ELSIF (count3=10) THEN V12 := DATA/10;
ELSIF (count3=11) THEN V13 := DATA/100;
ELSIF (count3=12) THEN V14 := DATA;
ENDIF;
count3 := count3+1;
);
TIMEOUT 300
END;
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
DATA[2] <- RWORD(
IF(count4>1) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 93;
ELSIF (count4=1) THEN tmp := 152;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V15 := DATA/100;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V16:=(DATA-65536)/10; ELSE V16:=DATA/10; ENDIF;
ENDIF;
count4 := count4+1;
);
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 SwegonGoldE NAMED "SwegonGoldE" TYPEID 15401 IS
PARAMETER
Id : "Adress";
V20 : "Alarm reset" [""];
PUBLIC
V1 : "OperationActive" [""]INT;
V2 : "LowSpeedOp" [""]INT;
V3 : "HighSpeedOp" [""]INT;
V4 : "AAlarm" [""]INT;
V5 : "BAlarm" [""]INT;
V6 : "Alarm1:1" [""]INT;
V7 : "Alarm1:2" [""]INT;
V8 : "Alarm1:3" [""]INT;
V9 : "Alarm5:2" [""]INT;
V10 : "Alarm5:3" [""]INT;
PRIVATE
count5;
BAUDRATE 9600;
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(0); % Start address
DATA[4] := RWORD(563); % Antal register att läsa
ANSWER SIZE 76 % (Antal register / 8) avrundat uppåt + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[2] = BYTE(71); % Antal Bytes
DATA[3] -> BYTE(
IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
IF (DATA & 4) THEN V2 := 1; ELSE V2 := 0; ENDIF;
IF (DATA & 8) THEN V3 := 1; ELSE V3 := 0; ENDIF;
);
DATA[4] -> BYTE(
IF (DATA & 16) THEN V4 := 1; ELSE V4 := 0; ENDIF;
IF (DATA & 32) THEN V5 := 1; ELSE V5 := 0; ENDIF;
);
DATA[65] -> BYTE(
IF (DATA & 16) THEN V6 := 1; ELSE V6 := 0; ENDIF;
IF (DATA & 32) THEN V7 := 1; ELSE V7 := 0; ENDIF;
IF (DATA & 64) THEN V8 := 1; ELSE V8 := 0; ENDIF;
);
DATA[73] -> BYTE(
IF (DATA & 2) THEN V9 := 1; ELSE V9 := 0; ENDIF;
IF (DATA & 4) THEN V10 := 1; ELSE V10 := 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 := 0;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count5=0) THEN IF (V20 >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 SwegonGoldE2 NAMED "SwegonGoldE2" TYPEID 15402 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "SAAirFlow" ["l/s"]INT;
V2 : "SAAirFlowReg" ["l/s"]INT;
V3 : "EAAirFlow" ["l/s"]INT;
V4 : "EAAirFlowReg" ["l/s"]INT;
V5 : "SADuctPress" ["Pa"]DEC1;
V6 : "SADuctPressReg" ["Pa"]DEC1;
V7 : "EADuctpress" ["Pa"]DEC1;
V8 : "EADuctPressReg" ["Pa"]DEC1;
V9 : "SAAirFlowPress" ["Pa"]DEC1;
V10 : "EAAirFlowPress" ["Pa"]DEC1;
V11 : "SAFanLvl" ["%"]DEC2;
V12 : "EAFanLvl" ["%"]DEC2;
V13 : "SATemp" ["°C"]DEC2;
V14 : "EATemp" ["°C"]DEC2;
V15 : "OutdoorTemp" ["°C"]DEC2;
V16 : "EADuctTemp" ["°C"]DEC2;
V17 : "SATempReg" ["°C"]DEC2;
V18 : "EATempReg" ["°C"]DEC2;
V19 : "CoolExchRegLvl" ["%"]DEC2;
V20 : "HeatExchRegLvl" ["%"]DEC2;
PRIVATE
BAUDRATE 9600;
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(3); % Start address
DATA[4] := RWORD(88); % Antal register att läsa
ANSWER SIZE 181 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(176); % Antal Bytes
DATA[3] -> RWORD(V1 := DATA;);
DATA[5] -> RWORD(V2 := DATA;);
DATA[7] -> RWORD(V3 := DATA;);
DATA[9] -> RWORD(V4 := DATA;);
DATA[11] -> RWORD(V5 := DATA/10;);
DATA[13] -> RWORD(V6 := DATA/10;);
DATA[15] -> RWORD(V7 := DATA/10;);
DATA[17] -> RWORD(V8 := DATA/10;);
DATA[23] -> RWORD(V9 := DATA/10;);
DATA[25] -> RWORD(V10 := DATA/10;);
DATA[69] -> RWORD(V11 := DATA/100;);
DATA[71] -> RWORD(V12 := DATA/100;);
DATA[123] -> RWORD(IF (DATA>=32768) THEN V13:=(DATA-65536)/100; ELSE V13:=DATA/100; ENDIF;);
DATA[127] -> RWORD(IF (DATA>=32768) THEN V14:=(DATA-65536)/100; ELSE V14:=DATA/100; ENDIF;);
DATA[141] -> RWORD(IF (DATA>=32768) THEN V15:=(DATA-65536)/100; ELSE V15:=DATA/100; ENDIF;);
DATA[155] -> RWORD(IF (DATA>=32768) THEN V16:=(DATA-65536)/100; ELSE V16:=DATA/100; ENDIF;);
DATA[169] -> RWORD(V17 := DATA/100;);
DATA[171] -> RWORD(V18 := DATA/100;);
DATA[175] -> RWORD(V19 := DATA/100;);
DATA[177] -> RWORD(V20 := DATA/100;);
TIMEOUT 300
END;
END;
DEVICETYPE SwegonGoldE3 NAMED "SwegonGoldE3" TYPEID 15403 IS
PARAMETER
Id : "Adress";
V3 : "SALowSpdSP" ["l/s"]INT;
V4 : "EALowSpdSP" ["l/s"]INT;
V5 : "SAHighSpdSP" ["l/s"]INT;
V6 : "EAHighSpdSP" ["l/s"]INT;
V7 : "SAMaxSpdSPBoost" ["l/s"]INT;
V8 : "EAMaxSpdSPBoost" ["l/s"]INT;
V9 : "SALowSpdPresSP" ["Pa"]DEC1;
V10 : "EALowSpdPresSP" ["Pa"]DEC1;
V11 : "SAHighSpdPresSP" ["Pa"]DEC1;
V12 : "EAHighSpdSP" ["Pa"]DEC1;
V13 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V14 : "EAMaxSpdPresSP" ["Pa"]DEC1;
V15 : "SATempSP" ["°C"]DEC2;
V16 : "ComOpLvl" [""]INT; % 0=auto, 1=total stop, 2=low speed, 3=high speed, 4=normal stop, 5= extended normal stop
PUBLIC
V1 : "ReheatRegLvl" ["%"]DEC2;
V2 : "ReHeatAntiFrostTemp" ["°C"]DEC2;
PRIVATE
count4;
count6;
tmp;
BAUDRATE 9600;
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
DATA[2] <- RWORD(
IF(count4>1) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 93;
ELSIF (count4=1) THEN tmp := 152;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V1 := DATA/100;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V2:=(DATA-65536)/100; ELSE V2:=DATA/100; ENDIF;
ENDIF;
count4 := count4+1;
);
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>13) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 2;
ELSIF (count6=1) THEN DATA := 3;
ELSIF (count6=2) THEN DATA := 4;
ELSIF (count6=3) THEN DATA := 5;
ELSIF (count6=4) THEN DATA := 6;
ELSIF (count6=5) THEN DATA := 7;
ELSIF (count6=6) THEN DATA := 18;
ELSIF (count6=7) THEN DATA := 19;
ELSIF (count6=8) THEN DATA := 20;
ELSIF (count6=9) THEN DATA := 21;
ELSIF (count6=10) THEN DATA := 22;
ELSIF (count6=11) THEN DATA := 23;
ELSIF (count6=12) THEN DATA := 131;
ELSIF (count6=13) THEN DATA := 792;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN DATA := V3;
ELSIF (count6=1) THEN DATA := V4;
ELSIF (count6=2) THEN DATA := V5;
ELSIF (count6=3) THEN DATA := V6;
ELSIF (count6=4) THEN DATA := V7;
ELSIF (count6=5) THEN DATA := V8;
ELSIF (count6=6) THEN DATA := V9*10;
ELSIF (count6=7) THEN DATA := V10*10;
ELSIF (count6=8) THEN DATA := V11*10;
ELSIF (count6=9) THEN DATA := V12*10;
ELSIF (count6=10) THEN DATA := V13*10;
ELSIF (count6=11) THEN DATA := V14*10;
ELSIF (count6=12) THEN DATA := V15*100;
ELSIF (count6=13) THEN DATA := V16;
ENDIF;
count6 := count6+1;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = BYTE(06);
TIMEOUT 300
END;
END;
DEVICETYPE SwegonGoldE4 NAMED "SwegonGoldE4" TYPEID 15404 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "EAMaxSpdPresSP" ["Pa"]INT;
V2 : "SALowSpdSP" ["l/s"]INT;
V3 : "EALowSpdSP" ["l/s"]INT;
V4 : "SAHighSpdSP" ["l/s"]INT;
V5 : "EAHighSpdSP" ["l/s"]INT;
V6 : "SAMaxSpdSPBoost" ["l/s"]INT;
V7 : "EAMaxSpdSPBoost" ["l/s"]INT;
V8 : "SALowSpdPresSP" ["Pa"]DEC1;
V9 : "EALowSpdPresSP" ["Pa"]DEC1;
V10 : "EAHighSpdSP" ["Pa"]DEC1;
V11 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V12 : "SAMaxSpdPresSP" ["Pa"]DEC1;
V13 : "SATempSP" ["°C"]DEC2;
V14 : "ComOpLvl" [""]; % 0=auto, 1=total stop, 2=low speed, 3=high speed, 4=normal stop, 5= extended normal stop
V15 : "ReheatRegLvl" ["%"]DEC2;
V16 : "ReHeatAntiFrostTemp" ["°C"]DEC1;
PRIVATE
count2;
count3;
count4;
tmp;
BAUDRATE 9600;
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
DATA[2] <- RWORD(
IF(count2>0) THEN count2 := 0; ENDIF;
IF (count2=0) THEN tmp := 23;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 6 DATA[0] = BYTE(Id);
DATA[1] = BYTE(02);
DATA[3] -> RWORD(
IF(count2>0) THEN count2 := 0; ENDIF;
IF (count2=0) THEN IF (DATA & 1) THEN V1 := 1; ELSE V1 := 0; ENDIF;
ENDIF;
count2 := count2+1;
);
TIMEOUT 300
END;
TELEGRAM Read3 NAMED "Read 3" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register
DATA[2] <- RWORD(
IF(count3>12) THEN count3 := 0; ENDIF;
IF (count3=0) THEN tmp := 2;
ELSIF (count3=1) THEN tmp := 3;
ELSIF (count3=2) THEN tmp := 4;
ELSIF (count3=3) THEN tmp := 5;
ELSIF (count3=4) THEN tmp := 6;
ELSIF (count3=5) THEN tmp := 7;
ELSIF (count3=6) THEN tmp := 18;
ELSIF (count3=7) THEN tmp := 19;
ELSIF (count3=8) THEN tmp := 21;
ELSIF (count3=9) THEN tmp := 22;
ELSIF (count3=10) THEN tmp := 23;
ELSIF (count3=11) THEN tmp := 131;
ELSIF (count3=12) THEN tmp := 793;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[3] -> RWORD(
IF (count3=0) THEN V2 := DATA;
ELSIF (count3=1) THEN V3 := DATA;
ELSIF (count3=2) THEN V4 := DATA;
ELSIF (count3=3) THEN V5 := DATA;
ELSIF (count3=4) THEN V6 := DATA;
ELSIF (count3=5) THEN V7 := DATA;
ELSIF (count3=6) THEN V8 := DATA/10;
ELSIF (count3=7) THEN V9 := DATA/10;
ELSIF (count3=8) THEN V10 := DATA/10;
ELSIF (count3=9) THEN V11 := DATA/10;
ELSIF (count3=10) THEN V12 := DATA/10;
ELSIF (count3=11) THEN V13 := DATA/100;
ELSIF (count3=12) THEN V14 := DATA;
ENDIF;
count3 := count3+1;
);
TIMEOUT 300
END;
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
DATA[2] <- RWORD(
IF(count4>1) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 93;
ELSIF (count4=1) THEN tmp := 152;
ENDIF;
DATA:= tmp;
);
DATA[4] := RWORD(01);
ANSWER SIZE 7 DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[3] -> RWORD(
IF (count4=0) THEN V15 := DATA/100;
ELSIF (count4=1) THEN IF (DATA>=32768) THEN V16:=(DATA-65536)/10; ELSE V16:=DATA/10; ENDIF;
ENDIF;
count4 := count4+1;
);
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.