Xylem Flygt MAS711

Detaljer

Typ
Drivrutin
Upplaggd av
Ove Jansson, Abelko Innovation
Version
1
Uppdaterad
2013-08-28
Skapad
2013-08-28
Kategori
Modbus, Vatten och avlopp
Visningar
3346

Beskrivning

Device definition for ITT MAS711

Bruksanvisning

Hur man installerar typdefinitionerna och driftsätter modulerna finns beskrivet i användarmanualen, kapitel 18.7.

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 ITT MAS711
%
% Settings module:
%       Parity: None
%       Baud:   9600
%       Mode:   RTU

% _Instructions_
%
% Set Setup->General configuration->RS-485/Modbus [External 1] to [Modbus Revision 2]

% Channels are read as 4 byte integers and converted into signed integer as needed.
% Decimal adjusment is made by division according to the channel settings on the unit. 
%   Eg One decimal = Divide by ten. 
% This script is made according to the default decimal settings. 
% If you change them then you need to change the divider here.
%
% Author:  Ove Jansson, ABELKO AB Luleå 
% History: 2011-10-05 initial version
%
DEVICETYPE MASReadPrimary NAMED "MASReadPrimary" TYPEID 21423 IS 

  PARAMETER
    Id       : "Adress";
   
  PUBLIC
    V1       : "AI_Leakage_1"; % Leakage stator housing
    V2       : "AI_Leakage_2"; % Leakage junktion box
    V3       : "AI_Leakage_3"; % Leakage inspection chamber
    V4       : "AI_TcPtc" ["ohm"]DEC1; % PTC/PT (/10)
    V5       : "AI_TcPtcPt_1" ["°C"]DEC1; % PT100 stator 1 (/10)
    V6       : "AI_TcPtcPt_2" ["°C"]DEC1; % PT100 stator 2 (/10)
    V7       : "AI_TcPtcPt_3" ["°C"]DEC1; % PT100 stator 3 (/10)
    V8       : "AI_Pt_1" ["°C"]DEC1; % PT100 main bearing (/10)
    V9       : "AI_Pt_2" ["°C"]DEC1; % PT100 support bearing (/10)
    V10      : "AI_Current_DC" ["mA"]DEC1; % DC current 0-20mA (/10)
    V11      : "AI_Current_AC" ["A"]DEC1; % AC current(/10)
    V12      : "XI_Reserve_1" ["°C"]DEC1; % Temperature pumpmemory (/10)
    V13      : "XI_Reserve_2" ["°%"]DEC1; % Current unbalance (/10)
    V14      : "XI_Reserve_3" ["°%"]DEC1; % Voltage unbalance (/10)
    V15      : "XI_Reserve_4" ["kW"]DEC1; % System power (/10)
    V16      : "XI_Reserve_5" [""]DEC2; % System power factor (/100)
    V17      : "AO_Current_DC" ["?"]DEC1; % System phase (/10)

    PRIVATE
    Tmp1;

  BAUDRATE 9600;

  CHECKSUM MODBUS SWAPPED;
  
  TELEGRAM ReadPrimary NAMED "Read Primary" IS
    QUESTION
      DATA[0]  := BYTE(Id);      % Modbus unit address
      DATA[1]  := HEX(03);       % Modbus command "03h" Read holding registers
      DATA[2]  := RWORD(5180);   % OBS!! Register adress = Modbusadress in spec
      DATA[4]  := RWORD(34);     % Number of registers (MAS uses 2 registers per channel)

    ANSWER SIZE 73  % number of registers *2 + 5
      DATA[0]   = BYTE(Id);      % ID
      DATA[1]   = HEX(03);       % Should be same as DATA[1] in the Question
      DATA[2]   = BYTE(68);      % Byte count = # registers times two
      DATA[3] -> RWORD(Tmp1 := DATA*65536;);
      DATA[5] -> RWORD(V1 := (Tmp1 + DATA);); % V1 : Leakage stator housing 
      DATA[7] -> RWORD(Tmp1 := DATA*65536;);
      DATA[9] -> RWORD(V2 := (Tmp1 + DATA);); % V2 : Leakage junktion box
      DATA[11] -> RWORD(Tmp1 := DATA*65536;);
      DATA[13] -> RWORD(V3 := (Tmp1 + DATA);); % V3 : Leakage inspection chamber
      DATA[15] -> RWORD(Tmp1 := DATA*65536;);
      DATA[17] -> RWORD(V4 := (Tmp1 + DATA);); % V4 : PTC/PT (/10)
      DATA[19] -> RWORD(Tmp1 := DATA*65536;);
      DATA[21] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V5 := (Tmp1-4294967296) / 10; ELSE V5 := Tmp1 / 10; ENDIF;); % V5 : PT100 stator 1 (/10)
      DATA[23] -> RWORD(Tmp1 := DATA*65536;);
      DATA[25] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V6 := (Tmp1-4294967296) / 10; ELSE V6 := Tmp1 / 10; ENDIF;); % V6 : PT100 stator 2 (/10)
      DATA[27] -> RWORD(Tmp1 := DATA*65536;);
      DATA[29] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V7 := (Tmp1-4294967296) / 10; ELSE V7 := Tmp1 / 10; ENDIF;); % V7 : PT100 stator 3 (/10)
      DATA[31] -> RWORD(Tmp1 := DATA*65536;);
      DATA[33] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V8 := (Tmp1-4294967296) / 10; ELSE V8 := Tmp1 / 10; ENDIF;); % V8 : PT100 main bearing (/10)
      DATA[35] -> RWORD(Tmp1 := DATA*65536;);
      DATA[37] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V9 := (Tmp1-4294967296) / 10; ELSE V9 := Tmp1 / 10; ENDIF;); % V9 : PT100 support bearing (/10)
      DATA[39] -> RWORD(Tmp1 := DATA*65536;);
      DATA[41] -> RWORD(V10 := (Tmp1 + (DATA)) / 10;); % V10 : DC current 0-20mA (/10)
      DATA[43] -> RWORD(Tmp1 := DATA*65536;);
      DATA[45] -> RWORD(V11 := (Tmp1 + (DATA)) / 10;); % V11 : DC current 0-20mA (/10)
      DATA[47] -> RWORD(Tmp1 := DATA*65536;);
      DATA[49] -> RWORD(V12 := (Tmp1 + (DATA)) / 10;); % V12 : AC current(/10)
      DATA[51] -> RWORD(Tmp1 := DATA*65536;);
      DATA[53] -> RWORD(Tmp1 := Tmp1 + DATA; IF Tmp1 > 2147483647 THEN V13 := (Tmp1-4294967296) / 10; ELSE V13 := Tmp1 / 10; ENDIF;);% V13 : Temperature pumpmemory (/10)
      DATA[55] -> RWORD(Tmp1 := DATA*65536;);
      DATA[57] -> RWORD(V14 := (Tmp1 + (DATA)) / 10;); % V14 : Current unbalance (/10)
      DATA[59] -> RWORD(Tmp1 := DATA*65536;);
      DATA[61] -> RWORD(V15 := (Tmp1 + (DATA)) / 10;); % V15 : Voltage unbalance (/10)
      DATA[63] -> RWORD(Tmp1 := DATA*65536;);
      DATA[65] -> RWORD(V16 := (Tmp1 + (DATA)) / 100;); % V16 : System power factor (/100)
      DATA[67] -> RWORD(Tmp1 := DATA*65536;);
      DATA[69] -> RWORD(V17 := (Tmp1 + (DATA)) / 10;); % V17 : System phase (/10)
      
    TIMEOUT 2000

  END;
