Added Kaco cyclic data exchange change

- Power will now only be written if the requested power changed
This commit is contained in:
Matthias Heisig
2025-09-10 08:49:21 +02:00
parent 39a206a1df
commit 7c462c9cd4
4 changed files with 214 additions and 197 deletions

View File

@@ -1041,7 +1041,7 @@ _fbTowerLight(
END_IF
IF (ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK THEN
IF ((ABS(_rAutoPowerRequest) < DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR _xEMSHeartbeatNotOK) AND (NOT GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) THEN
_fbStringReadyTimeout(IN := FALSE);
_xEnableString := FALSE;
_xCanChangeMode := TRUE;
@@ -1231,17 +1231,25 @@ _fbTowerLight(
END_IF
// Restart if possible
IF (ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
IF ((ABS(_rAutoPowerRequest) > DINT_TO_REAL(GVL_CONFIG.diMinimumAbsPowerForEnable)) OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive)
AND (NOT _xStringsErrorActive) AND _xStringsAllInAutomaticMode THEN
_xCanChangeMode := FALSE;
IF _rAutoPowerRequest < 0 AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL THEN
IF (_rAutoPowerRequest < 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.FULL THEN
_iState := 0;
// TODO: Meldung ausgeben, dass Batterie schon voll ist
END_IF
IF _rAutoPowerRequest > 0 AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.EMPTY THEN
IF (_rAutoPowerRequest > 0 OR GVL_MODBUS.stModbusEMSComm.stModbusReg12.wBMSControlsRegister.stBitmap.bScheduleActive) AND GVL_MODBUS.stModbusEMSComm.stModbusReg11.eChargeStatus <> E_CHARGE_STATUS.EMPTY THEN
_iState := 0;
// TODO: Meldung ausgeben, dass Batterie schon leer ist.
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
_iState := 0;
END_IF
END_IF
END_IF
// Check for errors