IME Conto D4-Pt/Conto 72-Pt/Conto 96-Pt Elenergi mätare
Detaljer
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
% Gjort för kommunikation på 9600 8N1 Modbus RTU enligt PR102 (Conto D4-Pt, Conto 72-Pt, Conto 96-Pt)
% OBS! Både Read och Read2 måste köras!
DEVICETYPE ContoD4Pt NAMED "Conto D4-Pt" TYPEID 14197 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "P1 voltage" ["mV"]INT;
V2 : "P2 voltage" ["mV"]INT;
V3 : "P3 voltage" ["mV"]INT;
V4 : "P1 current" ["mA"]INT;
V5 : "P2 current" ["mA"]INT;
V6 : "P3 current" ["mA"]INT;
V7 : "3P active power" ["W"]DEC2;
V8 : "3P reactive power" ["W"]DEC2;
V9 : "3P apparent power" ["W"]DEC2;
V10 : "Total power" ["Wh"]DEC2;
V11 : "Total reactive power" ["Wh"]DEC2;
V12 : "Average power" ["W"]DEC2;
V13 : "P1 active power" ["W"]DEC2;
V14 : "P2 active power" ["W"]DEC2;
V15 : "P3 active power" ["W"]DEC2;
V16 : "P1 reactive power" ["W"]DEC2;
V17 : "P2 reactive power" ["W"]DEC2;
V18 : "P3 reactive power" ["W"]DEC2;
PRIVATE
Tmp;
Kk; % KTA*KTV
Factor1;
Factor2;
BAUDRATE 19200;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(256); % 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(Tmp:=DATA;);
DATA[5] -> RWORD(Kk:=Tmp*DATA;
IF Kk<6000 THEN Factor1:=100; ELSE Factor1:=1; ENDIF;
IF Kk>=100000 THEN Factor2:=1000;
ELSIF Kk>=10000 THEN Factor2:=100;
ELSIF Kk>=1000 THEN Factor2:=10;
ELSIF Kk>=100 THEN Factor2:=1;
ELSIF Kk>=10 THEN Factor2:=0.1;
ELSE Factor2:=0.01;
ENDIF;
);
TIMEOUT 300
END;
TELEGRAM Read2 NAMED "Read2" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(4096); % Start address
DATA[4] := RWORD(39); % Antal register att läsa
ANSWER SIZE 83 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(78); % Antal Bytes
DATA[3] -> RWORD(Tmp:=DATA*65536;
IF Factor1=0 THEN Factor1:=1; ENDIF;
IF Factor2=0 THEN Factor1:=0.01; ENDIF;
);
DATA[5] -> RWORD(V1:=Tmp+DATA;);
DATA[7] -> RWORD(Tmp:=DATA*65536;);
DATA[9] -> RWORD(V2:=Tmp+DATA;);
DATA[11] -> RWORD(Tmp:=DATA*65536;);
DATA[13] -> RWORD(V3:=Tmp+DATA;);
DATA[15] -> RWORD(Tmp:=DATA*65536;);
DATA[17] -> RWORD(V4:=Tmp+DATA;);
DATA[19] -> RWORD(Tmp:=DATA*65536;);
DATA[21] -> RWORD(V5:=Tmp+DATA;);
DATA[23] -> RWORD(Tmp:=DATA*65536;);
DATA[25] -> RWORD(V6:=Tmp+DATA;);
DATA[43] -> RWORD(Tmp:=DATA*65536;);
DATA[45] -> RWORD(V7:=(Tmp+DATA)/Factor1;);
DATA[47] -> RWORD(Tmp:=DATA*65536;);
DATA[49] -> RWORD(V8:=(Tmp+DATA)/Factor1;);
DATA[51] -> RWORD(Tmp:=DATA*65536;);
DATA[53] -> RWORD(V9:=(Tmp+DATA)/Factor1;);
DATA[55] -> RWORD(IF DATA=1 THEN V7:=V7*-1; ENDIF;);
DATA[57] -> RWORD(IF DATA=1 THEN V8:=V8*-1; ENDIF;);
DATA[59] -> RWORD(Tmp:=DATA*65536;);
DATA[61] -> RWORD(V10:=(Tmp+DATA)*Factor2;);
DATA[63] -> RWORD(Tmp:=DATA*65536;);
DATA[65] -> RWORD(V11:=(Tmp+DATA)*Factor2;);
TIMEOUT 300
END;
TELEGRAM Read3 NAMED "Read3" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(4135); % Start address
DATA[4] := RWORD(23); % Antal register att läsa
ANSWER SIZE 51 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(46); % Antal Bytes
DATA[3] -> RWORD(Tmp:=DATA*65536;);
DATA[5] -> RWORD(V12:=(Tmp+DATA)/Factor1;);
DATA[13] -> RWORD(Tmp:=DATA*65536;);
DATA[15] -> RWORD(V13:=(Tmp+DATA)/Factor1;);
DATA[17] -> RWORD(Tmp:=DATA*65536;);
DATA[19] -> RWORD(V14:=(Tmp+DATA)/Factor1;);
DATA[21] -> RWORD(Tmp:=DATA*65536;);
DATA[23] -> RWORD(V15:=(Tmp+DATA)/Factor1;);
DATA[25] -> RWORD(IF DATA=1 THEN V13:=V13*-1; ENDIF;);
DATA[27] -> RWORD(IF DATA=1 THEN V14:=V14*-1; ENDIF;);
DATA[29] -> RWORD(IF DATA=1 THEN V15:=V15*-1; ENDIF;);
DATA[31] -> RWORD(Tmp:=DATA*65536;);
DATA[33] -> RWORD(V16:=(Tmp+DATA)/Factor1;);
DATA[35] -> RWORD(Tmp:=DATA*65536;);
DATA[37] -> RWORD(V17:=(Tmp+DATA)/Factor1;);
DATA[39] -> RWORD(Tmp:=DATA*65536;);
DATA[41] -> RWORD(V18:=(Tmp+DATA)/Factor1;);
DATA[43] -> RWORD(IF DATA=1 THEN V16:=V16*-1; ENDIF;);
DATA[45] -> RWORD(IF DATA=1 THEN V17:=V17*-1; ENDIF;);
DATA[47] -> RWORD(IF DATA=1 THEN V18:=V18*-1; ENDIF;);
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
% Gjort för kommunikation på 9600 8N1 Modbus RTU enligt PR102 (Conto D4-Pt, Conto 72-Pt, Conto 96-Pt)
% OBS! Både Read och Read2 måste köras!
DEVICETYPE ContoD4Pt NAMED "Conto D4-Pt" TYPEID 14197 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "P1 voltage" ["mV"]INT;
V2 : "P2 voltage" ["mV"]INT;
V3 : "P3 voltage" ["mV"]INT;
V4 : "P1 current" ["mA"]INT;
V5 : "P2 current" ["mA"]INT;
V6 : "P3 current" ["mA"]INT;
V7 : "3P active power" ["W"]DEC2;
V8 : "3P reactive power" ["W"]DEC2;
V9 : "3P apparent power" ["W"]DEC2;
V10 : "Total power" ["Wh"]DEC2;
V11 : "Total reactive power" ["Wh"]DEC2;
V12 : "Average power" ["W"]DEC2;
V13 : "P1 active power" ["W"]DEC2;
V14 : "P2 active power" ["W"]DEC2;
V15 : "P3 active power" ["W"]DEC2;
V16 : "P1 reactive power" ["W"]DEC2;
V17 : "P2 reactive power" ["W"]DEC2;
V18 : "P3 reactive power" ["W"]DEC2;
PRIVATE
Tmp;
Kk; % KTA*KTV
Factor1;
Factor2;
BAUDRATE 19200;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Read NAMED "Read" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(256); % 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(Tmp:=DATA;);
DATA[5] -> RWORD(Kk:=Tmp*DATA;
IF Kk<6000 THEN Factor1:=100; ELSE Factor1:=1; ENDIF;
IF Kk>=100000 THEN Factor2:=1000;
ELSIF Kk>=10000 THEN Factor2:=100;
ELSIF Kk>=1000 THEN Factor2:=10;
ELSIF Kk>=100 THEN Factor2:=1;
ELSIF Kk>=10 THEN Factor2:=0.1;
ELSE Factor2:=0.01;
ENDIF;
);
TIMEOUT 300
END;
TELEGRAM Read2 NAMED "Read2" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(4096); % Start address
DATA[4] := RWORD(39); % Antal register att läsa
ANSWER SIZE 83 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(78); % Antal Bytes
DATA[3] -> RWORD(Tmp:=DATA*65536;
IF Factor1=0 THEN Factor1:=1; ENDIF;
IF Factor2=0 THEN Factor1:=0.01; ENDIF;
);
DATA[5] -> RWORD(V1:=Tmp+DATA;);
DATA[7] -> RWORD(Tmp:=DATA*65536;);
DATA[9] -> RWORD(V2:=Tmp+DATA;);
DATA[11] -> RWORD(Tmp:=DATA*65536;);
DATA[13] -> RWORD(V3:=Tmp+DATA;);
DATA[15] -> RWORD(Tmp:=DATA*65536;);
DATA[17] -> RWORD(V4:=Tmp+DATA;);
DATA[19] -> RWORD(Tmp:=DATA*65536;);
DATA[21] -> RWORD(V5:=Tmp+DATA;);
DATA[23] -> RWORD(Tmp:=DATA*65536;);
DATA[25] -> RWORD(V6:=Tmp+DATA;);
DATA[43] -> RWORD(Tmp:=DATA*65536;);
DATA[45] -> RWORD(V7:=(Tmp+DATA)/Factor1;);
DATA[47] -> RWORD(Tmp:=DATA*65536;);
DATA[49] -> RWORD(V8:=(Tmp+DATA)/Factor1;);
DATA[51] -> RWORD(Tmp:=DATA*65536;);
DATA[53] -> RWORD(V9:=(Tmp+DATA)/Factor1;);
DATA[55] -> RWORD(IF DATA=1 THEN V7:=V7*-1; ENDIF;);
DATA[57] -> RWORD(IF DATA=1 THEN V8:=V8*-1; ENDIF;);
DATA[59] -> RWORD(Tmp:=DATA*65536;);
DATA[61] -> RWORD(V10:=(Tmp+DATA)*Factor2;);
DATA[63] -> RWORD(Tmp:=DATA*65536;);
DATA[65] -> RWORD(V11:=(Tmp+DATA)*Factor2;);
TIMEOUT 300
END;
TELEGRAM Read3 NAMED "Read3" IS
QUESTION
DATA[0] := BYTE(Id); % Enhetens Modbus adress
DATA[1] := HEX(03); % Modbus kommando för att läsa register kod 03
DATA[2] := RWORD(4135); % Start address
DATA[4] := RWORD(23); % Antal register att läsa
ANSWER SIZE 51 % (Antal register * 2) + 5
DATA[0] = BYTE(Id);
DATA[1] = BYTE(03);
DATA[2] = BYTE(46); % Antal Bytes
DATA[3] -> RWORD(Tmp:=DATA*65536;);
DATA[5] -> RWORD(V12:=(Tmp+DATA)/Factor1;);
DATA[13] -> RWORD(Tmp:=DATA*65536;);
DATA[15] -> RWORD(V13:=(Tmp+DATA)/Factor1;);
DATA[17] -> RWORD(Tmp:=DATA*65536;);
DATA[19] -> RWORD(V14:=(Tmp+DATA)/Factor1;);
DATA[21] -> RWORD(Tmp:=DATA*65536;);
DATA[23] -> RWORD(V15:=(Tmp+DATA)/Factor1;);
DATA[25] -> RWORD(IF DATA=1 THEN V13:=V13*-1; ENDIF;);
DATA[27] -> RWORD(IF DATA=1 THEN V14:=V14*-1; ENDIF;);
DATA[29] -> RWORD(IF DATA=1 THEN V15:=V15*-1; ENDIF;);
DATA[31] -> RWORD(Tmp:=DATA*65536;);
DATA[33] -> RWORD(V16:=(Tmp+DATA)/Factor1;);
DATA[35] -> RWORD(Tmp:=DATA*65536;);
DATA[37] -> RWORD(V17:=(Tmp+DATA)/Factor1;);
DATA[39] -> RWORD(Tmp:=DATA*65536;);
DATA[41] -> RWORD(V18:=(Tmp+DATA)/Factor1;);
DATA[43] -> RWORD(IF DATA=1 THEN V16:=V16*-1; ENDIF;);
DATA[45] -> RWORD(IF DATA=1 THEN V17:=V17*-1; ENDIF;);
DATA[47] -> RWORD(IF DATA=1 THEN V18:=V18*-1; ENDIF;);
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.