Kamstrup MC 602 värme och kylmätare
Detaljer
Beskrivning
Fungerar även på IMSE Ultra.
Nytt skript genererat med "M-bus creator" version 1.2.2 ger korrekt checksumma för init-telegram och klarar också att hantera negativa värden.
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
DEVICETYPE Kamstrup_MC602 NAMED "Kamstrup_MC602" TYPEID 19411
IS
% Device created 11:00:42 2019-05-21
% Modified 190521 (PW) Wh changed to MWh and W changed to kW
%
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec2 : "Energy"["MWh"]INT;
rec3 : "Volume"["m³"]DEC2;
rec5 : "Flow Temperature"["°C"]DEC2;
rec6 : "Return Temperature"["°C"]DEC2;
rec7 : "Temperature Difference"["°K"]DEC2;
rec8 : "Power"["kW"]DEC2;
rec10 : "Volume Flow"["m³/h"]DEC2;
PRIVATE
Exp;
tmp;
BAUDRATE 2400;
PARITY EVEN;
CHRGAPTIMEOUT 10;
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 253
DATA[0] = HEX(68);
DATA[1] = HEX(F7);
DATA[2] = HEX(F7);
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
DATA[27] -> WORD(tmp:=DATA;);
DATA[29] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec2:=tmp-4294967296; ELSE rec2:=tmp; ENDIF;);
DATA[26] -> BYTE(Exp := (DATA & 7) - 9; rec2 := rec2*10^Exp;); % -3 > -9 MWh
% 32 bit integer
DATA[33] -> WORD(tmp:=DATA;);
DATA[35] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[32] -> BYTE(Exp := (DATA & 7) - 6; rec3 := rec3*10^Exp;);
% 32 bit integer
DATA[45] -> WORD(tmp:=DATA;);
DATA[47] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec5:=tmp-4294967296; ELSE rec5:=tmp; ENDIF;);
DATA[44] -> BYTE(Exp := (DATA & 3) - 3; rec5 := rec5*10^Exp;);
% 32 bit integer
DATA[51] -> WORD(tmp:=DATA;);
DATA[53] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec6:=tmp-4294967296; ELSE rec6:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 3) - 3; rec6 := rec6*10^Exp;);
% 32 bit integer
DATA[57] -> WORD(tmp:=DATA;);
DATA[59] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec7:=tmp-4294967296; ELSE rec7:=tmp; ENDIF;);
DATA[56] -> BYTE(Exp := (DATA & 3) - 3; rec7 := rec7*10^Exp;);
% 32 bit integer
DATA[63] -> WORD(tmp:=DATA;);
DATA[65] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec8:=tmp-4294967296; ELSE rec8:=tmp; ENDIF;);
DATA[62] -> BYTE(Exp := (DATA & 7) - 6; rec8 := rec8*10^Exp;); % -3 > -6 kW
% 32 bit integer
DATA[75] -> WORD(tmp:=DATA;);
DATA[77] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec10:=tmp-4294967296; ELSE rec10:=tmp; ENDIF;);
DATA[74] -> BYTE(Exp := (DATA & 7) - 6; rec10 := rec10*10^Exp;);
TIMEOUT 5000
END;
END;
IS
% Device created 11:00:42 2019-05-21
% Modified 190521 (PW) Wh changed to MWh and W changed to kW
%
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec2 : "Energy"["MWh"]INT;
rec3 : "Volume"["m³"]DEC2;
rec5 : "Flow Temperature"["°C"]DEC2;
rec6 : "Return Temperature"["°C"]DEC2;
rec7 : "Temperature Difference"["°K"]DEC2;
rec8 : "Power"["kW"]DEC2;
rec10 : "Volume Flow"["m³/h"]DEC2;
PRIVATE
Exp;
tmp;
BAUDRATE 2400;
PARITY EVEN;
CHRGAPTIMEOUT 10;
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 253
DATA[0] = HEX(68);
DATA[1] = HEX(F7);
DATA[2] = HEX(F7);
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
DATA[27] -> WORD(tmp:=DATA;);
DATA[29] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec2:=tmp-4294967296; ELSE rec2:=tmp; ENDIF;);
DATA[26] -> BYTE(Exp := (DATA & 7) - 9; rec2 := rec2*10^Exp;); % -3 > -9 MWh
% 32 bit integer
DATA[33] -> WORD(tmp:=DATA;);
DATA[35] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[32] -> BYTE(Exp := (DATA & 7) - 6; rec3 := rec3*10^Exp;);
% 32 bit integer
DATA[45] -> WORD(tmp:=DATA;);
DATA[47] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec5:=tmp-4294967296; ELSE rec5:=tmp; ENDIF;);
DATA[44] -> BYTE(Exp := (DATA & 3) - 3; rec5 := rec5*10^Exp;);
% 32 bit integer
DATA[51] -> WORD(tmp:=DATA;);
DATA[53] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec6:=tmp-4294967296; ELSE rec6:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 3) - 3; rec6 := rec6*10^Exp;);
% 32 bit integer
DATA[57] -> WORD(tmp:=DATA;);
DATA[59] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec7:=tmp-4294967296; ELSE rec7:=tmp; ENDIF;);
DATA[56] -> BYTE(Exp := (DATA & 3) - 3; rec7 := rec7*10^Exp;);
% 32 bit integer
DATA[63] -> WORD(tmp:=DATA;);
DATA[65] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec8:=tmp-4294967296; ELSE rec8:=tmp; ENDIF;);
DATA[62] -> BYTE(Exp := (DATA & 7) - 6; rec8 := rec8*10^Exp;); % -3 > -6 kW
% 32 bit integer
DATA[75] -> WORD(tmp:=DATA;);
DATA[77] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec10:=tmp-4294967296; ELSE rec10:=tmp; ENDIF;);
DATA[74] -> BYTE(Exp := (DATA & 7) - 6; rec10 := rec10*10^Exp;);
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.