Vacon Frekvensomformare
Detaljer
- Typ
- Drivrutin
- Upplaggd av
- Ove Jansson, Abelko Innovation
- Version
- 1
- Uppdaterad
- 2013-08-28
- Skapad
- 2013-08-28
- Kategori
- Frekvensomformare, Modbus
- Visningar
- 3256
Beskrivning
Drivrutin
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 VACON read registers 2101-2111 and set register 2001-2011
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-04-07 inital version
% 2009-04-16 PW Ändrat för ställa läsa börvärde
% 2009-04-29 PW Ändrat för att hantera negativa börvärden
% 2010-06-21 PW Lagt till Energi mätning.
%
DEVICETYPE VaconData NAMED "VACON data" TYPEID 21300 IS
PARAMETER
Id : "Adress";
S1 : "FB Kontroll 1" [""]; %Bitmask FB Kontroll
S2 : "FB Kontroll 2" [""]; %Bitmask FB Kontroll
S3 : "FB Fart ref." [""]; %0-10000% FB Fart ref.
S4 : "FB Data in 1" [""]; %Int 16 FB Data in 1
S5 : "FB Data in 1" [""]; %Int 16 FB Data in 2
S6 : "FB Data in 3" [""]; %Int 16 FB Data in 3
S7 : "FB Data in 4" [""]; %Int 16 FB Data in 4
S8 : "FB Data in 5" [""]; %Int 16 FB Data in 5
S9 : "FB Data in 6" [""]; %Int 16 FB Data in 6
S10 : "FB Data in 7" [""]; %Int 16 FB Data in 7
S11 : "FB Data in 8" [""]; %Int 16 FB Data in 8
PUBLIC
R1 : "Kontroll 1" [""]; %Bitmask FB Kontroll 1
R2 : "Kontroll 2" [""]; %Bitmask FB Kontroll 2
R3 : "Fart verklig" ["%"]; %0-10000% FB Fart verklig
R4 : "Frekvens ut" ["Hz"]; %0.01 Hz FB Data ut 1 2104 Process data OUT 1 Output Frequency Hz 0,01
R5 : "MotorVarvtal" ["rpm"]; %1 rpm FB Data ut 2 2105 Process data OUT 2 Motor Speed rpm 1
R6 : "MotorStröm" ["A"]; %0.1 A FB Data ut 3 2106 Process data OUT 3 Motor Current A 0,1
R7 : "MotorVridmoment"["%"]; %0.1 % FB Data ut 4 2107 Process data OUT 4 Motor Torque % 0,1
R8 : "MotorEffekt" ["%"]; %0.1 % FB Data ut 5 2108 Process data OUT 5 Motor Power % 0,1
R9 : "MotorSpänning" ["V"]; %0.1 V FB Data ut 6 2109 Process data OUT 6 Motor Voltage V 0,1
R10 : "DC spänning" ["V"]; %1 V FB Data ut 7 2110 Process data OUT 7 DC link voltage V 1
R11 : "Aktiv felkod" [""]; %1 FB Data ut 8 2111 Process data OUT 8 Active Fault Code - 1
U1 : "FB Kontroll 1" [""]; %Bitmask FB Kontroll
U2 : "FB Kontroll 2" [""]; %Bitmask FB Kontroll
U3 : "FB Fart ref." [""]; %0-10000% FB Fart ref.
U4 : "BV Förångning" ["°C"]; %0.1°C FB Data in 1
U5 : "BV Kondensering"["°C"]; %0.1°C FB Data in 2
U6 : "FB Data in 3" [""]; %Int 16 FB Data in 3
U7 : "FB Data in 4" [""]; %Int 16 FB Data in 4
U8 : "FB Data in 5" [""]; %Int 16 FB Data in 5
U9 : "FB Data in 6" [""]; %Int 16 FB Data in 6
U10 : "FB Data in 7" [""]; %Int 16 FB Data in 7
U11 : "FB Data in 8" [""]; %Int 16 FB Data in 8
Energy : "Energi" ["MWh"];
PRIVATE
Cnt;
Value;
Format;
Unit;
Exp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DataIn1 NAMED "Läs processdata" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(2100); % Start address register 2101-1
DATA[4] := RWORD(11); % Number of registers
ANSWER SIZE 27
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(22); % Byte count
DATA[3] -> RWORD(R1 := DATA;);
DATA[5] -> RWORD(R2 := DATA;);
DATA[7] -> RWORD(R3 := DATA;);
DATA[9] -> RWORD(R4 := DATA / 100;);
DATA[11] -> RWORD(R5 := DATA;);
DATA[13] -> RWORD(R6 := DATA / 10;);
DATA[15] -> RWORD(R7 := DATA / 10;);
DATA[17] -> RWORD(R8 := DATA / 10;);
DATA[19] -> RWORD(R9 := DATA / 10;);
DATA[21] -> RWORD(R10 := DATA;);
DATA[23] -> RWORD(R11 := DATA;);
TIMEOUT 1000
END;
TELEGRAM DataIn2 NAMED "Läs börvärden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(2003); % Start address register 2004-1
DATA[4] := RWORD(2); % Number of registers
ANSWER SIZE 9
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(4); % Byte count
% Ändrat för att hantera negativa värden 090429 PW
%DATA[3] -> RWORD(U4 := DATA / 10;);
DATA[3] -> RWORD(IF DATA > 32767 THEN % Negativ ?
U4 := (DATA - 65536) / 10;
ELSE
U4 := DATA / 10;
ENDIF;
);
%DATA[5] -> RWORD(U5 := DATA / 10;);
DATA[5] -> RWORD(IF DATA > 32767 THEN % Negativ ?
U5 := (DATA - 65536) / 10;
ELSE
U5 := DATA / 10;
ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DataUt NAMED "Ställ börvärden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := BYTE(16); % Modbus command "10h" Write multiple registers
DATA[2] := RWORD(2003); % Start address register 2004 (- 1)
DATA[4] := RWORD(2); % Number of registers
DATA[6] := BYTE(4); % Number of bytes
DATA[7] <- RWORD(IF S4 >= 0 THEN
DATA := S4 * 10;
ELSE
DATA := 65536 + ROUND(S4 * 10) ;
ENDIF;
);
DATA[9] <- RWORD(IF S5 >= 0 THEN
DATA := S5 * 10;
ELSE
DATA := 65536 + ROUND(S5 * 10) ;
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 1000
END;
TELEGRAM DataIn3 NAMED "Läs energi" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] <- RWORD(IF (Cnt > 2) THEN
Cnt := 0;
ENDIF;
IF (Cnt = 0) THEN
DATA := 10; % Value = Register 11-1
ELSIF (Cnt = 1) THEN
DATA := 79; % Format = Register 80-1
ELSE
DATA := 80; % Unit = Register 81-1
ENDIF;
);
DATA[4] := RWORD(1); % Number of registers
ANSWER SIZE 7
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(2); % Byte count
DATA[3] -> RWORD(IF (Cnt = 0) THEN
Value := DATA; % Value
ELSIF (Cnt = 1) THEN
Format := DATA; % Format (Tiotal=antal siffror, Ental=decimaler)
ELSE
Unit := DATA; % Unit (1=kW, 2=MWh, 3=GWh, 4=TWh)
Exp := (FLOOR(Format / 10) * 10) - Format;
IF (Unit = 1) THEN Exp := Exp - 3;
ELSIF (Unit = 3) THEN Exp := Exp + 3;
ELSIF (Unit = 4) THEN Exp := Exp + 6;
ENDIF;
Energy := Value * 10^Exp;
ENDIF;
Cnt := Cnt + 1;
);
TIMEOUT 1000
END;
END;
% Device definition for VACON read registers 2101-2111 and set register 2001-2011
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2009-04-07 inital version
% 2009-04-16 PW Ändrat för ställa läsa börvärde
% 2009-04-29 PW Ändrat för att hantera negativa börvärden
% 2010-06-21 PW Lagt till Energi mätning.
%
DEVICETYPE VaconData NAMED "VACON data" TYPEID 21300 IS
PARAMETER
Id : "Adress";
S1 : "FB Kontroll 1" [""]; %Bitmask FB Kontroll
S2 : "FB Kontroll 2" [""]; %Bitmask FB Kontroll
S3 : "FB Fart ref." [""]; %0-10000% FB Fart ref.
S4 : "FB Data in 1" [""]; %Int 16 FB Data in 1
S5 : "FB Data in 1" [""]; %Int 16 FB Data in 2
S6 : "FB Data in 3" [""]; %Int 16 FB Data in 3
S7 : "FB Data in 4" [""]; %Int 16 FB Data in 4
S8 : "FB Data in 5" [""]; %Int 16 FB Data in 5
S9 : "FB Data in 6" [""]; %Int 16 FB Data in 6
S10 : "FB Data in 7" [""]; %Int 16 FB Data in 7
S11 : "FB Data in 8" [""]; %Int 16 FB Data in 8
PUBLIC
R1 : "Kontroll 1" [""]; %Bitmask FB Kontroll 1
R2 : "Kontroll 2" [""]; %Bitmask FB Kontroll 2
R3 : "Fart verklig" ["%"]; %0-10000% FB Fart verklig
R4 : "Frekvens ut" ["Hz"]; %0.01 Hz FB Data ut 1 2104 Process data OUT 1 Output Frequency Hz 0,01
R5 : "MotorVarvtal" ["rpm"]; %1 rpm FB Data ut 2 2105 Process data OUT 2 Motor Speed rpm 1
R6 : "MotorStröm" ["A"]; %0.1 A FB Data ut 3 2106 Process data OUT 3 Motor Current A 0,1
R7 : "MotorVridmoment"["%"]; %0.1 % FB Data ut 4 2107 Process data OUT 4 Motor Torque % 0,1
R8 : "MotorEffekt" ["%"]; %0.1 % FB Data ut 5 2108 Process data OUT 5 Motor Power % 0,1
R9 : "MotorSpänning" ["V"]; %0.1 V FB Data ut 6 2109 Process data OUT 6 Motor Voltage V 0,1
R10 : "DC spänning" ["V"]; %1 V FB Data ut 7 2110 Process data OUT 7 DC link voltage V 1
R11 : "Aktiv felkod" [""]; %1 FB Data ut 8 2111 Process data OUT 8 Active Fault Code - 1
U1 : "FB Kontroll 1" [""]; %Bitmask FB Kontroll
U2 : "FB Kontroll 2" [""]; %Bitmask FB Kontroll
U3 : "FB Fart ref." [""]; %0-10000% FB Fart ref.
U4 : "BV Förångning" ["°C"]; %0.1°C FB Data in 1
U5 : "BV Kondensering"["°C"]; %0.1°C FB Data in 2
U6 : "FB Data in 3" [""]; %Int 16 FB Data in 3
U7 : "FB Data in 4" [""]; %Int 16 FB Data in 4
U8 : "FB Data in 5" [""]; %Int 16 FB Data in 5
U9 : "FB Data in 6" [""]; %Int 16 FB Data in 6
U10 : "FB Data in 7" [""]; %Int 16 FB Data in 7
U11 : "FB Data in 8" [""]; %Int 16 FB Data in 8
Energy : "Energi" ["MWh"];
PRIVATE
Cnt;
Value;
Format;
Unit;
Exp;
BAUDRATE 9600;
CHECKSUM MODBUS SWAPPED;
TELEGRAM DataIn1 NAMED "Läs processdata" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(2100); % Start address register 2101-1
DATA[4] := RWORD(11); % Number of registers
ANSWER SIZE 27
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(22); % Byte count
DATA[3] -> RWORD(R1 := DATA;);
DATA[5] -> RWORD(R2 := DATA;);
DATA[7] -> RWORD(R3 := DATA;);
DATA[9] -> RWORD(R4 := DATA / 100;);
DATA[11] -> RWORD(R5 := DATA;);
DATA[13] -> RWORD(R6 := DATA / 10;);
DATA[15] -> RWORD(R7 := DATA / 10;);
DATA[17] -> RWORD(R8 := DATA / 10;);
DATA[19] -> RWORD(R9 := DATA / 10;);
DATA[21] -> RWORD(R10 := DATA;);
DATA[23] -> RWORD(R11 := DATA;);
TIMEOUT 1000
END;
TELEGRAM DataIn2 NAMED "Läs börvärden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] := RWORD(2003); % Start address register 2004-1
DATA[4] := RWORD(2); % Number of registers
ANSWER SIZE 9
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(4); % Byte count
% Ändrat för att hantera negativa värden 090429 PW
%DATA[3] -> RWORD(U4 := DATA / 10;);
DATA[3] -> RWORD(IF DATA > 32767 THEN % Negativ ?
U4 := (DATA - 65536) / 10;
ELSE
U4 := DATA / 10;
ENDIF;
);
%DATA[5] -> RWORD(U5 := DATA / 10;);
DATA[5] -> RWORD(IF DATA > 32767 THEN % Negativ ?
U5 := (DATA - 65536) / 10;
ELSE
U5 := DATA / 10;
ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM DataUt NAMED "Ställ börvärden" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := BYTE(16); % Modbus command "10h" Write multiple registers
DATA[2] := RWORD(2003); % Start address register 2004 (- 1)
DATA[4] := RWORD(2); % Number of registers
DATA[6] := BYTE(4); % Number of bytes
DATA[7] <- RWORD(IF S4 >= 0 THEN
DATA := S4 * 10;
ELSE
DATA := 65536 + ROUND(S4 * 10) ;
ENDIF;
);
DATA[9] <- RWORD(IF S5 >= 0 THEN
DATA := S5 * 10;
ELSE
DATA := 65536 + ROUND(S5 * 10) ;
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(10);
TIMEOUT 1000
END;
TELEGRAM DataIn3 NAMED "Läs energi" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(04); % Modbus command "04h" Read registers
DATA[2] <- RWORD(IF (Cnt > 2) THEN
Cnt := 0;
ENDIF;
IF (Cnt = 0) THEN
DATA := 10; % Value = Register 11-1
ELSIF (Cnt = 1) THEN
DATA := 79; % Format = Register 80-1
ELSE
DATA := 80; % Unit = Register 81-1
ENDIF;
);
DATA[4] := RWORD(1); % Number of registers
ANSWER SIZE 7
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(04); % Modbus command "04h" Read registers
%DATA[2] = BYTE(2); % Byte count
DATA[3] -> RWORD(IF (Cnt = 0) THEN
Value := DATA; % Value
ELSIF (Cnt = 1) THEN
Format := DATA; % Format (Tiotal=antal siffror, Ental=decimaler)
ELSE
Unit := DATA; % Unit (1=kW, 2=MWh, 3=GWh, 4=TWh)
Exp := (FLOOR(Format / 10) * 10) - Format;
IF (Unit = 1) THEN Exp := Exp - 3;
ELSIF (Unit = 3) THEN Exp := Exp + 3;
ELSIF (Unit = 4) THEN Exp := Exp + 6;
ENDIF;
Energy := Value * 10^Exp;
ENDIF;
Cnt := Cnt + 1;
);
TIMEOUT 1000
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.