First working implementation

- Currently only with one sided gripper
This commit is contained in:
2026-02-19 15:42:54 +01:00
parent 7126a7dd7e
commit 92276e4f4b
32 changed files with 1041 additions and 378 deletions

View File

@@ -1,16 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_Etcher" Id="{b81a122a-e5f5-475c-8ee0-2d97c1df7eb4}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Etcher EXTENDS FB_StationBase
<Declaration><![CDATA[FUNCTION_BLOCK FB_Etcher EXTENDS FB_BaseStation
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_iState : INT;
_tonProcessDuration : TON;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[CASE _iState OF
// Wait for product
0:
IF _iFlowRecIdx <> -1 THEN
_xDone := FALSE;
_xBusy := TRUE;
_iState := 10;
END_IF
// Simulate process
10:
_tonProcessDuration(IN := TRUE, PT := T#10S);
IF _tonProcessDuration.Q THEN
_tonProcessDuration(IN := FALSE);
fbFlowRecHandler.M_ReportResult(iIdx := _iFlowRecIdx, xResult := TRUE);
_xProdAvail := TRUE;
_xBusy := FALSE;
_xDone := TRUE;
_iState := 20;
END_IF
// Wait for station to be empty again
20:
IF _iFlowRecIdx = -1 THEN
_iState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<Method Name="FB_Init" Id="{0669fde2-f64d-4e8f-b76d-71a71bfb6cae}">
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
//The return value is not evaluated. For a specific influence, you can also declare the
//methods explicitly and provide additional code there with the standard initialization
//code. You can evaluate the return value.
METHOD FB_Init: BOOL
VAR_INPUT
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Set station capabilities
_dwCapabilities := 16#0001;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>

View File

@@ -1,16 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_HVTest" Id="{b3445d38-3c32-4973-bf63-429552f0da50}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_HVTest EXTENDS FB_StationBase
<Declaration><![CDATA[FUNCTION_BLOCK FB_HVTest EXTENDS FB_BaseStation
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_iState : INT;
_tonProcessDuration : TON;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[CASE _iState OF
// Wait for product
0:
IF _iFlowRecIdx <> -1 THEN
_xDone := FALSE;
_xBusy := TRUE;
_iState := 10;
END_IF
// Simulate process
10:
_tonProcessDuration(IN := TRUE, PT := T#10S);
IF _tonProcessDuration.Q THEN
_tonProcessDuration(IN := FALSE);
fbFlowRecHandler.M_ReportResult(iIdx := _iFlowRecIdx, xResult := TRUE);
_xProdAvail := TRUE;
_xBusy := FALSE;
_xDone := TRUE;
_iState := 20;
END_IF
// Wait for station to be empty again
20:
IF _iFlowRecIdx = -1 THEN
_iState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<Method Name="FB_Init" Id="{c40e1a0c-0b45-4ca1-a647-10e90c1b54ce}">
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
//The return value is not evaluated. For a specific influence, you can also declare the
//methods explicitly and provide additional code there with the standard initialization
//code. You can evaluate the return value.
METHOD FB_Init: BOOL
VAR_INPUT
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Set station capabilities
_dwCapabilities := 16#0002;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>

View File

@@ -1,16 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_Input" Id="{d51b3f46-877e-4234-99b6-53eb690c6bdc}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Input EXTENDS FB_StationBase
<Declaration><![CDATA[FUNCTION_BLOCK FB_Input EXTENDS FB_BaseStation
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_tonNewProductReady : TON;
_stFlowRecipe : ST_FlowRecipe;
_xRecipeSet : BOOL;
_xStart : BOOL;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[_tonNewProductReady(IN := ((NOT _xProdAvail) AND _xRecipeSet AND _xStart), PT := T#5S);
IF _tonNewProductReady.Q THEN
_iFlowRecIdx := fbFlowRecHandler.M_AddFlowRec(stFlowRecipe := _stFlowRecipe);
// Todo create additional recipe data in pool array where the index
// is the same as _iFlowRecIdx
_xProdAvail := TRUE;
END_IF]]></ST>
</Implementation>
<Method Name="M_SetRecipe" Id="{58f2ee2a-65a7-4788-a8f6-1e5a7ab222c9}">
<Declaration><![CDATA[METHOD M_SetRecipe
VAR_INPUT
stRecipe : ST_FlowRecipe;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[_stFlowRecipe := stRecipe;
_xRecipeSet := TRUE;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>

View File

@@ -1,16 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_NIO" Id="{2cf6f855-1738-40a7-bc96-4518cbb192c2}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_NIO EXTENDS FB_StationBase
<Declaration><![CDATA[FUNCTION_BLOCK FB_NIO EXTENDS FB_BaseStation
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_iState : INT;
_tonAutoRemove : TON;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[CASE _iState OF
// Wait for product
0:
IF _iFlowRecIdx <> -1 THEN
_iState := 10;
END_IF
// Remove product from line
10:
_tonAutoRemove(IN := TRUE, PT := T#5S);
IF _tonAutoRemove.Q THEN
_tonAutoRemove(IN := FALSE);
fbFlowRecHandler.M_RemFlowRec(iIdx := _iFlowRecIdx);
_iFlowRecIdx := -1;
_iState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<Method Name="FB_Init" Id="{a2216f45-001c-4771-bc7d-1f63f2637a1e}">
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
//The return value is not evaluated. For a specific influence, you can also declare the
//methods explicitly and provide additional code there with the standard initialization
//code. You can evaluate the return value.
METHOD FB_Init: BOOL
VAR_INPUT
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Set station capabilities
_dwCapabilities := 16#0008;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>

View File

@@ -1,16 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_Output" Id="{9711b552-d6a0-4f78-8a70-9ea977b18390}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Output EXTENDS FB_StationBase
<Declaration><![CDATA[FUNCTION_BLOCK FB_Output EXTENDS FB_BaseStation
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
_iState : INT;
_tonAutoRemove : TON;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[]]></ST>
<ST><![CDATA[CASE _iState OF
// Wait for product
0:
IF _iFlowRecIdx <> -1 THEN
_iState := 10;
END_IF
// Remove product from line
10:
_tonAutoRemove(IN := TRUE, PT := T#5S);
IF _tonAutoRemove.Q THEN
_tonAutoRemove(IN := FALSE);
fbFlowRecHandler.M_RemFlowRec(iIdx := _iFlowRecIdx);
_iFlowRecIdx := -1;
_iState := 0;
END_IF
END_CASE]]></ST>
</Implementation>
<Method Name="FB_Init" Id="{ae701a9f-9b93-4e2d-8380-8e14731a8c09}">
<Declaration><![CDATA[//FB_Init is always available implicitly and it is used primarily for initialization.
//The return value is not evaluated. For a specific influence, you can also declare the
//methods explicitly and provide additional code there with the standard initialization
//code. You can evaluate the return value.
METHOD FB_Init: BOOL
VAR_INPUT
bInitRetains: BOOL; // TRUE: the retain variables are initialized (reset warm / reset cold)
bInCopyCode: BOOL; // TRUE: the instance will be copied to the copy code afterward (online change)
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[// Set station capabilities
_dwCapabilities := 16#0004;]]></ST>
</Implementation>
</Method>
</POU>
</TcPlcObject>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<TcPlcObject Version="1.1.0.1">
<POU Name="FB_Robot" Id="{dc28987f-6f20-437a-aca7-b51d3eb98f94}" SpecialFunc="None">
<Declaration><![CDATA[FUNCTION_BLOCK FB_Robot EXTENDS FB_BaseTransport
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR_IN_OUT
fbScheduler : FB_Scheduler;
END_VAR
VAR
_tonTransportDone : TON;
_timTransportTime : TIME := T#5S;
_itfSourceStation : I_Station;
_itfTargetStation : I_Station;
_iFlowRecIdx : INT;
_iState : INT;
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[CASE _iState OF
// Idle, check for new transport job
0:
IF fbJobQueue.M_GetHighest(stJob => _stTransJon) THEN
_xAvailable := FALSE;
// Get station interfaces
_itfSourceStation := fbScheduler.M_GetStation(_stTransJon.uiFromStation);
_itfTargetStation := fbScheduler.M_GetStation(_stTransJon.uiToStation);
_iState := 10;
END_IF
// Move to pickup station
10:
_tonTransportDone(IN := TRUE, PT := _timTransportTime);
IF _tonTransportDone.Q THEN
_tonTransportDone(IN := FALSE);
// Get product from station
_iFlowRecIdx := _itfSourceStation.M_RemoveProduct();
_iState := 20;
END_IF
// Move to drop station
20:
_tonTransportDone(IN := TRUE, PT := _timTransportTime);
IF _tonTransportDone.Q THEN
_tonTransportDone(IN := FALSE);
// Put product into station
_itfTargetStation.M_InsertProduct(_iFlowRecIdx);
_iState := 30;
END_IF
// Release all station reservations
30:
_itfSourceStation.M_Release(uiHandle := _stTransJon.uiFromStationHandle);
_itfTargetStation.M_Release(uiHandle := _stTransJon.uiToStationHandle);
_xAvailable := TRUE;
_iState := 0;
END_CASE]]></ST>
</Implementation>
</POU>
</TcPlcObject>