Finished first implementation of modbus error registers

This commit is contained in:
Matthias Heisig
2025-04-14 19:38:17 +02:00
parent 4a00a4c414
commit f79cf27c0c
19 changed files with 998 additions and 531 deletions

View File

@@ -1,11 +1,15 @@
<?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="FB_Module" Id="{87be924f-018d-4c09-997b-f0c0054414cc}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Module
VAR_INPUT
// Emergency stop ok
xEmergencyStopOk : BOOL;
// Unit numbering start (0 based index)
// Unit 1 -> Index 0
uiFirstUnitIndex : UINT;
// Enable
xEnable : BOOL;
@@ -179,6 +183,8 @@ END_IF
// Leackage Unit 1/2 error (1 - OK; 0 - Leackage)
// ===============================
IF (NOT xLeakageSegments12) AND (NOT _fbLeackageSegment12Alarm.bRaised) AND xReleaseErrors THEN
GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex].stBitmap.bLeack := 1;
GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+1].stBitmap.bLeack := 1;
_fbLeackageSegment12Alarm.Raise(0);
END_IF
@@ -195,6 +201,8 @@ END_IF
// Leackage Unit 3/4 error (1 - OK; 0 - Leackage)
// ===============================
IF (NOT xLeakageSegments34) AND (NOT _fbLeackageSegment34Alarm.bRaised) AND xReleaseErrors THEN
GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+2].stBitmap.bLeack := 1;
GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+3].stBitmap.bLeack := 1;
_fbLeackageSegment34Alarm.Raise(0);
END_IF
@@ -223,7 +231,9 @@ _fbUnit1(
xConfirmAlarms:= xConfirmAlarms,
xReleaseManualMode := xReleaseManualMode,
rBalancingTargetVoltage := rBalancingTargetVoltage,
xAllToManualMode := xAllToManualMode);
xAllToManualMode := xAllToManualMode,
stModbusWarnings := GVL_MODBUS.awWarningsUnitsActive[uiFirstUnitIndex],
stModbusErrors := GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex]);
refstHMIInterface.stHMIInterfaceUnit1.rCurrent := rCurrent;
@@ -261,7 +271,9 @@ _fbUnit2(
xConfirmAlarms:= xConfirmAlarms,
xReleaseManualMode := xReleaseManualMode,
rBalancingTargetVoltage := rBalancingTargetVoltage,
xAllToManualMode := xAllToManualMode);
xAllToManualMode := xAllToManualMode,
stModbusWarnings := GVL_MODBUS.awWarningsUnitsActive[uiFirstUnitIndex+1],
stModbusErrors := GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+1]);
refstHMIInterface.stHMIInterfaceUnit2.rCurrent := rCurrent;
@@ -299,7 +311,9 @@ _fbUnit3(
xConfirmAlarms:= xConfirmAlarms,
xReleaseManualMode := xReleaseManualMode,
rBalancingTargetVoltage := rBalancingTargetVoltage,
xAllToManualMode := xAllToManualMode);
xAllToManualMode := xAllToManualMode,
stModbusWarnings := GVL_MODBUS.awWarningsUnitsActive[uiFirstUnitIndex+2],
stModbusErrors := GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+2]);
refstHMIInterface.stHMIInterfaceUnit3.rCurrent := rCurrent;
@@ -337,7 +351,9 @@ _fbUnit4(
xConfirmAlarms:= xConfirmAlarms,
xReleaseManualMode := xReleaseManualMode,
rBalancingTargetVoltage := rBalancingTargetVoltage,
xAllToManualMode := xAllToManualMode);
xAllToManualMode := xAllToManualMode,
stModbusWarnings := GVL_MODBUS.awWarningsUnitsActive[uiFirstUnitIndex+3],
stModbusErrors := GVL_MODBUS.awErrorsUnitsActive[uiFirstUnitIndex+3]);
refstHMIInterface.stHMIInterfaceUnit4.rCurrent := rCurrent;
@@ -587,37 +603,5 @@ _fbLeackageSegment34Alarm.ipArguments.Clear().AddString(_sName);]]></ST>
</Implementation>
</Set>
</Property>
<LineIds Name="FB_Module">
<LineId Id="3" Count="81" />
<LineId Id="86" Count="9" />
<LineId Id="371" Count="1" />
<LineId Id="96" Count="25" />
<LineId Id="123" Count="9" />
<LineId Id="373" Count="1" />
<LineId Id="133" Count="25" />
<LineId Id="160" Count="9" />
<LineId Id="375" Count="1" />
<LineId Id="170" Count="25" />
<LineId Id="197" Count="9" />
<LineId Id="377" Count="1" />
<LineId Id="207" Count="135" />
<LineId Id="380" Count="1" />
<LineId Id="383" Count="0" />
<LineId Id="379" Count="0" />
<LineId Id="384" Count="0" />
<LineId Id="343" Count="27" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Module.FB_init">
<LineId Id="3" Count="26" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Module.Name.Get">
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Module.Name.Set">
<LineId Id="3" Count="16" />
<LineId Id="2" Count="0" />
</LineIds>
</POU>
</TcPlcObject>