Added string startup timeout

This commit is contained in:
Matthias Heisig
2024-08-30 13:12:42 +02:00
parent 58e511438e
commit 08d2ffd136
7 changed files with 1009 additions and 844 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
<POU Name="FB_String" Id="{46501225-f446-4674-bfed-3be64273e576}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_String
VAR_INPUT
@@ -102,9 +102,13 @@ VAR
_fbModule2 : FB_Module(CONCAT(Name,' - Module 2'));
_fbModule3 : FB_Module(CONCAT(Name,' - Module 3'));
// Summed status of all module errors
_xModuleError : BOOL;
// All modules are ready
_xAllModulesReady : BOOL;
// All modules in shutdown discharge mode
_xAllModulesInShutdownDischargeMode : BOOL;
@@ -154,7 +158,10 @@ VAR
// Fault timer for inverter startup
_tonInverterStartupTimeout : TON := (PT := T#2M);
// Deabug delay timer for inverter shutdown
// Fault timer for inverter shutdown
_tonInverterShutdownError : TON := (PT := T#10S);
// Debug delay timer for inverter shutdown
_tonInverterShutdownDelay : TON := (PT := T#10S);
// Timer for Safety ok timeout
@@ -187,15 +194,9 @@ VAR PERSISTENT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Reset error flag
xError := FALSE;
// Reset all modules in automatic mode
<ST><![CDATA[// Reset all modules in automatic mode
xAllModulesInAutoMode := TRUE;
// Reset safety interlocks flag
//xSafetyIntlksOk := TRUE;
// Reset Safety
xResetSafetyDCCB := xResetSafety;
@@ -249,18 +250,6 @@ _fbModule1(
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule1.xWarning THEN
xWarning := TRUE;
END_IF
IF _fbModule1.xError THEN
xError := TRUE;
END_IF
IF NOT _fbModule1.xAllUnitsInAutomatic THEN
xAllModulesInAutoMode := FALSE;
END_IF
// ===============================
@@ -280,18 +269,6 @@ _fbModule2(
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule2.xWarning THEN
xWarning := TRUE;
END_IF
IF _fbModule2.xError THEN
xError := TRUE;
END_IF
IF NOT _fbModule2.xAllUnitsInAutomatic THEN
xAllModulesInAutoMode := FALSE;
END_IF
// ===============================
@@ -310,19 +287,21 @@ _fbModule3(
xReleaseManualMode := xReleaseManualMode,
xConfirmAlarms:= xConfirmAlarms,
rBalancingTargetVoltage := rSmallestSegmentVoltage);
IF _fbModule3.xWarning THEN
xWarning := TRUE;
END_IF
IF _fbModule3.xError THEN
xError := TRUE;
END_IF
// ===============================
// Handle modules error state
// ===============================
_xModuleError := _fbModule1.xError OR _fbModule2.xError OR _fbModule3.xError;
IF NOT _fbModule3.xAllUnitsInAutomatic THEN
xAllModulesInAutoMode := FALSE;
END_IF
// ===============================
// Handle modules warning state
// ===============================
xWarning := _fbModule1.xWarning OR _fbModule2.xWarning OR _fbModule3.xWarning;
// ===============================
// Handle modules in auto mode
// ===============================
xAllModulesInAutoMode := _fbModule1.xAllUnitsInAutomatic AND _fbModule2.xAllUnitsInAutomatic AND _fbModule3.xAllUnitsInAutomatic;
// ===============================
// Handle shutdown discharge mode
@@ -491,7 +470,7 @@ CASE _iState OF
_iState := 0;
END_IF
IF xError THEN
IF _xModuleError THEN
_xEnable := FALSE;
_iState := 1000;
END_IF
@@ -609,7 +588,7 @@ CASE _iState OF
END_IF
// Shutdown
IF NOT xEnable THEN
IF (NOT xEnable) THEN
_xEnable := FALSE;
_xReleaseLimitErrorsInternal := FALSE;
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
@@ -692,10 +671,35 @@ CASE _iState OF
END_IF
1000: // Error state
_xEnable := FALSE;
_xEnableInverter := FALSE;
_rPowerInverterInternal := 0.0;
xError := TRUE;
_xReleaseLimitErrorsInternal := FALSE;
// Reset timer
_tonResetPulseLength(IN := FALSE);
_tonErrorDCCBNotClosed(IN := FALSE);
_iState := 1005;
1005: // Wait for inverter to be off
_tonInverterShutdownError(IN := TRUE);
// If inverter is not shutting down, hard disconnect it
IF (NOT _fbInverter.xActive) OR _tonInverterShutdownError.Q THEN
_tonInverterShutdownError(IN := FALSE);
xCloseDCCB := FALSE;
_iState := 1010;
END_IF
1010: // Error idle state
// Leave error state only if modules are deactivated
IF NOT xEnable THEN
_tonResetPulseLength.IN := FALSE;
_tonErrorDCCBNotClosed.IN := FALSE;
IF (NOT xEnable) AND (NOT _xModuleError) THEN
xError := FALSE;
_iState := 0;
END_IF
END_CASE
@@ -799,7 +803,22 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
</Set>
</Property>
<LineIds Name="FB_String">
<LineId Id="4873" Count="251" />
<LineId Id="4876" Count="1" />
<LineId Id="4881" Count="53" />
<LineId Id="4947" Count="18" />
<LineId Id="4978" Count="17" />
<LineId Id="5966" Count="1" />
<LineId Id="5965" Count="0" />
<LineId Id="5969" Count="0" />
<LineId Id="5968" Count="0" />
<LineId Id="5971" Count="2" />
<LineId Id="5970" Count="0" />
<LineId Id="5008" Count="0" />
<LineId Id="5976" Count="0" />
<LineId Id="5978" Count="1" />
<LineId Id="5977" Count="0" />
<LineId Id="5975" Count="0" />
<LineId Id="5009" Count="115" />
<LineId Id="5776" Count="0" />
<LineId Id="5775" Count="0" />
<LineId Id="5773" Count="0" />
@@ -818,7 +837,29 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<LineId Id="5581" Count="2" />
<LineId Id="5585" Count="1" />
<LineId Id="5584" Count="0" />
<LineId Id="5312" Count="86" />
<LineId Id="5312" Count="51" />
<LineId Id="5985" Count="2" />
<LineId Id="5980" Count="0" />
<LineId Id="5995" Count="1" />
<LineId Id="5990" Count="0" />
<LineId Id="5993" Count="0" />
<LineId Id="5991" Count="1" />
<LineId Id="5994" Count="0" />
<LineId Id="5988" Count="0" />
<LineId Id="5999" Count="1" />
<LineId Id="6009" Count="1" />
<LineId Id="6013" Count="0" />
<LineId Id="6001" Count="0" />
<LineId Id="6008" Count="0" />
<LineId Id="6002" Count="0" />
<LineId Id="6004" Count="0" />
<LineId Id="6003" Count="0" />
<LineId Id="6005" Count="1" />
<LineId Id="5981" Count="0" />
<LineId Id="5989" Count="0" />
<LineId Id="5364" Count="1" />
<LineId Id="5997" Count="0" />
<LineId Id="5368" Count="30" />
<LineId Id="527" Count="0" />
</LineIds>
<LineIds Name="FB_String.FB_init">