First string implemented

This commit is contained in:
Matthias Heisig
2024-04-18 08:32:21 +02:00
parent 9ce3522a70
commit b95033a155
64 changed files with 14526 additions and 6024 deletions

View File

@@ -9,6 +9,9 @@ VAR_INPUT
// HMI interface
stHMIInterface : REFERENCE TO ST_UNIT_HMI_INTERFACE;
// Components shortage workaround
xVoltageSensorIs1500V : BOOL;
// Start unit
xEnable : BOOL;
@@ -18,12 +21,6 @@ VAR_INPUT
// Emergency stop ok
xEmergencyStopOk : BOOL;
// Setpoint posolyt pump inlet
rSetpointPosolytPumpInlet : REAL;
// Setpoint negolyt pump inlet
rSetpointNegolytPumpInlet : REAL;
// Release alarms
xReleaseErrors : BOOL;
@@ -72,30 +69,30 @@ VAR
// _timUnitStartupWaitTime : TIME := T#10S;
// Valves posolyt
_fbPosolytValveTankOutlet : FB_Valve('Posolyt tank outlet');
_fbPosolytValveTankOutlet : FB_Valve(CONCAT(_sName, ' - Posolyt tank outlet'));
// Valves negolyt
_fbNegolytValveTankOutlet : FB_Valve('Negolyt tank outlet');
_fbNegolytValveTankOutlet : FB_Valve(CONCAT(_sName, ' - Negolyt tank outlet'));
// Pumps posolyt
_fbPosolytPumpInlet : FB_MotorAnalog('Posolyt segment inlet');
_fbPosolytPumpInlet : FB_MotorAnalog(CONCAT(_sName, ' - Posolyt segment inlet'));
// Pumps negolyt
_fbNegolytPumpInlet : FB_MotorAnalog('Negolyt segment inlet');
_fbNegolytPumpInlet : FB_MotorAnalog(CONCAT(_sName, ' - Negolyt segment inlet'));
// Pressure sensors posolyt
_fbPressurePosolytSegmentInlet : FB_AnalogInput('P1_P');
_fbPressurePosolytTankInlet : FB_AnalogInput('P3_P');
_fbPressurePosolytSegmentInlet : FB_AnalogInput(CONCAT(_sName, ' - P1_P'));
_fbPressurePosolytTankInlet : FB_AnalogInput(CONCAT(_sName, ' - P3_P'));
// Pressure sensors negolyt
_fbPressureNegolytSegmentInlet : FB_AnalogInput('P1_N');
_fbPressureNegolytTankInlet : FB_AnalogInput('P3_N');
_fbPressureNegolytSegmentInlet : FB_AnalogInput(CONCAT(_sName, ' - P1_N'));
_fbPressureNegolytTankInlet : FB_AnalogInput(CONCAT(_sName, ' - P3_N'));
// Temperature sensor posolyt
_fbTempSensorPosolyt : FB_AnalogInput('T1_P');
_fbTempSensorPosolyt : FB_AnalogInput(CONCAT(Name, ' - T1_P'));
// Temperature sensor negolyt
_fbTempSensorNegolyt : FB_AnalogInput('T1_N');
_fbTempSensorNegolyt : FB_AnalogInput(CONCAT(Name, ' - T1_N'));
// Unit voltage
_fbVoltageSegment : FB_AnalogInput('Voltage');
@@ -116,13 +113,13 @@ VAR
// Pump posolyt inlet interlocks
_stPosolytPumpInletPIntlk : T_INTERLOCK;
_stPosolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0000;
_stPosolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
_stPosolytPumpInletSIntlk : T_INTERLOCK;
_stPosolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
// Pump negolyt inlet interlocks
_stNegolytPumpInletPIntlk : T_INTERLOCK;
_stNegolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0000;
_stNegolytPumpInletPIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
_stNegolytPumpInletSIntlk : T_INTERLOCK;
_stNegolytPumpInletSIntlkUsed : T_INTERLOCK := 2#0000_0000_0000_0001;
@@ -160,10 +157,26 @@ VAR
_xDeltaPSegmentInletToHigh : BOOL;
_xEnableCheckForDeltaPSegmentInlet : BOOL;
_xErrorDeltaPSegmentInlet : BOOL;
// Setpoint posolyt pump inlet
_rSetpointPosolytPumpInlet : REAL;
// Setpoint negolyt pump inlet
_rSetpointNegolytPumpInlet : REAL;
// Indicate if it ise the first cycle
xFirstCycle : BOOL := TRUE;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Reset error active
<ST><![CDATA[IF xFirstCycle THEN
_fbPosolytPumpInlet.Name := CONCAT(_sName, ' - Posolyt segment inlet');
_fbNegolytPumpInlet.Name := CONCAT(_sName, ' - Negolyt segment inlet');
xFirstCycle := FALSE;
END_IF
// Reset error active
_xErrorActive := FALSE;
// Reset warning active
@@ -180,7 +193,7 @@ _xReleaseManualMode := xReleaseManualMode;
// ===============================
// Safety Interlocks
stHMIInterface.stPosolytValve.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
stHMIInterface.stNS12.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
_stPosolytValveTankOutletSIntlk.0 := xEmergencyStopOk;
// Valve fb
@@ -193,7 +206,7 @@ _fbPosolytValveTankOutlet(
xConfirmAlarms:= xConfirmAlarms,
xReleaseErrors:= xReleaseErrors,
stValveConfig:= stUnitConfig.stConfigPosolytValve,
stHMIInterface:= stHMIInterface.stPosolytValve);
stHMIInterface:= stHMIInterface.stNS12);
// Set error active if fb has error
IF _fbPosolytValveTankOutlet.xError THEN
@@ -201,7 +214,7 @@ IF _fbPosolytValveTankOutlet.xError THEN
END_IF
// Set safety interlock flag if fb has safety interlocks active
IF NOT stHMIInterface.stPosolytValve.stInterlock.xSafetyINTLKOk THEN
IF NOT stHMIInterface.stNS12.stInterlock.xSafetyINTLKOk THEN
xSafetyIntlksOk := FALSE;
END_IF
@@ -211,7 +224,7 @@ END_IF
// ===============================
// Safety Interlocks
stHMIInterface.stNegolytValve.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
stHMIInterface.stNS22.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
_stNegolytValveTankOutletSIntlk.0 := xEmergencyStopOk;
// Valve fb
@@ -224,7 +237,7 @@ _fbNegolytValveTankOutlet(
xConfirmAlarms:= xConfirmAlarms,
xReleaseErrors:= xReleaseErrors,
stValveConfig:= stUnitConfig.stConfigNegolytValve,
stHMIInterface:= stHMIInterface.stNegolytValve);
stHMIInterface:= stHMIInterface.stNS22);
// Set error active if fb has error
IF _fbNegolytValveTankOutlet.xError THEN
@@ -232,7 +245,7 @@ IF _fbNegolytValveTankOutlet.xError THEN
END_IF
// Set safety interlock flag if fb has safety interlocks active
IF NOT stHMIInterface.stNegolytValve.stInterlock.xSafetyINTLKOk THEN
IF NOT stHMIInterface.stNS22.stInterlock.xSafetyINTLKOk THEN
xSafetyIntlksOk := FALSE;
END_IF
@@ -242,15 +255,15 @@ END_IF
// ===============================
// Safety Interlocks
stHMIInterface.stPosolytPump.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
stHMIInterface.stNS11.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
_stPosolytPumpInletSIntlk.0 := xEmergencyStopOk;
// Process interlocks
// stHMIInterface.stPosolytPump.stInterlock.asProcessINTLKName[0] := 'At least one valve is open';
//_stPosolytPumpInletPIntlk.0 := _fbPosolytValveTankOutlet.IsOpen;
stHMIInterface.stNS21.stInterlock.asProcessINTLKName[0] := 'Negolyt Pump Error';
_stPosolytPumpInletPIntlk.0 := NOT _fbNegolytPumpInlet.xError;
// Valve fb
// Pump fb
_fbPosolytPumpInlet(
xReleaseManualMode:= _xReleaseManualMode,
wProcessINTLK:= _stPosolytPumpInletPIntlk,
@@ -259,10 +272,10 @@ _fbPosolytPumpInlet(
wSafetyINTLKUsed:= _stPosolytPumpInletSIntlkUsed,
xReleaseErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
rSPautomatic:= rSetpointPosolytPumpInlet,
rSPautomatic:= _rSetpointPosolytPumpInlet,
xReleaseAnalogInLimitErrors:= xReleaseLimitErrors,
stMotorAnalogConfig:= stUnitConfig.stConfigPosolytPump,
stHMIInterface:= stHMIInterface.stPosolytPump,
stHMIInterface:= stHMIInterface.stNS11,
xWarning=> );
// Set error active if fb has error
@@ -276,7 +289,7 @@ IF _fbPosolytPumpInlet.xWarning THEN
END_IF
// Set safety interlock flag if fb has safety interlocks active
IF NOT stHMIInterface.stPosolytPump.stInterlock.xSafetyINTLKOk THEN
IF NOT stHMIInterface.stNS11.stInterlock.xSafetyINTLKOk THEN
xSafetyIntlksOk := FALSE;
END_IF
@@ -286,15 +299,15 @@ END_IF
// ===============================
// Safety Interlocks
stHMIInterface.stNegolytPump.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
stHMIInterface.stNS21.stInterlock.asSafetyINTLKName[0] := 'Emergency stop ok';
_stNegolytPumpInletSIntlk.0 := xEmergencyStopOk;
// Process interlocks
//stHMIInterface.stNegolytPump.stInterlock.asProcessINTLKName[0] := 'At least one valve is open';
//_stNegolytPumpInletPIntlk.0 := _fbNegolytValveTankOutlet.IsOpen;
stHMIInterface.stNS11.stInterlock.asProcessINTLKName[0] := 'Posolyt Pump Error';
_stNegolytPumpInletPIntlk.0 := NOT _fbPosolytPumpInlet.xError;
// Valve fb
// Pump fb
_fbNegolytPumpInlet(
xReleaseManualMode:= _xReleaseManualMode,
wProcessINTLK:= _stNegolytPumpInletPIntlk,
@@ -303,10 +316,10 @@ _fbNegolytPumpInlet(
wSafetyINTLKUsed:= _stNegolytPumpInletSIntlkUsed,
xReleaseErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
rSPautomatic:= rSetpointNegolytPumpInlet,
rSPautomatic:= _rSetpointNegolytPumpInlet,
xReleaseAnalogInLimitErrors:= xReleaseLimitErrors,
stMotorAnalogConfig:= stUnitConfig.stConfigNegolytPump,
stHMIInterface:= stHMIInterface.stNegolytPump,
stHMIInterface:= stHMIInterface.stNS21,
xWarning=> );
// Set error active if fb has error
@@ -320,7 +333,7 @@ IF _fbNegolytPumpInlet.xWarning THEN
END_IF
// Set safety interlock flag if fb has safety interlocks active
IF NOT stHMIInterface.stNegolytPump.stInterlock.xSafetyINTLKOk THEN
IF NOT stHMIInterface.stNS21.stInterlock.xSafetyINTLKOk THEN
xSafetyIntlksOk := FALSE;
END_IF
@@ -336,7 +349,7 @@ _fbPressurePosolytSegmentInlet(
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbPosolytPumpInlet.IsRunning AND _fbPosolytPumpInlet.xInTarget,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface => stHMIInterface.stPosolytPressureSegmentInlet);
stHMIInterface => stHMIInterface.stP11);
// Set error active if fb has error
IF _fbPressurePosolytSegmentInlet.xError THEN
@@ -360,7 +373,7 @@ _fbPressureNegolytSegmentInlet(
xReleaseLimitErrors:= xReleaseLimitErrors AND _fbNegolytPumpInlet.IsRunning AND _fbNegolytPumpInlet.xInTarget,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface => stHMIInterface.stNegolytPressureSegmentInlet);
stHMIInterface => stHMIInterface.stP21);
// Set error active if fb has error
IF _fbPressureNegolytSegmentInlet.xError THEN
@@ -384,7 +397,7 @@ _fbPressurePosolytTankInlet(
xReleaseLimitErrors:= xReleaseLimitErrors,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface => stHMIInterface.stPosolytPressureTankInlet);
stHMIInterface => stHMIInterface.stP12);
// Set error active if fb has error
IF _fbPressurePosolytTankInlet.xError THEN
@@ -408,7 +421,7 @@ _fbPressureNegolytTankInlet(
xReleaseLimitErrors:= xReleaseLimitErrors,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface => stHMIInterface.stNegolytPressureTankInlet);
stHMIInterface => stHMIInterface.stP22);
// Set error active if fb has error
IF _fbPressureNegolytTankInlet.xError THEN
@@ -431,7 +444,7 @@ _fbTempSensorPosolyt(
xReleaseLimitErrors:= xReleaseLimitErrors,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface=> stHMIInterface.stPosolytTempTankInlet);
stHMIInterface=> stHMIInterface.stT11);
IF _fbTempSensorPosolyt.xError THEN
_xErrorActive := TRUE;
@@ -452,7 +465,7 @@ _fbTempSensorNegolyt(
xReleaseLimitErrors:= xReleaseLimitErrors,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface=> stHMIInterface.stNegolytTempTankInlet);
stHMIInterface=> stHMIInterface.stT21);
IF _fbTempSensorNegolyt.xError THEN
_xErrorActive := TRUE;
@@ -465,16 +478,29 @@ 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);
IF xVoltageSensorIs1500V THEN
_fbVoltageSegment(
stScalingConfig:= GVL_CONFIG.stConfigVoltageSegment1500,
stEWConfig:= GVL_CONFIG.stUnitConfig.stEWLVoltageSegment,
stEWDelayConfig:= GVL_CONFIG.stUnitConfig.stEWDVoltageSegment,
xReleaseErrors:= xReleaseErrors,
xReleaseLimitErrors:= xReleaseLimitErrors AND _xEnableVoltageLimitChecks,
xReleaseHardwareErrors:= xReleaseErrors,
xConfirmAlarms:= xConfirmAlarms,
stHMIInterface=> stHMIInterface.stE31,
rScaledValue => rCurrentVoltage);
ELSE
_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.stE31,
rScaledValue => rCurrentVoltage);
END_IF
// Set error active if fb has error
IF _fbVoltageSegment.xError THEN
@@ -560,6 +586,9 @@ CASE _iState OF
_fbPosolytPumpInlet.ReqAutomaticStart();
_fbNegolytPumpInlet.ReqAutomaticStart();
_xEnableCheckForDeltaPSegmentInlet := TRUE;
_rSetpointNegolytPumpInlet := GVL_CONFIG.rPumpNegolytOnPower;
_rSetpointPosolytPumpInlet := GVL_CONFIG.rPumpPosolytOnPower;
_iState := 25;
25: // Wait for all pumps to run
@@ -579,8 +608,7 @@ CASE _iState OF
IF _tonStartupCheck.Q THEN
_tonStartupCheck(In := FALSE);
// Check for minimum unit voltage
// (_fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage) AND
IF NOT _xErrorActive AND NOT _xWarningActive THEN
IF (_fbVoltageSegment.rScaledValue >= GVL_CONFIG.rMinimumUnitVoltage) AND (NOT _xErrorActive) AND (NOT _xWarningActive) THEN
xReady := TRUE;
// Only enable Voltage Cheks if not in safety check mode
@@ -613,6 +641,8 @@ CASE _iState OF
_fbNegolytValveTankOutlet.ReqAutomaticClose();
_fbPosolytValveTankOutlet.ReqAutomaticClose();
_xEnableCheckForDeltaPSegmentInlet := FALSE;
_rSetpointNegolytPumpInlet := GVL_CONFIG.rPumpNegolytDisChrgPower;
_rSetpointPosolytPumpInlet := GVL_CONFIG.rPumpPosolytDisChrgPower;
_iState := 45;
45: // Wait for valves to be closed
@@ -639,8 +669,17 @@ CASE _iState OF
ELSE
xShutdownDischargeAllowed := FALSE;
_xEnableVoltageLimitChecks := FALSE;
_iState := 51;
END_IF
// Check for restart condition
IF xEnable AND (NOT _xErrorActive) THEN
xShutdownDischargeAllowed := FALSE;
xInShutdownDischargeMode := FALSE;
_iState := 0;
END_IF
51: // Discharge without inverter
IF (_fbVoltageSegment.rScaledValue <= GVL_CONFIG.rPumpshutoffThreshold) THEN
xShutdownDischargeAllowed := FALSE;
xInShutdownDischargeMode := FALSE;
@@ -750,6 +789,11 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
</Set>
</Property>
<LineIds Name="FB_Unit">
<LineId Id="6787" Count="0" />
<LineId Id="6790" Count="0" />
<LineId Id="6792" Count="1" />
<LineId Id="6791" Count="0" />
<LineId Id="6788" Count="1" />
<LineId Id="4232" Count="4" />
<LineId Id="5406" Count="1" />
<LineId Id="5405" Count="0" />
@@ -797,8 +841,13 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="5146" Count="0" />
<LineId Id="5198" Count="15" />
<LineId Id="5170" Count="0" />
<LineId Id="4622" Count="12" />
<LineId Id="4622" Count="3" />
<LineId Id="6419" Count="0" />
<LineId Id="4626" Count="8" />
<LineId Id="4937" Count="0" />
<LineId Id="6420" Count="0" />
<LineId Id="6423" Count="8" />
<LineId Id="6421" Count="1" />
<LineId Id="4635" Count="8" />
<LineId Id="4620" Count="0" />
<LineId Id="6068" Count="1" />
@@ -829,12 +878,12 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="5076" Count="0" />
<LineId Id="4464" Count="5" />
<LineId Id="6091" Count="0" />
<LineId Id="6603" Count="0" />
<LineId Id="6601" Count="1" />
<LineId Id="4470" Count="0" />
<LineId Id="4476" Count="15" />
<LineId Id="4790" Count="0" />
<LineId Id="4492" Count="0" />
<LineId Id="5903" Count="0" />
<LineId Id="4493" Count="0" />
<LineId Id="4492" Count="1" />
<LineId Id="4496" Count="0" />
<LineId Id="5908" Count="0" />
<LineId Id="5912" Count="0" />
@@ -852,6 +901,7 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="5081" Count="0" />
<LineId Id="4513" Count="3" />
<LineId Id="6092" Count="0" />
<LineId Id="6604" Count="1" />
<LineId Id="4517" Count="3" />
<LineId Id="5239" Count="0" />
<LineId Id="4521" Count="5" />
@@ -865,18 +915,20 @@ _fbNotAllAutomaticAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="5223" Count="0" />
<LineId Id="5225" Count="1" />
<LineId Id="5440" Count="0" />
<LineId Id="6776" Count="0" />
<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="1" />
<LineId Id="5229" Count="0" />
<LineId Id="5243" Count="0" />
<LineId Id="4662" Count="0" />
<LineId Id="4659" Count="0" />
<LineId Id="6769" Count="1" />
<LineId Id="6772" Count="3" />
<LineId Id="6771" Count="0" />
<LineId Id="6777" Count="0" />
<LineId Id="6779" Count="4" />
<LineId Id="6778" Count="0" />
<LineId Id="4569" Count="0" />
<LineId Id="4535" Count="6" />
<LineId Id="5251" Count="0" />