Seneca Z-4AI, Normaliserat värde
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Peter Widetun, Abelko Innovation
- Version
- 3
- Uppdaterad
- 2016-03-21
- Skapad
- 2016-02-29
- Kategori
- IO enheter, Modbus
- Visningar
- 3115
Beskrivning
Seneca Z-4AI (fyra analoga ingångar)
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/
För konfigurering av modulen använd Seneca PC-programvara, Easy-SETUP software, för att ställa FSCALE och ISCALE.
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
% Measured value from register 40017-40020 normalized by endscale (FSCALE) and startscale (ISCALE).
% Set registers FSCALE and ISCALE to give channel value 0..10000 (0-100%).
% With PC-program you set startvalue to 0 and endvalue to 10000.
% This will translate 4-20mA to 0-10000 (0-100%).
% Seneca specification:
% Scale end on mV measured; when value join value setting on
% FSCALEx register NCHx assumes value 10000.
% Beginning of scale in mV; when value join setting value on
% ISCALEx register NCHx takes value 0.
%
DEVICETYPE SenecaZ4AI NAMED "Seneca Z-4AI Norm" TYPEID 21008
IS
PARAMETER
Id :"Address";
FiltAI1 :"Filter AI1" ["0..6"];
FiltAI2 :"Filter AI2" ["0..6"];
FiltAI3 :"Filter AI3" ["0..6"];
FiltAI4 :"Filter AI4" ["0..6"];
PUBLIC
AI_1 :"AI1" ["%"];
AI_2 :"AI2" ["%"];
AI_3 :"AI3" ["%"];
AI_4 :"AI4" ["%"];
OOR_1 :"OutOfRange AI1";
OOR_2 :"OutOfRange AI2";
OOR_3 :"OutOfRange AI3";
OOR_4 :"OutOfRange AI4";
PRIVATE
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInputs NAMED "Read Inputs" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(10);
DATA[4] := HEX(00);
DATA[5] := HEX(04);
ANSWER SIZE 13
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(08);
DATA[3] -> RWORD(
IF DATA > 32767 THEN
AI_1 := (DATA - 65536) / 100;
ELSE
AI_1 := DATA / 100;
ENDIF;
);
DATA[5] -> RWORD(
IF DATA > 32767 THEN
AI_2 := (DATA - 65536) / 100;
ELSE
AI_2 := DATA / 100;
ENDIF;
);
DATA[7] -> RWORD(
IF DATA > 32767 THEN
AI_3 := (DATA - 65536) / 100;
ELSE
AI_3 := DATA / 100;
ENDIF;
);
DATA[9] -> RWORD(
IF DATA > 32767 THEN
AI_4 := (DATA - 65536) / 100;
ELSE
AI_4 := DATA / 100;
ENDIF;
);
TIMEOUT 300
END;
TELEGRAM ReadOverFlow NAMED "Read OverFlow" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(02);
DATA[4] := HEX(00);
DATA[5] := HEX(01);
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(02);
DATA[3] -> RWORD(
IF (FLOOR(DATA / 256) MOD 2 > 0) THEN OOR_1 := 1; ELSE OOR_1 := 0; ENDIF;
IF (FLOOR(DATA / 512) MOD 2 > 0) THEN OOR_1 := 1; ENDIF;
IF (FLOOR(DATA / 1024) MOD 2 > 0) THEN OOR_2 := 1; ELSE OOR_2 := 0; ENDIF;
IF (FLOOR(DATA / 2048) MOD 2 > 0) THEN OOR_2 := 1; ENDIF;
IF (FLOOR(DATA / 4096) MOD 2 > 0) THEN OOR_3 := 1; ELSE OOR_3 := 0; ENDIF;
IF (FLOOR(DATA / 8192) MOD 2 > 0) THEN OOR_3 := 1; ENDIF;
IF (FLOOR(DATA / 16384) MOD 2 > 0) THEN OOR_4 := 1; ELSE OOR_4 := 0; ENDIF;
IF (FLOOR(DATA / 32768) MOD 2 > 0) THEN OOR_4 := 1; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM WriteSettings NAMED "Write Settings" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10);
DATA[2] := HEX(00);
DATA[3] := HEX(03);
DATA[4] := HEX(00);
DATA[5] := HEX(04);
DATA[6] := HEX(08);
DATA[7] <- RWORD(
IF FiltAI1 <= 6 THEN DATA := FiltAI1;
ELSE DATA := 0; ENDIF;
);
DATA[9] <- RWORD(
IF FiltAI2 <= 6 THEN DATA := FiltAI2;
ELSE DATA := 0; ENDIF;
);
DATA[11] <- RWORD(
IF FiltAI3 <= 6 THEN DATA := FiltAI3;
ELSE DATA := 0; ENDIF;
);
DATA[13] <- RWORD(
IF FiltAI4 <= 6 THEN DATA := FiltAI4;
ELSE DATA := 0; ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 300
END;
END;
% Set registers FSCALE and ISCALE to give channel value 0..10000 (0-100%).
% With PC-program you set startvalue to 0 and endvalue to 10000.
% This will translate 4-20mA to 0-10000 (0-100%).
% Seneca specification:
% Scale end on mV measured; when value join value setting on
% FSCALEx register NCHx assumes value 10000.
% Beginning of scale in mV; when value join setting value on
% ISCALEx register NCHx takes value 0.
%
DEVICETYPE SenecaZ4AI NAMED "Seneca Z-4AI Norm" TYPEID 21008
IS
PARAMETER
Id :"Address";
FiltAI1 :"Filter AI1" ["0..6"];
FiltAI2 :"Filter AI2" ["0..6"];
FiltAI3 :"Filter AI3" ["0..6"];
FiltAI4 :"Filter AI4" ["0..6"];
PUBLIC
AI_1 :"AI1" ["%"];
AI_2 :"AI2" ["%"];
AI_3 :"AI3" ["%"];
AI_4 :"AI4" ["%"];
OOR_1 :"OutOfRange AI1";
OOR_2 :"OutOfRange AI2";
OOR_3 :"OutOfRange AI3";
OOR_4 :"OutOfRange AI4";
PRIVATE
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadInputs NAMED "Read Inputs" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(10);
DATA[4] := HEX(00);
DATA[5] := HEX(04);
ANSWER SIZE 13
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(08);
DATA[3] -> RWORD(
IF DATA > 32767 THEN
AI_1 := (DATA - 65536) / 100;
ELSE
AI_1 := DATA / 100;
ENDIF;
);
DATA[5] -> RWORD(
IF DATA > 32767 THEN
AI_2 := (DATA - 65536) / 100;
ELSE
AI_2 := DATA / 100;
ENDIF;
);
DATA[7] -> RWORD(
IF DATA > 32767 THEN
AI_3 := (DATA - 65536) / 100;
ELSE
AI_3 := DATA / 100;
ENDIF;
);
DATA[9] -> RWORD(
IF DATA > 32767 THEN
AI_4 := (DATA - 65536) / 100;
ELSE
AI_4 := DATA / 100;
ENDIF;
);
TIMEOUT 300
END;
TELEGRAM ReadOverFlow NAMED "Read OverFlow" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := HEX(00);
DATA[3] := HEX(02);
DATA[4] := HEX(00);
DATA[5] := HEX(01);
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[2] = HEX(02);
DATA[3] -> RWORD(
IF (FLOOR(DATA / 256) MOD 2 > 0) THEN OOR_1 := 1; ELSE OOR_1 := 0; ENDIF;
IF (FLOOR(DATA / 512) MOD 2 > 0) THEN OOR_1 := 1; ENDIF;
IF (FLOOR(DATA / 1024) MOD 2 > 0) THEN OOR_2 := 1; ELSE OOR_2 := 0; ENDIF;
IF (FLOOR(DATA / 2048) MOD 2 > 0) THEN OOR_2 := 1; ENDIF;
IF (FLOOR(DATA / 4096) MOD 2 > 0) THEN OOR_3 := 1; ELSE OOR_3 := 0; ENDIF;
IF (FLOOR(DATA / 8192) MOD 2 > 0) THEN OOR_3 := 1; ENDIF;
IF (FLOOR(DATA / 16384) MOD 2 > 0) THEN OOR_4 := 1; ELSE OOR_4 := 0; ENDIF;
IF (FLOOR(DATA / 32768) MOD 2 > 0) THEN OOR_4 := 1; ENDIF;
);
TIMEOUT 300
END;
TELEGRAM WriteSettings NAMED "Write Settings" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(10);
DATA[2] := HEX(00);
DATA[3] := HEX(03);
DATA[4] := HEX(00);
DATA[5] := HEX(04);
DATA[6] := HEX(08);
DATA[7] <- RWORD(
IF FiltAI1 <= 6 THEN DATA := FiltAI1;
ELSE DATA := 0; ENDIF;
);
DATA[9] <- RWORD(
IF FiltAI2 <= 6 THEN DATA := FiltAI2;
ELSE DATA := 0; ENDIF;
);
DATA[11] <- RWORD(
IF FiltAI3 <= 6 THEN DATA := FiltAI3;
ELSE DATA := 0; ENDIF;
);
DATA[13] <- RWORD(
IF FiltAI4 <= 6 THEN DATA := FiltAI4;
ELSE DATA := 0; ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
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.