|
|
|
|
@@ -207,6 +207,7 @@ VAR
|
|
|
|
|
_xGetPowerMeterData : BOOL;
|
|
|
|
|
|
|
|
|
|
_rPowerDH : REAL;
|
|
|
|
|
_xDHActive : BOOL;
|
|
|
|
|
_fbTONDHCycleTime : TON := (PT := T#15M);
|
|
|
|
|
|
|
|
|
|
// tower light
|
|
|
|
|
@@ -486,6 +487,11 @@ GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module2High
|
|
|
|
|
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString1Module3High := _afbStrings[0].xTempCabinetModule3Warning;
|
|
|
|
|
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString1High := _fbTempCabinetSCSString1.xWarningHigh;
|
|
|
|
|
|
|
|
|
|
// Copy inverter data to Modbus registers
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1CurrentState := _afbStrings[0].stInverterInfos.eCurrentState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1RequestedState := _afbStrings[0].stInverterInfos.eRequestedState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1PCUState := _afbStrings[0].stInverterInfos.ePCUState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter1PCUError := _afbStrings[0].stInverterInfos.ePCUError;
|
|
|
|
|
|
|
|
|
|
// Call string 2
|
|
|
|
|
_afbStrings[1](
|
|
|
|
|
@@ -548,6 +554,12 @@ GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module2High
|
|
|
|
|
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetString2Module3High := _afbStrings[1].xTempCabinetModule3Warning;
|
|
|
|
|
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bTCabinetSCSString2High := _fbTempCabinetSCSString2.xWarningHigh;
|
|
|
|
|
|
|
|
|
|
// Copy inverter data to Modbus registers
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2CurrentState := _afbStrings[1].stInverterInfos.eCurrentState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2RequestedState := _afbStrings[1].stInverterInfos.eRequestedState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2PCUState := _afbStrings[1].stInverterInfos.ePCUState;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eInverter2PCUError := _afbStrings[1].stInverterInfos.ePCUError;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ===============================
|
|
|
|
|
// Get global string status information
|
|
|
|
|
@@ -880,14 +892,21 @@ CASE _eBMSControlMode OF
|
|
|
|
|
|
|
|
|
|
// Goto error state if a string has an error
|
|
|
|
|
IF _xStringsErrorActive THEN
|
|
|
|
|
_xDHActive := FALSE;
|
|
|
|
|
_iStateDH := 1000;
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
CASE _iStateDH OF
|
|
|
|
|
0: // Idle, wait for command
|
|
|
|
|
_rAutoPowerRequest := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
|
|
|
|
IF (ABS(_rAutoPowerRequest) > 100.0) THEN
|
|
|
|
|
_rPowerDH := _rAutoPowerRequest;
|
|
|
|
|
_rPowerDH := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
|
|
|
|
|
IF (ABS(_rPowerDH) > 100.0) THEN
|
|
|
|
|
_xDHActive := TRUE;
|
|
|
|
|
_iStateDH := 5;
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
5: // Wait for pre startup
|
|
|
|
|
IF _xBatteryActive THEN
|
|
|
|
|
_rAutoPowerRequest := _rPowerDH;
|
|
|
|
|
_fbTONDHCycleTime(IN := TRUE);
|
|
|
|
|
_iStateDH := 10;
|
|
|
|
|
END_IF
|
|
|
|
|
@@ -904,7 +923,7 @@ CASE _eBMSControlMode OF
|
|
|
|
|
20: // First pause
|
|
|
|
|
_fbTONDHCycleTime(IN := TRUE);
|
|
|
|
|
IF _fbTONDHCycleTime.Q THEN
|
|
|
|
|
_rAutoPowerRequest := _rPowerDH;
|
|
|
|
|
_rAutoPowerRequest := _rPowerDH * -1;
|
|
|
|
|
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := REAL_TO_DINT(_rAutoPowerRequest);
|
|
|
|
|
_fbTONDHCycleTime(IN := FALSE);
|
|
|
|
|
_iStateDH := 30;
|
|
|
|
|
@@ -916,6 +935,7 @@ CASE _eBMSControlMode OF
|
|
|
|
|
_rAutoPowerRequest := 0;
|
|
|
|
|
GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic := 0;
|
|
|
|
|
_fbTONDHCycleTime(IN := FALSE);
|
|
|
|
|
_xDHActive := FALSE;
|
|
|
|
|
_iStateDH := 0;
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
@@ -1019,7 +1039,7 @@ _fbTowerLight(
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
// Wait for power command
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive)
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive OR _xDHActive)
|
|
|
|
|
AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode AND (NOT _xEMSHeartbeatNotOK) THEN
|
|
|
|
|
_iState := 5;
|
|
|
|
|
_xReleaseInverterPower := FALSE;
|
|
|
|
|
@@ -1065,7 +1085,7 @@ _fbTowerLight(
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) THEN
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND (NOT _xDHActive) THEN
|
|
|
|
|
_fbStringReadyTimeout(IN := FALSE);
|
|
|
|
|
_xEnableString := FALSE;
|
|
|
|
|
_xCanChangeMode := TRUE;
|
|
|
|
|
@@ -1080,7 +1100,7 @@ _fbTowerLight(
|
|
|
|
|
_xBatteryActive := TRUE;
|
|
|
|
|
|
|
|
|
|
// Check if the battery should still be active
|
|
|
|
|
IF (_rAutoPowerRequest = 0.0) AND NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive THEN
|
|
|
|
|
IF (_rAutoPowerRequest = 0.0) AND ((NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) OR (NOT _xDHActive)) THEN
|
|
|
|
|
_xNoPowerRequested := TRUE;
|
|
|
|
|
ELSE
|
|
|
|
|
_xNoPowerRequested := FALSE;
|
|
|
|
|
@@ -1248,6 +1268,7 @@ _fbTowerLight(
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
45: // Wait for shutdown of string to be done
|
|
|
|
|
_xCanChangeMode := TRUE;
|
|
|
|
|
IF (NOT _xStringsInSchutdownDischargeMode) AND _xStringsOff THEN
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eBatteryStatus := E_BATTERY_STATUS.OFF;
|
|
|
|
|
GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus := E_CHARGE_STATUS.UNDEFINED;
|
|
|
|
|
@@ -1256,7 +1277,7 @@ _fbTowerLight(
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
// Restart if possible
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive)
|
|
|
|
|
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive OR _xDHActive)
|
|
|
|
|
AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
|
|
|
|
|
_xCanChangeMode := FALSE;
|
|
|
|
|
IF (_rAutoPowerRequest < 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL THEN
|
|
|
|
|
@@ -1267,6 +1288,10 @@ _fbTowerLight(
|
|
|
|
|
_iState := 0;
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
IF _xDHActive THEN
|
|
|
|
|
_iState := 0;
|
|
|
|
|
END_IF
|
|
|
|
|
|
|
|
|
|
IF (_rAutoPowerRequest <> 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) THEN
|
|
|
|
|
IF (_rAutoPowerRequest <= 0 AND (GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL))
|
|
|
|
|
OR (_rAutoPowerRequest >= 0) AND (GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.EMPTY) THEN
|
|
|
|
|
|