Fixed some bugs in cycling mode

This commit is contained in:
Matthias Heisig
2025-02-14 15:42:27 +01:00
parent 2ded890dd4
commit 4f0905d64a
3 changed files with 26 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@@ -558,7 +558,9 @@ CASE _eBMSControlMode OF
_xAllComponentsToManualMode := FALSE;
_xInSafetyCheckMode := FALSE;
_xReleaseManualMode := FALSE;
_rAutoPowerRequest := DINT_TO_REAL(GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower);
IF (_iState <> 30) OR _rAutoPowerRequest = 0.0 THEN
_rAutoPowerRequest := DINT_TO_REAL(GVL_SCADA.stAutomaticModeHMI.diSetpointAutomatic);
END_IF
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
_eBMSControlMode := GVL_SCADA.eRequestedControlMode;
END_IF
@@ -677,8 +679,8 @@ END_IF]]></ST>
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.CHARGING AND ((_rMaxCurrentInverterDCVoltage >= GVL_CONFIG.rStringFullyChargedVoltage) OR _rHighestSegmentVoltage >= GVL_CONFIG.rMaximumUnitVoltage) THEN
IF (_eBMSControlMode = E_BMS_CONTROL_MODE.CYCLING) THEN
GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower := GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower * -1;
// Change of charge discharge should be handled in next cycle by sasme state
_rAutoPowerRequest := _rAutoPowerRequest * -1;
// Change of charge discharge should be handled in next cycle by same state
// GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus := E_CHARGE_STATUS.DISCHARGING;
ELSE
_tonBeginShutdown(In := FALSE);
@@ -706,8 +708,8 @@ END_IF]]></ST>
// Shutdown triggered by battery empty
IF GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus = E_CHARGE_STATUS.DISCHARGING AND ((_rMinCurrentInverterDCVoltage <= GVL_CONFIG.rStringEmptyVoltage) OR _rSmallestSegmentVoltage <= GVL_CONFIG.rMinimumUnitVoltage) THEN
IF (_eBMSControlMode = E_BMS_CONTROL_MODE.CYCLING) THEN
GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower := GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower * -1;
// Change of charge discharge should be handled in next cycle by sasme state
_rAutoPowerRequest := _rAutoPowerRequest * -1;
// Change of charge discharge should be handled in next cycle by same state
// GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus := E_CHARGE_STATUS.CHARGING;
ELSE
_tonBeginShutdown(In := FALSE);