Started input station

This commit is contained in:
2026-03-04 10:20:36 +01:00
parent 070822e497
commit 64f561b0c5
8 changed files with 519 additions and 134 deletions

View File

@@ -41,6 +41,9 @@ VAR
// Trigger change recipe
_rtChangeRecipeRequest : R_TRIG;
// Internal PackMLs buffer
_stStatus : ST_PMLs;
// State state machine variable
_iSSM : INT := 0;
END_VAR
@@ -74,19 +77,19 @@ _fbStateMachine(
eMode:= _eMode,
eCmd:= _eCmd,
stConfig := _stSMConfig,
eState=> stStatus.eStateCurrent,
eCurrentMode => stStatus.eUnitModeCurrent,
eState=> _stStatus.eStateCurrent,
eCurrentMode => _stStatus.eUnitModeCurrent,
xError=> );
// Reset state state machine
IF _eLastState <> stStatus.eStateCurrent THEN
IF _eLastState <> _stStatus.eStateCurrent THEN
_iSSM := 0;
_eLastState := stStatus.eStateCurrent;
_eLastState := _stStatus.eStateCurrent;
END_IF
// Call state method according to current state
CASE stStatus.eStateCurrent OF
CASE _stStatus.eStateCurrent OF
E_PackMLState.CLEARING:
M_Clearing();
@@ -143,9 +146,13 @@ CASE stStatus.eStateCurrent OF
;
END_CASE
A_HandleHMIOutput();]]></ST>
A_HandleHMIOutput();
// Copy ouput buffers
stStatus := _stStatus;]]></ST>
</Implementation>
<Folder Name="Commands" Id="{11740802-7551-418d-83f3-5b2d5c93c299}" />
<Folder Name="Properties" Id="{71c1b935-7017-4f1f-b047-e556465667b8}" />
<Folder Name="States" Id="{2cf25144-1e5c-4db8-ba57-9d98461c53ce}" />
<Action Name="A_HandleHMIInput" Id="{723844ed-d531-4820-b577-cf5a7662c8f5}">
<Implementation>
@@ -273,101 +280,101 @@ IF (NOT __ISVALIDREF(stPackMLHMIInterface)) THEN
END_IF
// Handle manual mode button
stPackMLHMIInterface.stBtnManualMode.xRelease := (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eUnitModeCurrent = E_PackMLUnitMode.MANUAL THEN
stPackMLHMIInterface.stBtnManualMode.xRelease := (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF _stStatus.eUnitModeCurrent = E_PackMLUnitMode.MANUAL THEN
stPackMLHMIInterface.stBtnManualMode.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnManualMode.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle production mode button
stPackMLHMIInterface.stBtnProdMode.xRelease := (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eUnitModeCurrent = E_PackMLUnitMode.PRODUCTION THEN
stPackMLHMIInterface.stBtnProdMode.xRelease := (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF _stStatus.eUnitModeCurrent = E_PackMLUnitMode.PRODUCTION THEN
stPackMLHMIInterface.stBtnProdMode.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnProdMode.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle clear button
stPackMLHMIInterface.stBtnClear.xRelease := (stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF stStatus.eStateCurrent = E_PackMLState.CLEARING THEN
stPackMLHMIInterface.stBtnClear.xRelease := (_stStatus.eStateCurrent = E_PackMLState.ABORTED);
IF _stStatus.eStateCurrent = E_PackMLState.CLEARING THEN
stPackMLHMIInterface.stBtnClear.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnClear.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle reset button
stPackMLHMIInterface.stBtnReset.xRelease := (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.COMPLETED);
IF stStatus.eStateCurrent = E_PackMLState.RESETTING THEN
stPackMLHMIInterface.stBtnReset.xRelease := (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.COMPLETED);
IF _stStatus.eStateCurrent = E_PackMLState.RESETTING THEN
stPackMLHMIInterface.stBtnReset.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnReset.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle start button
stPackMLHMIInterface.stBtnStart.xRelease := (stStatus.eStateCurrent = E_PackMLState.IDLE);
IF stStatus.eStateCurrent = E_PackMLState.STARTING THEN
stPackMLHMIInterface.stBtnStart.xRelease := (_stStatus.eStateCurrent = E_PackMLState.IDLE);
IF _stStatus.eStateCurrent = E_PackMLState.STARTING THEN
stPackMLHMIInterface.stBtnStart.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnStart.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle abort button
stPackMLHMIInterface.stBtnAbort.xRelease := (stStatus.eStateCurrent <> E_PackMLState.ABORTED) AND (stStatus.eStateCurrent <> E_PackMLState.ABORTING);
IF stStatus.eStateCurrent = E_PackMLState.ABORTING THEN
stPackMLHMIInterface.stBtnAbort.xRelease := (_stStatus.eStateCurrent <> E_PackMLState.ABORTED) AND (_stStatus.eStateCurrent <> E_PackMLState.ABORTING);
IF _stStatus.eStateCurrent = E_PackMLState.ABORTING THEN
stPackMLHMIInterface.stBtnAbort.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnAbort.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle hold button
stPackMLHMIInterface.stBtnHold.xRelease := (stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF stStatus.eStateCurrent = E_PackMLState.HOLDING THEN
stPackMLHMIInterface.stBtnHold.xRelease := (_stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (_stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF _stStatus.eStateCurrent = E_PackMLState.HOLDING THEN
stPackMLHMIInterface.stBtnHold.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnHold.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle stop button
stPackMLHMIInterface.stBtnStop.xRelease := (stStatus.eStateCurrent <> E_PackMLState.ABORTED)
AND (stStatus.eStateCurrent <> E_PackMLState.ABORTING)
AND (stStatus.eStateCurrent <> E_PackMLState.CLEARING)
AND (stStatus.eStateCurrent <> E_PackMLState.STOPPING)
AND (stStatus.eStateCurrent <> E_PackMLState.STOPPED);
stPackMLHMIInterface.stBtnStop.xRelease := (_stStatus.eStateCurrent <> E_PackMLState.ABORTED)
AND (_stStatus.eStateCurrent <> E_PackMLState.ABORTING)
AND (_stStatus.eStateCurrent <> E_PackMLState.CLEARING)
AND (_stStatus.eStateCurrent <> E_PackMLState.STOPPING)
AND (_stStatus.eStateCurrent <> E_PackMLState.STOPPED);
IF stStatus.eStateCurrent = E_PackMLState.STOPPING THEN
IF _stStatus.eStateCurrent = E_PackMLState.STOPPING THEN
stPackMLHMIInterface.stBtnStop.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnStop.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle suspend button
stPackMLHMIInterface.stBtnSuspend.xRelease := (stStatus.eStateCurrent = E_PackMLState.EXECUTE);
IF stStatus.eStateCurrent = E_PackMLState.SUSPENDING THEN
stPackMLHMIInterface.stBtnSuspend.xRelease := (_stStatus.eStateCurrent = E_PackMLState.EXECUTE);
IF _stStatus.eStateCurrent = E_PackMLState.SUSPENDING THEN
stPackMLHMIInterface.stBtnSuspend.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnSuspend.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle unhold button
stPackMLHMIInterface.stBtnUnhold.xRelease := (stStatus.eStateCurrent = E_PackMLState.HELD);
IF stStatus.eStateCurrent = E_PackMLState.UNHOLDING THEN
stPackMLHMIInterface.stBtnUnhold.xRelease := (_stStatus.eStateCurrent = E_PackMLState.HELD);
IF _stStatus.eStateCurrent = E_PackMLState.UNHOLDING THEN
stPackMLHMIInterface.stBtnUnhold.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnUnhold.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle unsuspend button
stPackMLHMIInterface.stBtnUnsuspend.xRelease := (stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF stStatus.eStateCurrent = E_PackMLState.UNSUSPENDING THEN
stPackMLHMIInterface.stBtnUnsuspend.xRelease := (_stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF _stStatus.eStateCurrent = E_PackMLState.UNSUSPENDING THEN
stPackMLHMIInterface.stBtnUnsuspend.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnUnsuspend.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
END_IF
// Handle complete button
stPackMLHMIInterface.stBtnComplete.xRelease := (stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (stStatus.eStateCurrent = E_PackMLState.HELD) OR (stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF stStatus.eStateCurrent = E_PackMLState.UNSUSPENDING THEN
stPackMLHMIInterface.stBtnComplete.xRelease := (_stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (_stStatus.eStateCurrent = E_PackMLState.HELD) OR (_stStatus.eStateCurrent = E_PackMLState.SUSPENDED);
IF _stStatus.eStateCurrent = E_PackMLState.UNSUSPENDING THEN
stPackMLHMIInterface.stBtnComplete.eFeedback := E_HMI_BUTTON_FEEDBACK.ACTIVE;
ELSE
stPackMLHMIInterface.stBtnComplete.eFeedback := E_HMI_BUTTON_FEEDBACK.NONE;
@@ -375,7 +382,7 @@ END_IF
// Copy mode and state
stPackMLHMIInterface.eCurrentMode := _eMode;
stPackMLHMIInterface.eCurrentState := stStatus.eStateCurrent;]]></ST>
stPackMLHMIInterface.eCurrentState := _stStatus.eStateCurrent;]]></ST>
</Implementation>
</Action>
<Method Name="M_Aborted" Id="{db1a684f-e4e1-4d89-a3aa-9b9dfde0508c}" FolderPath="States\">
@@ -398,7 +405,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
_eMode := E_PackMLUnitMode.MANUAL;
END_IF]]></ST>
</Implementation>
@@ -409,7 +416,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.ABORTED) THEN
_eMode := E_PackMLUnitMode.PRODUCTION;
END_IF]]></ST>
</Implementation>
@@ -427,7 +434,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent <> E_PackMLState.ABORTED) AND (stStatus.eStateCurrent <> E_PackMLState.ABORTING) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent <> E_PackMLState.ABORTED) AND (_stStatus.eStateCurrent <> E_PackMLState.ABORTING) THEN
_eCmd := E_PackMLCmd.ABORT;
M_CmdAbort := TRUE;
ELSE
@@ -440,7 +447,7 @@ END_IF]]></ST>
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.ABORTED THEN
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.ABORTED THEN
_eCmd := E_PackMLCmd.CLEAR;
M_CmdClear := TRUE;
ELSE
@@ -454,7 +461,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
_eCmd := E_PackMLCmd.COMPLETE;
M_CmdComplete := TRUE;
ELSE
@@ -468,7 +475,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (_stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
_eCmd := E_PackMLCmd.HOLD;
M_CmdHold := TRUE;
ELSE
@@ -482,7 +489,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (stStatus.eStateCurrent = E_PackMLState.COMPLETED) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.STOPPED) OR (_stStatus.eStateCurrent = E_PackMLState.COMPLETED) THEN
_eCmd := E_PackMLCmd.RESET;
M_CmdReset := TRUE;
ELSE
@@ -496,7 +503,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.IDLE THEN
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.IDLE THEN
_eCmd := E_PackMLCmd.START;
M_CmdStart := TRUE;
ELSE
@@ -510,11 +517,11 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent <> E_PackMLState.ABORTED)
AND (stStatus.eStateCurrent <> E_PackMLState.ABORTING)
AND (stStatus.eStateCurrent <> E_PackMLState.CLEARING)
AND (stStatus.eStateCurrent <> E_PackMLState.STOPPING)
AND (stStatus.eStateCurrent <> E_PackMLState.STOPPED)
<ST><![CDATA[IF (_stStatus.eStateCurrent <> E_PackMLState.ABORTED)
AND (_stStatus.eStateCurrent <> E_PackMLState.ABORTING)
AND (_stStatus.eStateCurrent <> E_PackMLState.CLEARING)
AND (_stStatus.eStateCurrent <> E_PackMLState.STOPPING)
AND (_stStatus.eStateCurrent <> E_PackMLState.STOPPED)
THEN
_eCmd := E_PackMLCmd.STOP;
M_CmdStop := TRUE;
@@ -529,7 +536,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
_eCmd := E_PackMLCmd.SUSPEND;
M_CmdSuspend := TRUE;
ELSE
@@ -543,7 +550,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.HELD) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.HELD) THEN
_eCmd := E_PackMLCmd.UNSUSPEND;
M_CmdUnhold := TRUE;
ELSE
@@ -557,7 +564,7 @@ VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
<ST><![CDATA[IF (_stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
_eCmd := E_PackMLCmd.UNSUSPEND;
M_CmdUnsuspend := TRUE;
ELSE
@@ -566,10 +573,10 @@ END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Completed" Id="{33df5dea-d83b-48e1-8898-d7c8e1f031bd}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Completed
<Declaration><![CDATA[METHOD PROTECTED M_Completed : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
_eCmd := E_PackMLCmd.COMPLETE;
M_Completed := TRUE;
ELSE
@@ -679,5 +686,65 @@ _fbStateMachine.M_StateComplete();]]></ST>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Property Name="P_IsAborting" Id="{2b0946af-b14d-4d2e-990d-b07d1895ea11}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY PUBLIC P_IsAborting : BOOL]]></Declaration>
<Get Name="Get" Id="{70c3f60f-0f05-4a00-a64d-b39e6fe8aed2}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.ABORTING THEN
P_IsAborting := TRUE;
ELSE
P_IsAborting := FALSE;
END_IF]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="P_IsClearing" Id="{944646f8-7122-4c20-a9f8-47665b03c3a6}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY PUBLIC P_IsClearing : BOOL]]></Declaration>
<Get Name="Get" Id="{a9daac25-4395-40d2-b9b1-1febd61f0c04}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.CLEARING THEN
P_IsClearing := TRUE;
ELSE
P_IsClearing := FALSE;
END_IF]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="P_IsResetting" Id="{87063e57-8128-494e-93a1-c43385c51aa1}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY PUBLIC P_IsResetting : BOOL]]></Declaration>
<Get Name="Get" Id="{0dce300e-62cf-49c8-a396-770e6fb91489}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.RESETTING THEN
P_IsResetting := TRUE;
ELSE
P_IsResetting := FALSE;
END_IF]]></ST>
</Implementation>
</Get>
</Property>
<Property Name="P_IsStopping" Id="{46829e26-3c3f-4a9e-ad8b-51b2c66f4c40}" FolderPath="Properties\">
<Declaration><![CDATA[PROPERTY PUBLIC P_IsStopping : BOOL]]></Declaration>
<Get Name="Get" Id="{36bdb17b-1165-46ad-8819-9201a1893683}">
<Declaration><![CDATA[VAR
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF _stStatus.eStateCurrent = E_PackMLState.STOPPING THEN
P_IsStopping := TRUE;
ELSE
P_IsStopping := FALSE;
END_IF]]></ST>
</Implementation>
</Get>
</Property>
</POU>
</TcPlcObject>