Added inverter implementation
This commit is contained in:
@@ -26,11 +26,13 @@ STRUCT
|
||||
// Drucksensoren Posolyt
|
||||
//====================================
|
||||
stPosolytPressureSegmentInlet : ST_HMI_ANALOG_VALUE;
|
||||
stPosolytPressureTankInlet : ST_HMI_ANALOG_VALUE;
|
||||
|
||||
|
||||
// Drucksensoren Negolyt
|
||||
//====================================
|
||||
stNegolytPressureSegmentInlet : ST_HMI_ANALOG_VALUE;
|
||||
stNegolytPressureTankInlet : ST_HMI_ANALOG_VALUE;
|
||||
|
||||
|
||||
// Temperature sensor posolyt tank inlet
|
||||
|
||||
@@ -44,69 +44,103 @@ VAR_GLOBAL
|
||||
|
||||
// Pressure posolyt segment inlet
|
||||
stConfigPosolytPressureSegmentInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 1500, rPVMin := -1000, sUnit := 'mbar'),
|
||||
stEWLPosolytPressureSegmentInlet := (rErrorMin := -500, rWarningMin := -400, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWLPosolytPressureSegmentInlet := (rErrorMin := 170, rWarningMin := 200, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWDPosolytPressureSegmentInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure negolyt segment inlet
|
||||
stConfigNegolytPressureSegmentInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 1500, rPVMin := -1000, sUnit := 'mbar'),
|
||||
stEWLNegolytPressureSegmentInlet := (rErrorMin := -500, rWarningMin := -400, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWLNegolytPressureSegmentInlet := (rErrorMin := 170, rWarningMin := 200, rWarningMax := 600, rErrorMax := 700),
|
||||
stEWDNegolytPressureSegmentInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#1S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#1S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#1S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#1S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure posolyt tank inlet
|
||||
stConfigPosolytPressureTankInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 1500, rPVMin := -1000, sUnit := 'mbar'),
|
||||
stEWLPosolytPressureTankInlet := (rErrorMin := -100, rWarningMin := -50, rWarningMax := 100, rErrorMax := 120),
|
||||
stEWDPosolytPressureTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Pressure negolyt tank inlet
|
||||
stConfigNegolytPressureTankInlet := (iAIMax := 32767, iAIMin := 0, rPVMax := 1500, rPVMin := -1000, sUnit := 'mbar'),
|
||||
stEWLNegolytPressureTankInlet := (rErrorMin := -100, rWarningMin := -50, rWarningMax := 100, rErrorMax := 120),
|
||||
stEWDNegolytPressureTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Temperature sensor posolyt tank inlet
|
||||
stConfigPosolytTempTankInlet := (iAIMax := 32767, iAIMin := -32768, rPVMax := 3276.7, rPVMin := -3276.8, sUnit := '°C'),
|
||||
stEWLPosolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 45, rErrorMax := 60),
|
||||
stEWLPosolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWDPosolytTempTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
// Temperature sensor negolyt tank inlet
|
||||
stConfigNegolytTempTankInlet := (iAIMax := 32767, iAIMin := -32768, rPVMax := 3276.7, rPVMin := -3276.8, sUnit := '°C'),
|
||||
stEWLNegolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 45, rErrorMax := 60),
|
||||
stEWLNegolytTempTankInlet := (rErrorMin := -10, rWarningMin := -5, rWarningMax := 50, rErrorMax := 60),
|
||||
stEWDNegolytTempTankInlet :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
timHardwareSignalLevelOff := T#5S,
|
||||
timErrorLowOn := T#5S,
|
||||
timErrorLowOn := T#2S,
|
||||
timErrorLowOff := T#5S,
|
||||
timWarningLowOn := T#5S,
|
||||
timWarningLowOn := T#2S,
|
||||
timWarningLowOff := T#5S,
|
||||
timWarningHighOn := T#5S,
|
||||
timWarningHighOn := T#2S,
|
||||
timWarningHighOff := T#5S,
|
||||
timErrorHighOn := T#5S,
|
||||
timErrorHighOn := T#2S,
|
||||
timErrorHighOff := T#5S
|
||||
),
|
||||
|
||||
@@ -115,7 +149,7 @@ VAR_GLOBAL
|
||||
// Index 0x80n0:02 "Presentation" = Signed(0) -> Resolution 1/10°C
|
||||
// Index 0x80n0:19 "RTD Element" = PT100(0)
|
||||
stConfigVoltageSegment := (iAIMax := 32767, iAIMin := 0, rPVMax := 150, rPVMin := 0, sUnit := 'V'),
|
||||
stEWLVoltageSegment := (rErrorMin := 50, rWarningMin := 55, rWarningMax := 75, rErrorMax := 80),
|
||||
stEWLVoltageSegment := (rErrorMin := 50, rWarningMin := 55, rWarningMax := 75, rErrorMax := 79),
|
||||
stEWDVoltageSegment :=
|
||||
(
|
||||
timHardwareSignalLevelOn := T#0S,
|
||||
@@ -135,24 +169,51 @@ VAR_GLOBAL
|
||||
// General settings
|
||||
// ===========================
|
||||
|
||||
// Pump on power
|
||||
// Pump on power (%)
|
||||
rPumpPosolytOnPower : REAL := 70.0;
|
||||
rPumpNegolytOnPower : REAL := 70.0;
|
||||
|
||||
// Unit voltage pumps shutoff threshold
|
||||
rPumpshutoffThreshold : REAL := 25.0;
|
||||
// Unit voltage pumps shutoff threshold (Volt)
|
||||
rPumpshutoffThreshold : REAL := 15.0;
|
||||
|
||||
// Minimum unit voltage for startup
|
||||
// Minimum unit voltage required for inverter startup (Volt)
|
||||
rMinimumUnitVoltage : REAL := 49.0;
|
||||
|
||||
// Delta value to minimum unit voltage for shutdown discharge (Volt)
|
||||
rDeltaUnitVoltageShutdownDischarge : REAL := 5.0;
|
||||
|
||||
// Maximum absolute voltage difference
|
||||
// between units in the same module
|
||||
rMaxAbsDiffVoltageUnitsOnModule : REAL := 5.0;
|
||||
|
||||
// Maximum absolute voltage difference
|
||||
// between Modules
|
||||
// between Modules (Volt)
|
||||
rMaxAbsDiffVoltageModulesInString : REAL := 10.0;
|
||||
|
||||
// Minimum absolute power command to enable battery (Watt)
|
||||
diMinimumAbsPowerForEnable : DINT := 100;
|
||||
|
||||
// Maximum allowed charging power (Watt)
|
||||
diMaxStringChargingPower : DINT := -30_000;
|
||||
|
||||
// Maximum allowed discharging power (Watt)
|
||||
diMaxStringDischargePower : DINT := 30_000;
|
||||
|
||||
// Inverter ip address
|
||||
sInverterIp : STRING := '192.168.0.1';
|
||||
|
||||
// Absolute shutdown discharge power (Watt)
|
||||
rAbsShutdownDischargePower : REAL := 5_000;
|
||||
|
||||
// Allow inverter fast shutdown discharge
|
||||
xShutdownDischargeWithInverter : BOOL := TRUE;
|
||||
|
||||
// String fully charged voltage (Volt)
|
||||
rStringFullyChargedVoltage : REAL := 888.0;
|
||||
|
||||
// String empty voltage (Volt)
|
||||
rStringEmptyVoltage : REAL := 672.0;
|
||||
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
@@ -9,13 +9,15 @@ VAR_GLOBAL
|
||||
sModelname := 'all liquid',
|
||||
sSerialnumber := '202312151643',
|
||||
sBMSVersion := '0.8.0',
|
||||
uiTotalParallelMembers := 2);
|
||||
uiTotalParallelMembers := 2,
|
||||
eChargeStatus := E_CHARGE_STATUS.UNDEFINED,
|
||||
eBatteryStatus := E_BATTERY_STATUS.OFF);
|
||||
|
||||
// Modbus default config
|
||||
mb_Input_Coils : ARRAY [0..255] OF BOOL;
|
||||
mb_Output_Coils : ARRAY [0..255] OF BOOL;
|
||||
mb_Input_Registers : ARRAY [0..255] OF WORD;
|
||||
mb_Output_Registers : ARRAY [0..255] OF WORD;
|
||||
//mb_Input_Coils : ARRAY [0..255] OF BOOL;
|
||||
//mb_Output_Coils : ARRAY [0..255] OF BOOL;
|
||||
//mb_Input_Registers : ARRAY [0..255] OF WORD;
|
||||
//mb_Output_Registers : ARRAY [0..255] OF WORD;
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
270
PLC/PLC.tmc
270
PLC/PLC.tmc
File diff suppressed because one or more lines are too long
@@ -6,6 +6,12 @@ VAR_INPUT
|
||||
// Emergency stop ok
|
||||
xEmergencyStopOk : BOOL;
|
||||
|
||||
// Enable
|
||||
xEnable : BOOL;
|
||||
|
||||
// Module completely off
|
||||
xOff : BOOL := TRUE;
|
||||
|
||||
// HMI Interface
|
||||
stHMIInterface : REFERENCE TO ST_MODULE_HMI_INTERFACE;
|
||||
|
||||
@@ -19,6 +25,18 @@ VAR_INPUT
|
||||
xConfirmAlarms : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Module voltage
|
||||
rCurrentVoltage : REAL;
|
||||
|
||||
// Module ready
|
||||
xReady : BOOL;
|
||||
|
||||
// Module in shutdown segment discharge mode
|
||||
xInShutdownDischargeMode : BOOL;
|
||||
|
||||
// Module can be discharged during shutdown sequence
|
||||
xShutdownDischargeAllowed : BOOL;
|
||||
|
||||
// One unit has an error
|
||||
xError : BOOL;
|
||||
|
||||
@@ -31,6 +49,12 @@ VAR
|
||||
_fbUnit3 : FB_Unit(CONCAT(_sName, ' Unit 3'));
|
||||
_fbUnit4 : FB_Unit(CONCAT(_sName, ' Unit 4'));
|
||||
|
||||
// Flag for unit balance checking
|
||||
_xBalanceOk : BOOL;
|
||||
|
||||
// All units are ready
|
||||
_xAllUnitsReady : BOOL;
|
||||
|
||||
// Module name
|
||||
_sName : STRING;
|
||||
END_VAR
|
||||
@@ -44,6 +68,7 @@ xWarning := FALSE;
|
||||
// Unit 1
|
||||
// ===============================
|
||||
_fbUnit1(
|
||||
xEnable := xEnable,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit1,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -67,6 +92,7 @@ END_IF
|
||||
// Unit 2
|
||||
// ===============================
|
||||
_fbUnit2(
|
||||
xEnable := xEnable,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit2,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -90,6 +116,7 @@ END_IF
|
||||
// Unit 3
|
||||
// ===============================
|
||||
_fbUnit3(
|
||||
xEnable := xEnable,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit3,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -113,6 +140,7 @@ END_IF
|
||||
// Unit 4
|
||||
// ===============================
|
||||
_fbUnit4(
|
||||
xEnable := xEnable,
|
||||
stUnitConfig:= GVL_CONFIG.stUnitConfig,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit4,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -129,6 +157,86 @@ END_IF
|
||||
|
||||
IF _fbUnit4.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units ready check
|
||||
// ===============================
|
||||
_xAllUnitsReady := _fbUnit1.xReady AND _fbUnit2.xReady AND _fbUnit3.xReady AND _fbUnit4.xReady;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units in shutdown discharge mode
|
||||
// ===============================
|
||||
xInShutdownDischargeMode := _fbUnit1.xInShutdownDischargeMode AND _fbUnit2.xInShutdownDischargeMode AND _fbUnit3.xInShutdownDischargeMode AND _fbUnit4.xInShutdownDischargeMode;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units shutdown discharge allowed
|
||||
// ===============================
|
||||
xShutdownDischargeAllowed := _fbUnit1.xShutdownDischargeAllowed AND _fbUnit2.xShutdownDischargeAllowed AND _fbUnit3.xShutdownDischargeAllowed AND _fbUnit4.xShutdownDischargeAllowed;
|
||||
|
||||
|
||||
// ===============================
|
||||
// All units off
|
||||
// ===============================
|
||||
xOff := _fbUnit1.xOff AND _fbUnit2.xOff AND _fbUnit3.xOff AND _fbUnit4.xOff;
|
||||
|
||||
// ===============================
|
||||
// Calculate module voltage
|
||||
// ===============================
|
||||
rCurrentVoltage := _fbUnit1.rCurrentVoltage + _fbUnit2.rCurrentVoltage + _fbUnit3.rCurrentVoltage + _fbUnit4.rCurrentVoltage;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Module balance check
|
||||
// ===============================
|
||||
// Reset balance ok flag
|
||||
_xBalanceOk := TRUE;
|
||||
|
||||
// Test unit 1 with unit 2
|
||||
IF ABS(_fbUnit1.rCurrentVoltage - _fbUnit2.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test unit 1 with unit 3
|
||||
IF ABS(_fbUnit1.rCurrentVoltage - _fbUnit3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test unit 1 with unit 4
|
||||
IF ABS(_fbUnit1.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test unit 2 with unit 3
|
||||
IF ABS(_fbUnit2.rCurrentVoltage - _fbUnit3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test unit 2 with unit 4
|
||||
IF ABS(_fbUnit2.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test unit 3 with unit 4
|
||||
IF ABS(_fbUnit3.rCurrentVoltage - _fbUnit4.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageUnitsOnModule THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Signal an error if all units are ready and module is out of balance
|
||||
IF _xAllUnitsReady AND (NOT _xBalanceOk) THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Module ready validation check
|
||||
// ===============================
|
||||
IF _xAllUnitsReady AND _xBalanceOk THEN
|
||||
xReady := TRUE;
|
||||
ELSE
|
||||
xReady := FALSE;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="FB_init" Id="{369c1d27-76e4-45f8-9dbe-03524d3389df}">
|
||||
@@ -145,8 +253,77 @@ END_VAR
|
||||
</Implementation>
|
||||
</Method>
|
||||
<LineIds Name="FB_Module">
|
||||
<LineId Id="248" Count="92" />
|
||||
<LineId Id="248" Count="7" />
|
||||
<LineId Id="456" Count="0" />
|
||||
<LineId Id="256" Count="22" />
|
||||
<LineId Id="457" Count="0" />
|
||||
<LineId Id="279" Count="22" />
|
||||
<LineId Id="458" Count="0" />
|
||||
<LineId Id="302" Count="22" />
|
||||
<LineId Id="459" Count="0" />
|
||||
<LineId Id="325" Count="15" />
|
||||
<LineId Id="188" Count="0" />
|
||||
<LineId Id="441" Count="0" />
|
||||
<LineId Id="436" Count="0" />
|
||||
<LineId Id="438" Count="1" />
|
||||
<LineId Id="437" Count="0" />
|
||||
<LineId Id="435" Count="0" />
|
||||
<LineId Id="465" Count="0" />
|
||||
<LineId Id="464" Count="0" />
|
||||
<LineId Id="466" Count="1" />
|
||||
<LineId Id="448" Count="0" />
|
||||
<LineId Id="469" Count="0" />
|
||||
<LineId Id="486" Count="0" />
|
||||
<LineId Id="483" Count="2" />
|
||||
<LineId Id="482" Count="0" />
|
||||
<LineId Id="468" Count="0" />
|
||||
<LineId Id="495" Count="0" />
|
||||
<LineId Id="491" Count="1" />
|
||||
<LineId Id="487" Count="0" />
|
||||
<LineId Id="494" Count="0" />
|
||||
<LineId Id="493" Count="0" />
|
||||
<LineId Id="444" Count="0" />
|
||||
<LineId Id="446" Count="1" />
|
||||
<LineId Id="445" Count="0" />
|
||||
<LineId Id="442" Count="0" />
|
||||
<LineId Id="440" Count="0" />
|
||||
<LineId Id="378" Count="3" />
|
||||
<LineId Id="387" Count="0" />
|
||||
<LineId Id="389" Count="0" />
|
||||
<LineId Id="393" Count="0" />
|
||||
<LineId Id="388" Count="0" />
|
||||
<LineId Id="404" Count="2" />
|
||||
<LineId Id="395" Count="0" />
|
||||
<LineId Id="394" Count="0" />
|
||||
<LineId Id="408" Count="1" />
|
||||
<LineId Id="407" Count="0" />
|
||||
<LineId Id="397" Count="0" />
|
||||
<LineId Id="396" Count="0" />
|
||||
<LineId Id="411" Count="1" />
|
||||
<LineId Id="410" Count="0" />
|
||||
<LineId Id="399" Count="0" />
|
||||
<LineId Id="398" Count="0" />
|
||||
<LineId Id="414" Count="1" />
|
||||
<LineId Id="413" Count="0" />
|
||||
<LineId Id="401" Count="0" />
|
||||
<LineId Id="400" Count="0" />
|
||||
<LineId Id="417" Count="1" />
|
||||
<LineId Id="416" Count="0" />
|
||||
<LineId Id="403" Count="0" />
|
||||
<LineId Id="402" Count="0" />
|
||||
<LineId Id="420" Count="1" />
|
||||
<LineId Id="419" Count="0" />
|
||||
<LineId Id="423" Count="0" />
|
||||
<LineId Id="422" Count="0" />
|
||||
<LineId Id="377" Count="0" />
|
||||
<LineId Id="449" Count="1" />
|
||||
<LineId Id="452" Count="0" />
|
||||
<LineId Id="460" Count="1" />
|
||||
<LineId Id="451" Count="0" />
|
||||
<LineId Id="453" Count="1" />
|
||||
<LineId Id="463" Count="0" />
|
||||
<LineId Id="462" Count="0" />
|
||||
<LineId Id="455" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_Module.FB_init">
|
||||
<LineId Id="7" Count="0" />
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
<POU Name="FB_String" Id="{46501225-f446-4674-bfed-3be64273e576}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_String
|
||||
VAR_INPUT
|
||||
// Enable
|
||||
xEnable : BOOL;
|
||||
|
||||
// Module 1 HMI interface
|
||||
stHMIInterface : ST_STRING_HMI_INTERFACE;
|
||||
|
||||
@@ -19,6 +22,21 @@ VAR_INPUT
|
||||
xConfirmAlarms : BOOL;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Current string voltage
|
||||
rCurrentVoltage : REAL;
|
||||
|
||||
// Module in shutdown segment discharge mode
|
||||
xInShutdownDischargeMode : BOOL;
|
||||
|
||||
// Module can be discharged during shutdown sequence
|
||||
xShutdownDischargeAllowed : BOOL;
|
||||
|
||||
// String ready
|
||||
xReady : BOOL;
|
||||
|
||||
// String completely off
|
||||
xOff : BOOL;
|
||||
|
||||
xError : BOOL;
|
||||
xWarning : BOOL;
|
||||
END_VAR
|
||||
@@ -27,15 +45,28 @@ VAR
|
||||
_fbModule2 : FB_Module(CONCAT(_sName, 'Module 2'));
|
||||
_fbModule3 : FB_Module(CONCAT(_sName, 'Module 3'));
|
||||
|
||||
// All modules are ready
|
||||
_xAllModulesReady : BOOL;
|
||||
|
||||
// All modules in shutdown discharge mode
|
||||
_xAllModulesInShutdownDischargeMode : BOOL;
|
||||
|
||||
// Flag for module balance checking
|
||||
_xBalanceOk : BOOL;
|
||||
|
||||
// String name
|
||||
_sName : STRING;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// ===============================
|
||||
<ST><![CDATA[// Reset error flag
|
||||
xError := FALSE;
|
||||
|
||||
// ===============================
|
||||
// Module 1
|
||||
// ===============================
|
||||
_fbModule1(
|
||||
xEnable := xEnable,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule1,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
@@ -55,6 +86,7 @@ END_IF
|
||||
// Module 2
|
||||
// ===============================
|
||||
_fbModule2(
|
||||
xEnable := xEnable,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule2,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
@@ -74,6 +106,7 @@ END_IF
|
||||
// Module 3
|
||||
// ===============================
|
||||
_fbModule3(
|
||||
xEnable := xEnable,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
stHMIInterface:= stHMIInterface.stHMIInterfaceModule3,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
@@ -86,6 +119,73 @@ END_IF
|
||||
|
||||
IF _fbModule3.xError THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Modules ready check
|
||||
// ===============================
|
||||
_xAllModulesReady := _fbModule1.xReady AND _fbModule2.xReady AND _fbModule3.xReady;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Modules in shutdown discharge mode
|
||||
// ===============================
|
||||
xInShutdownDischargeMode := _fbModule1.xInShutdownDischargeMode AND _fbModule2.xInShutdownDischargeMode AND _fbModule3.xInShutdownDischargeMode;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Units shutdown discharge allowed
|
||||
// ===============================
|
||||
xShutdownDischargeAllowed := _fbModule1.xShutdownDischargeAllowed AND _fbModule2.xShutdownDischargeAllowed AND _fbModule3.xShutdownDischargeAllowed;
|
||||
|
||||
|
||||
// ===============================
|
||||
// All modules off
|
||||
// ===============================
|
||||
xOff := _fbModule1.xOff AND _fbModule2.xOff AND _fbModule3.xOff;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Calculate module voltage
|
||||
// ===============================
|
||||
rCurrentVoltage := _fbModule1.rCurrentVoltage + _fbModule2.rCurrentVoltage + _fbModule3.rCurrentVoltage;
|
||||
|
||||
|
||||
// ===============================
|
||||
// String balance check
|
||||
// ===============================
|
||||
// Reset balance ok flag
|
||||
_xBalanceOk := TRUE;
|
||||
|
||||
// Test module 1 with module 2
|
||||
IF ABS(_fbModule1.rCurrentVoltage - _fbModule2.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageModulesInString THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test module 1 with module 3
|
||||
IF ABS(_fbModule1.rCurrentVoltage - _fbModule3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageModulesInString THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
// Test module 2 with module 3
|
||||
IF ABS(_fbModule2.rCurrentVoltage - _fbModule3.rCurrentVoltage) > GVL_CONFIG.rMaxAbsDiffVoltageModulesInString THEN
|
||||
_xBalanceOk := FALSE;
|
||||
END_IF
|
||||
|
||||
|
||||
// Signal an error if all units are ready and module is out of balance
|
||||
IF _xAllModulesReady AND (NOT _xBalanceOk) THEN
|
||||
xError := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// String ready validation check
|
||||
// ===============================
|
||||
IF _xAllModulesReady AND _xBalanceOk THEN
|
||||
xReady := TRUE;
|
||||
ELSE
|
||||
xReady := FALSE;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="FB_init" Id="{9e8494eb-1b40-4be9-91c8-810ecbdf7f0c}">
|
||||
@@ -102,9 +202,14 @@ END_VAR
|
||||
</Implementation>
|
||||
</Method>
|
||||
<LineIds Name="FB_String">
|
||||
<LineId Id="266" Count="0" />
|
||||
<LineId Id="268" Count="0" />
|
||||
<LineId Id="267" Count="0" />
|
||||
<LineId Id="69" Count="0" />
|
||||
<LineId Id="67" Count="1" />
|
||||
<LineId Id="47" Count="1" />
|
||||
<LineId Id="47" Count="0" />
|
||||
<LineId Id="140" Count="0" />
|
||||
<LineId Id="48" Count="0" />
|
||||
<LineId Id="50" Count="3" />
|
||||
<LineId Id="58" Count="0" />
|
||||
<LineId Id="62" Count="0" />
|
||||
@@ -112,10 +217,41 @@ END_VAR
|
||||
<LineId Id="66" Count="0" />
|
||||
<LineId Id="63" Count="0" />
|
||||
<LineId Id="59" Count="2" />
|
||||
<LineId Id="71" Count="17" />
|
||||
<LineId Id="71" Count="5" />
|
||||
<LineId Id="141" Count="0" />
|
||||
<LineId Id="77" Count="11" />
|
||||
<LineId Id="70" Count="0" />
|
||||
<LineId Id="90" Count="17" />
|
||||
<LineId Id="90" Count="5" />
|
||||
<LineId Id="142" Count="0" />
|
||||
<LineId Id="96" Count="11" />
|
||||
<LineId Id="89" Count="0" />
|
||||
<LineId Id="183" Count="5" />
|
||||
<LineId Id="245" Count="4" />
|
||||
<LineId Id="244" Count="0" />
|
||||
<LineId Id="261" Count="4" />
|
||||
<LineId Id="260" Count="0" />
|
||||
<LineId Id="270" Count="4" />
|
||||
<LineId Id="269" Count="0" />
|
||||
<LineId Id="197" Count="0" />
|
||||
<LineId Id="190" Count="3" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="199" Count="5" />
|
||||
<LineId Id="198" Count="0" />
|
||||
<LineId Id="209" Count="0" />
|
||||
<LineId Id="208" Count="0" />
|
||||
<LineId Id="230" Count="1" />
|
||||
<LineId Id="211" Count="0" />
|
||||
<LineId Id="232" Count="0" />
|
||||
<LineId Id="210" Count="0" />
|
||||
<LineId Id="234" Count="1" />
|
||||
<LineId Id="233" Count="0" />
|
||||
<LineId Id="213" Count="0" />
|
||||
<LineId Id="212" Count="0" />
|
||||
<LineId Id="237" Count="1" />
|
||||
<LineId Id="236" Count="0" />
|
||||
<LineId Id="215" Count="11" />
|
||||
<LineId Id="239" Count="1" />
|
||||
<LineId Id="214" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.FB_init">
|
||||
<LineId Id="7" Count="0" />
|
||||
|
||||
@@ -32,7 +32,16 @@ VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Unit ready
|
||||
xReady : BOOL;
|
||||
xReady : BOOL;
|
||||
|
||||
// Unit completely off
|
||||
xOff : BOOL := TRUE;
|
||||
|
||||
// Unit can be discharged during shutdown sequence
|
||||
xShutdownDischargeAllowed : BOOL;
|
||||
|
||||
// Unit in shutdown segment discharge mode
|
||||
xInShutdownDischargeMode : BOOL;
|
||||
|
||||
// Error active
|
||||
xError : BOOL;
|
||||
@@ -42,6 +51,9 @@ VAR_OUTPUT
|
||||
|
||||
// Warning confirmation still pending
|
||||
_xWarningConfirmPending : BOOL;
|
||||
|
||||
// Current Unit voltage
|
||||
rCurrentVoltage : REAL;
|
||||
END_VAR
|
||||
VAR
|
||||
// Check unit condition after some time during startup
|
||||
@@ -81,26 +93,26 @@ VAR
|
||||
_stPosolytValveTankOutletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0000;
|
||||
|
||||
_stPosolytValveTankOutletSIntlk : T_INTERLOCK;
|
||||
_stPosolytValveTankOutletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0011;
|
||||
_stPosolytValveTankOutletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
|
||||
// Valve negolyt tank outlet interlocks
|
||||
_stNegolytValveTankOutletPIntlk : T_INTERLOCK;
|
||||
_stNegolytValveTankOutletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0000;
|
||||
|
||||
_stNegolytValveTankOutletSIntlk : T_INTERLOCK;
|
||||
_stNegolytValveTankOutletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0011;
|
||||
_stNegolytValveTankOutletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
|
||||
// Pump posolyt inlet interlocks
|
||||
_stPosolytPumpInletPIntlk : T_INTERLOCK;
|
||||
_stPosolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
_stPosolytPumpInletSIntlk : T_INTERLOCK;
|
||||
_stPosolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0011;
|
||||
_stPosolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
|
||||
// Pump negolyt inlet interlocks
|
||||
_stNegolytPumpInletPIntlk : T_INTERLOCK;
|
||||
_stNegolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
_stNegolytPumpInletSIntlk : T_INTERLOCK;
|
||||
_stNegolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0011;
|
||||
_stNegolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
|
||||
|
||||
// Error active
|
||||
_xErrorActive : BOOL;
|
||||
@@ -108,6 +120,9 @@ VAR
|
||||
// Warning active
|
||||
_xWarningActive : BOOL;
|
||||
|
||||
// Shutdown discharge allowed voltage
|
||||
_rShutdownDischargeVoltageThreshold : REAL;
|
||||
|
||||
// Current state
|
||||
_iState: INT;
|
||||
|
||||
@@ -122,6 +137,12 @@ VAR
|
||||
|
||||
// Unit startup check timer
|
||||
_tonStartupCheck : TON;
|
||||
|
||||
// Enable voltage limit checks
|
||||
_xEnableVoltageLimitChecks : BOOL;
|
||||
|
||||
// Manual mode allowed flag
|
||||
_xReleaseManualMode : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -141,7 +162,7 @@ _stPosolytValveTankOutletSIntlk.0 := xEmergencyStopOk;
|
||||
|
||||
// Valve fb
|
||||
_fbPosolytValveTankOutlet(
|
||||
xReleaseManualMode:= TRUE,
|
||||
xReleaseManualMode:= _xReleaseManualMode,
|
||||
wProcessINTLK:= _stPosolytValveTankOutletPIntlk,
|
||||
wProcessINTLKUsed:= _stPosolytValveTankOutletPIntlkUsed,
|
||||
wSafetyINTLK:= _stPosolytValveTankOutletSIntlk,
|
||||
@@ -167,7 +188,7 @@ _stNegolytValveTankOutletSIntlk.0 := xEmergencyStopOk;
|
||||
|
||||
// Valve fb
|
||||
_fbNegolytValveTankOutlet(
|
||||
xReleaseManualMode:= TRUE,
|
||||
xReleaseManualMode:= _xReleaseManualMode,
|
||||
wProcessINTLK:= _stNegolytValveTankOutletPIntlk,
|
||||
wProcessINTLKUsed:= _stNegolytValveTankOutletPIntlkUsed,
|
||||
wSafetyINTLK:= _stNegolytValveTankOutletSIntlk,
|
||||
@@ -198,7 +219,7 @@ _stPosolytPumpInletPIntlk.0 := _fbPosolytValveTankOutlet.IsOpen;
|
||||
|
||||
// Valve fb
|
||||
_fbPosolytPumpInlet(
|
||||
xReleaseManualMode:= TRUE,
|
||||
xReleaseManualMode:= _xReleaseManualMode,
|
||||
wProcessINTLK:= _stPosolytPumpInletPIntlk,
|
||||
wProcessINTLKUsed:= _stPosolytPumpInletPIntlkUsed,
|
||||
wSafetyINTLK:= _stPosolytPumpInletSIntlk,
|
||||
@@ -237,7 +258,7 @@ _stNegolytPumpInletPIntlk.0 := _fbNegolytValveTankOutlet.IsOpen;
|
||||
|
||||
// Valve fb
|
||||
_fbNegolytPumpInlet(
|
||||
xReleaseManualMode:= TRUE,
|
||||
xReleaseManualMode:= _xReleaseManualMode,
|
||||
wProcessINTLK:= _stNegolytPumpInletPIntlk,
|
||||
wProcessINTLKUsed:= _stNegolytPumpInletPIntlkUsed,
|
||||
wSafetyINTLK:= _stNegolytPumpInletSIntlk,
|
||||
@@ -262,14 +283,14 @@ END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Pressure sensors posolyt segment inlet
|
||||
// Pressure sensor posolyt segment inlet
|
||||
// ===============================
|
||||
_fbPressurePosolytSegmentInlet(
|
||||
stScalingConfig:= stUnitConfig.stConfigPosolytPressureSegmentInlet,
|
||||
stEWConfig:= stUnitConfig.stEWLPosolytPressureSegmentInlet,
|
||||
stEWDelayConfig:= stUnitConfig.stEWDPosolytPressureSegmentInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbPosolytPumpInlet.IsRunning AND _fbPosolytPumpInlet.xInTarget,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface => stHMIInterface.stPosolytPressureSegmentInlet);
|
||||
@@ -293,7 +314,7 @@ _fbPressureNegolytSegmentInlet(
|
||||
stEWConfig:= stUnitConfig.stEWLNegolytPressureSegmentInlet,
|
||||
stEWDelayConfig:= stUnitConfig.stEWDNegolytPressureSegmentInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbNegolytPumpInlet.IsRunning AND _fbNegolytPumpInlet.xInTarget,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface => stHMIInterface.stNegolytPressureSegmentInlet);
|
||||
@@ -310,17 +331,107 @@ END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Voltage segment
|
||||
// Pressure sensors posolyt tank inlet
|
||||
// ===============================
|
||||
_fbVoltageSegment(
|
||||
stScalingConfig:= ,
|
||||
stEWConfig:= ,
|
||||
stEWDelayConfig:= ,
|
||||
_fbPressurePosolytTankInlet(
|
||||
stScalingConfig:= stUnitConfig.stConfigPosolytPressureTankInlet,
|
||||
stEWConfig:= stUnitConfig.stEWLPosolytPressureTankInlet,
|
||||
stEWDelayConfig:= stUnitConfig.stEWDPosolytPressureTankInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbPosolytPumpInlet.IsRunning AND _fbPosolytPumpInlet.xInTarget,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface => stHMIInterface.stPosolytPressureTankInlet);
|
||||
|
||||
// Set error active if fb has error
|
||||
IF _fbPressurePosolytTankInlet.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Set warning if fb has warning
|
||||
IF _fbPressurePosolytTankInlet.xWarning THEN
|
||||
_xWarningActive := TRUE;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Pressure sensors negolyt tank inlet
|
||||
// ===============================
|
||||
_fbPressureNegolytTankInlet(
|
||||
stScalingConfig:= stUnitConfig.stConfigNegolytPressureTankInlet,
|
||||
stEWConfig:= stUnitConfig.stEWLNegolytPressureTankInlet,
|
||||
stEWDelayConfig:= stUnitConfig.stEWDNegolytPressureTankInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbNegolytPumpInlet.IsRunning AND _fbNegolytPumpInlet.xInTarget,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface => stHMIInterface.stNegolytPressureTankInlet);
|
||||
|
||||
// Set error active if fb has error
|
||||
IF _fbPressureNegolytTankInlet.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Set warning if fb has warning
|
||||
IF _fbPressureNegolytTankInlet.xWarning THEN
|
||||
_xWarningActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor posolyt tank inlet
|
||||
// ===============================
|
||||
_fbTempSensorPosolyt(
|
||||
stScalingConfig:= stUnitConfig.stConfigPosolytTempTankInlet,
|
||||
stEWConfig:= GVL_CONFIG.stUnitConfig.stEWLPosolytTempTankInlet,
|
||||
stEWDelayConfig:= GVL_CONFIG.stUnitConfig.stEWDPosolytTempTankInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface=> stHMIInterface.stVoltageSegment);
|
||||
stHMIInterface=> stHMIInterface.stPosolytTempTankInlet);
|
||||
|
||||
IF _fbTempSensorPosolyt.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
IF _fbTempSensorPosolyt.xWarning THEN
|
||||
_xWarningActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Temperature sensor negolyt tank inlet
|
||||
// ===============================
|
||||
_fbTempSensorNegolyt(
|
||||
stScalingConfig:= stUnitConfig.stConfigNegolytTempTankInlet,
|
||||
stEWConfig:= GVL_CONFIG.stUnitConfig.stEWLNegolytTempTankInlet,
|
||||
stEWDelayConfig:= GVL_CONFIG.stUnitConfig.stEWDNegolytTempTankInlet,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface=> stHMIInterface.stNegolytTempTankInlet);
|
||||
|
||||
IF _fbTempSensorNegolyt.xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
IF _fbTempSensorNegolyt.xWarning THEN
|
||||
_xWarningActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Voltage segment
|
||||
// ===============================
|
||||
_fbVoltageSegment(
|
||||
stScalingConfig:= GVL_CONFIG.stUnitConfig.stConfigVoltageSegment,
|
||||
stEWConfig:= GVL_CONFIG.stUnitConfig.stEWLVoltageSegment,
|
||||
stEWDelayConfig:= GVL_CONFIG.stUnitConfig.stEWDVoltageSegment,
|
||||
xReleaseErrors:= xReleaseErrors,
|
||||
xReleaseLimitErrors:= xReleaseLimitErrors AND _xEnableVoltageLimitChecks,
|
||||
xReleaseHardwareErrors:= xReleaseErrors,
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
stHMIInterface=> stHMIInterface.stVoltageSegment,
|
||||
rScaledValue => rCurrentVoltage);
|
||||
|
||||
// Set error active if fb has error
|
||||
IF _fbVoltageSegment.xError THEN
|
||||
@@ -351,30 +462,36 @@ IF _fbNotAllAutomaticAlarm.bRaised AND _xAllComponentsInAutomatic THEN
|
||||
_fbNotAllAutomaticAlarm.Clear(0, TRUE);
|
||||
END_IF
|
||||
|
||||
// Calculate shutdown discharge threshold
|
||||
_rShutdownDischargeVoltageThreshold := GVL_CONFIG.rMinimumUnitVoltage + GVL_CONFIG.rDeltaUnitVoltageShutdownDischarge;
|
||||
|
||||
// ===============================
|
||||
// Run state machine for startup and shutdown
|
||||
// ===============================
|
||||
CASE _iState OF
|
||||
0: // Off
|
||||
IF xEnable AND _xAllComponentsInAutomatic AND (NOT _xErrorActive) THEN
|
||||
_xReleaseManualMode := FALSE;
|
||||
_iState := 10;
|
||||
END_IF
|
||||
|
||||
10: // Open all valves
|
||||
_fbPosolytValveTankOutlet.ReqAutomaticOpen();
|
||||
_fbNegolytValveTankOutlet.ReqAutomaticOpen();
|
||||
xOff := FALSE;
|
||||
_iState := 15;
|
||||
|
||||
15: // Wait for all valves to be open
|
||||
IF _fbPosolytValveTankOutlet.IsOpen AND _fbNegolytValveTankOutlet.IsOpen THEN
|
||||
IF NOT _fbPosolytValveTankOutlet.xError AND _fbNegolytValveTankOutlet.xError THEN
|
||||
IF (NOT _fbPosolytValveTankOutlet.xError) AND (NOT _fbNegolytValveTankOutlet.xError) THEN
|
||||
_iState := 20;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// If enable signal is lost, or there is an error, goto shutdown
|
||||
IF (NOT xEnable) OR _xErrorActive THEN
|
||||
_iState := 40;
|
||||
_xReleaseManualMode := TRUE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
20: // Start pumps
|
||||
@@ -397,11 +514,13 @@ CASE _iState OF
|
||||
|
||||
// After some time, check if all values are ok
|
||||
IF _tonStartupCheck.Q THEN
|
||||
_tonStartupCheck(In := FALSE);
|
||||
// Check for minimum unit voltage
|
||||
IF _fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage AND
|
||||
NOT _xErrorActive AND
|
||||
NOT _xWarningActive THEN
|
||||
IF (_fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage)
|
||||
AND NOT _xErrorActive
|
||||
AND NOT _xWarningActive THEN
|
||||
xReady := TRUE;
|
||||
_xEnableVoltageLimitChecks := TRUE;
|
||||
_iState := 35;
|
||||
ELSE
|
||||
_iState := 40;
|
||||
@@ -414,9 +533,15 @@ CASE _iState OF
|
||||
END_IF
|
||||
|
||||
35: // Unit in enabled state
|
||||
IF (NOT xEnable) OR _xErrorActive THEN
|
||||
IF (NOT xEnable) AND NOT _xErrorActive THEN
|
||||
_xEnableVoltageLimitChecks := FALSE;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
// Goto error shutdown if an error occured
|
||||
IF _xErrorActive THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
40: // Close all valves
|
||||
_fbNegolytValveTankOutlet.ReqAutomaticClose();
|
||||
@@ -425,6 +550,7 @@ CASE _iState OF
|
||||
|
||||
45: // Wait for valves to be closed
|
||||
IF _fbNegolytValveTankOutlet.IsClosed AND _fbPosolytValveTankOutlet.IsClosed THEN
|
||||
xInShutdownDischargeMode := TRUE;
|
||||
_iState := 50;
|
||||
END_IF
|
||||
|
||||
@@ -440,12 +566,22 @@ CASE _iState OF
|
||||
END_IF
|
||||
|
||||
50: // Wait for unit voltage to drop below a certain threshold
|
||||
IF (_fbVoltageSegment.rScaledValue > _rShutdownDischargeVoltageThreshold) THEN
|
||||
xShutdownDischargeAllowed := TRUE;
|
||||
ELSE
|
||||
xShutdownDischargeAllowed := FALSE;
|
||||
END_IF
|
||||
|
||||
IF (_fbVoltageSegment.rScaledValue <= GVL_CONFIG.rPumpshutoffThreshold) THEN
|
||||
xShutdownDischargeAllowed := FALSE;
|
||||
xInShutdownDischargeMode := FALSE;
|
||||
_iState := 60;
|
||||
END_IF
|
||||
|
||||
// Check for restart condition
|
||||
IF xEnable AND (NOT _xErrorActive) THEN
|
||||
xShutdownDischargeAllowed := FALSE;
|
||||
xInShutdownDischargeMode := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -456,10 +592,10 @@ CASE _iState OF
|
||||
|
||||
65: // Wait for pumps to be stopped
|
||||
IF _fbPosolytPumpInlet.IsStopped AND _fbNegolytPumpInlet.IsStopped THEN
|
||||
IF _xErrorActive THEN
|
||||
xOff := TRUE;
|
||||
_xReleaseManualMode := TRUE;
|
||||
IF NOT _xErrorActive THEN
|
||||
_iState := 1000;
|
||||
ELSE
|
||||
_iState := 0;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
@@ -467,8 +603,25 @@ CASE _iState OF
|
||||
IF xEnable AND (NOT _xErrorActive) THEN
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
// Check for error
|
||||
IF _xErrorActive THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
1000: // Alarm active
|
||||
1000: // Error shutdown
|
||||
_fbNegolytValveTankOutlet.ReqAutomaticClose();
|
||||
_fbPosolytValveTankOutlet.ReqAutomaticClose();
|
||||
_fbPosolytPumpInlet.ReqAutomaticStop();
|
||||
_fbNegolytPumpInlet.ReqAutomaticStop();
|
||||
_xEnableVoltageLimitChecks := FALSE;
|
||||
xShutdownDischargeAllowed := FALSE;
|
||||
xInShutdownDischargeMode := FALSE;
|
||||
xReady := FALSE;
|
||||
xOff := TRUE;
|
||||
_iState := 1001;
|
||||
|
||||
1001: // Alarm active
|
||||
// Only allow reset when enable is deactivated to avoid an
|
||||
// automatic restart of the unit
|
||||
IF (NOT _xErrorActive) AND (NOT xEnable) THEN
|
||||
@@ -505,29 +658,107 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
<LineId Id="4263" Count="102" />
|
||||
<LineId Id="4619" Count="0" />
|
||||
<LineId Id="4367" Count="46" />
|
||||
<LineId Id="4621" Count="22" />
|
||||
<LineId Id="5099" Count="0" />
|
||||
<LineId Id="5101" Count="2" />
|
||||
<LineId Id="5095" Count="0" />
|
||||
<LineId Id="5124" Count="17" />
|
||||
<LineId Id="5104" Count="1" />
|
||||
<LineId Id="5096" Count="2" />
|
||||
<LineId Id="5094" Count="0" />
|
||||
<LineId Id="5106" Count="17" />
|
||||
<LineId Id="4621" Count="0" />
|
||||
<LineId Id="5143" Count="2" />
|
||||
<LineId Id="5142" Count="0" />
|
||||
<LineId Id="5151" Count="0" />
|
||||
<LineId Id="5153" Count="2" />
|
||||
<LineId Id="5159" Count="3" />
|
||||
<LineId Id="5150" Count="0" />
|
||||
<LineId Id="5190" Count="3" />
|
||||
<LineId Id="5195" Count="0" />
|
||||
<LineId Id="5194" Count="0" />
|
||||
<LineId Id="5196" Count="1" />
|
||||
<LineId Id="5147" Count="2" />
|
||||
<LineId Id="5146" Count="0" />
|
||||
<LineId Id="5198" Count="15" />
|
||||
<LineId Id="5170" Count="0" />
|
||||
<LineId Id="4622" Count="12" />
|
||||
<LineId Id="4937" Count="0" />
|
||||
<LineId Id="4635" Count="8" />
|
||||
<LineId Id="4620" Count="0" />
|
||||
<LineId Id="4644" Count="1" />
|
||||
<LineId Id="4414" Count="0" />
|
||||
<LineId Id="4647" Count="0" />
|
||||
<LineId Id="4646" Count="0" />
|
||||
<LineId Id="4416" Count="17" />
|
||||
<LineId Id="4444" Count="26" />
|
||||
<LineId Id="4476" Count="33" />
|
||||
<LineId Id="4511" Count="17" />
|
||||
<LineId Id="4416" Count="13" />
|
||||
<LineId Id="5234" Count="0" />
|
||||
<LineId Id="5233" Count="0" />
|
||||
<LineId Id="5235" Count="0" />
|
||||
<LineId Id="4430" Count="3" />
|
||||
<LineId Id="4444" Count="2" />
|
||||
<LineId Id="4941" Count="0" />
|
||||
<LineId Id="4447" Count="5" />
|
||||
<LineId Id="5249" Count="0" />
|
||||
<LineId Id="4453" Count="10" />
|
||||
<LineId Id="5076" Count="0" />
|
||||
<LineId Id="4464" Count="6" />
|
||||
<LineId Id="4476" Count="15" />
|
||||
<LineId Id="4790" Count="0" />
|
||||
<LineId Id="4492" Count="1" />
|
||||
<LineId Id="4926" Count="1" />
|
||||
<LineId Id="4496" Count="0" />
|
||||
<LineId Id="4794" Count="0" />
|
||||
<LineId Id="4497" Count="12" />
|
||||
<LineId Id="4795" Count="0" />
|
||||
<LineId Id="4511" Count="1" />
|
||||
<LineId Id="5078" Count="0" />
|
||||
<LineId Id="5083" Count="0" />
|
||||
<LineId Id="5079" Count="0" />
|
||||
<LineId Id="5082" Count="0" />
|
||||
<LineId Id="5081" Count="0" />
|
||||
<LineId Id="4513" Count="7" />
|
||||
<LineId Id="5239" Count="0" />
|
||||
<LineId Id="4521" Count="7" />
|
||||
<LineId Id="4653" Count="0" />
|
||||
<LineId Id="4655" Count="2" />
|
||||
<LineId Id="4654" Count="0" />
|
||||
<LineId Id="4529" Count="4" />
|
||||
<LineId Id="4529" Count="1" />
|
||||
<LineId Id="5220" Count="0" />
|
||||
<LineId Id="5223" Count="0" />
|
||||
<LineId Id="5225" Count="1" />
|
||||
<LineId Id="5224" Count="0" />
|
||||
<LineId Id="5221" Count="0" />
|
||||
<LineId Id="4531" Count="0" />
|
||||
<LineId Id="5228" Count="0" />
|
||||
<LineId Id="5242" Count="0" />
|
||||
<LineId Id="4532" Count="1" />
|
||||
<LineId Id="4658" Count="0" />
|
||||
<LineId Id="4660" Count="2" />
|
||||
<LineId Id="4660" Count="1" />
|
||||
<LineId Id="5229" Count="0" />
|
||||
<LineId Id="5243" Count="0" />
|
||||
<LineId Id="4662" Count="0" />
|
||||
<LineId Id="4659" Count="0" />
|
||||
<LineId Id="4569" Count="0" />
|
||||
<LineId Id="4535" Count="12" />
|
||||
<LineId Id="4535" Count="6" />
|
||||
<LineId Id="5251" Count="0" />
|
||||
<LineId Id="4944" Count="0" />
|
||||
<LineId Id="4542" Count="1" />
|
||||
<LineId Id="4546" Count="1" />
|
||||
<LineId Id="4663" Count="0" />
|
||||
<LineId Id="4665" Count="2" />
|
||||
<LineId Id="4664" Count="0" />
|
||||
<LineId Id="4548" Count="6" />
|
||||
<LineId Id="5252" Count="4" />
|
||||
<LineId Id="4548" Count="0" />
|
||||
<LineId Id="5084" Count="0" />
|
||||
<LineId Id="5086" Count="1" />
|
||||
<LineId Id="5089" Count="1" />
|
||||
<LineId Id="5093" Count="0" />
|
||||
<LineId Id="5227" Count="0" />
|
||||
<LineId Id="5240" Count="0" />
|
||||
<LineId Id="5092" Count="0" />
|
||||
<LineId Id="5258" Count="0" />
|
||||
<LineId Id="5091" Count="0" />
|
||||
<LineId Id="5085" Count="0" />
|
||||
<LineId Id="4549" Count="5" />
|
||||
<LineId Id="4556" Count="6" />
|
||||
<LineId Id="2754" Count="0" />
|
||||
</LineIds>
|
||||
|
||||
@@ -4,25 +4,325 @@
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
_xEmergencyStopOk AT %I* : BOOL;
|
||||
_xReleaseErrors : BOOL;
|
||||
_xReleaseLimitsErrors : BOOL;
|
||||
_xReleaseErrors : BOOL := TRUE;
|
||||
_xReleaseLimitsErrors : BOOL := TRUE;
|
||||
_xConfirmAlarms : BOOL;
|
||||
_xEnableString : BOOL;
|
||||
_xEnableInverter : BOOL;
|
||||
_fbString : FB_String('String 1');
|
||||
_fbInverter : FB_PowerSupplySunspec;
|
||||
|
||||
_iState : INT;
|
||||
|
||||
// Internal inverter power
|
||||
_rPowerInverter : REAL;
|
||||
|
||||
// Flag for zero power indication
|
||||
_xNoPowerRequested : BOOL;
|
||||
|
||||
// Startup delay for error release during plc startup
|
||||
_tonStartupDelay : TON := (PT := T#10S);
|
||||
|
||||
// Small delay for inverter shutdown
|
||||
_tonBeginShutdown : TON := (PT := T#10S);
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_fbString(
|
||||
<ST><![CDATA[// Dely release of errors during PLC startup phase
|
||||
_tonStartupDelay(IN := TRUE);
|
||||
|
||||
// Call string 1
|
||||
_fbString(
|
||||
xEnable := _xEnableString,
|
||||
stHMIInterface:= ,
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
xError=> ,
|
||||
xWarning=> );]]></ST>
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xConfirmAlarms:= _xConfirmAlarms);
|
||||
|
||||
|
||||
// Call inverter
|
||||
//_fbInverter(
|
||||
// sInverterIPAddr:= GVL_CONFIG.sInverterIp,
|
||||
// xEnable:= _xEnableInverter,
|
||||
// rPower:= _rPowerInverter,
|
||||
// xReset:= _xConfirmAlarms,
|
||||
// rMaxBattPower:= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower),
|
||||
// xCloseDCRelais=> ,
|
||||
// rActDCCurrent=> ,
|
||||
// rActDCVoltage=> ,
|
||||
// xError=> ,
|
||||
// xActive=> );
|
||||
|
||||
|
||||
// ===============================
|
||||
// State machine
|
||||
// ===============================
|
||||
CASE _iState OF
|
||||
0: // Idle
|
||||
// Wait for power command
|
||||
IF ABS(GVL_MODBUS.stModbusEMSComm.diSetpointActivePower) > GVL_CONFIG.diMinimumAbsPowerForEnable THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
5: // Check if power command is within limits
|
||||
IF GVL_MODBUS.stModbusEMSComm.diSetpointActivePower < GVL_CONFIG.diMaxStringDischargePower
|
||||
AND GVL_MODBUS.stModbusEMSComm.diSetpointActivePower > GVL_CONFIG.diMaxStringChargingPower THEN
|
||||
_xEnableString := TRUE;
|
||||
_iState := 10;
|
||||
ELSE
|
||||
// Set error bitmap flag
|
||||
GVL_MODBUS.stModbusEMSComm.lwErrorBitmap.0 := 1;
|
||||
|
||||
// Goto error state
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
10: // Wait for string to be ready
|
||||
IF _fbString.xReady AND (NOT _fbString.xError) THEN
|
||||
_iState := 20;
|
||||
END_IF
|
||||
|
||||
20: // Start main inverter with zero power
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := TRUE;
|
||||
_iState := 25;
|
||||
|
||||
25: // Wait for inverter to be ready
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
GVL_MODBUS.stModbusEMSComm.eBatteryStatus := E_BATTERY_STATUS.ACTIVE;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _fbString.xError OR _fbInverter.xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
30: // String and inverter enabled
|
||||
// Set inverter power to modbus requested power
|
||||
_rPowerInverter := DINT_TO_REAL(GVL_MODBUS.stModbusEMSComm.diSetpointActivePower);
|
||||
|
||||
// Check if the battery should still be active
|
||||
IF (GVL_MODBUS.stModbusEMSComm.diSetpointActivePower = 0) THEN
|
||||
_xNoPowerRequested := TRUE;
|
||||
ELSE
|
||||
_xNoPowerRequested := FALSE;
|
||||
END_IF
|
||||
|
||||
// Set battery status
|
||||
IF GVL_MODBUS.stModbusEMSComm.diSetpointActivePower > 0 THEN
|
||||
GVL_MODBUS.stModbusEMSComm.eChargeStatus := E_CHARGE_STATUS.DISCHARGING;
|
||||
ELSIF GVL_MODBUS.stModbusEMSComm.diSetpointActivePower < 0 THEN
|
||||
GVL_MODBUS.stModbusEMSComm.eChargeStatus := E_CHARGE_STATUS.CHARGING;
|
||||
ELSE
|
||||
GVL_MODBUS.stModbusEMSComm.eChargeStatus := E_CHARGE_STATUS.UNDEFINED;
|
||||
END_IF
|
||||
|
||||
// Add small delay before shutdown by EMS is detected
|
||||
_tonBeginShutdown(IN := _xNoPowerRequested);
|
||||
|
||||
// shutdown triggered from EMS
|
||||
IF _tonBeginShutdown.Q THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
// Start string shutdown
|
||||
_xEnableString := FALSE;
|
||||
_iState := 35;
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery fully charged
|
||||
IF GVL_MODBUS.stModbusEMSComm.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_fbString.rCurrentVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
// Start string shutdown
|
||||
_xEnableString := FALSE;
|
||||
|
||||
// Change battery status
|
||||
GVL_MODBUS.stModbusEMSComm.eChargeStatus := E_CHARGE_STATUS.FULL;
|
||||
|
||||
_iState := 35;
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery empty
|
||||
IF GVL_MODBUS.stModbusEMSComm.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND (_fbString.rCurrentVoltage <= GVL_CONFIG.rStringEmptyVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
// Start string shutdown
|
||||
_xEnableString := FALSE;
|
||||
|
||||
// Change battery status
|
||||
GVL_MODBUS.stModbusEMSComm.eChargeStatus := E_CHARGE_STATUS.FULL;
|
||||
|
||||
_iState := 35;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _fbString.xError OR _fbInverter.xError THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
35: // Wait for string to be in shutdown discharge mode
|
||||
IF _fbString.xInShutdownDischargeMode THEN
|
||||
// Check if we are allowed to discharge during shutdown with inverter
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_iState := 40;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _fbString.xError OR _fbInverter.xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
40: // Wait for inverter discharge done
|
||||
IF _fbString.xShutdownDischargeAllowed THEN
|
||||
_rPowerInverter := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _fbString.xError OR _fbInverter.xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
IF (NOT _fbString.xInShutdownDischargeMode) AND _fbString.xOff THEN
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _fbString.xError OR _fbInverter.xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverter := 0.0;
|
||||
GVL_MODBUS.stModbusEMSComm.eBatteryStatus := E_BATTERY_STATUS.ERROR;
|
||||
_iState := 1010;
|
||||
|
||||
1010: // Wait for reset from error state
|
||||
IF (GVL_MODBUS.stModbusEMSComm.diSetpointActivePower = 0) AND (NOT _fbString.xError) AND (NOT _fbInverter.xError) THEN
|
||||
// Reset modbus error register
|
||||
GVL_MODBUS.stModbusEMSComm.lwErrorBitmap := 0;
|
||||
|
||||
// Reset modbus error flag
|
||||
GVL_MODBUS.stModbusEMSComm.eBatteryStatus := E_BATTERY_STATUS.OFF;
|
||||
|
||||
// Goto init state
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
END_CASE
|
||||
|
||||
|
||||
// Reset alarm confirmation
|
||||
IF _xConfirmAlarms THEN
|
||||
_xConfirmAlarms := FALSE;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="MAIN">
|
||||
<LineId Id="7" Count="6" />
|
||||
<LineId Id="2" Count="0" />
|
||||
<LineId Id="126" Count="55" />
|
||||
<LineId Id="218" Count="0" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="304" Count="0" />
|
||||
<LineId Id="207" Count="2" />
|
||||
<LineId Id="314" Count="0" />
|
||||
<LineId Id="210" Count="2" />
|
||||
<LineId Id="305" Count="1" />
|
||||
<LineId Id="308" Count="0" />
|
||||
<LineId Id="215" Count="0" />
|
||||
<LineId Id="219" Count="1" />
|
||||
<LineId Id="222" Count="0" />
|
||||
<LineId Id="221" Count="0" />
|
||||
<LineId Id="223" Count="1" />
|
||||
<LineId Id="234" Count="1" />
|
||||
<LineId Id="237" Count="1" />
|
||||
<LineId Id="236" Count="0" />
|
||||
<LineId Id="309" Count="3" />
|
||||
<LineId Id="315" Count="1" />
|
||||
<LineId Id="360" Count="1" />
|
||||
<LineId Id="313" Count="0" />
|
||||
<LineId Id="317" Count="0" />
|
||||
<LineId Id="241" Count="0" />
|
||||
<LineId Id="240" Count="0" />
|
||||
<LineId Id="239" Count="0" />
|
||||
<LineId Id="327" Count="0" />
|
||||
<LineId Id="242" Count="1" />
|
||||
<LineId Id="262" Count="0" />
|
||||
<LineId Id="264" Count="0" />
|
||||
<LineId Id="261" Count="0" />
|
||||
<LineId Id="263" Count="0" />
|
||||
<LineId Id="265" Count="0" />
|
||||
<LineId Id="260" Count="0" />
|
||||
<LineId Id="245" Count="0" />
|
||||
<LineId Id="244" Count="0" />
|
||||
<LineId Id="328" Count="0" />
|
||||
<LineId Id="330" Count="2" />
|
||||
<LineId Id="339" Count="0" />
|
||||
<LineId Id="338" Count="0" />
|
||||
<LineId Id="333" Count="3" />
|
||||
<LineId Id="340" Count="3" />
|
||||
<LineId Id="337" Count="0" />
|
||||
<LineId Id="329" Count="0" />
|
||||
<LineId Id="344" Count="1" />
|
||||
<LineId Id="347" Count="12" />
|
||||
<LineId Id="346" Count="0" />
|
||||
<LineId Id="246" Count="2" />
|
||||
<LineId Id="251" Count="0" />
|
||||
<LineId Id="249" Count="1" />
|
||||
<LineId Id="256" Count="1" />
|
||||
<LineId Id="266" Count="0" />
|
||||
<LineId Id="296" Count="0" />
|
||||
<LineId Id="290" Count="0" />
|
||||
<LineId Id="267" Count="0" />
|
||||
<LineId Id="291" Count="0" />
|
||||
<LineId Id="294" Count="1" />
|
||||
<LineId Id="292" Count="1" />
|
||||
<LineId Id="268" Count="0" />
|
||||
<LineId Id="258" Count="0" />
|
||||
<LineId Id="269" Count="1" />
|
||||
<LineId Id="272" Count="0" />
|
||||
<LineId Id="259" Count="0" />
|
||||
<LineId Id="273" Count="3" />
|
||||
<LineId Id="278" Count="3" />
|
||||
<LineId Id="277" Count="0" />
|
||||
<LineId Id="285" Count="0" />
|
||||
<LineId Id="287" Count="2" />
|
||||
<LineId Id="286" Count="0" />
|
||||
<LineId Id="282" Count="1" />
|
||||
<LineId Id="300" Count="0" />
|
||||
<LineId Id="302" Count="1" />
|
||||
<LineId Id="301" Count="0" />
|
||||
<LineId Id="297" Count="2" />
|
||||
<LineId Id="284" Count="0" />
|
||||
<LineId Id="183" Count="2" />
|
||||
<LineId Id="216" Count="1" />
|
||||
<LineId Id="186" Count="6" />
|
||||
<LineId Id="252" Count="1" />
|
||||
<LineId Id="255" Count="0" />
|
||||
<LineId Id="254" Count="0" />
|
||||
<LineId Id="193" Count="9" />
|
||||
<LineId Id="25" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
@@ -268,7 +268,7 @@ CASE _iState OF
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 40;
|
||||
// Reading a register with scaling factor = value * 10^SF
|
||||
_rWMax := _iWMax * EXPT(10,_iWMaxSF);
|
||||
_rWMax := LREAL_TO_REAL(_iWMax * EXPT(10,_iWMaxSF));
|
||||
|
||||
// Calculate power to write to register
|
||||
_iWMaxLimPct := LREAL_TO_INT(rPower * EXPT(10,_iWMaxLimPctSF) / _rWMax);
|
||||
@@ -444,8 +444,8 @@ CASE _iState OF
|
||||
// If there was no error and the converter has no error continue
|
||||
IF NOT _fbReadRegister.bError THEN
|
||||
_iState := 65;
|
||||
rActDCCurrent := WORD_TO_UINT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1]));
|
||||
rActDCVoltage := WORD_TO_UINT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3]));
|
||||
rActDCCurrent := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[0]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[1])));
|
||||
rActDCVoltage := LREAL_TO_REAL(WORD_TO_UINT(_awCurrentDCValues[2]) * EXPT(10,WORD_TO_INT(_awCurrentDCValues[3])));
|
||||
ELSE
|
||||
// Read error register
|
||||
_iState := 1000;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user