Added precharge mode
This commit is contained in:
@@ -18,6 +18,9 @@ VAR_INPUT
|
||||
// String in safety check mode
|
||||
xInSafetyCheckMode : BOOL;
|
||||
|
||||
// Operating mode of string
|
||||
eOperationMode : E_STRING_OPERATING_MODE;
|
||||
|
||||
// Requested inverter power
|
||||
rPowerInverter : REAL;
|
||||
|
||||
@@ -266,6 +269,7 @@ _fbModule1(
|
||||
uiFirstUnitIndex := uiStringNumber * 12,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
eStringOperatingMode := eOperationMode,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -286,6 +290,7 @@ _fbModule2(
|
||||
uiFirstUnitIndex := uiStringNumber * 12 + 4,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
eStringOperatingMode := eOperationMode,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -306,6 +311,7 @@ _fbModule3(
|
||||
uiFirstUnitIndex := uiStringNumber * 12 + 8,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
eStringOperatingMode := eOperationMode,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
@@ -399,22 +405,28 @@ HandleErrors();
|
||||
CASE _iState OF
|
||||
0: // Idle
|
||||
// Start in normal mode
|
||||
IF xEnable AND (NOT xStartBalancing) AND xAllModulesInAutoMode AND xRepairSwitchOk AND (NOT _xErrorInternal) THEN
|
||||
IF xEnable AND xAllModulesInAutoMode AND xRepairSwitchOk AND (NOT _xErrorInternal) THEN
|
||||
_xEnable := TRUE;
|
||||
//eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
IF xInSafetyCheckMode THEN
|
||||
_iState := 1;
|
||||
ELSE
|
||||
_iState := 5;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// Start in balancing mode
|
||||
IF (NOT xEnable) AND xStartBalancing AND xAllModulesInAutoMode AND (NOT _xErrorInternal) THEN
|
||||
_xStartBalancing := TRUE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
_iState := 7;
|
||||
|
||||
CASE eOperationMode OF
|
||||
// Automatic mode (local or remote)
|
||||
E_STRING_OPERATING_MODE.AUTOMATIC:
|
||||
_iState := 5;
|
||||
|
||||
// Balancing mode
|
||||
E_STRING_OPERATING_MODE.BALANCING:
|
||||
_xStartBalancing := TRUE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
_iState := 7;
|
||||
|
||||
// Safety check mode
|
||||
E_STRING_OPERATING_MODE.SAFETY_CHECK:
|
||||
_iState := 1;
|
||||
|
||||
// Precharge mode
|
||||
E_STRING_OPERATING_MODE.PRECHARGE:
|
||||
_iState := 1;
|
||||
END_CASE
|
||||
END_IF
|
||||
|
||||
IF _xErrorInternal THEN
|
||||
@@ -442,16 +454,13 @@ CASE _iState OF
|
||||
5: // Wait for all modules to be ready in normal mode
|
||||
IF _xAllModulesReady AND _xBalanceOk THEN
|
||||
xResetSafetyDCCB := TRUE;
|
||||
IF (NOT xInSafetyCheckMode) THEN
|
||||
_xReleaseLimitErrorsInternal := TRUE;
|
||||
END_IF
|
||||
_xReleaseLimitErrorsInternal := TRUE;
|
||||
_tonResetPulseLength.IN := TRUE;
|
||||
_iState := 10;
|
||||
END_IF
|
||||
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -497,7 +506,6 @@ CASE _iState OF
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
xResetSafetyDCCB := FALSE;
|
||||
_xEnable := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
@@ -521,18 +529,32 @@ CASE _iState OF
|
||||
IF (NOT xDCCBOpen) THEN
|
||||
_xReleaseSafetyIntlkErrors := TRUE;
|
||||
_tonErrorDCCBNotClosed.IN := FALSE;
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
//_rPowerInverterInternal := 0.0;
|
||||
IF xInSafetyCheckMode THEN
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := TRUE;
|
||||
// _iState := 29;
|
||||
_iState := 21;
|
||||
//eStatus := E_COMPONENT_STATUS.ON;
|
||||
ELSE
|
||||
_iState := 21;
|
||||
END_IF
|
||||
|
||||
CASE eOperationMode OF
|
||||
E_STRING_OPERATING_MODE.AUTOMATIC:
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
_xEnableInverter := TRUE;
|
||||
_iState := 21;
|
||||
|
||||
E_STRING_OPERATING_MODE.SAFETY_CHECK:
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := TRUE;
|
||||
_iState := 21;
|
||||
|
||||
E_STRING_OPERATING_MODE.PRECHARGE:
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 29;
|
||||
|
||||
// Balancing mode should never reach this point!
|
||||
// Its just here for testing
|
||||
E_STRING_OPERATING_MODE.BALANCING:
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_iState := 50;
|
||||
END_CASE
|
||||
END_IF
|
||||
|
||||
IF _tonErrorDCCBNotClosed.Q THEN
|
||||
_xEnable := FALSE;
|
||||
xCloseDCCB := FALSE;
|
||||
@@ -564,12 +586,12 @@ CASE _iState OF
|
||||
22: // Wait for inverter to be ready
|
||||
_tonInverterStartupTimeout(IN := TRUE);
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
IF xInSafetyCheckMode THEN
|
||||
_iState := 29;
|
||||
ELSE
|
||||
_iState := 30;
|
||||
END_IF
|
||||
//eStatus := E_COMPONENT_STATUS.ON;
|
||||
CASE eOperationMode OF
|
||||
E_STRING_OPERATING_MODE.SAFETY_CHECK:
|
||||
_iState := 29;
|
||||
ELSE
|
||||
_iState := 30;
|
||||
END_CASE
|
||||
xReady := TRUE;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
@@ -578,7 +600,6 @@ CASE _iState OF
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnable := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
@@ -603,7 +624,6 @@ CASE _iState OF
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
END_IF
|
||||
|
||||
@@ -627,28 +647,16 @@ CASE _iState OF
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
END_IF
|
||||
|
||||
(*
|
||||
IF _rPowerInverterInternal > 0.0 THEN
|
||||
eStatus := E_COMPONENT_STATUS.DISCHARGING;
|
||||
ELSIF _rPowerInverterInternal < 0.0 THEN
|
||||
eStatus := E_COMPONENT_STATUS.CHARGING;
|
||||
ELSE
|
||||
eStatus := E_COMPONENT_STATUS.ON;
|
||||
END_IF
|
||||
*)
|
||||
|
||||
// Shutdown
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_rPowerInverterInternal := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
ELSE
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user