Fixed missing multistring handling in some modes
This commit is contained in:
28
PLC/PLC.tmc
28
PLC/PLC.tmc
File diff suppressed because one or more lines are too long
@@ -128,8 +128,6 @@ VAR
|
|||||||
|
|
||||||
_xDebug : BOOL;
|
_xDebug : BOOL;
|
||||||
|
|
||||||
_uiDebugCurrentString : UINT := 0;
|
|
||||||
|
|
||||||
_ModbusDebugTest : ST_MODBUS_REG_11;
|
_ModbusDebugTest : ST_MODBUS_REG_11;
|
||||||
|
|
||||||
_fbStringReadyTimeout : TON;
|
_fbStringReadyTimeout : TON;
|
||||||
@@ -145,6 +143,7 @@ VAR
|
|||||||
_xStringsShutdownDischargeAllowed : BOOL;
|
_xStringsShutdownDischargeAllowed : BOOL;
|
||||||
_xStringsAllInAutomaticMode : BOOL;
|
_xStringsAllInAutomaticMode : BOOL;
|
||||||
_xStringsOff : BOOL;
|
_xStringsOff : BOOL;
|
||||||
|
_xStringsBalancingDone : BOOL;
|
||||||
|
|
||||||
_rMaxCurrentInverterDCVoltage : REAL;
|
_rMaxCurrentInverterDCVoltage : REAL;
|
||||||
_rMinCurrentInverterDCVoltage : REAL;
|
_rMinCurrentInverterDCVoltage : REAL;
|
||||||
@@ -349,6 +348,7 @@ _xStringsInSchutdownDischargeMode := FALSE;
|
|||||||
_xStringsShutdownDischargeAllowed := TRUE;
|
_xStringsShutdownDischargeAllowed := TRUE;
|
||||||
_xStringsAllInAutomaticMode := TRUE;
|
_xStringsAllInAutomaticMode := TRUE;
|
||||||
_xStringsOff := TRUE;
|
_xStringsOff := TRUE;
|
||||||
|
_xStringsBalancingDone := TRUE;
|
||||||
_rMaxCurrentInverterDCVoltage := 0.0;
|
_rMaxCurrentInverterDCVoltage := 0.0;
|
||||||
_rMinCurrentInverterDCVoltage := 10_000;
|
_rMinCurrentInverterDCVoltage := 10_000;
|
||||||
_rHighestSegmentVoltage := 0.0;
|
_rHighestSegmentVoltage := 0.0;
|
||||||
@@ -385,6 +385,11 @@ FOR _ui := 0 TO (GVL_CONFIG.uiNumberOfStrings-1) DO
|
|||||||
_xStringsOff := FALSE;
|
_xStringsOff := FALSE;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
|
// check balancing done
|
||||||
|
IF (NOT _afbStrings[_ui].xBalancingDone) THEN
|
||||||
|
_xStringsBalancingDone := FALSE;
|
||||||
|
END_IF
|
||||||
|
|
||||||
// Check for max dc voltage
|
// Check for max dc voltage
|
||||||
IF _rMaxCurrentInverterDCVoltage < _afbStrings[_ui].stInverterData.rActDCVoltage THEN
|
IF _rMaxCurrentInverterDCVoltage < _afbStrings[_ui].stInverterData.rActDCVoltage THEN
|
||||||
_rMaxCurrentInverterDCVoltage := _afbStrings[_ui].stInverterData.rActDCVoltage;
|
_rMaxCurrentInverterDCVoltage := _afbStrings[_ui].stInverterData.rActDCVoltage;
|
||||||
@@ -593,7 +598,7 @@ END_IF]]></ST>
|
|||||||
<ST><![CDATA[CASE _iState OF
|
<ST><![CDATA[CASE _iState OF
|
||||||
0: // Idle
|
0: // Idle
|
||||||
// Wait for power command
|
// Wait for power command
|
||||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
|
||||||
_iState := 5;
|
_iState := 5;
|
||||||
_xCanChangeMode := FALSE;
|
_xCanChangeMode := FALSE;
|
||||||
END_IF
|
END_IF
|
||||||
@@ -852,10 +857,10 @@ END_IF
|
|||||||
_iStateBalancing := 5;
|
_iStateBalancing := 5;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
// GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRelease := (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode;
|
// GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRelease := (NOT _xStringsErrorActive) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode;
|
||||||
|
|
||||||
5: // Check for start conditions
|
5: // Check for start conditions
|
||||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
IF (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
|
||||||
_xCanChangeMode := FALSE;
|
_xCanChangeMode := FALSE;
|
||||||
_xEnableString := FALSE;
|
_xEnableString := FALSE;
|
||||||
_xStartBalancing := TRUE;
|
_xStartBalancing := TRUE;
|
||||||
@@ -863,13 +868,13 @@ END_IF
|
|||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
10: // Wait for balancing to be done
|
10: // Wait for balancing to be done
|
||||||
IF _afbStrings[_uiDebugCurrentString].xBalancingDone THEN
|
IF _xStringsBalancingDone THEN
|
||||||
_xCanChangeMode := TRUE;
|
_xCanChangeMode := TRUE;
|
||||||
_xStartBalancing := FALSE;
|
_xStartBalancing := FALSE;
|
||||||
_iStateBalancing := 0;
|
_iStateBalancing := 0;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
IF _xStringsErrorActive THEN
|
||||||
_iStateBalancing := 900;
|
_iStateBalancing := 900;
|
||||||
_xStartBalancing := FALSE;
|
_xStartBalancing := FALSE;
|
||||||
END_IF
|
END_IF
|
||||||
@@ -881,7 +886,7 @@ END_IF
|
|||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
900: // Error state
|
900: // Error state
|
||||||
IF _xConfirmAlarms AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
IF _xConfirmAlarms AND (NOT _xStringsErrorActive) THEN
|
||||||
_xCanChangeMode := TRUE;
|
_xCanChangeMode := TRUE;
|
||||||
_iStateBalancing := 0;
|
_iStateBalancing := 0;
|
||||||
END_IF
|
END_IF
|
||||||
@@ -908,7 +913,7 @@ END_CASE]]></ST>
|
|||||||
<ST><![CDATA[// Start on start button pressed
|
<ST><![CDATA[// Start on start button pressed
|
||||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||||
// Only start if everything is ok
|
// Only start if everything is ok
|
||||||
IF _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
IF _xStringsAllInAutomaticMode AND (NOT _xStringsErrorActive) THEN
|
||||||
_xStartSafetyCheck := TRUE;
|
_xStartSafetyCheck := TRUE;
|
||||||
END_IF
|
END_IF
|
||||||
END_IF
|
END_IF
|
||||||
@@ -923,7 +928,7 @@ END_IF
|
|||||||
CASE _iStateSafetyCheck OF
|
CASE _iStateSafetyCheck OF
|
||||||
0: // Idle
|
0: // Idle
|
||||||
// Wait for start command
|
// Wait for start command
|
||||||
IF _xStartSafetyCheck AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
IF _xStartSafetyCheck AND _xStringsAllInAutomaticMode THEN
|
||||||
_xEnableString := TRUE;
|
_xEnableString := TRUE;
|
||||||
_iStateSafetyCheck := 10;
|
_iStateSafetyCheck := 10;
|
||||||
_rPowerInverter := 0.0;
|
_rPowerInverter := 0.0;
|
||||||
@@ -931,7 +936,7 @@ CASE _iStateSafetyCheck OF
|
|||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
10: // Wait for string to be ready
|
10: // Wait for string to be ready
|
||||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
IF _xStringsReady AND (NOT _xStringsErrorActive) THEN
|
||||||
_iStateSafetyCheck := 30;
|
_iStateSafetyCheck := 30;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
@@ -943,7 +948,7 @@ CASE _iStateSafetyCheck OF
|
|||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
IF _xStringsErrorActive THEN
|
||||||
_iStateSafetyCheck := 1000;
|
_iStateSafetyCheck := 1000;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
@@ -959,18 +964,18 @@ CASE _iStateSafetyCheck OF
|
|||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
IF _xStringsErrorActive THEN
|
||||||
_xEnableString := FALSE;
|
_xEnableString := FALSE;
|
||||||
_iStateSafetyCheck := 1000;
|
_iStateSafetyCheck := 1000;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
45: // Wait for shutdown of string to be done
|
45: // Wait for shutdown of string to be done
|
||||||
IF _afbStrings[_uiDebugCurrentString].xOff THEN
|
IF _xStringsOff THEN
|
||||||
_iStateSafetyCheck := 0;
|
_iStateSafetyCheck := 0;
|
||||||
END_IF
|
END_IF
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
IF _xStringsErrorActive THEN
|
||||||
_xEnableString := FALSE;
|
_xEnableString := FALSE;
|
||||||
_iStateSafetyCheck := 1000;
|
_iStateSafetyCheck := 1000;
|
||||||
END_IF
|
END_IF
|
||||||
@@ -982,7 +987,7 @@ CASE _iStateSafetyCheck OF
|
|||||||
_iStateSafetyCheck := 1010;
|
_iStateSafetyCheck := 1010;
|
||||||
|
|
||||||
1010: // Wait for reset from error state
|
1010: // Wait for reset from error state
|
||||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND (NOT _xStartSafetyCheck) THEN
|
IF (NOT _xStringsErrorActive) AND (NOT _xStartSafetyCheck) THEN
|
||||||
// Goto init state
|
// Goto init state
|
||||||
_iStateSafetyCheck := 0;
|
_iStateSafetyCheck := 0;
|
||||||
|
|
||||||
|
|||||||
@@ -269,7 +269,7 @@
|
|||||||
</System>
|
</System>
|
||||||
<Plc>
|
<Plc>
|
||||||
<Project GUID="{9AE64910-5EB2-4866-93FD-EFE059C38C36}" Name="PLC" PrjFilePath="PLC\PLC.plcproj" TmcFilePath="PLC\PLC.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e" CopyTmcToTarget="true" CopyTpyToTarget="false" SymbolicMapping="true">
|
<Project GUID="{9AE64910-5EB2-4866-93FD-EFE059C38C36}" Name="PLC" PrjFilePath="PLC\PLC.plcproj" TmcFilePath="PLC\PLC.tmc" ReloadTmc="true" AmsPort="851" FileArchiveSettings="#x000e" CopyTmcToTarget="true" CopyTpyToTarget="false" SymbolicMapping="true">
|
||||||
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{8F86D368-EFB2-BFDB-9B1F-280FD290DFAC}" TmcPath="PLC\PLC.tmc">
|
<Instance Id="#x08502000" TcSmClass="TComPlcObjDef" KeepUnrestoredLinks="2" TmcHash="{D38151DB-7B35-9BBB-5607-C6EF9594E4EB}" TmcPath="PLC\PLC.tmc">
|
||||||
<Name>PLC Instance</Name>
|
<Name>PLC Instance</Name>
|
||||||
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
|
<CLSID ClassFactory="TcPlc30">{08500001-0000-0000-F000-000000000064}</CLSID>
|
||||||
<Vars VarGrpType="2" AreaNo="1">
|
<Vars VarGrpType="2" AreaNo="1">
|
||||||
|
|||||||
Reference in New Issue
Block a user