Swegon CASA med modbus premium GW
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 6
- Uppdaterad
- 2015-04-28
- Skapad
- 2013-09-03
- Kategori
- Modbus, Ventilation
- Visningar
- 2571
Beskrivning
Drivrutin till Swegon CASA ventialationsaggregat med modbus premium gateway
Bruksanvisning
Se kommentarerna i skriptet
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 SwegonCASA NAMED "SwegonCASA" TYPEID 15033 IS
PARAMETER
Id : "Adress";
V17 : "wOpMode" [""]; % 0=Away, 1=Normal, 2=Boost
V18 : "wSupplyTempSP" ["°C"]DEC1;
V19 : "wClearAlarms" [""]; % 1 = FreezingDanger 2 = ServiceReminderUser 3 = ServiceReminderService 4 = IRSensorFailure 5 =TemperatureDeviation 6 = Efficiency 7 = FanFailureSupply 8 = FanFailureExhaust 9 = OverheatProtection 10 = FilterGuard 11 = TempSensorError
PUBLIC
V1 : "OpMode" [""]; % 0=Away, 1=Normal, 2=Boost
V2 : "UnitState" [""]; % 0=Stopped, 1=Running
V3 : "SupplyTempSP" ["°C"]DEC1;
V4 : "TempT3" ["°C"]DEC1;
V5 : "TempT4" ["°C"]DEC1;
V6 : "HREefficiency" ["%"];
V7 : "IR failure" [""]; % 0=Off, 1=Alarm
V8 : "TempDeviation" [""]; % 0=Off, 1=Alarm
V9 : "FreezeDanger" [""]; % 0=Off, 1=Alarm
V10 : "FilterGuard" [""]; % 0=Off, 1=Alarm
V11 : "OverheatAHeater" [""]; % 0=Off, 1=Alarm
V12 : "Efficiency" [""]; % 0=Off, 1=Alarm
V13 : "FanFailureSA" [""]; % 0=Off, 1=Alarm
V14 : "FanFailEA" [""]; % 0=Off, 1=Alarm
V15 : "Service" [""]; % 0=Off, 1=Alarm
V16 : "TempSensor" [""]; % 0=Off, 1=Alarm
PRIVATE
count3;
count4;
count6;
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
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>2) THEN count3 := 0; ENDIF;
IF (count3=0) THEN tmp := 4100;
ELSIF (count3=1) THEN tmp := 8000;
ELSIF (count3=2) THEN tmp := 8003;
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 V1 := DATA;
ELSIF (count3=1) THEN V2 := DATA;
ELSIF (count3=2) THEN V3 := DATA/10;
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>12) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 335;
ELSIF (count4=1) THEN tmp := 336;
ELSIF (count4=2) THEN tmp := 341;
ELSIF (count4=3) THEN tmp := 366;
ELSIF (count4=4) THEN tmp := 367;
ELSIF (count4=5) THEN tmp := 368;
ELSIF (count4=6) THEN tmp := 369;
ELSIF (count4=7) THEN tmp := 370;
ELSIF (count4=8) THEN tmp := 371;
ELSIF (count4=9) THEN tmp := 372;
ELSIF (count4=10) THEN tmp := 373;
ELSIF (count4=11) THEN tmp := 374;
ELSIF (count4=12) THEN tmp := 375;
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 V4 := DATA/10;
ELSIF (count4=1) THEN V5 := DATA/10;
ELSIF (count4=2) THEN V6 := DATA;
ELSIF (count4=3) THEN V7 := DATA;
ELSIF (count4=4) THEN V8 := DATA;
ELSIF (count4=5) THEN V9 := DATA;
ELSIF (count4=6) THEN V10 := DATA;
ELSIF (count4=7) THEN V11 := DATA;
ELSIF (count4=8) THEN V12 := DATA;
ELSIF (count4=9) THEN V13 := DATA;
ELSIF (count4=10) THEN V14 := DATA;
ELSIF (count4=11) THEN V15 := DATA;
ELSIF (count4=12) THEN V16 := DATA;
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>2) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 4100;
ELSIF (count6=1) THEN DATA := 8003;
ELSIF (count6=2) THEN DATA := 8028;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN DATA := V17;
ELSIF (count6=1) THEN DATA := V18*10;
ELSIF (count6=2) THEN DATA := V19;
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 SwegonCASA NAMED "SwegonCASA" TYPEID 15033 IS
PARAMETER
Id : "Adress";
V17 : "wOpMode" [""]; % 0=Away, 1=Normal, 2=Boost
V18 : "wSupplyTempSP" ["°C"]DEC1;
V19 : "wClearAlarms" [""]; % 1 = FreezingDanger 2 = ServiceReminderUser 3 = ServiceReminderService 4 = IRSensorFailure 5 =TemperatureDeviation 6 = Efficiency 7 = FanFailureSupply 8 = FanFailureExhaust 9 = OverheatProtection 10 = FilterGuard 11 = TempSensorError
PUBLIC
V1 : "OpMode" [""]; % 0=Away, 1=Normal, 2=Boost
V2 : "UnitState" [""]; % 0=Stopped, 1=Running
V3 : "SupplyTempSP" ["°C"]DEC1;
V4 : "TempT3" ["°C"]DEC1;
V5 : "TempT4" ["°C"]DEC1;
V6 : "HREefficiency" ["%"];
V7 : "IR failure" [""]; % 0=Off, 1=Alarm
V8 : "TempDeviation" [""]; % 0=Off, 1=Alarm
V9 : "FreezeDanger" [""]; % 0=Off, 1=Alarm
V10 : "FilterGuard" [""]; % 0=Off, 1=Alarm
V11 : "OverheatAHeater" [""]; % 0=Off, 1=Alarm
V12 : "Efficiency" [""]; % 0=Off, 1=Alarm
V13 : "FanFailureSA" [""]; % 0=Off, 1=Alarm
V14 : "FanFailEA" [""]; % 0=Off, 1=Alarm
V15 : "Service" [""]; % 0=Off, 1=Alarm
V16 : "TempSensor" [""]; % 0=Off, 1=Alarm
PRIVATE
count3;
count4;
count6;
tmp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
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>2) THEN count3 := 0; ENDIF;
IF (count3=0) THEN tmp := 4100;
ELSIF (count3=1) THEN tmp := 8000;
ELSIF (count3=2) THEN tmp := 8003;
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 V1 := DATA;
ELSIF (count3=1) THEN V2 := DATA;
ELSIF (count3=2) THEN V3 := DATA/10;
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>12) THEN count4 := 0; ENDIF;
IF (count4=0) THEN tmp := 335;
ELSIF (count4=1) THEN tmp := 336;
ELSIF (count4=2) THEN tmp := 341;
ELSIF (count4=3) THEN tmp := 366;
ELSIF (count4=4) THEN tmp := 367;
ELSIF (count4=5) THEN tmp := 368;
ELSIF (count4=6) THEN tmp := 369;
ELSIF (count4=7) THEN tmp := 370;
ELSIF (count4=8) THEN tmp := 371;
ELSIF (count4=9) THEN tmp := 372;
ELSIF (count4=10) THEN tmp := 373;
ELSIF (count4=11) THEN tmp := 374;
ELSIF (count4=12) THEN tmp := 375;
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 V4 := DATA/10;
ELSIF (count4=1) THEN V5 := DATA/10;
ELSIF (count4=2) THEN V6 := DATA;
ELSIF (count4=3) THEN V7 := DATA;
ELSIF (count4=4) THEN V8 := DATA;
ELSIF (count4=5) THEN V9 := DATA;
ELSIF (count4=6) THEN V10 := DATA;
ELSIF (count4=7) THEN V11 := DATA;
ELSIF (count4=8) THEN V12 := DATA;
ELSIF (count4=9) THEN V13 := DATA;
ELSIF (count4=10) THEN V14 := DATA;
ELSIF (count4=11) THEN V15 := DATA;
ELSIF (count4=12) THEN V16 := DATA;
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>2) THEN count6 := 0; ENDIF;
IF (count6=0) THEN DATA := 4100;
ELSIF (count6=1) THEN DATA := 8003;
ELSIF (count6=2) THEN DATA := 8028;
ENDIF;
); % Register adress
DATA[4] <- RWORD(
IF (count6=0) THEN DATA := V17;
ELSIF (count6=1) THEN DATA := V18*10;
ELSIF (count6=2) THEN DATA := V19;
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.