Some refactoring

This commit is contained in:
Matthias Heisig
2025-01-17 08:08:37 +01:00
parent 39a02352f6
commit 0345f57a3f
10 changed files with 2921 additions and 934 deletions

View File

@@ -25,7 +25,7 @@ VAR_INPUT
xOff : BOOL := TRUE;
// HMI Interface
stHMIInterface : REFERENCE TO ST_MODULE_HMI_INTERFACE;
refstHMIInterface : REFERENCE TO ST_MODULE_HMI_INTERFACE;
// Release alarms
xReleaseErrors : BOOL;
@@ -57,7 +57,7 @@ VAR_INPUT
// Leakage tank
xLeakageTank AT %I* : BOOL;
xECState AT %I* : UINT;
uiECState AT %I* : UINT;
END_VAR
VAR_OUTPUT
// Module voltage
@@ -151,7 +151,7 @@ xSafetyIntlksOk := TRUE;
// ===============================
// Handle module connection lost error
// ===============================
_xECModuleInOP := (xECState AND 16#000F) = 8;
_xECModuleInOP := (uiECState AND 16#000F) = 8;
IF (NOT _xECModuleInOP) AND (NOT _fbConnLostAlarm.bRaised) AND xReleaseErrors THEN
_fbConnLostAlarm.Raise(0);
END_IF
@@ -223,7 +223,7 @@ _fbUnit1(
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit1Is1500V,
xInSafetyCheckMode := xInSafetyCheckMode,
stUnitConfig:= GVL_CONFIG.stUnitConfig,
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit1,
stHMIInterface:= refstHMIInterface.stHMIInterfaceUnit1,
xEmergencyStopOk:= xEmergencyStopOk,
xReleaseErrors:= xReleaseErrors,
xReleaseLimitErrors:= xReleaseLimitErrors,
@@ -261,7 +261,7 @@ _fbUnit2(
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit2Is1500V,
xInSafetyCheckMode := xInSafetyCheckMode,
stUnitConfig:= GVL_CONFIG.stUnitConfig,
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit2,
stHMIInterface:= refstHMIInterface.stHMIInterfaceUnit2,
xEmergencyStopOk:= xEmergencyStopOk,
xReleaseErrors:= xReleaseErrors,
xReleaseLimitErrors:= xReleaseLimitErrors,
@@ -299,7 +299,7 @@ _fbUnit3(
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit3Is1500V,
xInSafetyCheckMode := xInSafetyCheckMode,
stUnitConfig:= GVL_CONFIG.stUnitConfig,
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit3,
stHMIInterface:= refstHMIInterface.stHMIInterfaceUnit3,
xEmergencyStopOk:= xEmergencyStopOk,
xReleaseErrors:= xReleaseErrors,
xReleaseLimitErrors:= xReleaseLimitErrors,
@@ -337,7 +337,7 @@ _fbUnit4(
xVoltageSensorIs1500V := stModuleVoltageConfig.xUnit4Is1500V,
xInSafetyCheckMode := xInSafetyCheckMode,
stUnitConfig:= GVL_CONFIG.stUnitConfig,
stHMIInterface:= stHMIInterface.stHMIInterfaceUnit4,
stHMIInterface:= refstHMIInterface.stHMIInterfaceUnit4,
xEmergencyStopOk:= xEmergencyStopOk,
xReleaseErrors:= xReleaseErrors,
xReleaseLimitErrors:= xReleaseLimitErrors,
@@ -400,7 +400,7 @@ xOff := _fbUnit1.xOff AND _fbUnit2.xOff AND _fbUnit3.xOff AND _fbUnit4.xOff;
rCurrentVoltage := _fbUnit1.rCurrentVoltage + _fbUnit2.rCurrentVoltage + _fbUnit3.rCurrentVoltage + _fbUnit4.rCurrentVoltage;
//_fbMAFVoltage(pValues := ADR(_arMAFVoltage), iArraySize := 10, rCurrentValue := rCurrentVoltage, rAverage => stHMIInterface.rVoltage);
//stHMIInterface.rVoltage := rCurrentVoltage;
stHMIInterface.rVoltage := stHMIInterface.rVoltage * 0.9 + rCurrentVoltage * 0.1;
refstHMIInterface.rVoltage := refstHMIInterface.rVoltage * 0.9 + rCurrentVoltage * 0.1;
// ===============================
@@ -488,23 +488,23 @@ rHighestSegmentVoltage := MAX(_fbUnit1.rCurrentVoltage, _fbUnit2.rCurrentVoltage
// Module status sum
// ===============================
IF xReady AND (NOT xError) THEN
stHMIInterface.eStatus := E_COMPONENT_STATUS.ON;
refstHMIInterface.eStatus := E_COMPONENT_STATUS.ON;
END_IF
IF (_fbUnit1.eUnitState = E_COMPONENT_STATUS.STARTING OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.STARTING OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.STARTING OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.STARTING) AND (NOT xError) THEN
stHMIInterface.eStatus := E_COMPONENT_STATUS.STARTING;
refstHMIInterface.eStatus := E_COMPONENT_STATUS.STARTING;
END_IF
IF (_fbUnit1.eUnitState = E_COMPONENT_STATUS.SHUTDOWN OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.SHUTDOWN OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.SHUTDOWN OR _fbUnit1.eUnitState = E_COMPONENT_STATUS.SHUTDOWN) AND (NOT xError) THEN
stHMIInterface.eStatus := E_COMPONENT_STATUS.SHUTDOWN;
refstHMIInterface.eStatus := E_COMPONENT_STATUS.SHUTDOWN;
END_IF
IF (_fbUnit1.eUnitState = E_COMPONENT_STATUS.OFF AND _fbUnit1.eUnitState = E_COMPONENT_STATUS.OFF AND _fbUnit1.eUnitState = E_COMPONENT_STATUS.OFF AND _fbUnit1.eUnitState = E_COMPONENT_STATUS.OFF) AND (NOT xError) THEN
stHMIInterface.eStatus := E_COMPONENT_STATUS.OFF;
refstHMIInterface.eStatus := E_COMPONENT_STATUS.OFF;
END_IF
IF xError THEN
stHMIInterface.eStatus := E_COMPONENT_STATUS.ERROR;
refstHMIInterface.eStatus := E_COMPONENT_STATUS.ERROR;
END_IF
]]></ST>
</Implementation>
@@ -584,75 +584,5 @@ _fbLeackageSegment34Alarm.ipArguments.Clear().AddString(_sName);]]></ST>
</Implementation>
</Set>
</Property>
<LineIds Name="FB_Module">
<LineId Id="3" Count="8" />
<LineId Id="338" Count="0" />
<LineId Id="340" Count="1" />
<LineId Id="339" Count="0" />
<LineId Id="352" Count="0" />
<LineId Id="337" Count="0" />
<LineId Id="342" Count="1" />
<LineId Id="345" Count="2" />
<LineId Id="344" Count="0" />
<LineId Id="349" Count="0" />
<LineId Id="348" Count="0" />
<LineId Id="350" Count="1" />
<LineId Id="354" Count="3" />
<LineId Id="353" Count="0" />
<LineId Id="359" Count="0" />
<LineId Id="361" Count="1" />
<LineId Id="360" Count="0" />
<LineId Id="358" Count="0" />
<LineId Id="363" Count="1" />
<LineId Id="366" Count="0" />
<LineId Id="365" Count="0" />
<LineId Id="367" Count="1" />
<LineId Id="384" Count="0" />
<LineId Id="370" Count="13" />
<LineId Id="369" Count="0" />
<LineId Id="386" Count="14" />
<LineId Id="385" Count="0" />
<LineId Id="12" Count="275" />
<LineId Id="317" Count="2" />
<LineId Id="326" Count="0" />
<LineId Id="325" Count="0" />
<LineId Id="327" Count="1" />
<LineId Id="330" Count="0" />
<LineId Id="329" Count="0" />
<LineId Id="331" Count="1" />
<LineId Id="334" Count="0" />
<LineId Id="333" Count="0" />
<LineId Id="335" Count="1" />
<LineId Id="322" Count="0" />
<LineId Id="321" Count="0" />
<LineId Id="323" Count="1" />
<LineId Id="2" Count="0" />
</LineIds>
<LineIds Name="FB_Module.FB_init">
<LineId Id="3" Count="13" />
<LineId Id="18" Count="0" />
<LineId Id="21" Count="1" />
<LineId Id="19" Count="1" />
<LineId Id="17" Count="0" />
<LineId Id="2" Count="0" />
<LineId Id="23" Count="0" />
<LineId Id="25" Count="1" />
<LineId Id="24" Count="0" />
<LineId Id="28" Count="1" />
<LineId Id="27" 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="8" />
<LineId Id="2" Count="0" />
<LineId Id="14" Count="0" />
<LineId Id="13" Count="0" />
<LineId Id="12" Count="0" />
<LineId Id="16" Count="0" />
<LineId Id="15" Count="0" />
<LineId Id="17" Count="2" />
</LineIds>
</POU>
</TcPlcObject>