Added string startup timeout
This commit is contained in:
@@ -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="MAIN" Id="{bbd7302c-91ce-4697-9f4b-743f57ca5819}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
@@ -83,7 +83,7 @@ VAR
|
||||
_eBMSControlMode : E_BMS_CONTROL_MODE := E_BMS_CONTROL_MODE.AUTO_LOCAL;
|
||||
|
||||
// UPS
|
||||
_fbUPS : FB_S_UPS_BAPI;
|
||||
//_fbUPS : FB_S_UPS_BAPI;
|
||||
|
||||
// Safety
|
||||
xSafetyRun AT %Q* : BOOL := TRUE;
|
||||
@@ -129,9 +129,13 @@ VAR
|
||||
|
||||
_ModbusDebugTest : ST_MODBUS_REG_11;
|
||||
|
||||
_fbStringReadyTimeout : TON;
|
||||
|
||||
_fbModbusRead : FB_MBReadRegs;
|
||||
_iLength : WORD := 49;
|
||||
bDebugTest : BOOL;
|
||||
_wDebug1 : WORD;
|
||||
_wDebug2 : WORD;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -184,7 +188,9 @@ END_IF
|
||||
// ===============================
|
||||
_wEtherCATState := UINT_TO_WORD(_uiEtherCATState);
|
||||
_xEtherCatString1Ok := (_wEtherCATState AND 16#8000) = 0;
|
||||
_wDebug1 := (_wEtherCATState AND 16#8000);
|
||||
_xEtherCatString2Ok := (_wEtherCATState AND 16#2000) = 0;
|
||||
_wDebug2 := (_wEtherCATState AND 16#2000);
|
||||
|
||||
// String 1 on X1 = Port D = 0x8000
|
||||
IF (NOT _xEtherCatString1Ok) AND (NOT _fbEtherCATErrorString1.bRaised) THEN
|
||||
@@ -251,6 +257,7 @@ _rtHardwareResetButton(CLK := _tonHardwareResetButton.Q);
|
||||
// ===============================
|
||||
// Handle UPS events
|
||||
// ===============================
|
||||
(*
|
||||
_fbUPS(
|
||||
sNetID:= '',
|
||||
iPLCPort:= 851,
|
||||
@@ -260,6 +267,7 @@ _fbUPS(
|
||||
tRecoverTime:= T#10S,
|
||||
bPowerFailDetect=> ,
|
||||
eState=> );
|
||||
*)
|
||||
|
||||
|
||||
IF _xFirstCycle THEN
|
||||
@@ -281,7 +289,7 @@ _afbStrings[0](
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[0],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND _xEtherCatString1Ok,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND _xEtherCatString1Ok AND FALSE,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
@@ -301,7 +309,7 @@ _afbStrings[1](
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[1],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND _xEtherCatString2Ok,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND _xEtherCatString2Ok AND FALSE,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q AND _xEtherCatString2Ok,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
@@ -492,18 +500,24 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
10: // Wait for string to be ready
|
||||
_fbStringReadyTimeout(IN := TRUE, PT := GVL_CONFIG.timStringReadyTimeout);
|
||||
|
||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_fbStringReadyTimeout(IN := FALSE);
|
||||
_rPowerInverter := 0.0;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError OR _fbStringReadyTimeout.Q THEN
|
||||
_fbStringReadyTimeout(IN := FALSE);
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
IF (ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) THEN
|
||||
_fbStringReadyTimeout(IN := FALSE);
|
||||
_xEnableString := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
@@ -651,12 +665,12 @@ END_IF]]></ST>
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
|
||||
// Check for errors
|
||||
// IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
// _xEnableInverter := FALSE;
|
||||
// _iState := 1000;
|
||||
//END_IF
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
@@ -842,7 +856,10 @@ END_CASE]]></ST>
|
||||
<LineId Id="3444" Count="0" />
|
||||
<LineId Id="3264" Count="3" />
|
||||
<LineId Id="3272" Count="0" />
|
||||
<LineId Id="3298" Count="1" />
|
||||
<LineId Id="3298" Count="0" />
|
||||
<LineId Id="3455" Count="0" />
|
||||
<LineId Id="3299" Count="0" />
|
||||
<LineId Id="3456" Count="0" />
|
||||
<LineId Id="3282" Count="0" />
|
||||
<LineId Id="3277" Count="0" />
|
||||
<LineId Id="3268" Count="2" />
|
||||
@@ -864,7 +881,11 @@ END_CASE]]></ST>
|
||||
<LineId Id="2928" Count="0" />
|
||||
<LineId Id="2927" Count="0" />
|
||||
<LineId Id="2929" Count="1" />
|
||||
<LineId Id="2052" Count="34" />
|
||||
<LineId Id="2052" Count="20" />
|
||||
<LineId Id="3453" Count="0" />
|
||||
<LineId Id="2073" Count="8" />
|
||||
<LineId Id="3454" Count="0" />
|
||||
<LineId Id="2082" Count="4" />
|
||||
<LineId Id="2197" Count="0" />
|
||||
<LineId Id="2087" Count="3" />
|
||||
<LineId Id="2097" Count="2" />
|
||||
@@ -956,15 +977,21 @@ END_CASE]]></ST>
|
||||
<LineId Id="195" Count="0" />
|
||||
<LineId Id="7" Count="5" />
|
||||
<LineId Id="242" Count="0" />
|
||||
<LineId Id="13" Count="10" />
|
||||
<LineId Id="13" Count="9" />
|
||||
<LineId Id="259" Count="1" />
|
||||
<LineId Id="23" Count="0" />
|
||||
<LineId Id="263" Count="0" />
|
||||
<LineId Id="183" Count="0" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="25" Count="0" />
|
||||
<LineId Id="185" Count="1" />
|
||||
<LineId Id="264" Count="0" />
|
||||
<LineId Id="205" Count="0" />
|
||||
<LineId Id="214" Count="0" />
|
||||
<LineId Id="247" Count="0" />
|
||||
<LineId Id="187" Count="1" />
|
||||
<LineId Id="200" Count="1" />
|
||||
<LineId Id="265" Count="0" />
|
||||
<LineId Id="203" Count="0" />
|
||||
<LineId Id="246" Count="0" />
|
||||
<LineId Id="204" Count="0" />
|
||||
@@ -1001,9 +1028,11 @@ END_CASE]]></ST>
|
||||
<LineId Id="209" Count="0" />
|
||||
<LineId Id="213" Count="0" />
|
||||
<LineId Id="210" Count="2" />
|
||||
<LineId Id="157" Count="2" />
|
||||
<LineId Id="194" Count="0" />
|
||||
<LineId Id="160" Count="4" />
|
||||
<LineId Id="253" Count="0" />
|
||||
<LineId Id="257" Count="0" />
|
||||
<LineId Id="254" Count="2" />
|
||||
<LineId Id="258" Count="0" />
|
||||
<LineId Id="162" Count="2" />
|
||||
<LineId Id="166" Count="13" />
|
||||
<LineId Id="198" Count="1" />
|
||||
<LineId Id="180" Count="0" />
|
||||
|
||||
Reference in New Issue
Block a user