Finished first implementation of modbus error registers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.8">
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4026.12">
|
||||
<POU Name="MAIN" Id="{bbd7302c-91ce-4697-9f4b-743f57ca5819}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
@@ -122,8 +122,6 @@ VAR
|
||||
_xAllComponentsToManualMode : BOOL;
|
||||
|
||||
// DEBUG
|
||||
_xRestart : BOOL;
|
||||
|
||||
_ModbusDebugTest : ST_MODBUS_REG_11;
|
||||
|
||||
_fbStringReadyTimeout : TON;
|
||||
@@ -158,21 +156,7 @@ VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><;
|
||||
|
||||
|
||||
// Call string 2
|
||||
_afbStrings[1](
|
||||
xEnable := _xEnableString,
|
||||
uiStringNumber := 1,
|
||||
xErrorShutdown := _xErrorShutdown,
|
||||
xStartBalancing := _xStartBalancing,
|
||||
sInverterIP := GVL_CONFIG.sInverterIpString2,
|
||||
@@ -342,6 +345,16 @@ IF _afbStrings[1].xError THEN
|
||||
_xErrorActive := TRUE;
|
||||
END_IF
|
||||
|
||||
// Handle string 1 modbus error and warning
|
||||
GVL_MODBUS.stBMSErrorReg.wStringErrorActive.1 := _afbStrings[1].xError;
|
||||
GVL_MODBUS.stBMSErrorReg.wStringWarningActive.1 := _afbStrings[1].xWarning;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bDCSwitchS2 := _afbStrings[1].xRepairSwitchOk;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bSafetyIntlkString2 := (NOT _afbStrings[1].xSafetyIntlksOk);
|
||||
|
||||
// Copy general error to modbus error register
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.stBitmap.bError := _xErrorActive;
|
||||
|
||||
|
||||
// ===============================
|
||||
// Get global string status information
|
||||
// ===============================
|
||||
@@ -616,6 +629,9 @@ IF _xStringsInAutoMode AND _fbNoAutomaticModeAlarm.bRaised THEN
|
||||
_fbNoAutomaticModeAlarm.Clear(0, TRUE);
|
||||
END_IF
|
||||
|
||||
// Copy auto mode warning message to modbus register
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.stBitmap.bNotAllInAuto := (NOT _xStringsInAutoMode);
|
||||
|
||||
// Reset automatic buttons
|
||||
IF GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest THEN
|
||||
GVL_SCADA.stAutomaticModeHMI.stStartAutoButton.xRequest := FALSE;
|
||||
@@ -626,6 +642,8 @@ END_IF
|
||||
|
||||
// Reset alarm confirmation
|
||||
IF _xConfirmAlarms OR _rtHardwareResetButton.Q THEN
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSErrorActive.wRegister := 0;
|
||||
GVL_MODBUS.stBMSErrorReg.wBMSWarningActive.wRegister := 0;
|
||||
_xConfirmAlarms := FALSE;
|
||||
END_IF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user