Kamstrup Multical 603
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Marcus Willander, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2018-02-20
- Skapad
- 2018-02-20
- Kategori
- Energioptimering, M-bus, Mätare, Värme
- Visningar
- 2469
Beskrivning
Kommunikationsskript för Kamstrups nya Multical 603. OBS Endast för WMUltra.
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
DEVICETYPE Kamstrup NAMED "Kamstrup"
IS
% --- Device created 19:14:27 2018-02-12
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec2 : "Energy"["MWh"]DEC1;
rec3 : "Volume"["m³"]INT;
rec4 : "Flow Temperature"["°C"]DEC2;
rec5 : "Return Temperature"["°C"]DEC2;
rec6 : "Temperature Difference"["°K"]DEC2;
rec7 : "Power"["kW"]INT;
rec8 : "Volume Flow"["m³/h"]DEC2;
rec9 : "Counter"["h"]INT;
PRIVATE
Exp;
tmp;
BAUDRATE 1200;
PARITY EVEN;
CHECKSUM SUM8 SKIP 4;
POSTBYTES 1;
TELEGRAM Init NAMED "Init" IS
QUESTION
DATA[0] := HEX(10);
DATA[1] := HEX(40);
DATA[2] := BYTE(Id);
DATA[3] <- BYTE(DATA :=Id+64;);
DATA[4] := HEX(16);
ANSWER SIZE 1
DATA[0] = HEX(E5);
TIMEOUT 5000
END;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := HEX(10);
DATA[1] := HEX(5B);
DATA[2] := BYTE(Id);
DATA[3] <- BYTE(DATA :=Id+91;);
DATA[4] := HEX(16);
ANSWER SIZE 99
DATA[0] = HEX(68);
DATA[1] = HEX(5D);
DATA[2] = HEX(5D);
DATA[3] = HEX(68);
DATA[4] = HEX(08);
DATA[5] = BYTE(Id);
DATA[6] = HEX(72);
DATA[7] -> BYTE(IDNr := (DATA & HEX(F)) + 10*(DATA & HEX(F0))/16;);
DATA[8] -> BYTE(IDNr := IDNr + 100*(DATA & HEX(F)) + 1000*(DATA & HEX(F0))/16;);
DATA[9] -> BYTE(IDNr := IDNr + 10000*(DATA & HEX(F)) + 100000*(DATA & HEX(F0))/16;);
DATA[10] -> BYTE(IDNr := IDNr + 1000000*(DATA & HEX(F)) + 10000000*(DATA & HEX(F0))/16;);
DATA[14] = HEX(04);
% 32 bit integer
rec2 := WORD32[22]/10;
DATA[37] -> WORD(tmp:=DATA;);
DATA[39] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[36] -> BYTE(Exp := (DATA & 7) - 6; rec3 := rec3*10^Exp;);
% 16 bit integer
DATA[43] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec4:=tmp-65536; ELSE rec4:=tmp; ENDIF;);
DATA[42] -> BYTE(Exp := (DATA & 3) - 3; rec4 := rec4*10^Exp;);
% 16 bit integer
DATA[47] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec5:=tmp-65536; ELSE rec5:=tmp; ENDIF;);
DATA[46] -> BYTE(Exp := (DATA & 3) - 3; rec5 := rec5*10^Exp;);
% 16 bit integer
DATA[51] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec6:=tmp-65536; ELSE rec6:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 3) - 3; rec6 := rec6*10^Exp;);
% 32 bit integer
DATA[55] -> WORD(tmp:=DATA;);
DATA[57] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec7:=tmp-4294967296; ELSE rec7:=tmp; ENDIF;);
DATA[54] -> BYTE(Exp := (DATA & 7) - 3; rec7 := (rec7*10^Exp)/1000;);
% 32 bit integer
DATA[61] -> WORD(tmp:=DATA;);
DATA[63] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec8:=tmp-4294967296; ELSE rec8:=tmp; ENDIF;);
DATA[60] -> BYTE(Exp := (DATA & 7) - 6; rec8 := rec8*10^Exp;);
rec9 := WORD32[74];
TIMEOUT 5000
END;
END;
IS
% --- Device created 19:14:27 2018-02-12
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec2 : "Energy"["MWh"]DEC1;
rec3 : "Volume"["m³"]INT;
rec4 : "Flow Temperature"["°C"]DEC2;
rec5 : "Return Temperature"["°C"]DEC2;
rec6 : "Temperature Difference"["°K"]DEC2;
rec7 : "Power"["kW"]INT;
rec8 : "Volume Flow"["m³/h"]DEC2;
rec9 : "Counter"["h"]INT;
PRIVATE
Exp;
tmp;
BAUDRATE 1200;
PARITY EVEN;
CHECKSUM SUM8 SKIP 4;
POSTBYTES 1;
TELEGRAM Init NAMED "Init" IS
QUESTION
DATA[0] := HEX(10);
DATA[1] := HEX(40);
DATA[2] := BYTE(Id);
DATA[3] <- BYTE(DATA :=Id+64;);
DATA[4] := HEX(16);
ANSWER SIZE 1
DATA[0] = HEX(E5);
TIMEOUT 5000
END;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := HEX(10);
DATA[1] := HEX(5B);
DATA[2] := BYTE(Id);
DATA[3] <- BYTE(DATA :=Id+91;);
DATA[4] := HEX(16);
ANSWER SIZE 99
DATA[0] = HEX(68);
DATA[1] = HEX(5D);
DATA[2] = HEX(5D);
DATA[3] = HEX(68);
DATA[4] = HEX(08);
DATA[5] = BYTE(Id);
DATA[6] = HEX(72);
DATA[7] -> BYTE(IDNr := (DATA & HEX(F)) + 10*(DATA & HEX(F0))/16;);
DATA[8] -> BYTE(IDNr := IDNr + 100*(DATA & HEX(F)) + 1000*(DATA & HEX(F0))/16;);
DATA[9] -> BYTE(IDNr := IDNr + 10000*(DATA & HEX(F)) + 100000*(DATA & HEX(F0))/16;);
DATA[10] -> BYTE(IDNr := IDNr + 1000000*(DATA & HEX(F)) + 10000000*(DATA & HEX(F0))/16;);
DATA[14] = HEX(04);
% 32 bit integer
rec2 := WORD32[22]/10;
DATA[37] -> WORD(tmp:=DATA;);
DATA[39] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[36] -> BYTE(Exp := (DATA & 7) - 6; rec3 := rec3*10^Exp;);
% 16 bit integer
DATA[43] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec4:=tmp-65536; ELSE rec4:=tmp; ENDIF;);
DATA[42] -> BYTE(Exp := (DATA & 3) - 3; rec4 := rec4*10^Exp;);
% 16 bit integer
DATA[47] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec5:=tmp-65536; ELSE rec5:=tmp; ENDIF;);
DATA[46] -> BYTE(Exp := (DATA & 3) - 3; rec5 := rec5*10^Exp;);
% 16 bit integer
DATA[51] -> WORD(tmp:=DATA; IF (tmp>32767) THEN rec6:=tmp-65536; ELSE rec6:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 3) - 3; rec6 := rec6*10^Exp;);
% 32 bit integer
DATA[55] -> WORD(tmp:=DATA;);
DATA[57] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec7:=tmp-4294967296; ELSE rec7:=tmp; ENDIF;);
DATA[54] -> BYTE(Exp := (DATA & 7) - 3; rec7 := (rec7*10^Exp)/1000;);
% 32 bit integer
DATA[61] -> WORD(tmp:=DATA;);
DATA[63] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec8:=tmp-4294967296; ELSE rec8:=tmp; ENDIF;);
DATA[60] -> BYTE(Exp := (DATA & 7) - 6; rec8 := rec8*10^Exp;);
rec9 := WORD32[74];
TIMEOUT 5000
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.