Regin EXO Compact
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-27
- Skapad
- 2013-08-27
- Kategori
- Modbus, Övrig utrustning
- Visningar
- 2808
Beskrivning
Drivrutin till Regin EXO Compact
Bruksanvisning
EXOcompact Manual (pdf)
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Analog inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginAnalog NAMED "Regin analog" TYPEID 21260 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "AI_GT2_1_Rum" ["°C"];
V2 : "AI_GT2_2_Rum" ["°C"];
V3 : "AI_GTU_Ute" ["°C"];
V4 : "AI_GT8" ["°C"];
V5 : "AI_GT1_1" ["°C"];
V6 : "AI_GT1_2" ["°C"];
V7 : "AI_GP1" ["Pa"];
V8 : "AI_GP2" ["Pa"];
V9 : "AU_TF1" ["%"];
V10 : "AU_FF1" ["%"];
V11 : "AU_VVX" ["%"];
V12 : "AU_SV1" ["%"];
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput NAMED "Läs analog" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Start address register
DATA[4] := RWORD(12); % Number of registers
ANSWER SIZE 29
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(24); % Byte count
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); % 10*
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); % 10*
DATA[7] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); % 10*
DATA[9] -> RWORD(IF (DATA>=32768) THEN V4:=(DATA-65536)/10; ELSE V4:=DATA/10; ENDIF;); % 10*
DATA[11] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); % 10*
DATA[13] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); % 10*
DATA[15] -> RWORD(V7 := DATA / 10;);
DATA[17] -> RWORD(V8 := DATA / 10;);
DATA[19] -> RWORD(V9 := DATA / 10;);
DATA[21] -> RWORD(V10:= DATA / 10;);
DATA[23] -> RWORD(V11:= DATA / 10;);
DATA[25] -> RWORD(V12:= DATA / 10;);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact settings
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginOutput NAMED "Regin ställ" TYPEID 21261 IS
PARAMETER
Id :"Adress";
S1 :"Börvärde Reg1"["°C"];
S2 :"Börvärde Reg2"["°C"];
S3 :"Larmåterställ";
PUBLIC
V1 :"Börvärde Reg1"["°C"];
V2 :"Börvärde Reg2"["°C"];
%V1 :"Läst BV Reg1"["°C"];
%V2 :"Läst BV Reg2"["°C"];
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteSet NAMED "Ställ värden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(0); % start register
DATA[4] := RWORD(3); % number of registers to write
DATA[6] := BYTE(6); % number of bytes
DATA[7] <- RWORD(DATA := S1*10;
V1 := S1;
);
DATA[9] <- RWORD(DATA := S2*10;
V2 := S2;
);
DATA[11]<- RWORD(DATA :=(S3>0););
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(0); % start register
%DATA[4] = RWORD(3); % number of registers to write
TIMEOUT 2000
END;
% TELEGRAM ReadSet NAMED "Läs värden" IS
%
% QUESTION
% DATA[0] := BYTE(Id); % Modbus unit address
% DATA[1] := HEX(03); % Modbus command "3h" Read holding registers
% DATA[2] := RWORD(0); % Start address register
% DATA[4] := RWORD(2); % Number of registers
%
% ANSWER SIZE 9
% DATA[0] = BYTE(Id); % ID
% DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
% DATA[2] = BYTE(4); % Byte count
% DATA[3] -> RWORD(V1 := DATA / 10;);
% DATA[5] -> RWORD(V2 := DATA / 10;);
%
% TIMEOUT 2000
%
% END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Digital inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginDigital NAMED "Regin DI/DU" TYPEID 21262 IS
PARAMETER
Id : "Adress";
PUBLIC
DI1 : "DU_TF1";
DI2 : "DU_FF1";
DI3 : "DI_P1";
DI4 : "DI_TM1";
DI5 : "DI_TM2";
DI6 : "DU_BSX_3";
DI7 : "DU_SUMMALARM_A";
DI8 : "DU_SUMMALARM_B";
DI9 : "DU_BSX_1_2";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput NAMED "Digital status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(9); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(2);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 4) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 8) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 16) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 32) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 64) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
IF (DATA & 128) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
);
TIMEOUT 2000
END;
END;
% Device definition for REGIN EXO Compact Analog inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginAnalog NAMED "Regin analog" TYPEID 21260 IS
PARAMETER
Id : "Adress";
PUBLIC
V1 : "AI_GT2_1_Rum" ["°C"];
V2 : "AI_GT2_2_Rum" ["°C"];
V3 : "AI_GTU_Ute" ["°C"];
V4 : "AI_GT8" ["°C"];
V5 : "AI_GT1_1" ["°C"];
V6 : "AI_GT1_2" ["°C"];
V7 : "AI_GP1" ["Pa"];
V8 : "AI_GP2" ["Pa"];
V9 : "AU_TF1" ["%"];
V10 : "AU_FF1" ["%"];
V11 : "AU_VVX" ["%"];
V12 : "AU_SV1" ["%"];
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM AnalogInput NAMED "Läs analog" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(0); % Start address register
DATA[4] := RWORD(12); % Number of registers
ANSWER SIZE 29
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
DATA[2] = BYTE(24); % Byte count
DATA[3] -> RWORD(IF (DATA>=32768) THEN V1:=(DATA-65536)/10; ELSE V1:=DATA/10; ENDIF;); % 10*
DATA[5] -> RWORD(IF (DATA>=32768) THEN V2:=(DATA-65536)/10; ELSE V2:=DATA/10; ENDIF;); % 10*
DATA[7] -> RWORD(IF (DATA>=32768) THEN V3:=(DATA-65536)/10; ELSE V3:=DATA/10; ENDIF;); % 10*
DATA[9] -> RWORD(IF (DATA>=32768) THEN V4:=(DATA-65536)/10; ELSE V4:=DATA/10; ENDIF;); % 10*
DATA[11] -> RWORD(IF (DATA>=32768) THEN V5:=(DATA-65536)/10; ELSE V5:=DATA/10; ENDIF;); % 10*
DATA[13] -> RWORD(IF (DATA>=32768) THEN V6:=(DATA-65536)/10; ELSE V6:=DATA/10; ENDIF;); % 10*
DATA[15] -> RWORD(V7 := DATA / 10;);
DATA[17] -> RWORD(V8 := DATA / 10;);
DATA[19] -> RWORD(V9 := DATA / 10;);
DATA[21] -> RWORD(V10:= DATA / 10;);
DATA[23] -> RWORD(V11:= DATA / 10;);
DATA[25] -> RWORD(V12:= DATA / 10;);
TIMEOUT 2000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact settings
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginOutput NAMED "Regin ställ" TYPEID 21261 IS
PARAMETER
Id :"Adress";
S1 :"Börvärde Reg1"["°C"];
S2 :"Börvärde Reg2"["°C"];
S3 :"Larmåterställ";
PUBLIC
V1 :"Börvärde Reg1"["°C"];
V2 :"Börvärde Reg2"["°C"];
%V1 :"Läst BV Reg1"["°C"];
%V2 :"Läst BV Reg2"["°C"];
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM WriteSet NAMED "Ställ värden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(10); % Modbus command "0x10" write multiple registers
DATA[2] := RWORD(0); % start register
DATA[4] := RWORD(3); % number of registers to write
DATA[6] := BYTE(6); % number of bytes
DATA[7] <- RWORD(DATA := S1*10;
V1 := S1;
);
DATA[9] <- RWORD(DATA := S2*10;
V2 := S2;
);
DATA[11]<- RWORD(DATA :=(S3>0););
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
%DATA[2] = RWORD(0); % start register
%DATA[4] = RWORD(3); % number of registers to write
TIMEOUT 2000
END;
% TELEGRAM ReadSet NAMED "Läs värden" IS
%
% QUESTION
% DATA[0] := BYTE(Id); % Modbus unit address
% DATA[1] := HEX(03); % Modbus command "3h" Read holding registers
% DATA[2] := RWORD(0); % Start address register
% DATA[4] := RWORD(2); % Number of registers
%
% ANSWER SIZE 9
% DATA[0] = BYTE(Id); % ID
% DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
% DATA[2] = BYTE(4); % Byte count
% DATA[3] -> RWORD(V1 := DATA / 10;);
% DATA[5] -> RWORD(V2 := DATA / 10;);
%
% TIMEOUT 2000
%
% END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for REGIN EXO Compact Digital inputs/outputs
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2008-10-23 initial version
%
DEVICETYPE ReginDigital NAMED "Regin DI/DU" TYPEID 21262 IS
PARAMETER
Id : "Adress";
PUBLIC
DI1 : "DU_TF1";
DI2 : "DU_FF1";
DI3 : "DI_P1";
DI4 : "DI_TM1";
DI5 : "DI_TM2";
DI6 : "DU_BSX_3";
DI7 : "DU_SUMMALARM_A";
DI8 : "DU_SUMMALARM_B";
DI9 : "DU_BSX_1_2";
PRIVATE
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DigitalInput NAMED "Digital status" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(02); % Modbus command "02h" read discrete input (bit)
DATA[2] := RWORD(0); % Start adress
DATA[4] := RWORD(9); % Number of inputs
ANSWER SIZE 7
DATA[0] = BYTE(Id);
DATA[1] = HEX(02);
DATA[2] = BYTE(2);
DATA[3] -> BYTE(IF (DATA & 1) THEN DI1 := 1; ELSE DI1 := 0; ENDIF;
IF (DATA & 2) THEN DI2 := 1; ELSE DI2 := 0; ENDIF;
IF (DATA & 4) THEN DI3 := 1; ELSE DI3 := 0; ENDIF;
IF (DATA & 8) THEN DI4 := 1; ELSE DI4 := 0; ENDIF;
IF (DATA & 16) THEN DI5 := 1; ELSE DI5 := 0; ENDIF;
IF (DATA & 32) THEN DI6 := 1; ELSE DI6 := 0; ENDIF;
IF (DATA & 64) THEN DI7 := 1; ELSE DI7 := 0; ENDIF;
IF (DATA & 128) THEN DI8 := 1; ELSE DI8 := 0; ENDIF;
);
DATA[4] -> BYTE(IF (DATA & 1) THEN DI9 := 1; ELSE DI9 := 0; ENDIF;
);
TIMEOUT 2000
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.