Seneca Z-D-IN Cnt
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- IO enheter, Modbus
- Visningar
- 2611
Beskrivning
Seneca Z-D-IN Cnt
Bruksanvisning
Hur man installerar typdefinitionerna och driftsätter modulerna finns beskrivet i användarmanualen, kapitel 18.7. För inkopplingsanvisningar och liknande, se modulens manual. Den kan hämtas från Senecas hemsida: http://www.seneca.it/
Det finns ett skript för att konfigurera Seneca enheter
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 SenecaZDINCnt NAMED "Seneca Z-D-IN Cnt" TYPEID 21021
IS
PARAMETER
Id :"Address";
Filter:"Filter" ["ms"];
PUBLIC
DI_1 :"DCnt1";
DI_2 :"DCnt2";
DI_3 :"DCnt3";
DI_4 :"DCnt4";
DI_5 :"DCnt5";
PRIVATE
NotFirst;
Updated;
ClrOverFlow;
OF1;
OF2;
OF3;
OF4;
OF5;
OF1Noted;
OF2Noted;
OF3Noted;
OF4Noted;
OF5Noted;
LCnt1;
LCnt2;
LCnt3;
LCnt4;
LCnt5;
Cnt1;
Cnt2;
Cnt3;
Cnt4;
Cnt5;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInputs NAMED "Read Counters" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(01);
DATA[4] := HEX(00);
DATA[5] := HEX(06);
ANSWER SIZE 17
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(0C);
DATA[3] -> RWORD(IF (FLOOR(DATA / 256) MOD 2) > 0 THEN OF1 := 1; ENDIF;
IF (FLOOR(DATA / 512) MOD 2) > 0 THEN OF2 := 1; ENDIF;
IF (FLOOR(DATA / 1024) MOD 2) > 0 THEN OF3 := 1; ENDIF;
IF (FLOOR(DATA / 2048) MOD 2 )> 0 THEN OF4 := 1; ENDIF;
IF (FLOOR(DATA / 4096) MOD 2 )> 0 THEN OF5 := 1; ENDIF;
);
DATA[5] -> RWORD(Cnt1 := DATA;);
DATA[7] -> RWORD(Cnt2 := DATA;);
DATA[9] -> RWORD(Cnt3 := DATA;);
DATA[11] -> RWORD(Cnt4 := DATA;);
DATA[13] -> RWORD(
Cnt5 := DATA;
IF NotFirst THEN
IF OF1 AND NOT OF1Noted THEN OF1Noted := 1;
ENDIF;
IF OF2 AND NOT OF2Noted THEN OF2Noted := 1;
ENDIF;
IF OF3 AND NOT OF3Noted THEN OF3Noted := 1;
ENDIF;
IF OF4 AND NOT OF4Noted THEN OF4Noted := 1;
ENDIF;
IF OF5 AND NOT OF5Noted THEN OF5Noted := 1;
ENDIF;
ELSE
NotFirst := 1;
ENDIF;
DI_1 := Cnt1 - LCnt1;
DI_2 := Cnt2 - LCnt2;
DI_3 := Cnt3 - LCnt3;
DI_4 := Cnt4 - LCnt4;
DI_5 := Cnt5 - LCnt5;
IF DI_1 < 0 THEN DI_1 := 65536 + DI_1; ENDIF;
IF DI_2 < 0 THEN DI_2 := 65536 + DI_2; ENDIF;
IF DI_3 < 0 THEN DI_3 := 65536 + DI_3; ENDIF;
IF DI_4 < 0 THEN DI_4 := 65536 + DI_4; ENDIF;
IF DI_5 < 0 THEN DI_5 := 65536 + DI_5; ENDIF;
LCnt1 := Cnt1;
LCnt2 := Cnt2;
LCnt3 := Cnt3;
LCnt4 := Cnt4;
LCnt5 := Cnt5;
Updated := 1;
);
TIMEOUT 300
END;
TELEGRAM WriteFilt NAMED "W Overfl & Filt" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06);
DATA[2] <- RWORD(
ClrOverFlow := ((OF1 XOR OF1Noted) AND (OF2 XOR OF2Noted) AND (OF3 XOR OF3Noted)
AND (OF4 XOR OF4Noted) AND (OF5 XOR OF5Noted))
AND (OF1Noted OR OF2Noted OR OF3Noted OR OF4Noted OR OF5Noted);
IF ClrOverFlow THEN
DATA := 1;
OF1Noted := 0;
OF2Noted := 0;
OF3Noted := 0;
OF4Noted := 0;
OF5Noted := 0;
ELSE DATA := 7;
ENDIF;);
DATA[4] <- RWORD(IF ClrOverFlow THEN DATA := 0; ELSE
DATA := Filter; ENDIF;);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 300
END;
END;
GROUP SenecaZDINCnt OF MAX 20 DEVICE TYPEID 21021
SELECT ALL
ITERATOR Process
ALIAS
BEGIN
IF Updated THEN
Updated := 0;
ELSE
DI_1 := 0;
DI_2 := 0;
DI_3 := 0;
DI_4 := 0;
DI_5 := 0;
ENDIF;
END;
END;
ROUTINE SenecaDIN_Cnt
BEGIN
CALL SenecaZDINCnt.Process;
END;
IS
PARAMETER
Id :"Address";
Filter:"Filter" ["ms"];
PUBLIC
DI_1 :"DCnt1";
DI_2 :"DCnt2";
DI_3 :"DCnt3";
DI_4 :"DCnt4";
DI_5 :"DCnt5";
PRIVATE
NotFirst;
Updated;
ClrOverFlow;
OF1;
OF2;
OF3;
OF4;
OF5;
OF1Noted;
OF2Noted;
OF3Noted;
OF4Noted;
OF5Noted;
LCnt1;
LCnt2;
LCnt3;
LCnt4;
LCnt5;
Cnt1;
Cnt2;
Cnt3;
Cnt4;
Cnt5;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInputs NAMED "Read Counters" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(01);
DATA[4] := HEX(00);
DATA[5] := HEX(06);
ANSWER SIZE 17
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(0C);
DATA[3] -> RWORD(IF (FLOOR(DATA / 256) MOD 2) > 0 THEN OF1 := 1; ENDIF;
IF (FLOOR(DATA / 512) MOD 2) > 0 THEN OF2 := 1; ENDIF;
IF (FLOOR(DATA / 1024) MOD 2) > 0 THEN OF3 := 1; ENDIF;
IF (FLOOR(DATA / 2048) MOD 2 )> 0 THEN OF4 := 1; ENDIF;
IF (FLOOR(DATA / 4096) MOD 2 )> 0 THEN OF5 := 1; ENDIF;
);
DATA[5] -> RWORD(Cnt1 := DATA;);
DATA[7] -> RWORD(Cnt2 := DATA;);
DATA[9] -> RWORD(Cnt3 := DATA;);
DATA[11] -> RWORD(Cnt4 := DATA;);
DATA[13] -> RWORD(
Cnt5 := DATA;
IF NotFirst THEN
IF OF1 AND NOT OF1Noted THEN OF1Noted := 1;
ENDIF;
IF OF2 AND NOT OF2Noted THEN OF2Noted := 1;
ENDIF;
IF OF3 AND NOT OF3Noted THEN OF3Noted := 1;
ENDIF;
IF OF4 AND NOT OF4Noted THEN OF4Noted := 1;
ENDIF;
IF OF5 AND NOT OF5Noted THEN OF5Noted := 1;
ENDIF;
ELSE
NotFirst := 1;
ENDIF;
DI_1 := Cnt1 - LCnt1;
DI_2 := Cnt2 - LCnt2;
DI_3 := Cnt3 - LCnt3;
DI_4 := Cnt4 - LCnt4;
DI_5 := Cnt5 - LCnt5;
IF DI_1 < 0 THEN DI_1 := 65536 + DI_1; ENDIF;
IF DI_2 < 0 THEN DI_2 := 65536 + DI_2; ENDIF;
IF DI_3 < 0 THEN DI_3 := 65536 + DI_3; ENDIF;
IF DI_4 < 0 THEN DI_4 := 65536 + DI_4; ENDIF;
IF DI_5 < 0 THEN DI_5 := 65536 + DI_5; ENDIF;
LCnt1 := Cnt1;
LCnt2 := Cnt2;
LCnt3 := Cnt3;
LCnt4 := Cnt4;
LCnt5 := Cnt5;
Updated := 1;
);
TIMEOUT 300
END;
TELEGRAM WriteFilt NAMED "W Overfl & Filt" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06);
DATA[2] <- RWORD(
ClrOverFlow := ((OF1 XOR OF1Noted) AND (OF2 XOR OF2Noted) AND (OF3 XOR OF3Noted)
AND (OF4 XOR OF4Noted) AND (OF5 XOR OF5Noted))
AND (OF1Noted OR OF2Noted OR OF3Noted OR OF4Noted OR OF5Noted);
IF ClrOverFlow THEN
DATA := 1;
OF1Noted := 0;
OF2Noted := 0;
OF3Noted := 0;
OF4Noted := 0;
OF5Noted := 0;
ELSE DATA := 7;
ENDIF;);
DATA[4] <- RWORD(IF ClrOverFlow THEN DATA := 0; ELSE
DATA := Filter; ENDIF;);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 300
END;
END;
GROUP SenecaZDINCnt OF MAX 20 DEVICE TYPEID 21021
SELECT ALL
ITERATOR Process
ALIAS
BEGIN
IF Updated THEN
Updated := 0;
ELSE
DI_1 := 0;
DI_2 := 0;
DI_3 := 0;
DI_4 := 0;
DI_5 := 0;
ENDIF;
END;
END;
ROUTINE SenecaDIN_Cnt
BEGIN
CALL SenecaZDINCnt.Process;
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.