Carlo Gavazzi EM24 M-bus
Detaljer
Beskrivning
Fungerar även på IMSE Ultra
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 EM24 NAMED "CG EM24" TYPEID 17983
IS
% --- Device created 8:14:53 PM 6/28/2014
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec1 : "Energy Tot"["Wh"]INT;
rec3 : "Energy L1"["Wh"]INT;
rec4 : "Energy L2"["Wh"]INT;
rec5 : "Energy L3"["Wh"]INT;
rec6 : "Power"["W"]DEC2;
PRIVATE
Exp;
tmp;
BAUDRATE 2400;
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 126
DATA[0] = HEX(68);
DATA[1] = HEX(78);
DATA[2] = HEX(78);
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(02);
% 32 bit integer
DATA[21] -> WORD(tmp:=DATA;);
DATA[23] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec1:=tmp-4294967296; ELSE rec1:=tmp; ENDIF;);
DATA[20] -> BYTE(Exp := (DATA & 7) - 3; rec1 := rec1*10^Exp;);
% 32 bit integer
DATA[35] -> WORD(tmp:=DATA;);
DATA[37] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[34] -> BYTE(Exp := (DATA & 7) - 3; rec3 := rec3*10^Exp;);
% 32 bit integer
DATA[43] -> WORD(tmp:=DATA;);
DATA[45] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec4:=tmp-4294967296; ELSE rec4:=tmp; ENDIF;);
DATA[42] -> BYTE(Exp := (DATA & 7) - 3; rec4 := rec4*10^Exp;);
% 32 bit integer
DATA[51] -> WORD(tmp:=DATA;);
DATA[53] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec5:=tmp-4294967296; ELSE rec5:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 7) - 3; rec5 := rec5*10^Exp;);
% 32 bit integer
DATA[57] -> WORD(tmp:=DATA;);
DATA[59] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec6:=tmp-4294967296; ELSE rec6:=tmp; ENDIF;);
DATA[56] -> BYTE(Exp := (DATA & 7) - 3; rec6 := rec6*10^Exp;);
TIMEOUT 5000
END;
END;
IS
% --- Device created 8:14:53 PM 6/28/2014
PARAMETER
Id :"Address"INT;
PUBLIC
IDNr : "ID number"INT;
rec1 : "Energy Tot"["Wh"]INT;
rec3 : "Energy L1"["Wh"]INT;
rec4 : "Energy L2"["Wh"]INT;
rec5 : "Energy L3"["Wh"]INT;
rec6 : "Power"["W"]DEC2;
PRIVATE
Exp;
tmp;
BAUDRATE 2400;
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 126
DATA[0] = HEX(68);
DATA[1] = HEX(78);
DATA[2] = HEX(78);
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(02);
% 32 bit integer
DATA[21] -> WORD(tmp:=DATA;);
DATA[23] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec1:=tmp-4294967296; ELSE rec1:=tmp; ENDIF;);
DATA[20] -> BYTE(Exp := (DATA & 7) - 3; rec1 := rec1*10^Exp;);
% 32 bit integer
DATA[35] -> WORD(tmp:=DATA;);
DATA[37] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec3:=tmp-4294967296; ELSE rec3:=tmp; ENDIF;);
DATA[34] -> BYTE(Exp := (DATA & 7) - 3; rec3 := rec3*10^Exp;);
% 32 bit integer
DATA[43] -> WORD(tmp:=DATA;);
DATA[45] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec4:=tmp-4294967296; ELSE rec4:=tmp; ENDIF;);
DATA[42] -> BYTE(Exp := (DATA & 7) - 3; rec4 := rec4*10^Exp;);
% 32 bit integer
DATA[51] -> WORD(tmp:=DATA;);
DATA[53] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec5:=tmp-4294967296; ELSE rec5:=tmp; ENDIF;);
DATA[50] -> BYTE(Exp := (DATA & 7) - 3; rec5 := rec5*10^Exp;);
% 32 bit integer
DATA[57] -> WORD(tmp:=DATA;);
DATA[59] -> WORD(tmp:=tmp + 65536*DATA; IF (tmp>2147483647) THEN rec6:=tmp-4294967296; ELSE rec6:=tmp; ENDIF;);
DATA[56] -> BYTE(Exp := (DATA & 7) - 3; rec6 := rec6*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.