Added hot and cold plates

- Started spinner chuck io's
This commit is contained in:
2026-02-01 13:53:21 +01:00
parent 8c41ff9bad
commit 1ade81c1c5
30 changed files with 3626 additions and 5882 deletions

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_PI" Id="{d504557e-7fd7-4784-a00a-5d7d1bed0c95}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_PI
VAR_INPUT
rSP : REAL;
rPV : REAL;
rKp : REAL;
rTn : REAL;
xEnable : BOOL;
xSaturatedUpper : BOOL := FALSE;
xSaturatedLower : BOOL := FALSE;
END_VAR
VAR_OUTPUT
rMV : REAL;
END_VAR
VAR
_rError : REAL := 0.0;
_rIntegral : REAL := 0.0;
_rProportinal : REAL := 0.0;
_rDeltaIntegral : REAL := 0.0;
_fbGetCurTaskIdx : GETCURTASKINDEX;
_rT : REAL;
_xFirstCylce : BOOL := TRUE;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF _xFirstCylce THEN
_xFirstCylce := FALSE;
// Get current task time
_fbGetCurTaskIdx();
_rT := LREAL_TO_REAL(UDINT_TO_LREAL(TwinCAT_SystemInfoVarList._TASKInfo[_fbGetCurTaskIdx.index].CycleTime) * 10E-5);
END_IF
IF xEnable THEN
_rError := rSP - rPV;
ELSE
_rError := 0.0;
_rIntegral := 0.0;
rMV := 0.0;
RETURN;
END_IF
// Calculate proportinal part
_rProportinal := rKp * _rError;
// Calculate controller output
rMV := _rProportinal + _rIntegral;
// Calculate integral for this step
IF rTn <> 0 THEN
_rDeltaIntegral := (rKp * _rT / rTn) * _rError;
ELSE
_rDeltaIntegral := 0;
END_IF
// Only add new integral part if we are going away from the upper or lower bound
IF (xSaturatedUpper AND (_rDeltaIntegral > 0.0)) THEN
_rDeltaIntegral := 0.0;
END_IF
IF (xSaturatedLower AND (_rDeltaIntegral < 0.0)) THEN
_rDeltaIntegral := 0.0;
END_IF
// Calculate integral part
_rIntegral := _rIntegral + _rDeltaIntegral;
// Reset integral with deactivated integral time
IF (rTn = 0.0) AND (_rIntegral <> 0) THEN
_rIntegral := 0.0;
END_IF]]></ST>
</Implementation>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<DUT Name="ST_PackMLGenericHMIInterface" Id="{54cdd4b1-e09e-436e-9737-cc31548609eb}">
<Declaration><![CDATA[TYPE ST_PackMLGenericHMIInterface :
STRUCT
stBtnAbort : ST_HMI_CONTROL_BUTTON;
stBtnClear : ST_HMI_CONTROL_BUTTON;
stBtnHold : ST_HMI_CONTROL_BUTTON;
stBtnReset : ST_HMI_CONTROL_BUTTON;
stBtnStart : ST_HMI_CONTROL_BUTTON;
stBtnStop : ST_HMI_CONTROL_BUTTON;
stBtnSuspend : ST_HMI_CONTROL_BUTTON;
stBtnUnhold : ST_HMI_CONTROL_BUTTON;
stBtnUnsuspend : ST_HMI_CONTROL_BUTTON;
eCurrentMode : E_PackMLUnitMode;
eCurrentState : E_PackMLState;
END_STRUCT
END_TYPE
]]></Declaration>
</DUT>
</TcPlcObject>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_PackMLGeneric" Id="{f562a10e-01bc-407d-9fc0-2837d13c10b1}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_PackMLGeneric IMPLEMENTS I_UnitState
<Declaration><![CDATA[FUNCTION_BLOCK FB_PackMLGeneric
VAR_INPUT
stCommand : ST_PMLc;
END_VAR
@@ -12,6 +12,9 @@ VAR_OUTPUT
// Admin data
stAdmin : ST_PMLa;
END_VAR
VAR_IN_OUT
//stHMIInterface : ST_PackMLGenericHMIInterface;
END_VAR
VAR
// State machine handler
_fbStateMachine : FB_PackMLStateMachine;
@@ -143,85 +146,161 @@ CASE stStatus.eStateCurrent OF
;
END_CASE]]></ST>
</Implementation>
<Method Name="M_Aborted" Id="{db1a684f-e4e1-4d89-a3aa-9b9dfde0508c}">
<Declaration><![CDATA[METHOD M_Aborted
<Folder Name="Commands" Id="{11740802-7551-418d-83f3-5b2d5c93c299}" />
<Folder Name="States" Id="{2cf25144-1e5c-4db8-ba57-9d98461c53ce}" />
<Action Name="A_HandleHMIOutput" Id="{73c47dbe-0382-4e83-8c9e-e4744dd66394}">
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Action>
<Method Name="M_Abort" Id="{a8ac7d94-0639-4bcc-b083-994135ce6951}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Abort : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent <> E_PackMLState.ABORTED) AND (stStatus.eStateCurrent <> E_PackMLState.ABORTING) THEN
_eCmd := E_PackMLCmd.ABORT;
M_Abort := TRUE;
ELSE
M_Abort := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Aborted" Id="{db1a684f-e4e1-4d89-a3aa-9b9dfde0508c}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Aborted
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Aborting" Id="{928ad614-a3a7-4c6c-b1bc-55ae54e4c95f}">
<Declaration><![CDATA[METHOD M_Aborting
<Method Name="M_Aborting" Id="{928ad614-a3a7-4c6c-b1bc-55ae54e4c95f}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Aborting
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Clearing" Id="{1716cf1b-94c6-4995-8b3f-c7ebcf5727d3}">
<Declaration><![CDATA[METHOD M_Clearing
<Method Name="M_Clear" Id="{1ae1174f-acb8-4f8a-bc73-ec233f6637b2}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Clear : BOOL
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.ABORTED THEN
_eCmd := E_PackMLCmd.CLEAR;
M_Clear := TRUE;
ELSE
M_Clear := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Clearing" Id="{1716cf1b-94c6-4995-8b3f-c7ebcf5727d3}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Clearing
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Complete" Id="{33df5dea-d83b-48e1-8898-d7c8e1f031bd}">
<Declaration><![CDATA[METHOD M_Complete
<Method Name="M_Complete" Id="{33df5dea-d83b-48e1-8898-d7c8e1f031bd}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Complete
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Completing" Id="{341608cb-1218-481f-929c-cb79602c11ab}">
<Declaration><![CDATA[METHOD M_Completing
<Method Name="M_Completing" Id="{341608cb-1218-481f-929c-cb79602c11ab}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Completing
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Execute" Id="{2a469169-0eb2-43c9-be21-48909285ee44}">
<Declaration><![CDATA[METHOD M_Execute
<Method Name="M_Execute" Id="{2a469169-0eb2-43c9-be21-48909285ee44}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Execute
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Held" Id="{05b040b0-b1b9-4afd-81d0-88fc1f1a7f9b}">
<Declaration><![CDATA[METHOD M_Held
<Method Name="M_Held" Id="{05b040b0-b1b9-4afd-81d0-88fc1f1a7f9b}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Held
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Holding" Id="{519b03b3-2409-4b45-818f-535b3e16b22e}">
<Declaration><![CDATA[METHOD M_Holding
<Method Name="M_Hold" Id="{63908543-c84a-46a6-803b-0cd0a69ee040}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Hold : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.EXECUTE) OR (stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
_eCmd := E_PackMLCmd.HOLD;
M_Hold := TRUE;
ELSE
M_Hold := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Holding" Id="{519b03b3-2409-4b45-818f-535b3e16b22e}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Holding
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Idle" Id="{aa784f5c-7adf-4c9f-a414-65b10afd2772}">
<Declaration><![CDATA[METHOD M_Idle
<Method Name="M_Idle" Id="{aa784f5c-7adf-4c9f-a414-65b10afd2772}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Idle
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Resetting" Id="{4050ed6f-edbe-4c3e-ac42-919a37a47ea9}">
<Declaration><![CDATA[METHOD M_Resetting
<Method Name="M_Reset" Id="{9acdfbad-6477-4a07-aac5-b9a102467964}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Reset : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.STOPPED THEN
_eCmd := E_PackMLCmd.RESET;
M_Reset := TRUE;
ELSE
M_Reset := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Resetting" Id="{4050ed6f-edbe-4c3e-ac42-919a37a47ea9}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Resetting
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Starting" Id="{0059e7f6-5f2a-40e4-9d9b-652f221495a9}">
<Declaration><![CDATA[METHOD M_Starting
<Method Name="M_Start" Id="{86eb6432-588a-4480-b09e-72e5733dc716}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Start : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.IDLE THEN
_eCmd := E_PackMLCmd.RESET;
M_Start := TRUE;
ELSE
M_Start := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Starting" Id="{0059e7f6-5f2a-40e4-9d9b-652f221495a9}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Starting
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_StateComplete" Id="{0cf3625e-8009-4108-a9f4-d98c991f9930}">
<Declaration><![CDATA[METHOD M_StateComplete
<Method Name="M_StateComplete" Id="{0cf3625e-8009-4108-a9f4-d98c991f9930}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_StateComplete
]]></Declaration>
<Implementation>
<ST><![CDATA[// Reset state state machine
@@ -231,43 +310,104 @@ _iSSM := 0;
_fbStateMachine.M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Stopped" Id="{9f8a09cf-f3be-4d60-b5e4-cd9572fae88c}">
<Declaration><![CDATA[METHOD M_Stopped
<Method Name="M_Stop" Id="{8beef0bf-5aa2-4644-ae54-6acbcdaacef4}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Stop : BOOL
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)
THEN
_eCmd := E_PackMLCmd.STOP;
M_Stop := TRUE;
ELSE
M_Stop := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Stopped" Id="{9f8a09cf-f3be-4d60-b5e4-cd9572fae88c}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Stopped
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Stopping" Id="{193565ef-cf20-428c-b726-e7c1b61375c5}">
<Declaration><![CDATA[METHOD M_Stopping
<Method Name="M_Stopping" Id="{193565ef-cf20-428c-b726-e7c1b61375c5}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Stopping
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Suspended" Id="{222c3ad7-f7d5-4773-8e98-863345472053}">
<Declaration><![CDATA[METHOD M_Suspended
<Method Name="M_Suspend" Id="{a69941cd-31ee-44b4-9c8b-a7c774e40447}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Suspend : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF stStatus.eStateCurrent = E_PackMLState.EXECUTE THEN
_eCmd := E_PackMLCmd.SUSPEND;
M_Suspend := TRUE;
ELSE
M_Suspend := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Suspended" Id="{222c3ad7-f7d5-4773-8e98-863345472053}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Suspended
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
</Implementation>
</Method>
<Method Name="M_Suspending" Id="{0f5d52e2-2a54-4ea9-a0c4-7f08229c4f21}">
<Declaration><![CDATA[METHOD M_Suspending
<Method Name="M_Suspending" Id="{0f5d52e2-2a54-4ea9-a0c4-7f08229c4f21}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Suspending
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Unholding" Id="{662dd054-329b-4e57-ba77-486f92af795a}">
<Declaration><![CDATA[METHOD M_Unholding
<Method Name="M_Unhold" Id="{6af8dbfd-0422-459a-b99f-09e9246d2621}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Unhold : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.HELD) THEN
_eCmd := E_PackMLCmd.UNSUSPEND;
M_Unhold := TRUE;
ELSE
M_Unhold := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Unholding" Id="{662dd054-329b-4e57-ba77-486f92af795a}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Unholding
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>
</Implementation>
</Method>
<Method Name="M_Unsuspending" Id="{80fb11c4-916a-4f8f-9cf9-b9a2d51524a1}">
<Declaration><![CDATA[METHOD M_Unsuspending
<Method Name="M_Unsuspend" Id="{ff6f4f4b-4bc6-47f7-a257-a2bcea2d6ae3}" FolderPath="Commands\">
<Declaration><![CDATA[METHOD M_Unsuspend : BOOL
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[IF (stStatus.eStateCurrent = E_PackMLState.SUSPENDED) THEN
_eCmd := E_PackMLCmd.UNSUSPEND;
M_Unsuspend := TRUE;
ELSE
M_Unsuspend := FALSE;
END_IF]]></ST>
</Implementation>
</Method>
<Method Name="M_Unsuspending" Id="{80fb11c4-916a-4f8f-9cf9-b9a2d51524a1}" FolderPath="States\">
<Declaration><![CDATA[METHOD PROTECTED M_Unsuspending
]]></Declaration>
<Implementation>
<ST><![CDATA[M_StateComplete();]]></ST>