- Added new module status
- Added error messages for EtherCAT connection lost
This commit is contained in:
@@ -54,6 +54,7 @@ VAR_INPUT
|
||||
// String inverter ip
|
||||
sInverterIP : STRING;
|
||||
|
||||
xECStateSCS AT %I* : UINT;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
// Current string voltage
|
||||
@@ -130,6 +131,9 @@ VAR
|
||||
// DC Main switch not closed
|
||||
_fbDCMainSwitchNotClosed : FB_TcAlarm;
|
||||
|
||||
// Connection to SCS lost
|
||||
_fbSCSConnLost : FB_TcAlarm;
|
||||
|
||||
// Shutdown discharge stopped messages
|
||||
_fbSDDCLevel : FB_TcMessage;
|
||||
_fbSDUnitThreshold : FB_TcMessage;
|
||||
@@ -206,6 +210,21 @@ xAllModulesInAutoMode := TRUE;
|
||||
// Reset Safety
|
||||
xResetSafetyDCCB := xResetSafety;
|
||||
|
||||
// ===============================
|
||||
// EtherCAT connection lost error handling
|
||||
// ===============================
|
||||
IF (xECStateSCS <> 8) AND (NOT _fbSCSConnLost.bRaised) AND xReleaseErrors THEN
|
||||
_fbSCSConnLost.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF (xECStateSCS = 8) AND _fbSCSConnLost.bRaised THEN
|
||||
_fbSCSConnLost.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
IF _fbSCSConnLost.eConfirmationState = TcEventConfirmationState.WaitForConfirmation AND xConfirmAlarms THEN
|
||||
_fbSCSConnLost.Confirm(0);
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// DC Main switch error handling
|
||||
// ===============================
|
||||
@@ -532,6 +551,7 @@ CASE _iState OF
|
||||
|
||||
20: // Check if DC relais closed and safety is ok
|
||||
IF NOT xDCCBOpen THEN
|
||||
_tonErrorDCCBNotClosed.IN := FALSE;
|
||||
_xEnableInverter := TRUE;
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
//_rPowerInverterInternal := 0.0;
|
||||
@@ -565,13 +585,18 @@ CASE _iState OF
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnable := FALSE;
|
||||
_iState := 31;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
|
||||
|
||||
|
||||
// Inverter error or timeout for startup
|
||||
IF _fbInverter.xError OR (NOT xRepairSwitchOk) THEN // _tonInverterStartupTimeout.Q
|
||||
IF _fbInverter.xError OR (NOT xRepairSwitchOk) OR _tonInverterStartupTimeout.Q THEN // _tonInverterStartupTimeout.Q
|
||||
// Shutdown beacause of inverter startup timeout
|
||||
IF _tonInverterStartupTimeout.Q AND (NOT _fbInverterStartupTimeoutAlarm.bRaised) THEN
|
||||
_fbInverterStartupTimeoutAlarm.Raise(0);
|
||||
END_IF
|
||||
|
||||
_iState := 1000;
|
||||
_xEnableInverter := FALSE;
|
||||
xError := TRUE;
|
||||
@@ -650,8 +675,8 @@ CASE _iState OF
|
||||
// Restart on Enable or StartBalancing
|
||||
IF xEnable OR xStartBalancing THEN
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 40;
|
||||
//_xEnableInverter := FALSE;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
40: // Wait for inverter to shut down
|
||||
@@ -750,6 +775,9 @@ VAR_INPUT
|
||||
|
||||
sName : STRING;
|
||||
END_VAR
|
||||
VAR
|
||||
_sTemp : STRING;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_sName := sName;
|
||||
@@ -775,6 +803,11 @@ _fbInverterStartupTimeoutAlarm.ipArguments.Clear().AddString(_sName);
|
||||
_fbDCMainSwitchNotClosed.CreateEx(stEventEntry := TC_EVENTS.General.DCMainSwitchNotClosed, bWithConfirmation := FALSE, 0);
|
||||
_fbDCMainSwitchNotClosed.ipArguments.Clear().AddString(_sName);
|
||||
|
||||
// EtherCAT communication lost alarm
|
||||
_fbSCSConnLost.CreateEx(stEventEntry := TC_EVENTS.General.CommError, bWithConfirmation := TRUE, 0);
|
||||
_sTemp := CONCAT(_sName, ' SCS');
|
||||
_fbSCSConnLost.ipArguments.Clear().AddString(_sTemp);
|
||||
|
||||
// Shutdown discharge messages
|
||||
_fbSDDCLevel.CreateEx(TC_EVENTS.BMSEvents.SDDCVoltage, 0);
|
||||
_fbSDDCLevel.ipArguments.Clear().AddString(_sName);
|
||||
@@ -805,6 +838,9 @@ _fbModule1.Name := CONCAT(_sName, ' - Module 1');
|
||||
_fbModule2.Name := CONCAT(_sName, ' - Module 2');
|
||||
_fbModule3.Name := CONCAT(_sName, ' - Module 3');
|
||||
|
||||
// Set inverter Name
|
||||
_fbInverter.Name := _sName;
|
||||
|
||||
// Create alarm messages
|
||||
_fbModulesOutOfBalanceAlarm.ipArguments.Clear().AddString(_sName);
|
||||
_fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
@@ -812,18 +848,47 @@ _fbSafetyInterlocksNotOkAlarm.ipArguments.Clear().AddString(_sName);]]></ST>
|
||||
</Set>
|
||||
</Property>
|
||||
<LineIds Name="FB_String">
|
||||
<LineId Id="3" Count="542" />
|
||||
<LineId Id="3" Count="7" />
|
||||
<LineId Id="600" Count="2" />
|
||||
<LineId Id="599" Count="0" />
|
||||
<LineId Id="603" Count="2" />
|
||||
<LineId Id="607" Count="0" />
|
||||
<LineId Id="606" Count="0" />
|
||||
<LineId Id="608" Count="1" />
|
||||
<LineId Id="611" Count="0" />
|
||||
<LineId Id="610" Count="0" />
|
||||
<LineId Id="612" Count="1" />
|
||||
<LineId Id="11" Count="326" />
|
||||
<LineId Id="597" Count="0" />
|
||||
<LineId Id="338" Count="32" />
|
||||
<LineId Id="578" Count="0" />
|
||||
<LineId Id="371" Count="0" />
|
||||
<LineId Id="582" Count="0" />
|
||||
<LineId Id="584" Count="0" />
|
||||
<LineId Id="372" Count="2" />
|
||||
<LineId Id="587" Count="2" />
|
||||
<LineId Id="377" Count="0" />
|
||||
<LineId Id="596" Count="0" />
|
||||
<LineId Id="378" Count="167" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.FB_init">
|
||||
<LineId Id="3" Count="27" />
|
||||
<LineId Id="3" Count="21" />
|
||||
<LineId Id="31" Count="2" />
|
||||
<LineId Id="35" Count="0" />
|
||||
<LineId Id="34" Count="0" />
|
||||
<LineId Id="25" Count="5" />
|
||||
<LineId Id="2" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.Name.Get">
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="FB_String.Name.Set">
|
||||
<LineId Id="1" Count="9" />
|
||||
<LineId Id="1" Count="5" />
|
||||
<LineId Id="12" Count="0" />
|
||||
<LineId Id="11" Count="0" />
|
||||
<LineId Id="13" Count="0" />
|
||||
<LineId Id="7" Count="3" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user