END;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for ITT MAS711
%
% Settings module:
%       Parity: None
%       Baud:   9600
%       Mode:   RTU

% _Instructions_
%
% Set Setup->General configuration->RS-485/Modbus [External 1] to [Modbus Revision 2] 

% Channels are read as 4 byte integers and converted into signed integer as needed.
% Decimal adjusment is made by division according to the channel settings on the unit. 
%   Eg One decimal = Divide by ten. 
% This script is made according to the default decimal settings. 
% If you change them then you need to change the divider here.
%
% Author:  Ove Jansson, ABELKO AB Luleå 
% History: 2011-10-05 initial version
%
DEVICETYPE MASReadSecondary NAMED "MASReadSecondary" TYPEID 21424 IS 

  PARAMETER
    Id       : "Adress";
   
  PUBLIC
    V1       : "V_SYS" ["V"]DEC1; % System voltage [4038]
    V2       : "KWH_TOT" ["kWh"]DEC1; % Total energy [4066]

    PRIVATE
    Tmp2;

  BAUDRATE 9600;

  CHECKSUM MODBUS SWAPPED;
  
  TELEGRAM ReadSecondary NAMED "Read Secondary" IS
    QUESTION
      DATA[0]  := BYTE(Id);      % Modbus unit address
      DATA[1]  := HEX(03);       % Modbus command "03h" Read holding registers
      DATA[2]  := RWORD(4038);   % OBS!! Register adress = Modbusadress in spec
      DATA[4]  := RWORD(30);     % Number of registers (MAS uses 2 registers per channel)

    ANSWER SIZE 65  % number of registers *2 + 5
      DATA[0]   = BYTE(Id);      % ID
      DATA[1]   = HEX(03);       % Should be same as DATA[1] in the Question
      DATA[2]   = BYTE(60);      % Byte count = # registers times two
% We fetch a subset starting with the first value we need
% Byte count is used so it is the offset from the manual times two plus three
% Each valu is 4 bytes and we read them wordwise (2 bytes at a time)
      DATA[3] -> RWORD(Tmp2 := DATA*65536;);
      DATA[5] -> RWORD(V1 := (Tmp2 + DATA) / 100;); % V1 : System voltage [4038] 
      DATA[59] -> RWORD(Tmp2 := DATA*65536;);
      DATA[61] -> RWORD(V2 := (Tmp2 + DATA) / 100;); % V2 : Total energy [4066]      
      
    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.