Minor bugfixes and future addons
This commit is contained in:
@@ -6,6 +6,9 @@ VAR_INPUT
|
||||
// Enable
|
||||
xEnable : BOOL;
|
||||
|
||||
// Error shutdown -> No discharge throught inverter
|
||||
xErrorShutdown : BOOL;
|
||||
|
||||
// Start in balancing mode
|
||||
xStartBalancing : BOOL;
|
||||
|
||||
@@ -14,11 +17,8 @@ VAR_INPUT
|
||||
|
||||
// Requested inverter power
|
||||
rPowerInverter : REAL;
|
||||
|
||||
// Components shortage workaround
|
||||
stStringModuleVoltageConfig : ST_STRING_VOLT_CONFIG;
|
||||
|
||||
// Module 1 HMI interface
|
||||
// String HMI interface
|
||||
stHMIInterface : REFERENCE TO ST_STRING_HMI_INTERFACE;
|
||||
|
||||
// Emergency stop ok
|
||||
@@ -31,6 +31,7 @@ VAR_INPUT
|
||||
xSafetyIntlksOk AT %I* : BOOL;
|
||||
|
||||
// Safety communication error
|
||||
{attribute 'analysis' := '-33'}
|
||||
xSafetyComError AT %I* : BOOL;
|
||||
|
||||
// Release alarms
|
||||
@@ -294,7 +295,10 @@ _fbStringCurrent(
|
||||
xWarningLow=> ,
|
||||
xWarningHigh=> ,
|
||||
xErrorHigh=> ,
|
||||
stHMIInterface=> stHMIInterface.stStringCurrent);
|
||||
stHMIInterface=> );
|
||||
|
||||
// Copy scaled current value to HMI
|
||||
stHMIInterface.rCurrent := _fbStringCurrent.stHMIInterface.rValue;
|
||||
|
||||
|
||||
|
||||
@@ -303,9 +307,9 @@ _fbStringCurrent(
|
||||
// ===============================
|
||||
_fbModule1(
|
||||
xEnable := _xEnable,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule1VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
refstHMIInterface:= stHMIInterface.stHMIInterfaceModule1,
|
||||
@@ -315,6 +319,8 @@ _fbModule1(
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
|
||||
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -323,9 +329,9 @@ _fbModule1(
|
||||
|
||||
_fbModule2(
|
||||
xEnable := _xEnable,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule2VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
refstHMIInterface:= stHMIInterface.stHMIInterfaceModule2,
|
||||
@@ -335,6 +341,8 @@ _fbModule2(
|
||||
xConfirmAlarms:= xConfirmAlarms,
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
|
||||
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -342,9 +350,9 @@ _fbModule2(
|
||||
// ===============================
|
||||
_fbModule3(
|
||||
xEnable := _xEnable,
|
||||
rCurrent := stHMIInterface.rCurrent,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
xInverterEnabled := _fbInverter.xActive,
|
||||
stModuleVoltageConfig := stStringModuleVoltageConfig.stModule3VoltConfig,
|
||||
xInSafetyCheckMode := xInSafetyCheckMode,
|
||||
xEmergencyStopOk:= xEmergencyStopOk,
|
||||
refstHMIInterface:= stHMIInterface.stHMIInterfaceModule3,
|
||||
@@ -355,6 +363,7 @@ _fbModule3(
|
||||
xAllToManualMode := xAllToManualMode,
|
||||
rBalancingTargetVoltage := rSmallestSegmentVoltage);
|
||||
|
||||
|
||||
// ===============================
|
||||
// Handle modules error state
|
||||
// ===============================
|
||||
@@ -393,29 +402,63 @@ END_IF
|
||||
// ===============================
|
||||
_xAllModulesReady := _fbModule1.xReady AND _fbModule2.xReady AND _fbModule3.xReady;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Balancing done check
|
||||
// ===============================
|
||||
_xBalancingDone := _fbModule1.xBalancingDone AND _fbModule2.xBalancingDone AND _fbModule3.xBalancingDone;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Modules in shutdown discharge mode
|
||||
// ===============================
|
||||
xInShutdownDischargeMode := _fbModule1.xInShutdownDischargeMode AND _fbModule2.xInShutdownDischargeMode AND _fbModule3.xInShutdownDischargeMode;
|
||||
|
||||
xInShutdownDischargeMode := _fbModule1.xInShutdownDischargeMode OR _fbModule2.xInShutdownDischargeMode OR _fbModule3.xInShutdownDischargeMode;
|
||||
|
||||
// ===============================
|
||||
// Units shutdown discharge allowed
|
||||
// ===============================
|
||||
xShutdownDischargeAllowed := _fbModule1.xShutdownDischargeAllowed AND _fbModule2.xShutdownDischargeAllowed AND _fbModule3.xShutdownDischargeAllowed;
|
||||
|
||||
|
||||
// ===============================
|
||||
// All modules off
|
||||
// ===============================
|
||||
xOff := _fbModule1.xOff AND _fbModule2.xOff AND _fbModule3.xOff;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Handle status
|
||||
// ===============================
|
||||
// String off
|
||||
IF xOff AND (NOT xError) THEN
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
END_IF
|
||||
|
||||
// String starting
|
||||
IF _xEnable AND (NOT _xAllModulesReady) AND (NOT xError) THEN
|
||||
eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
END_IF
|
||||
|
||||
// String on
|
||||
IF _xAllModulesReady AND _fbInverter.xActive AND (NOT xError) THEN
|
||||
IF _rPowerInverterInternal < 0.0 THEN
|
||||
eStatus := E_COMPONENT_STATUS.CHARGING;
|
||||
ELSIF _rPowerInverterInternal > 0.0 THEN
|
||||
eStatus := E_COMPONENT_STATUS.DISCHARGING;
|
||||
ELSE
|
||||
eStatus := E_COMPONENT_STATUS.ON;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// String in shutdown
|
||||
IF xInShutdownDischargeMode AND (NOT xError) THEN
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
END_IF
|
||||
|
||||
// String in error state
|
||||
IF xError THEN
|
||||
eStatus := E_COMPONENT_STATUS.ERROR;
|
||||
END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
// Calculate string voltage
|
||||
// ===============================
|
||||
@@ -512,7 +555,7 @@ CASE _iState OF
|
||||
// Start in normal mode
|
||||
IF xEnable AND (NOT xStartBalancing) AND xAllModulesInAutoMode AND xRepairSwitchOk THEN
|
||||
_xEnable := TRUE;
|
||||
eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
//eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
IF xInSafetyCheckMode THEN
|
||||
_iState := 1;
|
||||
ELSE
|
||||
@@ -524,10 +567,11 @@ CASE _iState OF
|
||||
IF (NOT xEnable) AND xStartBalancing AND xAllModulesInAutoMode THEN
|
||||
_xStartBalancing := TRUE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
//eStatus := E_COMPONENT_STATUS.STARTING;
|
||||
_iState := 7;
|
||||
END_IF
|
||||
|
||||
|
||||
1: // Wait for ready in safety check mode
|
||||
IF _xAllModulesReady THEN
|
||||
xResetSafetyDCCB := TRUE;
|
||||
@@ -547,7 +591,7 @@ CASE _iState OF
|
||||
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -563,7 +607,7 @@ CASE _iState OF
|
||||
|
||||
IF (NOT xStartBalancing) THEN
|
||||
_xStartBalancing := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -589,10 +633,10 @@ CASE _iState OF
|
||||
_iState := 20;
|
||||
END_IF
|
||||
|
||||
IF NOT xEnable THEN
|
||||
IF (NOT xEnable) THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
_xEnable := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
@@ -615,6 +659,7 @@ CASE _iState OF
|
||||
//_rPowerInverterInternal := 0.0;
|
||||
IF xInSafetyCheckMode THEN
|
||||
_iState := 29;
|
||||
//eStatus := E_COMPONENT_STATUS.ON;
|
||||
ELSE
|
||||
_iState := 21;
|
||||
END_IF
|
||||
@@ -628,10 +673,10 @@ CASE _iState OF
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
IF NOT xEnable THEN
|
||||
IF (NOT xEnable) THEN
|
||||
_tonSafetyOkTimeout.IN := FALSE;
|
||||
_xEnable := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
@@ -639,7 +684,7 @@ CASE _iState OF
|
||||
_tonInverterStartupTimeout(IN := TRUE);
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
_iState := 30;
|
||||
eStatus := E_COMPONENT_STATUS.ON;
|
||||
//eStatus := E_COMPONENT_STATUS.ON;
|
||||
xReady := TRUE;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
@@ -648,7 +693,7 @@ CASE _iState OF
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnable := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
_tonInverterStartupTimeout(IN := FALSE);
|
||||
END_IF
|
||||
@@ -674,7 +719,7 @@ CASE _iState OF
|
||||
IF (NOT xEnable) THEN
|
||||
_xEnable := FALSE;
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
END_IF
|
||||
|
||||
@@ -694,6 +739,7 @@ CASE _iState OF
|
||||
_rPowerInverterInternal := rPowerInverter;
|
||||
END_IF
|
||||
|
||||
(*
|
||||
IF _rPowerInverterInternal > 0.0 THEN
|
||||
eStatus := E_COMPONENT_STATUS.DISCHARGING;
|
||||
ELSIF _rPowerInverterInternal < 0.0 THEN
|
||||
@@ -701,6 +747,7 @@ CASE _iState OF
|
||||
ELSE
|
||||
eStatus := E_COMPONENT_STATUS.ON;
|
||||
END_IF
|
||||
*)
|
||||
|
||||
// Shutdown
|
||||
IF (NOT xEnable) THEN
|
||||
@@ -708,12 +755,12 @@ CASE _iState OF
|
||||
_xReleaseLimitErrorsInternal := FALSE;
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_rPowerInverterInternal := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 31;
|
||||
ELSE
|
||||
_rPowerInverterInternal := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
//eStatus := E_COMPONENT_STATUS.SHUTDOWN;
|
||||
_iState := 40;
|
||||
END_IF
|
||||
|
||||
@@ -738,7 +785,7 @@ CASE _iState OF
|
||||
END_IF
|
||||
|
||||
32: // Shutdown discharge mode
|
||||
IF xShutdownDischargeAllowed AND GVL_CONFIG.xShutdownDischargeWithInverter AND xSafetyIntlksOk AND (stInverterData.rActDCVoltage > 620.0) THEN
|
||||
IF xShutdownDischargeAllowed AND (NOT xErrorShutdown) AND GVL_CONFIG.xShutdownDischargeWithInverter AND xSafetyIntlksOk AND (stInverterData.rActDCVoltage > 620.0) THEN
|
||||
_rPowerInverterInternal := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
ELSE
|
||||
// Send shutdown message
|
||||
@@ -773,7 +820,7 @@ CASE _iState OF
|
||||
IF _tonInverterShutdownDelay.Q THEN
|
||||
_tonInverterShutdownDelay(IN := FALSE);
|
||||
xCloseDCCB := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -785,7 +832,7 @@ CASE _iState OF
|
||||
|
||||
51: // Check if start balancing has been releases to avoid a restart
|
||||
IF (NOT xStartBalancing) THEN
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
@@ -801,7 +848,7 @@ CASE _iState OF
|
||||
_tonResetPulseLength(IN := FALSE);
|
||||
_tonErrorDCCBNotClosed(IN := FALSE);
|
||||
|
||||
eStatus := E_COMPONENT_STATUS.ERROR;
|
||||
//eStatus := E_COMPONENT_STATUS.ERROR;
|
||||
|
||||
_iState := 1005;
|
||||
|
||||
@@ -821,7 +868,7 @@ CASE _iState OF
|
||||
// Leave error state only if modules are deactivated
|
||||
IF (NOT xEnable) AND (NOT _xModuleError) THEN
|
||||
xError := FALSE;
|
||||
eStatus := E_COMPONENT_STATUS.OFF;
|
||||
//eStatus := E_COMPONENT_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
END_CASE
|
||||
|
||||
Reference in New Issue
Block a user