Implemented fixes and improvements during comissioning
- New Balancing mode - HMI Interface for Inverterdata implemented - Adjusted GVL_CONFIG values - Read inverter data even when inverter is off - Added OPC UA settings to inverter data hmi interface - Added multisettings to safety project for strings
This commit is contained in:
@@ -10,16 +10,13 @@ VAR
|
||||
_xReleaseLimitsErrors : BOOL := TRUE;
|
||||
_xConfirmAlarms : BOOL;
|
||||
_xEnableString : BOOL;
|
||||
_xEnableInverter : BOOL;
|
||||
_xStartBalancing : BOOL;
|
||||
|
||||
_xCanChangeMode : BOOL := TRUE;
|
||||
|
||||
{attribute 'OPC.UA.DA' := '0'}
|
||||
_afbStrings : ARRAY[0..1] OF FB_String[('String 1'), ('String 2')];
|
||||
|
||||
_fbInverter : FB_PowerSupplySunspec;
|
||||
_stInverterData : ST_SUNSPEC_CURRENT_VALUES;
|
||||
|
||||
// Variable to detect charge status change
|
||||
_eLastChargeStatus : E_CHARGE_STATUS;
|
||||
// Variable to detect battery status change
|
||||
@@ -28,6 +25,7 @@ VAR
|
||||
// State machine state
|
||||
_iState : INT;
|
||||
_iStateSafetyCheck : INT;
|
||||
_iStateBalancing : INT;
|
||||
|
||||
// Start safety check mode
|
||||
_xStartSafetyCheck : BOOL;
|
||||
@@ -50,6 +48,9 @@ VAR
|
||||
// Not all strings in automatic mode
|
||||
_fbNoAutomaticModeAlarm : Fb_TcAlarm;
|
||||
|
||||
// Emergency stop not ok alarm
|
||||
_fbEStopNotOk : FB_TcAlarm;
|
||||
|
||||
// First cycle tag
|
||||
_xFirstCycle : BOOL := TRUE;
|
||||
|
||||
@@ -90,11 +91,19 @@ VAR
|
||||
// Battery in safety check mode
|
||||
_xInSafetyCheckMode : BOOL;
|
||||
|
||||
// Battery full message
|
||||
_fbBatteryFullMessage : FB_TcMessage;
|
||||
_fbBatteryEmptyMessage : FB_TcMessage;
|
||||
|
||||
// Safety
|
||||
_fbSafety : FB_Safety;
|
||||
|
||||
// DEBUG
|
||||
_xRestart : BOOL;
|
||||
|
||||
_xDebug : BOOL;
|
||||
|
||||
_uiDebugCurrentString : UINT := 1;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
@@ -111,29 +120,58 @@ IF _xRestart AND (_iState = 0) THEN
|
||||
END_IF
|
||||
// DEBUG
|
||||
// ===============================
|
||||
|
||||
IF _xFirstCycle THEN
|
||||
_xFirstCycle := FALSE;
|
||||
|
||||
_fbBatteryFullMessage.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.BatteryFull, 0);
|
||||
_fbBatteryEmptyMessage.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.BatteryEmpty, 0);
|
||||
|
||||
_fbEStopNotOk.CreateEx(stEventEntry := TC_EVENTS.BMSEvents.EmergencyStopNotOk, TRUE, 0);
|
||||
END_IF
|
||||
|
||||
|
||||
_xErrorActive := FALSE;
|
||||
|
||||
// Ack alarms from HMI
|
||||
_xConfirmAlarms := GVL_SCADA.stAckAlarmsButton.xRequest;
|
||||
IF GVL_SCADA.stAckAlarmsButton.xRequest THEN
|
||||
GVL_SCADA.stAckAlarmsButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Safety
|
||||
// ===============================
|
||||
xSafetyErrAck := xSafetyResterTaster;
|
||||
_xShowAckEmergencyStop := NOT _xEmergencyStopOk;
|
||||
|
||||
IF (NOT _xEmergencyStopOk) AND (NOT _fbEStopNotOk.bRaised) THEN
|
||||
_fbEStopNotOk.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF _xEmergencyStopOk AND _fbEStopNotOk.bRaised THEN
|
||||
_fbEStopNotOk.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
IF _fbEStopNotOk.eConfirmationState = TcEventConfirmationState.WaitForConfirmation AND _xConfirmAlarms THEN
|
||||
_fbEStopNotOk.Confirm(0);
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Hardware reset button part 1
|
||||
// ===============================
|
||||
_tonHardwareResetButton(IN := _xHarwareResetButton);
|
||||
_rtHardwareResetButton(CLK := _tonHardwareResetButton.Q);
|
||||
_xConfirmAlarms := TRUE;
|
||||
// _xConfirmAlarms := TRUE;
|
||||
|
||||
// ===============================
|
||||
// Handle Manual mode release
|
||||
// ===============================
|
||||
IF _iState = 0 THEN
|
||||
_xReleaseManualMode := TRUE;
|
||||
ELSE
|
||||
_xReleaseManualMode := FALSE;
|
||||
END_IF
|
||||
//IF _iState = 0 THEN
|
||||
// _xReleaseManualMode := TRUE;
|
||||
//ELSE
|
||||
// _xReleaseManualMode := FALSE;
|
||||
//END_IF
|
||||
|
||||
|
||||
// ===============================
|
||||
@@ -159,26 +197,43 @@ END_IF
|
||||
// Dely release of errors during PLC startup phase
|
||||
_tonStartupDelay(IN := TRUE);
|
||||
|
||||
// Ack alarms from HMI
|
||||
_xConfirmAlarms := GVL_SCADA.stAckAlarmsButton.xRequest;
|
||||
IF GVL_SCADA.stAckAlarmsButton.xRequest THEN
|
||||
GVL_SCADA.stAckAlarmsButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// Call string 1
|
||||
_afbStrings[0](
|
||||
stStringModuleVoltageConfig := GVL_CONFIG.stString1VoltageConfig,
|
||||
xEnable := _xEnableString,
|
||||
xEnable := _xEnableString AND GVL_CONFIG.xDummy,
|
||||
xStartBalancing := _xStartBalancing AND GVL_CONFIG.xDummy,
|
||||
sInverterIP := GVL_CONFIG.sInverterIpString1,
|
||||
rPowerInverter := _rPowerInverter,
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[0],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q AND GVL_CONFIG.xDummy,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
xResetSafety := xSafetyResterTaster);
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Call string 2
|
||||
_afbStrings[1](
|
||||
stStringModuleVoltageConfig := GVL_CONFIG.stString2VoltageConfig,
|
||||
xEnable := _xEnableString,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
sInverterIP := GVL_CONFIG.sInverterIpString2,
|
||||
rPowerInverter := _rPowerInverter,
|
||||
xInSafetyCheckMode := _xInSafetyCheckMode,
|
||||
stHMIInterface:= GVL_SCADA.stHMIInterface[1],
|
||||
xEmergencyStopOk:= _xEmergencyStopOk,
|
||||
xReleaseErrors:= _xReleaseErrors AND _tonStartupDelay.Q,
|
||||
xReleaseLimitErrors:= _xReleaseLimitsErrors AND _tonStartupDelay.Q,
|
||||
xReleaseManualMode := _xReleaseManualMode,
|
||||
xConfirmAlarms:= _xConfirmAlarms,
|
||||
xResetSafety := xSafetyResterTaster);
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[1].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
@@ -201,17 +256,6 @@ ELSE
|
||||
GVL_SCADA.stHMIInterface[0].eStatus :=_afbStrings[0].eStatus;
|
||||
END_IF
|
||||
|
||||
// DEACTIVATED FOR DEBUG REASONS !!!
|
||||
// Call inverter
|
||||
_fbInverter(
|
||||
sInverterIPAddr:= GVL_CONFIG.sInverterIp,
|
||||
xEnable:= _xEnableInverter,
|
||||
rPower:= _rPowerInverter,
|
||||
xReset:= _xConfirmAlarms,
|
||||
rMaxBattPower:= DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower),
|
||||
stCurrentValues => _stInverterData);
|
||||
|
||||
|
||||
// ===============================
|
||||
// Read modbus request count
|
||||
// ===============================
|
||||
@@ -236,34 +280,75 @@ _fbADSReader(
|
||||
CASE _eBMSControlMode OF
|
||||
E_BMS_CONTROL_MODE.AUTO_REMOTE:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower);
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_AUTO();
|
||||
|
||||
E_BMS_CONTROL_MODE.AUTO_LOCAL:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.TESTING;
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_AUTO();
|
||||
|
||||
E_BMS_CONTROL_MODE.MANUAL:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := TRUE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.MAINTENANCE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_MANUAL();
|
||||
|
||||
E_BMS_CONTROL_MODE.SAFETY_CHECK:
|
||||
_xInSafetyCheckMode := TRUE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.MAINTENANCE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_SAFETY_CHECK();
|
||||
|
||||
E_BMS_CONTROL_MODE.CAPACITY_TEST:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.TESTING;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_CAPACITY_TEST();
|
||||
|
||||
E_BMS_CONTROL_MODE.BALANCING:
|
||||
_xInSafetyCheckMode := FALSE;
|
||||
_xReleaseManualMode := FALSE;
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
|
||||
END_IF
|
||||
SM_BALANCING();
|
||||
END_CASE
|
||||
|
||||
GVL_SCADA.xCanChangeControlMode := _xCanChangeMode;
|
||||
GVL_SCADA.eCurrentControlMode := _eBMSControlMode;
|
||||
|
||||
// Calculate current battery dc power
|
||||
GVL_SCADA.diCurrentBatteryPower := REAL_TO_DINT(_afbStrings[0].stInverterData.rActDCPower + _afbStrings[1].stInverterData.rActDCPower);
|
||||
|
||||
_fbSafety();
|
||||
|
||||
// Reset automatic buttons
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest := FALSE;
|
||||
END_IF
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest := FALSE;
|
||||
END_IF
|
||||
|
||||
// Reset alarm confirmation
|
||||
IF _xConfirmAlarms OR _rtHardwareResetButton.Q THEN
|
||||
@@ -275,7 +360,7 @@ END_IF]]></ST>
|
||||
<ST><![CDATA[CASE _iState OF
|
||||
0: // Idle
|
||||
// Wait for power command
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND _afbStrings[0].xSafetyIntlksOk AND (NOT _afbStrings[0].xError) AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
_xCanChangeMode := FALSE;
|
||||
END_IF
|
||||
@@ -284,6 +369,7 @@ END_IF]]></ST>
|
||||
IF _rAutoPowerRequest < DINT_TO_REAL(GVL_CONFIG.diMaxStringDischargePower)
|
||||
AND _rAutoPowerRequest > DINT_TO_REAL(GVL_CONFIG.diMaxStringChargingPower) THEN
|
||||
_xEnableString := TRUE;
|
||||
_xStartBalancing := FALSE;
|
||||
_iState := 10;
|
||||
ELSE
|
||||
// Set error bitmap flag
|
||||
@@ -292,16 +378,14 @@ END_IF]]></ST>
|
||||
// Goto error state
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
|
||||
10: // Wait for string to be ready
|
||||
IF _afbStrings[0].xReady AND (NOT _afbStrings[0].xError) THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := TRUE;
|
||||
_iState := 20;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
IF _afbStrings[0].xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_iState := 45;
|
||||
@@ -311,22 +395,7 @@ END_IF]]></ST>
|
||||
_xEnableString := FALSE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
20: // Wait for inverter to be ready
|
||||
IF _fbInverter.xActive AND (NOT _fbInverter.xError) THEN
|
||||
// Set battery status for modbus
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.ACTIVE;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg10.uiActiveParallelMembers := 1;
|
||||
_iState := 30;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
30: // String and inverter enabled
|
||||
// Set inverter power to modbus requested power
|
||||
@@ -366,12 +435,18 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery fully charged
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_afbStrings[0].rCurrentVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) THEN
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND (_afbStrings[_uiDebugCurrentString].stInverterData.rActDCVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Send message
|
||||
_fbBatteryFullMessage.Send(0);
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
// Set local remote to zero power
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
|
||||
// Start string shutdown
|
||||
_xEnableString := FALSE;
|
||||
|
||||
@@ -382,9 +457,15 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Shutdown triggered by battery empty
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND (_afbStrings[0].rCurrentVoltage <= GVL_CONFIG.rStringEmptyVoltage) THEN
|
||||
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND (_afbStrings[_uiDebugCurrentString].stInverterData.rActDCVoltage <= GVL_CONFIG.rStringEmptyVoltage) THEN
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
|
||||
// Send Message
|
||||
_fbBatteryEmptyMessage.Send(0);
|
||||
|
||||
// Set local remote to zero power
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
|
||||
// Set inverter to zero power
|
||||
_rPowerInverter := 0.0;
|
||||
|
||||
@@ -398,8 +479,7 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR (NOT _xString1DCSafetyOk) OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_tonBeginShutdown(In := FALSE);
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
@@ -407,51 +487,53 @@ END_IF]]></ST>
|
||||
END_IF
|
||||
|
||||
35: // Wait for string to be in shutdown discharge mode
|
||||
IF _afbStrings[0].xInShutdownDischargeMode THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xInShutdownDischargeMode THEN
|
||||
// Check if we are allowed to discharge during shutdown with inverter
|
||||
IF GVL_CONFIG.xShutdownDischargeWithInverter THEN
|
||||
_iState := 40;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
40: // Wait for inverter discharge done
|
||||
IF _afbStrings[0].xShutdownDischargeAllowed THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xShutdownDischargeAllowed THEN
|
||||
_rPowerInverter := GVL_CONFIG.rAbsShutdownDischargePower;
|
||||
ELSE
|
||||
_rPowerInverter := 0.0;
|
||||
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
||||
_xEnableInverter := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iState := 45;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError OR _fbInverter.xError THEN
|
||||
_xEnableInverter := FALSE;
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
// Restart if possible
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
IF (NOT _afbStrings[0].xInShutdownDischargeMode) AND _afbStrings[0].xOff THEN
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xInShutdownDischargeMode) AND _afbStrings[_uiDebugCurrentString].xOff THEN
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.OFF;
|
||||
_iState := 0;
|
||||
END_IF
|
||||
|
||||
// Restart if possible
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND _afbStrings[0].xSafetyIntlksOk AND (NOT _afbStrings[0].xError) AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_iState := 5;
|
||||
END_IF
|
||||
|
||||
@@ -463,13 +545,12 @@ END_IF]]></ST>
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverter := 0.0;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.ERROR;
|
||||
_iState := 1010;
|
||||
|
||||
1010: // Wait for reset from error state
|
||||
IF (_rAutoPowerRequest = 0.0) AND (NOT _afbStrings[0].xError) AND (NOT _fbInverter.xError) THEN
|
||||
IF (_rAutoPowerRequest = 0.0) AND (NOT _afbStrings[_uiDebugCurrentString].xError) AND _xConfirmAlarms THEN
|
||||
// Reset modbus error register
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.lwErrorBitmap := 0;
|
||||
|
||||
@@ -481,6 +562,50 @@ END_IF]]></ST>
|
||||
|
||||
_xCanChangeMode := TRUE;
|
||||
END_IF
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<Action Name="SM_BALANCING" Id="{f1f90032-de29-468d-899c-50bfb54e48e0}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[CASE _iStateBalancing OF
|
||||
0: // Test
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
_iStateBalancing := 5;
|
||||
END_IF
|
||||
|
||||
// GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRelease := (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode;
|
||||
|
||||
5: // Check for start conditions
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_xCanChangeMode := FALSE;
|
||||
_xEnableString := FALSE;
|
||||
_xStartBalancing := TRUE;
|
||||
_iStateBalancing := 10;
|
||||
END_IF
|
||||
|
||||
10: // Wait for balancing to be done
|
||||
IF _afbStrings[_uiDebugCurrentString].xBalancingDone THEN
|
||||
_xCanChangeMode := TRUE;
|
||||
_xStartBalancing := FALSE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iStateBalancing := 900;
|
||||
_xStartBalancing := FALSE;
|
||||
END_IF
|
||||
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
_xStartBalancing := FALSE;
|
||||
_xCanChangeMode := TRUE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
|
||||
900: // Error state
|
||||
IF _xConfirmAlarms AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_xCanChangeMode := TRUE;
|
||||
_iStateBalancing := 0;
|
||||
END_IF
|
||||
END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
@@ -496,25 +621,30 @@ END_CASE]]></ST>
|
||||
</Action>
|
||||
<Action Name="SM_SAFETY_CHECK" Id="{6d8e5993-cf32-4980-9ea3-c1fbfa4b8601}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[// wait for stop or error
|
||||
<ST><![CDATA[// Start on start button pressed
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
// Only start if everything is ok
|
||||
IF _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_xStartSafetyCheck := TRUE;
|
||||
END_IF
|
||||
END_IF
|
||||
|
||||
// on stop: open dc circuit breakers and close valves
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStopAutoButton.xRequest THEN
|
||||
_xStartSafetyCheck := FALSE;
|
||||
END_IF
|
||||
|
||||
// wait for voltage to drop below xx volts
|
||||
|
||||
// stop pumps
|
||||
CASE _iStateSafetyCheck OF
|
||||
0: // Idle
|
||||
// Wait for power command
|
||||
IF _xStartSafetyCheck AND _afbStrings[0].xAllModulesInAutoMode THEN
|
||||
// Wait for start command
|
||||
IF _xStartSafetyCheck AND _afbStrings[_uiDebugCurrentString].xAllModulesInAutoMode THEN
|
||||
_xEnableString := TRUE;
|
||||
_xEnableInverter := FALSE;
|
||||
_iStateSafetyCheck := 10;
|
||||
_rPowerInverter := 0.0;
|
||||
_xCanChangeMode := FALSE;
|
||||
END_IF
|
||||
|
||||
10: // Wait for string to be ready
|
||||
IF _afbStrings[0].xReady AND (NOT _afbStrings[0].xError) THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xReady AND (NOT _afbStrings[_uiDebugCurrentString].xError) THEN
|
||||
_iStateSafetyCheck := 30;
|
||||
END_IF
|
||||
|
||||
@@ -524,7 +654,7 @@ CASE _iStateSafetyCheck OF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
@@ -540,28 +670,29 @@ CASE _iStateSafetyCheck OF
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
45: // Wait for shutdown of string to be done
|
||||
IF _afbStrings[0].xOff THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xOff THEN
|
||||
_iStateSafetyCheck := 0;
|
||||
END_IF
|
||||
|
||||
// Check for errors
|
||||
IF _afbStrings[0].xError THEN
|
||||
IF _afbStrings[_uiDebugCurrentString].xError THEN
|
||||
_xEnableString := FALSE;
|
||||
_iStateSafetyCheck := 1000;
|
||||
END_IF
|
||||
|
||||
1000: // Error state
|
||||
_xEnableString := FALSE;
|
||||
_xEnableInverter := FALSE;
|
||||
_rPowerInverter := 0.0;
|
||||
_iStateSafetyCheck := 1010;
|
||||
|
||||
1010: // Wait for reset from error state
|
||||
IF (NOT _afbStrings[0].xError) AND NOT _xStartSafetyCheck THEN
|
||||
IF (NOT _afbStrings[_uiDebugCurrentString].xError) AND (NOT _xStartSafetyCheck) THEN
|
||||
// Goto init state
|
||||
_iStateSafetyCheck := 0;
|
||||
|
||||
@@ -571,66 +702,173 @@ END_CASE]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
<LineIds Name="MAIN">
|
||||
<LineId Id="2032" Count="54" />
|
||||
<LineId Id="2032" Count="12" />
|
||||
<LineId Id="2803" Count="1" />
|
||||
<LineId Id="2806" Count="0" />
|
||||
<LineId Id="2808" Count="0" />
|
||||
<LineId Id="2813" Count="1" />
|
||||
<LineId Id="2917" Count="1" />
|
||||
<LineId Id="2807" Count="0" />
|
||||
<LineId Id="2805" Count="0" />
|
||||
<LineId Id="2802" Count="0" />
|
||||
<LineId Id="2045" Count="0" />
|
||||
<LineId Id="2932" Count="4" />
|
||||
<LineId Id="2931" Count="0" />
|
||||
<LineId Id="2046" Count="5" />
|
||||
<LineId Id="2920" Count="0" />
|
||||
<LineId Id="2919" Count="0" />
|
||||
<LineId Id="2921" Count="1" />
|
||||
<LineId Id="2924" Count="0" />
|
||||
<LineId Id="2923" Count="0" />
|
||||
<LineId Id="2925" Count="1" />
|
||||
<LineId Id="2928" Count="0" />
|
||||
<LineId Id="2927" Count="0" />
|
||||
<LineId Id="2929" Count="1" />
|
||||
<LineId Id="2052" Count="34" />
|
||||
<LineId Id="2197" Count="0" />
|
||||
<LineId Id="2087" Count="12" />
|
||||
<LineId Id="2087" Count="3" />
|
||||
<LineId Id="2097" Count="2" />
|
||||
<LineId Id="2287" Count="0" />
|
||||
<LineId Id="2100" Count="91" />
|
||||
<LineId Id="2100" Count="0" />
|
||||
<LineId Id="2967" Count="0" />
|
||||
<LineId Id="2702" Count="0" />
|
||||
<LineId Id="2596" Count="0" />
|
||||
<LineId Id="2101" Count="11" />
|
||||
<LineId Id="2485" Count="4" />
|
||||
<LineId Id="2966" Count="0" />
|
||||
<LineId Id="2703" Count="0" />
|
||||
<LineId Id="2597" Count="0" />
|
||||
<LineId Id="2490" Count="10" />
|
||||
<LineId Id="2484" Count="0" />
|
||||
<LineId Id="2113" Count="19" />
|
||||
<LineId Id="2144" Count="23" />
|
||||
<LineId Id="2601" Count="0" />
|
||||
<LineId Id="2168" Count="0" />
|
||||
<LineId Id="2944" Count="1" />
|
||||
<LineId Id="2943" Count="0" />
|
||||
<LineId Id="2169" Count="3" />
|
||||
<LineId Id="2602" Count="0" />
|
||||
<LineId Id="2173" Count="1" />
|
||||
<LineId Id="2937" Count="2" />
|
||||
<LineId Id="2175" Count="3" />
|
||||
<LineId Id="2600" Count="0" />
|
||||
<LineId Id="2179" Count="0" />
|
||||
<LineId Id="2941" Count="1" />
|
||||
<LineId Id="2940" Count="0" />
|
||||
<LineId Id="2180" Count="3" />
|
||||
<LineId Id="2603" Count="0" />
|
||||
<LineId Id="2184" Count="0" />
|
||||
<LineId Id="2947" Count="1" />
|
||||
<LineId Id="2946" Count="0" />
|
||||
<LineId Id="2185" Count="3" />
|
||||
<LineId Id="2604" Count="0" />
|
||||
<LineId Id="2189" Count="0" />
|
||||
<LineId Id="2950" Count="1" />
|
||||
<LineId Id="2949" Count="0" />
|
||||
<LineId Id="2190" Count="0" />
|
||||
<LineId Id="2955" Count="3" />
|
||||
<LineId Id="2961" Count="0" />
|
||||
<LineId Id="2965" Count="0" />
|
||||
<LineId Id="2962" Count="0" />
|
||||
<LineId Id="2960" Count="0" />
|
||||
<LineId Id="2959" Count="0" />
|
||||
<LineId Id="2191" Count="0" />
|
||||
<LineId Id="2383" Count="0" />
|
||||
<LineId Id="2192" Count="0" />
|
||||
<LineId Id="2606" Count="0" />
|
||||
<LineId Id="2954" Count="0" />
|
||||
<LineId Id="2953" Count="0" />
|
||||
<LineId Id="2952" Count="0" />
|
||||
<LineId Id="2388" Count="0" />
|
||||
<LineId Id="2387" Count="0" />
|
||||
<LineId Id="2970" Count="0" />
|
||||
<LineId Id="2969" Count="0" />
|
||||
<LineId Id="2972" Count="0" />
|
||||
<LineId Id="2971" Count="0" />
|
||||
<LineId Id="2973" Count="0" />
|
||||
<LineId Id="2975" Count="1" />
|
||||
<LineId Id="2974" Count="0" />
|
||||
<LineId Id="2193" Count="3" />
|
||||
<LineId Id="25" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_AUTO">
|
||||
<LineId Id="2" Count="4" />
|
||||
<LineId Id="195" Count="0" />
|
||||
<LineId Id="7" Count="16" />
|
||||
<LineId Id="183" Count="1" />
|
||||
<LineId Id="7" Count="5" />
|
||||
<LineId Id="242" Count="0" />
|
||||
<LineId Id="13" Count="10" />
|
||||
<LineId Id="183" Count="0" />
|
||||
<LineId Id="182" Count="0" />
|
||||
<LineId Id="25" Count="0" />
|
||||
<LineId Id="185" Count="1" />
|
||||
<LineId Id="189" Count="0" />
|
||||
<LineId Id="205" Count="0" />
|
||||
<LineId Id="214" Count="0" />
|
||||
<LineId Id="187" Count="1" />
|
||||
<LineId Id="200" Count="1" />
|
||||
<LineId Id="203" Count="1" />
|
||||
<LineId Id="202" Count="0" />
|
||||
<LineId Id="31" Count="10" />
|
||||
<LineId Id="190" Count="0" />
|
||||
<LineId Id="216" Count="0" />
|
||||
<LineId Id="215" Count="0" />
|
||||
<LineId Id="42" Count="18" />
|
||||
<LineId Id="62" Count="54" />
|
||||
<LineId Id="191" Count="0" />
|
||||
<LineId Id="220" Count="0" />
|
||||
<LineId Id="44" Count="16" />
|
||||
<LineId Id="62" Count="23" />
|
||||
<LineId Id="230" Count="2" />
|
||||
<LineId Id="86" Count="2" />
|
||||
<LineId Id="236" Count="2" />
|
||||
<LineId Id="89" Count="12" />
|
||||
<LineId Id="233" Count="2" />
|
||||
<LineId Id="239" Count="2" />
|
||||
<LineId Id="102" Count="14" />
|
||||
<LineId Id="206" Count="0" />
|
||||
<LineId Id="117" Count="0" />
|
||||
<LineId Id="217" Count="0" />
|
||||
<LineId Id="118" Count="10" />
|
||||
<LineId Id="118" Count="9" />
|
||||
<LineId Id="207" Count="0" />
|
||||
<LineId Id="218" Count="0" />
|
||||
<LineId Id="129" Count="5" />
|
||||
<LineId Id="192" Count="0" />
|
||||
<LineId Id="135" Count="7" />
|
||||
<LineId Id="243" Count="0" />
|
||||
<LineId Id="129" Count="13" />
|
||||
<LineId Id="219" Count="0" />
|
||||
<LineId Id="143" Count="0" />
|
||||
<LineId Id="208" Count="0" />
|
||||
<LineId Id="196" Count="0" />
|
||||
<LineId Id="144" Count="4" />
|
||||
<LineId Id="193" Count="0" />
|
||||
<LineId Id="149" Count="7" />
|
||||
<LineId Id="144" Count="6" />
|
||||
<LineId Id="225" Count="0" />
|
||||
<LineId Id="227" Count="2" />
|
||||
<LineId Id="226" Count="0" />
|
||||
<LineId Id="151" Count="5" />
|
||||
<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="19" />
|
||||
<LineId Id="160" Count="4" />
|
||||
<LineId Id="166" Count="13" />
|
||||
<LineId Id="198" Count="1" />
|
||||
<LineId Id="180" Count="0" />
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_BALANCING">
|
||||
<LineId Id="1" Count="1" />
|
||||
<LineId Id="5" Count="2" />
|
||||
<LineId Id="15" Count="1" />
|
||||
<LineId Id="9" Count="3" />
|
||||
<LineId Id="35" Count="0" />
|
||||
<LineId Id="20" Count="0" />
|
||||
<LineId Id="14" Count="0" />
|
||||
<LineId Id="13" Count="0" />
|
||||
<LineId Id="17" Count="2" />
|
||||
<LineId Id="21" Count="0" />
|
||||
<LineId Id="23" Count="1" />
|
||||
<LineId Id="22" Count="0" />
|
||||
<LineId Id="25" Count="2" />
|
||||
<LineId Id="29" Count="0" />
|
||||
<LineId Id="28" Count="0" />
|
||||
<LineId Id="36" Count="1" />
|
||||
<LineId Id="41" Count="1" />
|
||||
<LineId Id="40" Count="0" />
|
||||
<LineId Id="39" Count="0" />
|
||||
<LineId Id="30" Count="2" />
|
||||
<LineId Id="43" Count="0" />
|
||||
<LineId Id="33" Count="1" />
|
||||
<LineId Id="3" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_CAPACITY_TEST">
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
@@ -638,15 +876,18 @@ END_CASE]]></ST>
|
||||
<LineId Id="1" Count="0" />
|
||||
</LineIds>
|
||||
<LineIds Name="MAIN.SM_SAFETY_CHECK">
|
||||
<LineId Id="8" Count="0" />
|
||||
<LineId Id="15" Count="1" />
|
||||
<LineId Id="13" Count="0" />
|
||||
<LineId Id="12" Count="0" />
|
||||
<LineId Id="18" Count="0" />
|
||||
<LineId Id="244" Count="0" />
|
||||
<LineId Id="235" Count="0" />
|
||||
<LineId Id="245" Count="0" />
|
||||
<LineId Id="242" Count="0" />
|
||||
<LineId Id="236" Count="0" />
|
||||
<LineId Id="243" Count="0" />
|
||||
<LineId Id="237" Count="4" />
|
||||
<LineId Id="17" Count="0" />
|
||||
<LineId Id="20" Count="3" />
|
||||
<LineId Id="198" Count="1" />
|
||||
<LineId Id="198" Count="0" />
|
||||
<LineId Id="24" Count="0" />
|
||||
<LineId Id="220" Count="0" />
|
||||
<LineId Id="216" Count="0" />
|
||||
<LineId Id="25" Count="0" />
|
||||
<LineId Id="39" Count="4" />
|
||||
@@ -663,9 +904,13 @@ END_CASE]]></ST>
|
||||
<LineId Id="217" Count="0" />
|
||||
<LineId Id="72" Count="0" />
|
||||
<LineId Id="131" Count="2" />
|
||||
<LineId Id="221" Count="0" />
|
||||
<LineId Id="135" Count="1" />
|
||||
<LineId Id="168" Count="2" />
|
||||
<LineId Id="172" Count="11" />
|
||||
<LineId Id="172" Count="4" />
|
||||
<LineId Id="222" Count="0" />
|
||||
<LineId Id="177" Count="4" />
|
||||
<LineId Id="183" Count="0" />
|
||||
<LineId Id="185" Count="3" />
|
||||
<LineId Id="195" Count="1" />
|
||||
<LineId Id="218" Count="1" />
|
||||
|
||||
Reference in New Issue
Block a user