Some fixes before the FAT

- Refactored inverter Heartbeat check
- Added SafetyComError on EtherCAT checking
- Adjusted lower pressure value for safety plc from 200 mBar to 300mBar
This commit is contained in:
Matthias Heisig
2025-06-06 19:09:12 +02:00
parent 38f44128d1
commit 58f3c751d3
12 changed files with 826 additions and 882 deletions

View File

@@ -33,10 +33,6 @@ VAR_INPUT
// Reset Safety
xResetSafety : BOOL;
// Safety communication error
{attribute 'analysis' := '-33'}
xSafetyComError AT %I* : BOOL;
// Release alarms
xReleaseErrors : BOOL;
@@ -64,6 +60,10 @@ VAR_OUTPUT
// Repair switch closed
xRepairSwitchOk AT %I* : BOOL;
// Safety communication error
{attribute 'analysis' := '-33'}
xSafetyComError AT %I* : BOOL;
// All safetyinterlocks from safety plc are ok
xSafetyIntlksOk AT %I* : BOOL;
@@ -157,9 +157,6 @@ VAR
// State for start and stop
_iState : INT := 0;
// Timer for result pulse to safety
_tonResetPulseLength : TON := (PT := T#250MS);
// Error timer for not closing dc relais
_tonErrorDCCBNotClosed : TON := (PT := T#5S);
@@ -221,7 +218,7 @@ VAR
_xErrorInternal : BOOL;
_fbSafetyResetImpulseGen : FB_Blinker := (rFrequency := 1.0);
_fbSafetyResetImpulseGen : FB_Blinker := (rFrequency := 2.0);
END_VAR
@@ -234,8 +231,7 @@ END_VAR
<ST><![CDATA[// Reset all modules in automatic mode
xAllModulesInAutoMode := TRUE;
// Reset Safety
xResetSafetyDCCB := xResetSafety;
_fbSafetyResetImpulseGen();
// ===============================
// DC current measurement
@@ -383,7 +379,6 @@ END_IF
// ===============================
// String ready validation check
// ===============================
_tonResetPulseLength();
_tonErrorDCCBNotClosed();
_tonSafetyOkTimeout();
@@ -436,8 +431,6 @@ CASE _iState OF
1: // Wait for ready in safety check mode
IF _xAllModulesReady THEN
xResetSafetyDCCB := TRUE;
_tonResetPulseLength.IN := TRUE;
_xReleaseLimitErrorsInternal := TRUE;
_iState := 10;
END_IF
@@ -453,9 +446,7 @@ CASE _iState OF
5: // Wait for all modules to be ready in normal mode
IF _xAllModulesReady AND _xBalanceOk THEN
xResetSafetyDCCB := TRUE;
_xReleaseLimitErrorsInternal := TRUE;
_tonResetPulseLength.IN := TRUE;
_iState := 10;
END_IF
@@ -485,17 +476,14 @@ CASE _iState OF
10: // Reset safety from sensors
IF _tonResetPulseLength.Q THEN
_tonResetPulseLength.IN := FALSE;
xResetSafetyDCCB := FALSE;
_tonSafetyOkTimeout.IN := TRUE;
_iState := 15;
END_IF
xResetSafety := FALSE;
_tonSafetyOkTimeout.IN := TRUE;
_iState := 15;
15: // Wait for Safety to be ok
xResetSafetyDCCB := _fbSafetyResetImpulseGen.xOut;
xResetSafety := _fbSafetyResetImpulseGen.xOut;
IF xSafetyIntlksOk THEN
xResetSafetyDCCB := FALSE;
xResetSafety := FALSE;
_tonSafetyOkTimeout.IN := FALSE;
xCloseDCCB := TRUE;
_tonErrorDCCBNotClosed.IN := TRUE;
@@ -504,14 +492,14 @@ CASE _iState OF
IF (NOT xEnable) THEN
_tonSafetyOkTimeout.IN := FALSE;
xResetSafetyDCCB := FALSE;
xResetSafety := FALSE;
_xEnable := FALSE;
_iState := 40;
END_IF
IF _tonSafetyOkTimeout.Q THEN
_tonSafetyOkTimeout.IN := FALSE;
xResetSafetyDCCB := FALSE;
xResetSafety := FALSE;
xCloseDCCB := TRUE;
xError := TRUE;
xReady := FALSE;
@@ -759,7 +747,6 @@ CASE _iState OF
_xReleaseSafetyIntlkErrors := FALSE;
// Reset timer
_tonResetPulseLength(IN := FALSE);
_tonErrorDCCBNotClosed(IN := FALSE);
//eStatus := E_COMPONENT_STATUS.ERROR;
@@ -851,7 +838,10 @@ IF _fbSafetyIntlkTimeoutAlarm.bRaised AND xConfirmAlarms THEN
END_IF
// Copy status to hmi interface
stHMIInterface.eStatus := eStatus;]]></ST>
stHMIInterface.eStatus := eStatus;
// Reset Safety
xResetSafetyDCCB := xResetSafety;]]></ST>
</Implementation>
<Method Name="FB_init" Id="{9e8494eb-1b40-4be9-91c8-810ecbdf7f0c}">
<Declaration><![CDATA[METHOD FB_init : BOOL
@@ -915,6 +905,12 @@ _fbIsolationAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
<ST><![CDATA[// Reset internal error flag
_xErrorInternal := FALSE;
// ===============================
// Safety ComError Handling
// ===============================
IF xSafetyComError THEN
_xErrorInternal := TRUE;
END_IF
// ===============================
// EtherCAT connection lost error handling