NIBE Fighter 1330
Detaljer
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 NIBE Fighter ställa börvärde
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2011-02-08 inital version
% History: 2011-09-26 Anpassning ERAB extra register i 21284
% History: 2013-03-01 Uppdatering värmepumpstatus justerad i 21283
%
DEVICETYPE NIBEFighterWrite NAMED "NIBE_F Ställ BV" TYPEID 21285 IS
PARAMETER
Id : "Adress";
S221: "RCU offset" ["°C"]; % R/W Holding register -10 - +10°C, inga decimaler
PUBLIC
PRIVATE
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Settings1 NAMED "Ställ Temp offset" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); %Write singel register
DATA[2] <- RWORD(DATA := 220;); %Adress (regnr-1)
DATA[4] <- RWORD(IF S221<0 THEN
DATA := 65536+S221; %Fixa negativt värde, ingen decimal
ELSE
DATA := S221; %Värde = Heltal, ingen decimal
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for NIBE Fighter read registers
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2010-11-22 inital version
% 2011-02-08 Parameters are set as public not parameter
%
DEVICETYPE NIBEFighterRead NAMED "NIBE_F Läs värden" TYPEID 21284 IS
PARAMETER
Id : "Adress";
PUBLIC
R200 : "FramledningTemp" ["°C"]; % *0.1
R280 : "ReturTemp" ["°C"]; % *0.1
R400 : "UteTemp" ["°C"]; % *0.1
R660 : "VVAck.Temp" ["°C"]; % *0.1
R661 : "VVAck.LaddTemp" ["°C"]; % *1.0
R40_0: "VärmebärarpumpB"; % Bit0 0x0001 Värmebärarpump B
R40_1: "XVV_Elpatron"; % Bit1 0x0002 XVV elpatron
R40_2: "Eltillsats_1"; % Bit2 0x0004 Eltillsats 1
R40_3: "Eltillsats_2"; % Bit3 0x0008 Eltillsats 2
R40_4: "Eltillsats_3"; % Bit4 0x0010 Eltillsats 3/Oljepanna
R40_5: "Kompressor_A"; % Bit5 0x0020 Kompressor A
R40_6: "VärmebärarpumpA"; % Bit6 0x0040 Värmebärarpump A
R40_7: "Shuntvent.Öppna"; % Bit7 0x0080 Shuntventil öppna
R40_8: "Shuntvent.Stäng"; % Bit8 0x0100 Shuntventil stäng
R40_9: "VärmebärarpumpC"; % Bit9 0x0200 Värmebärarpump 3
R40_10:"Kompressor_B"; % Bit10 0x0400 Kompressor B
R40_11:"Växelventil"; % Bit11 0x0800 Växelventil
R40_12:"Köldbärarpump_B"; % Bit12 0x1000 Köldbärarpump B
R40_13:"Köldbärarpump_A"; % Bit13 0x2000 Köldbärarpump A
PRIVATE
Cnt;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Settings1 NAMED "Läs Register" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read holding registers
DATA[2] <- RWORD( % Start adress (regnr-1)
Cnt := Cnt + 1;
IF Cnt>5 THEN Cnt:=0; ENDIF;
% Adress=Register-1
IF Cnt=0 THEN DATA := 199; % R200
ELSIF Cnt=1 THEN DATA := 279; % R280
ELSIF Cnt=2 THEN DATA := 399; % R400
ELSIF Cnt=3 THEN DATA := 659; % R660
ELSIF Cnt=4 THEN DATA := 660; % R661
ELSIF Cnt=5 THEN DATA := 39; % R40
ELSE DATA := 39; % R40
ENDIF;
);
DATA[4] := RWORD(1); % Number of registers
ANSWER SIZE 7 % (Number of registers * 2) + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
%DATA[2] = BYTE(2); % Byte count
DATA[3] -> RWORD(
IF Cnt=0 THEN
IF (DATA>=32768) THEN R200:=(DATA-65536)*0.1; ELSE R200:=DATA*0.1; ENDIF; %R200
ELSIF Cnt=1 THEN
IF (DATA>=32768) THEN R280:=(DATA-65536)*0.1; ELSE R280:=DATA*0.1; ENDIF; %R280
ELSIF Cnt=2 THEN
IF (DATA>=32768) THEN R400:=(DATA-65536)*0.1; ELSE R400:=DATA*0.1; ENDIF; %R400
ELSIF Cnt=3 THEN
IF (DATA>=32768) THEN R660:=(DATA-65536)*0.1; ELSE R660:=DATA*0.1; ENDIF; %R660
ELSIF Cnt=4 THEN
R661 := DATA; %R661
ELSIF Cnt=5 THEN
R40_0 := DATA & 1; %R40
R40_1 := DATA & 2;
R40_2 := DATA & 4;
R40_3 := DATA & 8;
R40_4 := DATA & 16;
R40_5 := DATA & 32;
R40_6 := DATA & 64;
R40_7 := DATA & 128;
R40_8 := DATA & 256;
R40_9 := DATA & 512;
R40_10:= DATA & 1024;
R40_11:= DATA & 2048;
R40_12:= DATA & 4096;
R40_13:= DATA & 8192;
ENDIF;
);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Modified: 110208 Take care of negative values
%
DEVICETYPE NIBEFighterVP NAMED "NIBE-F Läs VPvärden" TYPEID 21283 IS
PARAMETER
Id : "Adress";
N : "VP nummer"; %0 = master, 1 till 8 = slavar
Ack : "Larmkvittering"; %Ändra status för kvittering
PUBLIC
% Codeing operating status R10-R27
% 0 = Not used 3 = Heating 4 = Hot water 5 = Ext. control
% 6 = Off 7 = Wait 8 = Pool 9 = Cooling
% 10 = Heating/Cooling 25 = Extern block 30 = High temp. Heating returnr 31 = Low temp. Brine-out
% 32 = High temp. Brine-in 33 = High temp. hot gas 34 = High condensing flow 35 = Comm.alarm
% 50 = Sensor alarm Heating return 51 = Sensor alarm Brine-out 52 = Sensor alarm Hot gas 60 = Hot gas alarm
% 70 = LP-alarm 71 = HP-alarm 72 = MS-alarm 73 = Phase alarm
% 90 = Level sens alarm
ALarm : "A-larm Master" INT; %R10
BLarm : "B-larm Master" INT; %R11
%ALarmS1 : "A-larm Slav1" INT; %R12
%BLarmS1 : "B-larm Slav1" INT; %R13
% ..
ATFramledning : "A VB tillopp" ["°C"] DEC1; %1000 Temperaturesensor, Heating medium flow A R int °C 0.1
ATRetur : "A VB retur " ["°C"] DEC1; %1001 Temperaturesensor, Heating medium return A R int °C 0.1
TBrine_in : "KB tillopptemp" ["°C"] DEC1; %1002 Temperaturesensor, Brine in R int °C 0.1
ATBrine_out : "A KB returtemp" ["°C"] DEC1; %1003 Temperaturesensor, Brine out A R int °C 0.1
ATHotgas : "A Hetgastemp" ["°C"] DEC1; %1004 Temperaturesensor, Hot gas A R int °C 0.1
ATBulb : "A Bulbtemp" ["°C"] DEC1; %1005 Temperaturesensor, Overheating A R int °C 0.1
ATLiquid : "A Vätsketemp" ["°C"] DEC1; %1006 Temperatursensor, Liquid line A R int °C 0.1
AStarter : "A Starter" [""] INT; %1007 Total starts of compressor A R uint
%ADrifttid : "A Drifttid" ["h"] INT; %1008 Operating time compressor A R uint h
BTFramledning : "B VB tillopp" ["°C"] DEC1; %1009 Temperaturesensor, Heating medium flow B R int °C 0.1
BTRetur : "B VB retur " ["°C"] DEC1; %1010 Temperaturesensor, Heating medium return B R int °C 0.1
BTBrine_out : "B KB returtemp" ["°C"] DEC1; %1011 Temperaturesensor, Brine out B R int °C 0.1
BTHotgas : "B Hetgastemp" ["°C"] DEC1; %1012 Temperaturesensor, Hot gas B R int °C 0.1
BTBulb : "B Bulbtemp" ["°C"] DEC1; %1013 Temperaturesensor, Overheating B R int °C 0.1
BTLiquid : "B Vätsketemp" ["°C"] DEC1; %1014 Temperatursensor, Liquid line B R int °C 0.1
%BStarter : "B Starter" [""] INT; %1015 Total starts of Compressor B R uint
%BDrifttid : "B Drifttid" ["h"] INT; %1016 Operating time Compressor B R uint h
%MaxTHeatReturn : "MaxTempVReturn" ["°C"]; %1017 Max temperatur heat return R int °C 40 - 60
%MinBrineOut : "MinBrineUt" ["°C"]; %1018 Min Brine out R/W int °C -10 - 15
%MaxBrineIn : "MaxBrineIn" ["°C"]; %1019 Max Brine in R/W int °C 10 - 41, 41 = Off
%Not used : "Ej_Använd" [""]; %1020 Not used
%MinTimeInterval: "MinTimeInterva" ["°C"]; %1021 Time, start to start R/W int min 20 - 60
%OperatingMode : "OperatingMode" [""] INT; %1022 Operating mode:
% % Brine pump bitfält 0x0C, 0 = Off, 1 = On
% % Level monitor bitfält 0x0C, 0 = Off, 1 = On
% % Heating medium pump A bitfält 0x03, 0 = Off, 1 = On
% % Quickstart Compressors bit 0x10, 0 = (normal) 1 = quick start
% % Reset alarm bit 0x20, 0 = (normal) 1 = reset alarm
%FactoryPreset : "Fabriksinställ" [""] INT; %1023 Factory presetting bitfält 0x3800 0 = (normal) 1 = normal factoty set 2 = extend factoty set
ADrift : "A Driftind." [""]; %1024 Relaystatus: Compressor A bit 0x01 0= Off, 1 = On
BDrift : "B Driftind." [""]; % Compressor B bit 0x02
%BPumpA : "Köldbärarpump_A" ; % Brine pump A bit 0x04
%BPumpB : "Köldbärarpump_B" ; % Brine pump B bit 0x08
VPumpA : "VärmebärarpumpA" ; % Heating medium pump A bit 0x10
VPumpB : "VärmebärarpumpB" ; % Heating medium pump B bit 0x20
PRIVATE
OperatingMode;
Started;
SilenceSend;
MAck;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadMain NAMED "Läs värden" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := RWORD(999+N*100);
DATA[4] := HEX(00);
DATA[5] := HEX(19);
ANSWER SIZE 55
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[3] -> RWORD(IF (DATA>=32768) THEN ATFramledning:=(DATA-65536)*0.1; ELSE ATFramledning:=DATA*0.1; ENDIF;); %R1000
DATA[5] -> RWORD(IF (DATA>=32768) THEN ATRetur :=(DATA-65536)*0.1; ELSE ATRetur :=DATA*0.1; ENDIF;); %R1001
DATA[7] -> RWORD(IF (DATA>=32768) THEN TBrine_in :=(DATA-65536)*0.1; ELSE TBrine_in :=DATA*0.1; ENDIF;); %R1002
DATA[9] -> RWORD(IF (DATA>=32768) THEN ATBrine_out :=(DATA-65536)*0.1; ELSE ATBrine_out :=DATA*0.1; ENDIF;); %R1003
DATA[11] -> RWORD(IF (DATA>=32768) THEN ATHotgas :=(DATA-65536)*0.1; ELSE ATHotgas :=DATA*0.1; ENDIF;); %R1004
DATA[13] -> RWORD(IF (DATA>=32768) THEN ATBulb :=(DATA-65536)*0.1; ELSE ATBulb :=DATA*0.1; ENDIF;); %R1005
DATA[15] -> RWORD(IF (DATA>=32768) THEN ATLiquid :=(DATA-65536)*0.1; ELSE ATLiquid :=DATA*0.1; ENDIF;); %R1006
DATA[17] -> RWORD(AStarter := DATA;); %R1007
%DATA[19] -> RWORD(ADrifttid := DATA;); %R1008
DATA[21] -> RWORD(IF (DATA>=32768) THEN BTFramledning:=(DATA-65536)*0.1; ELSE BTFramledning:=DATA*0.1; ENDIF;); %R1009
DATA[23] -> RWORD(IF (DATA>=32768) THEN BTRetur :=(DATA-65536)*0.1; ELSE BTRetur :=DATA*0.1; ENDIF;); %R1010
DATA[25] -> RWORD(IF (DATA>=32768) THEN BTBrine_out :=(DATA-65536)*0.1; ELSE BTBrine_out :=DATA*0.1; ENDIF;); %R1011
DATA[27] -> RWORD(IF (DATA>=32768) THEN BTHotgas :=(DATA-65536)*0.1; ELSE BTHotgas :=DATA*0.1; ENDIF;); %R1012
DATA[29] -> RWORD(IF (DATA>=32768) THEN BTBulb :=(DATA-65536)*0.1; ELSE BTBulb :=DATA*0.1; ENDIF;); %R1013
DATA[31] -> RWORD(IF (DATA>=32768) THEN BTLiquid :=(DATA-65536)*0.1; ELSE BTLiquid :=DATA*0.1; ENDIF;); %R1014
%DATA[33] -> RWORD(BStarter := DATA;); %R1015
%DATA[35] -> RWORD(BDrifttid := DATA;); %R1016
%DATA[37] -> RWORD(MaxTHeatReturn := DATA;); %R1017
%DATA[39] -> RWORD(IF (DATA>=32768) THEN MinBrineOut:=(DATA-65536); ELSE MinBrineOut:=DATA; ENDIF;); %R1018
%DATA[41] -> RWORD(MaxBrineIn := DATA;); %R1019
%DATA[43] -> RWORD(Not used := DATA;); %R1020
%DATA[45] -> RWORD(MinTimeInterval := DATA;); %R1021
DATA[47] -> RWORD(OperatingMode := DATA;); %R1022
%DATA[49] -> RWORD(FactoryPreset := DATA;); %R1023
%R1024 Relaystatus
DATA[51] -> RWORD(IF DATA & 1 THEN ADrift := 1; ELSE ADrift := 0; ENDIF;
IF DATA & 2 THEN BDrift := 1; ELSE BDrift := 0; ENDIF;
%IF DATA & 4 THEN BPumpA := 1; ELSE BPumpA := 0; ENDIF;
%IF DATA & 8 THEN BPumpB := 1; ELSE BPumpB := 0; ENDIF;
IF DATA & 16 THEN VPumpA := 1; ELSE VPumpA := 0; ENDIF;
IF DATA & 32 THEN VPumpB := 1; ELSE VPumpB := 0; ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM ReadAlarm NAMED "Läs larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := RWORD(9 + N*2);
DATA[4] := HEX(00);
DATA[5] := HEX(02);
ANSWER SIZE 9
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[3] -> RWORD(IF DATA > 25 THEN ALarm := DATA; ELSE ALarm := 0; ENDIF;); %R10 + N*2
DATA[5] -> RWORD(IF DATA > 25 THEN BLarm := DATA; ELSE BLarm := 0; ENDIF;); %R11 + N*2
TIMEOUT 1000
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1022 Operating mode R/W Holding register
% Brine pump Bitfält 0x0C 0 = Intermittent, 1 = Cont, 2 = 10 days cont.
% Level monitor Bitfält 0xC0 0 = Off, 1 = On (NC), 2 = On (NO)
% Heating medium pump A Bitfält 0x03 0 = Intermittent, 1 = Cont, 2 = Economy
% Quickstart Compressors Bit 0x10 0 = (normal), 1 = quick start
% Reset alarm Bit 0x20 0 = (normal), 1 = reset alarm
TELEGRAM SendAcknowledge NAMED "Kvittera larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); %Write singel register
DATA[2] := RWORD(1021+(N*100)); %Adress 1022 = Operating mode
DATA[4] <- RWORD(
DATA := OperatingMode | 32; % Set RESET bit
% Tysta telegrammet efter sändning
SilenceSend := 5;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 1000
END;
END;
% Special function for ERAB NOT USED.
% When more than 20 values are read values can be set
% directly to channels.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%GROUP Fighters OF MAX 9 DEVICE TYPEID 21283
% SELECT ALL SORT BY N
% ITERATOR Koppla
% ALIAS
% Master_BrineIn = CHANNEL[130]; %Ange kanalnumret för master köldbärare in
% Slav1_BrineIn = CHANNEL[132]; %Ange kanalnumret för slav 1 köldbärare in
% BEGIN
% IF N = 0 THEN
% Master_BrineIn <- TBrine_in;
% ELSIF N = 1 THEN
% Slav1_BrineIn <- TBrine_in;
% ENDIF;
% END;
%END;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ROUTINE UpdateBrineIn
%BEGIN
% CALL Fighters.Koppla;
%END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GROUP SendAckGroup OF MAX 9 DEVICE TYPEID 21283
SELECT ALL SORT BY N
ITERATOR SendAck
ALIAS
BEGIN
IF (Started) THEN
IF (MAck <> Ack) THEN
SEND SendAcknowledge;
MAck := Ack;
ENDIF;
IF (SilenceSend > 0) THEN
SilenceSend := SilenceSend - 1;
SILENCE SendAcknowledge;
ENDIF;
ELSE
SILENCE SendAcknowledge;
MAck := Ack;
Started := 1;
ENDIF;
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ROUTINE Acknowledge
BEGIN
CALL SendAckGroup.SendAck;
END;
% Device definition for NIBE Fighter ställa börvärde
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2011-02-08 inital version
% History: 2011-09-26 Anpassning ERAB extra register i 21284
% History: 2013-03-01 Uppdatering värmepumpstatus justerad i 21283
%
DEVICETYPE NIBEFighterWrite NAMED "NIBE_F Ställ BV" TYPEID 21285 IS
PARAMETER
Id : "Adress";
S221: "RCU offset" ["°C"]; % R/W Holding register -10 - +10°C, inga decimaler
PUBLIC
PRIVATE
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Settings1 NAMED "Ställ Temp offset" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); %Write singel register
DATA[2] <- RWORD(DATA := 220;); %Adress (regnr-1)
DATA[4] <- RWORD(IF S221<0 THEN
DATA := 65536+S221; %Fixa negativt värde, ingen decimal
ELSE
DATA := S221; %Värde = Heltal, ingen decimal
ENDIF;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Device definition for NIBE Fighter read registers
%
% Settings module:
% Parity: None
% Baud: 9600
% Mode: RTU
%
% Author: Peter Widetun, ABELKO AB Luleå
% History: 2010-11-22 inital version
% 2011-02-08 Parameters are set as public not parameter
%
DEVICETYPE NIBEFighterRead NAMED "NIBE_F Läs värden" TYPEID 21284 IS
PARAMETER
Id : "Adress";
PUBLIC
R200 : "FramledningTemp" ["°C"]; % *0.1
R280 : "ReturTemp" ["°C"]; % *0.1
R400 : "UteTemp" ["°C"]; % *0.1
R660 : "VVAck.Temp" ["°C"]; % *0.1
R661 : "VVAck.LaddTemp" ["°C"]; % *1.0
R40_0: "VärmebärarpumpB"; % Bit0 0x0001 Värmebärarpump B
R40_1: "XVV_Elpatron"; % Bit1 0x0002 XVV elpatron
R40_2: "Eltillsats_1"; % Bit2 0x0004 Eltillsats 1
R40_3: "Eltillsats_2"; % Bit3 0x0008 Eltillsats 2
R40_4: "Eltillsats_3"; % Bit4 0x0010 Eltillsats 3/Oljepanna
R40_5: "Kompressor_A"; % Bit5 0x0020 Kompressor A
R40_6: "VärmebärarpumpA"; % Bit6 0x0040 Värmebärarpump A
R40_7: "Shuntvent.Öppna"; % Bit7 0x0080 Shuntventil öppna
R40_8: "Shuntvent.Stäng"; % Bit8 0x0100 Shuntventil stäng
R40_9: "VärmebärarpumpC"; % Bit9 0x0200 Värmebärarpump 3
R40_10:"Kompressor_B"; % Bit10 0x0400 Kompressor B
R40_11:"Växelventil"; % Bit11 0x0800 Växelventil
R40_12:"Köldbärarpump_B"; % Bit12 0x1000 Köldbärarpump B
R40_13:"Köldbärarpump_A"; % Bit13 0x2000 Köldbärarpump A
PRIVATE
Cnt;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM Settings1 NAMED "Läs Register" IS
QUESTION
DATA[0] := BYTE(Id); % Modbus unit address
DATA[1] := HEX(03); % Modbus command "03h" Read holding registers
DATA[2] <- RWORD( % Start adress (regnr-1)
Cnt := Cnt + 1;
IF Cnt>5 THEN Cnt:=0; ENDIF;
% Adress=Register-1
IF Cnt=0 THEN DATA := 199; % R200
ELSIF Cnt=1 THEN DATA := 279; % R280
ELSIF Cnt=2 THEN DATA := 399; % R400
ELSIF Cnt=3 THEN DATA := 659; % R660
ELSIF Cnt=4 THEN DATA := 660; % R661
ELSIF Cnt=5 THEN DATA := 39; % R40
ELSE DATA := 39; % R40
ENDIF;
);
DATA[4] := RWORD(1); % Number of registers
ANSWER SIZE 7 % (Number of registers * 2) + 5
DATA[0] = BYTE(Id); % ID
DATA[1] = HEX(03); % Modbus command "03h" Read holding registers
%DATA[2] = BYTE(2); % Byte count
DATA[3] -> RWORD(
IF Cnt=0 THEN
IF (DATA>=32768) THEN R200:=(DATA-65536)*0.1; ELSE R200:=DATA*0.1; ENDIF; %R200
ELSIF Cnt=1 THEN
IF (DATA>=32768) THEN R280:=(DATA-65536)*0.1; ELSE R280:=DATA*0.1; ENDIF; %R280
ELSIF Cnt=2 THEN
IF (DATA>=32768) THEN R400:=(DATA-65536)*0.1; ELSE R400:=DATA*0.1; ENDIF; %R400
ELSIF Cnt=3 THEN
IF (DATA>=32768) THEN R660:=(DATA-65536)*0.1; ELSE R660:=DATA*0.1; ENDIF; %R660
ELSIF Cnt=4 THEN
R661 := DATA; %R661
ELSIF Cnt=5 THEN
R40_0 := DATA & 1; %R40
R40_1 := DATA & 2;
R40_2 := DATA & 4;
R40_3 := DATA & 8;
R40_4 := DATA & 16;
R40_5 := DATA & 32;
R40_6 := DATA & 64;
R40_7 := DATA & 128;
R40_8 := DATA & 256;
R40_9 := DATA & 512;
R40_10:= DATA & 1024;
R40_11:= DATA & 2048;
R40_12:= DATA & 4096;
R40_13:= DATA & 8192;
ENDIF;
);
TIMEOUT 1000
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Modified: 110208 Take care of negative values
%
DEVICETYPE NIBEFighterVP NAMED "NIBE-F Läs VPvärden" TYPEID 21283 IS
PARAMETER
Id : "Adress";
N : "VP nummer"; %0 = master, 1 till 8 = slavar
Ack : "Larmkvittering"; %Ändra status för kvittering
PUBLIC
% Codeing operating status R10-R27
% 0 = Not used 3 = Heating 4 = Hot water 5 = Ext. control
% 6 = Off 7 = Wait 8 = Pool 9 = Cooling
% 10 = Heating/Cooling 25 = Extern block 30 = High temp. Heating returnr 31 = Low temp. Brine-out
% 32 = High temp. Brine-in 33 = High temp. hot gas 34 = High condensing flow 35 = Comm.alarm
% 50 = Sensor alarm Heating return 51 = Sensor alarm Brine-out 52 = Sensor alarm Hot gas 60 = Hot gas alarm
% 70 = LP-alarm 71 = HP-alarm 72 = MS-alarm 73 = Phase alarm
% 90 = Level sens alarm
ALarm : "A-larm Master" INT; %R10
BLarm : "B-larm Master" INT; %R11
%ALarmS1 : "A-larm Slav1" INT; %R12
%BLarmS1 : "B-larm Slav1" INT; %R13
% ..
ATFramledning : "A VB tillopp" ["°C"] DEC1; %1000 Temperaturesensor, Heating medium flow A R int °C 0.1
ATRetur : "A VB retur " ["°C"] DEC1; %1001 Temperaturesensor, Heating medium return A R int °C 0.1
TBrine_in : "KB tillopptemp" ["°C"] DEC1; %1002 Temperaturesensor, Brine in R int °C 0.1
ATBrine_out : "A KB returtemp" ["°C"] DEC1; %1003 Temperaturesensor, Brine out A R int °C 0.1
ATHotgas : "A Hetgastemp" ["°C"] DEC1; %1004 Temperaturesensor, Hot gas A R int °C 0.1
ATBulb : "A Bulbtemp" ["°C"] DEC1; %1005 Temperaturesensor, Overheating A R int °C 0.1
ATLiquid : "A Vätsketemp" ["°C"] DEC1; %1006 Temperatursensor, Liquid line A R int °C 0.1
AStarter : "A Starter" [""] INT; %1007 Total starts of compressor A R uint
%ADrifttid : "A Drifttid" ["h"] INT; %1008 Operating time compressor A R uint h
BTFramledning : "B VB tillopp" ["°C"] DEC1; %1009 Temperaturesensor, Heating medium flow B R int °C 0.1
BTRetur : "B VB retur " ["°C"] DEC1; %1010 Temperaturesensor, Heating medium return B R int °C 0.1
BTBrine_out : "B KB returtemp" ["°C"] DEC1; %1011 Temperaturesensor, Brine out B R int °C 0.1
BTHotgas : "B Hetgastemp" ["°C"] DEC1; %1012 Temperaturesensor, Hot gas B R int °C 0.1
BTBulb : "B Bulbtemp" ["°C"] DEC1; %1013 Temperaturesensor, Overheating B R int °C 0.1
BTLiquid : "B Vätsketemp" ["°C"] DEC1; %1014 Temperatursensor, Liquid line B R int °C 0.1
%BStarter : "B Starter" [""] INT; %1015 Total starts of Compressor B R uint
%BDrifttid : "B Drifttid" ["h"] INT; %1016 Operating time Compressor B R uint h
%MaxTHeatReturn : "MaxTempVReturn" ["°C"]; %1017 Max temperatur heat return R int °C 40 - 60
%MinBrineOut : "MinBrineUt" ["°C"]; %1018 Min Brine out R/W int °C -10 - 15
%MaxBrineIn : "MaxBrineIn" ["°C"]; %1019 Max Brine in R/W int °C 10 - 41, 41 = Off
%Not used : "Ej_Använd" [""]; %1020 Not used
%MinTimeInterval: "MinTimeInterva" ["°C"]; %1021 Time, start to start R/W int min 20 - 60
%OperatingMode : "OperatingMode" [""] INT; %1022 Operating mode:
% % Brine pump bitfält 0x0C, 0 = Off, 1 = On
% % Level monitor bitfält 0x0C, 0 = Off, 1 = On
% % Heating medium pump A bitfält 0x03, 0 = Off, 1 = On
% % Quickstart Compressors bit 0x10, 0 = (normal) 1 = quick start
% % Reset alarm bit 0x20, 0 = (normal) 1 = reset alarm
%FactoryPreset : "Fabriksinställ" [""] INT; %1023 Factory presetting bitfält 0x3800 0 = (normal) 1 = normal factoty set 2 = extend factoty set
ADrift : "A Driftind." [""]; %1024 Relaystatus: Compressor A bit 0x01 0= Off, 1 = On
BDrift : "B Driftind." [""]; % Compressor B bit 0x02
%BPumpA : "Köldbärarpump_A" ; % Brine pump A bit 0x04
%BPumpB : "Köldbärarpump_B" ; % Brine pump B bit 0x08
VPumpA : "VärmebärarpumpA" ; % Heating medium pump A bit 0x10
VPumpB : "VärmebärarpumpB" ; % Heating medium pump B bit 0x20
PRIVATE
OperatingMode;
Started;
SilenceSend;
MAck;
BAUDRATE 38400;
CHECKSUM MODBUS SWAPPED;
TELEGRAM ReadMain NAMED "Läs värden" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := RWORD(999+N*100);
DATA[4] := HEX(00);
DATA[5] := HEX(19);
ANSWER SIZE 55
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[3] -> RWORD(IF (DATA>=32768) THEN ATFramledning:=(DATA-65536)*0.1; ELSE ATFramledning:=DATA*0.1; ENDIF;); %R1000
DATA[5] -> RWORD(IF (DATA>=32768) THEN ATRetur :=(DATA-65536)*0.1; ELSE ATRetur :=DATA*0.1; ENDIF;); %R1001
DATA[7] -> RWORD(IF (DATA>=32768) THEN TBrine_in :=(DATA-65536)*0.1; ELSE TBrine_in :=DATA*0.1; ENDIF;); %R1002
DATA[9] -> RWORD(IF (DATA>=32768) THEN ATBrine_out :=(DATA-65536)*0.1; ELSE ATBrine_out :=DATA*0.1; ENDIF;); %R1003
DATA[11] -> RWORD(IF (DATA>=32768) THEN ATHotgas :=(DATA-65536)*0.1; ELSE ATHotgas :=DATA*0.1; ENDIF;); %R1004
DATA[13] -> RWORD(IF (DATA>=32768) THEN ATBulb :=(DATA-65536)*0.1; ELSE ATBulb :=DATA*0.1; ENDIF;); %R1005
DATA[15] -> RWORD(IF (DATA>=32768) THEN ATLiquid :=(DATA-65536)*0.1; ELSE ATLiquid :=DATA*0.1; ENDIF;); %R1006
DATA[17] -> RWORD(AStarter := DATA;); %R1007
%DATA[19] -> RWORD(ADrifttid := DATA;); %R1008
DATA[21] -> RWORD(IF (DATA>=32768) THEN BTFramledning:=(DATA-65536)*0.1; ELSE BTFramledning:=DATA*0.1; ENDIF;); %R1009
DATA[23] -> RWORD(IF (DATA>=32768) THEN BTRetur :=(DATA-65536)*0.1; ELSE BTRetur :=DATA*0.1; ENDIF;); %R1010
DATA[25] -> RWORD(IF (DATA>=32768) THEN BTBrine_out :=(DATA-65536)*0.1; ELSE BTBrine_out :=DATA*0.1; ENDIF;); %R1011
DATA[27] -> RWORD(IF (DATA>=32768) THEN BTHotgas :=(DATA-65536)*0.1; ELSE BTHotgas :=DATA*0.1; ENDIF;); %R1012
DATA[29] -> RWORD(IF (DATA>=32768) THEN BTBulb :=(DATA-65536)*0.1; ELSE BTBulb :=DATA*0.1; ENDIF;); %R1013
DATA[31] -> RWORD(IF (DATA>=32768) THEN BTLiquid :=(DATA-65536)*0.1; ELSE BTLiquid :=DATA*0.1; ENDIF;); %R1014
%DATA[33] -> RWORD(BStarter := DATA;); %R1015
%DATA[35] -> RWORD(BDrifttid := DATA;); %R1016
%DATA[37] -> RWORD(MaxTHeatReturn := DATA;); %R1017
%DATA[39] -> RWORD(IF (DATA>=32768) THEN MinBrineOut:=(DATA-65536); ELSE MinBrineOut:=DATA; ENDIF;); %R1018
%DATA[41] -> RWORD(MaxBrineIn := DATA;); %R1019
%DATA[43] -> RWORD(Not used := DATA;); %R1020
%DATA[45] -> RWORD(MinTimeInterval := DATA;); %R1021
DATA[47] -> RWORD(OperatingMode := DATA;); %R1022
%DATA[49] -> RWORD(FactoryPreset := DATA;); %R1023
%R1024 Relaystatus
DATA[51] -> RWORD(IF DATA & 1 THEN ADrift := 1; ELSE ADrift := 0; ENDIF;
IF DATA & 2 THEN BDrift := 1; ELSE BDrift := 0; ENDIF;
%IF DATA & 4 THEN BPumpA := 1; ELSE BPumpA := 0; ENDIF;
%IF DATA & 8 THEN BPumpB := 1; ELSE BPumpB := 0; ENDIF;
IF DATA & 16 THEN VPumpA := 1; ELSE VPumpA := 0; ENDIF;
IF DATA & 32 THEN VPumpB := 1; ELSE VPumpB := 0; ENDIF;
);
TIMEOUT 1000
END;
TELEGRAM ReadAlarm NAMED "Läs larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(03);
DATA[2] := RWORD(9 + N*2);
DATA[4] := HEX(00);
DATA[5] := HEX(02);
ANSWER SIZE 9
DATA[0] = BYTE(Id);
DATA[1] = HEX(03);
DATA[3] -> RWORD(IF DATA > 25 THEN ALarm := DATA; ELSE ALarm := 0; ENDIF;); %R10 + N*2
DATA[5] -> RWORD(IF DATA > 25 THEN BLarm := DATA; ELSE BLarm := 0; ENDIF;); %R11 + N*2
TIMEOUT 1000
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1022 Operating mode R/W Holding register
% Brine pump Bitfält 0x0C 0 = Intermittent, 1 = Cont, 2 = 10 days cont.
% Level monitor Bitfält 0xC0 0 = Off, 1 = On (NC), 2 = On (NO)
% Heating medium pump A Bitfält 0x03 0 = Intermittent, 1 = Cont, 2 = Economy
% Quickstart Compressors Bit 0x10 0 = (normal), 1 = quick start
% Reset alarm Bit 0x20 0 = (normal), 1 = reset alarm
TELEGRAM SendAcknowledge NAMED "Kvittera larm" IS
QUESTION
DATA[0] := BYTE(Id);
DATA[1] := HEX(06); %Write singel register
DATA[2] := RWORD(1021+(N*100)); %Adress 1022 = Operating mode
DATA[4] <- RWORD(
DATA := OperatingMode | 32; % Set RESET bit
% Tysta telegrammet efter sändning
SilenceSend := 5;
);
ANSWER SIZE 8
DATA[0] = BYTE(Id);
DATA[1] = HEX(06);
TIMEOUT 1000
END;
END;
% Special function for ERAB NOT USED.
% When more than 20 values are read values can be set
% directly to channels.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%GROUP Fighters OF MAX 9 DEVICE TYPEID 21283
% SELECT ALL SORT BY N
% ITERATOR Koppla
% ALIAS
% Master_BrineIn = CHANNEL[130]; %Ange kanalnumret för master köldbärare in
% Slav1_BrineIn = CHANNEL[132]; %Ange kanalnumret för slav 1 köldbärare in
% BEGIN
% IF N = 0 THEN
% Master_BrineIn <- TBrine_in;
% ELSIF N = 1 THEN
% Slav1_BrineIn <- TBrine_in;
% ENDIF;
% END;
%END;
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%ROUTINE UpdateBrineIn
%BEGIN
% CALL Fighters.Koppla;
%END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GROUP SendAckGroup OF MAX 9 DEVICE TYPEID 21283
SELECT ALL SORT BY N
ITERATOR SendAck
ALIAS
BEGIN
IF (Started) THEN
IF (MAck <> Ack) THEN
SEND SendAcknowledge;
MAck := Ack;
ENDIF;
IF (SilenceSend > 0) THEN
SilenceSend := SilenceSend - 1;
SILENCE SendAcknowledge;
ENDIF;
ELSE
SILENCE SendAcknowledge;
MAck := Ack;
Started := 1;
ENDIF;
END;
END;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ROUTINE Acknowledge
BEGIN
CALL SendAckGroup.SendAck;
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.