Effektstyrning av Regin Corrigo E
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2018-09-26
- Skapad
- 2018-09-26
- Kategori
- Lastbalancering, Modbus, Smarta nät, Värme
- Visningar
- 2185
Beskrivning
.
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 ReginCorrigo NAMED "Regin Corrigo E" TYPEID 12928 IS
PARAMETER
Id : "Adress" INT;
wV12 : "VV01-GT11BV" ["°C"]DEC1;
wV15 : "VV02-GT11BV" ["°C"]DEC1;
wFS1 : "VS01-GT11FS" ["°C"]DEC1;
wFS2 : "VS02-GT11FS" ["°C"]DEC1;
wFS3 : "VS03-GT11FS" ["°C"]DEC1;
PUBLIC
V1 : "VS01-GT3U" ["°C"]DEC1;
V2 : "VS01-GT11" ["°C"]DEC1;
FS1 : "VS01-GT11FS" ["°C"]DEC1;
V3 : "VS01-GT41" ["°C"]DEC1;
V4 : "VS01-SV11" ["%"]DEC1;
V5 : "VS02-GT11" ["°C"]DEC1;
FS2 : "VS02-GT11FS" ["°C"]DEC1;
V6 : "VS02-GT41" ["°C"]DEC1;
V7 : "VS02-SV11" ["%"]DEC1;
V8 : "VS03-GT11" ["°C"]DEC1;
FS3 : "VS03-GT11FS" ["°C"]DEC1;
V9 : "VS03-GT41" ["°C"]DEC1;
V10 : "VS03-SV11" ["%"]DEC1;
V11 : "VV01-GT11" ["°C"]DEC1;
V12 : "VV01-GT11BV" ["°C"]DEC1;
V13 : "VV01-SV11" ["%"]DEC1;
V14 : "VV02-GT11" ["°C"]DEC1;
V15 : "VV02-GT11BV" ["°C"]DEC1;
V16 : "VV02-SV11" ["%"]DEC1;
PRIVATE
cFS;
cwFS;
cBV;
cwBV;
init;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadTemp NAMED "Läs temperaturer" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); %
DATA[2] := RWORD(0); % Start address
DATA[4] := RWORD(14); % Antal register att läsa
ANSWER SIZE 33 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(28); % Antal Bytes
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); %1
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); %2 VS01-GT11
DATA[11] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); %5 VS01-GT41
DATA[13] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); %6 VS02-GT11
DATA[19] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); %9 VS02-GT41
DATA[21] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/10; ELSE V8:=DATA/10; ENDIF;); %10 VS03-GT11
DATA[27] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/10; ELSE V9:=DATA/10; ENDIF;); %13 VS03-GT41
DATA[29] -> RWORD(IF (DATA>=32768) THEN V11:=(DATA-65536)/10; ELSE V11:=DATA/10; ENDIF;); %14 VV01-GT11
DATA[31] -> RWORD(IF (DATA>=32768) THEN V14:=(DATA-65536)/10; ELSE V14:=DATA/10; ENDIF;); %15 VV02-GT11
TIMEOUT 2000
END;
TELEGRAM ReadTri NAMED "Läs styrdon" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); %
DATA[2] := RWORD(159); % Start address
DATA[4] := RWORD(5); % Antal register att läsa
ANSWER SIZE 15 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(10); % Antal Bytes
DATA[3] -> RWORD(V4:=DATA/10;); %160 VS01-SV11
DATA[5] -> RWORD(V7 := DATA/10;); %161 VS02-SV11
DATA[7] -> RWORD(V10 := DATA/10;); %162 VS03-SV11
DATA[9] -> RWORD(V13 := DATA/10;); %163 VV01-SV11
DATA[11] -> RWORD(V16 := DATA/10;); %164 VV02-SV11
TIMEOUT 2000
END;
TELEGRAM ReadHWSP NAMED "Läs VV börvärde" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); %
DATA[2] := RWORD(51); % Start address
DATA[4] := RWORD(2); % Antal register att läsa
ANSWER SIZE 9 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(4); % Antal Bytes
DATA[3] -> RWORD(V12:=DATA/10;); %52 VV01-GT11BV
DATA[5] -> RWORD(V15 := DATA/10;); %53 VV02-GT11BV
TIMEOUT 2000
END;
TELEGRAM WriteHWSP NAMED "Skriv VV börvärde" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(10); %
DATA[2] := RWORD(51); % Start address
DATA[4] := RWORD(2); % Antal register att skriva
DATA[6] := BYTE(4); % Antal byte som följer
DATA[7] <- RWORD(DATA:= wV12*10;);
DATA[9] <- RWORD(DATA:= wV15*10;);
ANSWER SIZE 8 %
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 2000
END;
TELEGRAM ReadTrans NAMED "Läs kurv FS" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); %
DATA[2] <- RWORD(
IF cFS>2 THEN cFS:=0; ENDIF;
DATA:=534+cFS;
); % Start address
DATA[4] := RWORD(1); % Antal register att läsa
ANSWER SIZE 7 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(2); % Antal Bytes
DATA[3] -> RWORD(
IF cFS=0 THEN IF (DATA>=32768) THEN FS1:=(DATA-65536)/10; ELSE FS1:=DATA/10; ENDIF;
ELSIF cFS=1 THEN IF (DATA>=32768) THEN FS2:=(DATA-65536)/10; ELSE FS2:=DATA/10; ENDIF;
ELSIF cFS=2 THEN IF (DATA>=32768) THEN FS3:=(DATA-65536)/10; ELSE FS3:=DATA/10; ENDIF;
ENDIF;
cFS:=cFS+1;
);
TIMEOUT 2000
END;
TELEGRAM WriteTrans NAMED "Skriv kurv FS" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(6); %
DATA[2] <- RWORD(
IF cwFS>2 THEN cwFS:=0; ENDIF;
DATA:=534+cwFS;
); % Start address
DATA[4] <- RWORD(
IF cwFS=0 THEN IF wFS1<0 THEN DATA:=65536+(wFS1*10); ELSE DATA:=wFS1*10; ENDIF;
ELSIF cwFS=1 THEN IF wFS2<0 THEN DATA:=65536+(wFS2*10); ELSE DATA:=wFS2*10; ENDIF;
ELSIF cwFS=2 THEN IF wFS3<0 THEN DATA:=65536+(wFS3*10); ELSE DATA:=wFS3*10; ENDIF;
ENDIF;
cwFS:=cwFS+1;
);
ANSWER SIZE 8 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = HEX(6);
TIMEOUT 2000
END;
SCHEDULER BEGIN
DEFAULT(ReadTemp);
DEFAULT(ReadTri);
IF init=0 THEN
cFS:=0;
TRANSMIT(ReadTrans);
cFS:=1;
TRANSMIT(ReadTrans);
cFS:=2;
TRANSMIT(ReadTrans);
TRANSMIT(ReadHWSP);
init:=1;
ELSE
IF wFS1<>FS1 THEN cwFS:=0; TRANSMIT(WriteTrans); cFS:=0; TRANSMIT(ReadTrans);ENDIF;
IF wFS2<>FS2 THEN cwFS:=1; TRANSMIT(WriteTrans); cFS:=1; TRANSMIT(ReadTrans);ENDIF;
IF wFS3<>FS3 THEN cwFS:=2; TRANSMIT(WriteTrans); cFS:=2; TRANSMIT(ReadTrans);ENDIF;
IF wV12<>V12 OR wV15<>V15 THEN TRANSMIT(WriteHWSP); ENDIF;
TRANSMIT(ReadHWSP);
ENDIF;
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 ReginCorrigo NAMED "Regin Corrigo E" TYPEID 12928 IS
PARAMETER
Id : "Adress" INT;
wV12 : "VV01-GT11BV" ["°C"]DEC1;
wV15 : "VV02-GT11BV" ["°C"]DEC1;
wFS1 : "VS01-GT11FS" ["°C"]DEC1;
wFS2 : "VS02-GT11FS" ["°C"]DEC1;
wFS3 : "VS03-GT11FS" ["°C"]DEC1;
PUBLIC
V1 : "VS01-GT3U" ["°C"]DEC1;
V2 : "VS01-GT11" ["°C"]DEC1;
FS1 : "VS01-GT11FS" ["°C"]DEC1;
V3 : "VS01-GT41" ["°C"]DEC1;
V4 : "VS01-SV11" ["%"]DEC1;
V5 : "VS02-GT11" ["°C"]DEC1;
FS2 : "VS02-GT11FS" ["°C"]DEC1;
V6 : "VS02-GT41" ["°C"]DEC1;
V7 : "VS02-SV11" ["%"]DEC1;
V8 : "VS03-GT11" ["°C"]DEC1;
FS3 : "VS03-GT11FS" ["°C"]DEC1;
V9 : "VS03-GT41" ["°C"]DEC1;
V10 : "VS03-SV11" ["%"]DEC1;
V11 : "VV01-GT11" ["°C"]DEC1;
V12 : "VV01-GT11BV" ["°C"]DEC1;
V13 : "VV01-SV11" ["%"]DEC1;
V14 : "VV02-GT11" ["°C"]DEC1;
V15 : "VV02-GT11BV" ["°C"]DEC1;
V16 : "VV02-SV11" ["%"]DEC1;
PRIVATE
cFS;
cwFS;
cBV;
cwBV;
init;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadTemp NAMED "Läs temperaturer" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); %
DATA[2] := RWORD(0); % Start address
DATA[4] := RWORD(14); % Antal register att läsa
ANSWER SIZE 33 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(28); % Antal Bytes
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); %1
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); %2 VS01-GT11
DATA[11] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); %5 VS01-GT41
DATA[13] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); %6 VS02-GT11
DATA[19] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); %9 VS02-GT41
DATA[21] -> RWORD(IF (DATA>=32768) THEN V8:=(DATA-65536)/10; ELSE V8:=DATA/10; ENDIF;); %10 VS03-GT11
DATA[27] -> RWORD(IF (DATA>=32768) THEN V9:=(DATA-65536)/10; ELSE V9:=DATA/10; ENDIF;); %13 VS03-GT41
DATA[29] -> RWORD(IF (DATA>=32768) THEN V11:=(DATA-65536)/10; ELSE V11:=DATA/10; ENDIF;); %14 VV01-GT11
DATA[31] -> RWORD(IF (DATA>=32768) THEN V14:=(DATA-65536)/10; ELSE V14:=DATA/10; ENDIF;); %15 VV02-GT11
TIMEOUT 2000
END;
TELEGRAM ReadTri NAMED "Läs styrdon" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(04); %
DATA[2] := RWORD(159); % Start address
DATA[4] := RWORD(5); % Antal register att läsa
ANSWER SIZE 15 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(04);
DATA[2] = BYTE(10); % Antal Bytes
DATA[3] -> RWORD(V4:=DATA/10;); %160 VS01-SV11
DATA[5] -> RWORD(V7 := DATA/10;); %161 VS02-SV11
DATA[7] -> RWORD(V10 := DATA/10;); %162 VS03-SV11
DATA[9] -> RWORD(V13 := DATA/10;); %163 VV01-SV11
DATA[11] -> RWORD(V16 := DATA/10;); %164 VV02-SV11
TIMEOUT 2000
END;
TELEGRAM ReadHWSP NAMED "Läs VV börvärde" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); %
DATA[2] := RWORD(51); % Start address
DATA[4] := RWORD(2); % Antal register att läsa
ANSWER SIZE 9 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(4); % Antal Bytes
DATA[3] -> RWORD(V12:=DATA/10;); %52 VV01-GT11BV
DATA[5] -> RWORD(V15 := DATA/10;); %53 VV02-GT11BV
TIMEOUT 2000
END;
TELEGRAM WriteHWSP NAMED "Skriv VV börvärde" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(10); %
DATA[2] := RWORD(51); % Start address
DATA[4] := RWORD(2); % Antal register att skriva
DATA[6] := BYTE(4); % Antal byte som följer
DATA[7] <- RWORD(DATA:= wV12*10;);
DATA[9] <- RWORD(DATA:= wV15*10;);
ANSWER SIZE 8 %
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 2000
END;
TELEGRAM ReadTrans NAMED "Läs kurv FS" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); %
DATA[2] <- RWORD(
IF cFS>2 THEN cFS:=0; ENDIF;
DATA:=534+cFS;
); % Start address
DATA[4] := RWORD(1); % Antal register att läsa
ANSWER SIZE 7 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(2); % Antal Bytes
DATA[3] -> RWORD(
IF cFS=0 THEN IF (DATA>=32768) THEN FS1:=(DATA-65536)/10; ELSE FS1:=DATA/10; ENDIF;
ELSIF cFS=1 THEN IF (DATA>=32768) THEN FS2:=(DATA-65536)/10; ELSE FS2:=DATA/10; ENDIF;
ELSIF cFS=2 THEN IF (DATA>=32768) THEN FS3:=(DATA-65536)/10; ELSE FS3:=DATA/10; ENDIF;
ENDIF;
cFS:=cFS+1;
);
TIMEOUT 2000
END;
TELEGRAM WriteTrans NAMED "Skriv kurv FS" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(6); %
DATA[2] <- RWORD(
IF cwFS>2 THEN cwFS:=0; ENDIF;
DATA:=534+cwFS;
); % Start address
DATA[4] <- RWORD(
IF cwFS=0 THEN IF wFS1<0 THEN DATA:=65536+(wFS1*10); ELSE DATA:=wFS1*10; ENDIF;
ELSIF cwFS=1 THEN IF wFS2<0 THEN DATA:=65536+(wFS2*10); ELSE DATA:=wFS2*10; ENDIF;
ELSIF cwFS=2 THEN IF wFS3<0 THEN DATA:=65536+(wFS3*10); ELSE DATA:=wFS3*10; ENDIF;
ENDIF;
cwFS:=cwFS+1;
);
ANSWER SIZE 8 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = HEX(6);
TIMEOUT 2000
END;
SCHEDULER BEGIN
DEFAULT(ReadTemp);
DEFAULT(ReadTri);
IF init=0 THEN
cFS:=0;
TRANSMIT(ReadTrans);
cFS:=1;
TRANSMIT(ReadTrans);
cFS:=2;
TRANSMIT(ReadTrans);
TRANSMIT(ReadHWSP);
init:=1;
ELSE
IF wFS1<>FS1 THEN cwFS:=0; TRANSMIT(WriteTrans); cFS:=0; TRANSMIT(ReadTrans);ENDIF;
IF wFS2<>FS2 THEN cwFS:=1; TRANSMIT(WriteTrans); cFS:=1; TRANSMIT(ReadTrans);ENDIF;
IF wFS3<>FS3 THEN cwFS:=2; TRANSMIT(WriteTrans); cFS:=2; TRANSMIT(ReadTrans);ENDIF;
IF wV12<>V12 OR wV15<>V15 THEN TRANSMIT(WriteHWSP); ENDIF;
TRANSMIT(ReadHWSP);
ENDIF;
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.