EMS-BMS heartbeat and modbus fixes
added ledge and error state when modbus communication is lost, seperated register 13004 (confirm) from registers 13000-13001 (BMS/String warning/error messages) for modbus mapping, added Heartbeat error message to bmsErrors
This commit is contained in:
@@ -81,6 +81,8 @@ VAR
|
||||
|
||||
// EMS heartbeat not ok signal
|
||||
_xEMSHeartbeatNotOK : BOOL;
|
||||
_xEMSHeartbeatNotOKLedge : BOOL;
|
||||
_rtrigEMSHeartbeakNotOK : R_TRIG;
|
||||
|
||||
// Error signal for no EMS Heartbeat
|
||||
_fbEMSHeartbeatTimeout : FB_ReleaseSignal;
|
||||
@@ -216,8 +218,8 @@ IF GVL_SCADA.stAckAlarmsButton.xRequest THEN
|
||||
END_IF
|
||||
|
||||
// Ack alarms through modbus
|
||||
IF GVL_MODBUS.stBMSErrorReg.wConfirmAlarms > 0 THEN
|
||||
GVL_MODBUS.stBMSErrorReg.wConfirmAlarms := 0;
|
||||
IF GVL_MODBUS.wConfirmAlarms > 0 THEN
|
||||
GVL_MODBUS.wConfirmAlarms := 0;
|
||||
_xConfirmAlarms := TRUE;
|
||||
END_IF
|
||||
|
||||
@@ -560,10 +562,22 @@ END_IF
|
||||
IF _xConfirmAlarms AND _fbEMSHeartbeatAlarm.eConfirmationState = TcEventConfirmationState.WaitForConfirmation THEN
|
||||
_fbEMSHeartbeatAlarm.Confirm(0);
|
||||
END_IF
|
||||
|
||||
// Ledge heartbeatNOK
|
||||
_rtrigEMSHeartbeakNotOK(CLK := _xEMSHeartbeatNotOK);
|
||||
IF _rtrigEMSHeartbeakNotOK.Q THEN
|
||||
_xEMSHeartbeatNotOKLedge := TRUE;
|
||||
END_IF
|
||||
|
||||
IF NOT _xEMSHeartbeatNotOK AND _xConfirmAlarms THEN
|
||||
_xEMSHeartbeatNotOKLedge := FALSE;
|
||||
END_IF
|
||||
|
||||
// ===============================
|
||||
// Copy data to modbus registers
|
||||
// ===============================
|
||||
// heartbeat
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bEMSHeartbeatError := _xEMSHeartbeatNotOKLedge;
|
||||
// Modbus current inverter values
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.diCurrentActivePower := 0;
|
||||
GVL_MODBUS.stModbusEMSComm.stModbusReg11.diCurrentReactivePower := 0;
|
||||
@@ -596,10 +610,14 @@ CASE _eBMSControlMode OF
|
||||
|
||||
// Only set power to EMS requested power if the EMS heartbeat is ok
|
||||
// Otherwise shutdown battery
|
||||
IF (NOT _xEMSHeartbeatNotOK) THEN
|
||||
IF (NOT _xEMSHeartbeatNotOKLedge) AND _iState <> 1010 THEN
|
||||
_rAutoPowerRequest := DINT_TO_REAL(GVL_MODBUS.stModbusEMSComm.stModbusReg12.diSetpointActivePower);
|
||||
ELSIF _iState = 1010 THEN
|
||||
_rAutoPowerRequest := 0;
|
||||
ELSE
|
||||
_rAutoPowerRequest := 0;
|
||||
_xErrorShutdown := TRUE;
|
||||
_iState := 1000;
|
||||
END_IF
|
||||
|
||||
IF (GVL_SCADA.eRequestedControlMode <> _eBMSControlMode) AND (GVL_SCADA.xCanChangeControlMode) THEN
|
||||
|
||||
Reference in New Issue
Block a user