Initial commit
This commit is contained in:
71
PLC/POUs/MAIN.TcPOU
Normal file
71
PLC/POUs/MAIN.TcPOU
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="MAIN" Id="{253d06d0-7abd-4394-b68c-5ffd2aaf348a}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM MAIN
|
||||
VAR
|
||||
_fbScheduler : FB_Scheduler;
|
||||
|
||||
_xInitDone : BOOL;
|
||||
|
||||
// Stations
|
||||
_fbInput : FB_Input;
|
||||
_fbEtcher : FB_Etcher;
|
||||
_fbHVTest : FB_HVTest;
|
||||
_fbOutput : FB_Output;
|
||||
_fbNIO : FB_NIO;
|
||||
|
||||
// Example recipe
|
||||
_stRecipeSimple : ST_Recipe;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF (NOT _xInitDone) THEN
|
||||
_xInitDone := TRUE;
|
||||
A_Init();
|
||||
END_IF
|
||||
|
||||
// Call all stations
|
||||
_fbInput();
|
||||
_fbEtcher();
|
||||
_fbHVTest();
|
||||
_fbOutput();
|
||||
_fbNIO();
|
||||
|
||||
// Call scheduler
|
||||
_fbScheduler();]]></ST>
|
||||
</Implementation>
|
||||
<Action Name="A_Init" Id="{203d4406-b6da-4e3d-8378-ac96a0e18ff2}">
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Register stations to scheduler
|
||||
_fbScheduler.M_ClearStations();
|
||||
|
||||
_fbScheduler.M_Register(_fbInput);
|
||||
_fbScheduler.M_Register(_fbEtcher);
|
||||
_fbScheduler.M_Register(_fbHVTest);
|
||||
_fbScheduler.M_Register(_fbOutput);
|
||||
_fbScheduler.M_Register(_fbNIO);
|
||||
|
||||
|
||||
// Create simple recipe
|
||||
_stRecipeSimple.uiRecipeID := 1;
|
||||
_stRecipeSimple.uiStartNode := 0;
|
||||
_stRecipeSimple.uiNodeCnt := 3;
|
||||
|
||||
// Process nodes
|
||||
_stRecipeSimple.astNodes[0].uiNodeID := 1;
|
||||
_stRecipeSimple.astNodes[0].dwReqCap := 16#0001;
|
||||
_stRecipeSimple.astNodes[0].uiTransCnt := 1;
|
||||
_stRecipeSimple.astNodes[0].astTransitions[0].eCondition := E_TransitCond.ALWAYS;
|
||||
_stRecipeSimple.astNodes[0].astTransitions[0].uiNextNodeID := 1;
|
||||
|
||||
_stRecipeSimple.astNodes[1].uiNodeID := 1;
|
||||
_stRecipeSimple.astNodes[1].dwReqCap := 16#0001;
|
||||
_stRecipeSimple.astNodes[1].uiTransCnt := 2;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[0].eCondition := E_TransitCond.RESULT_OK;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[0].uiNextNodeID := 3;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[1].eCondition := E_TransitCond.RESULT_NIO;
|
||||
_stRecipeSimple.astNodes[1].astTransitions[1].uiNextNodeID := 4;]]></ST>
|
||||
</Implementation>
|
||||
</Action>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Scheduler/DUTs/E_TransitCond.TcDUT
Normal file
16
PLC/POUs/Scheduler/DUTs/E_TransitCond.TcDUT
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="E_TransitCond" Id="{0c8e8042-17f8-4b76-ad0c-96d650245098}">
|
||||
<Declaration><![CDATA[{attribute 'qualified_only'}
|
||||
{attribute 'strict'}
|
||||
{attribute 'to_string'}
|
||||
TYPE E_TransitCond :
|
||||
(
|
||||
ALWAYS := 0,
|
||||
RESULT_OK,
|
||||
RESULT_NIO
|
||||
);
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
14
PLC/POUs/Scheduler/DUTs/ST_Recipe.TcDUT
Normal file
14
PLC/POUs/Scheduler/DUTs/ST_Recipe.TcDUT
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="ST_Recipe" Id="{3e2c2867-3147-4627-bf49-6255dbaf5310}">
|
||||
<Declaration><![CDATA[TYPE ST_Recipe :
|
||||
STRUCT
|
||||
uiRecipeID : UINT;
|
||||
uiStartNode : UINT := 0;
|
||||
uiNodeCnt : UINT := 0;
|
||||
astNodes : ARRAY[0..(GVL_Scheduler.MAX_RECIPE_NODES - 1)] OF ST_RecipeNode;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
19
PLC/POUs/Scheduler/DUTs/ST_RecipeNode.TcDUT
Normal file
19
PLC/POUs/Scheduler/DUTs/ST_RecipeNode.TcDUT
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="ST_RecipeNode" Id="{ceb8b626-8a65-4e92-9344-14e330b6c8bd}">
|
||||
<Declaration><![CDATA[TYPE ST_RecipeNode :
|
||||
STRUCT
|
||||
uiNodeID : UINT;
|
||||
// Required capabilities
|
||||
dwReqCap : DWORD;
|
||||
|
||||
// Transition count
|
||||
uiTransCnt : UINT;
|
||||
|
||||
// Transitions
|
||||
astTransitions : ARRAY[0..(GVL_Scheduler.MAX_STATIONS - 1)] OF ST_Transition;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
12
PLC/POUs/Scheduler/DUTs/ST_Transition.TcDUT
Normal file
12
PLC/POUs/Scheduler/DUTs/ST_Transition.TcDUT
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<DUT Name="ST_Transition" Id="{7b8c5232-d3a6-4d0b-b8ad-e54400018d53}">
|
||||
<Declaration><![CDATA[TYPE ST_Transition :
|
||||
STRUCT
|
||||
eCondition : E_TransitCond;
|
||||
uiNextNodeID : UINT;
|
||||
END_STRUCT
|
||||
END_TYPE
|
||||
]]></Declaration>
|
||||
</DUT>
|
||||
</TcPlcObject>
|
||||
14
PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL
Normal file
14
PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<GVL Name="GVL_Scheduler" Id="{768bef46-feba-4d2e-bc5d-8385420ff7b5}">
|
||||
<Declaration><![CDATA[{attribute 'qualified_only'}
|
||||
VAR_GLOBAL CONSTANT
|
||||
// Recipe constants
|
||||
MAX_RECIPE_TRANSITIONS : UINT := 10;
|
||||
MAX_RECIPE_NODES : UINT := 10;
|
||||
|
||||
// Scheduler constants
|
||||
MAX_STATIONS : UINT := 10;
|
||||
END_VAR]]></Declaration>
|
||||
</GVL>
|
||||
</TcPlcObject>
|
||||
30
PLC/POUs/Scheduler/ITFs/I_Product.TcIO
Normal file
30
PLC/POUs/Scheduler/ITFs/I_Product.TcIO
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<Itf Name="I_Product" Id="{78dffc1b-aed6-4622-8b64-e060477179c6}">
|
||||
<Declaration><![CDATA[{attribute 'no_explicit_call' := 'do not call this POU directly'}
|
||||
INTERFACE I_Product
|
||||
]]></Declaration>
|
||||
<Method Name="M_SetCurrProcRes" Id="{afd48187-6008-4813-8fe5-04c632483cf0}">
|
||||
<Declaration><![CDATA[METHOD M_SetCurrProcRes
|
||||
VAR_INPUT
|
||||
xSuccess : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Property Name="P_CurrNodeID" Id="{2408303a-b81e-4623-9557-4af29ff08776}">
|
||||
<Declaration><![CDATA[PROPERTY P_CurrNodeID : UINT]]></Declaration>
|
||||
<Get Name="Get" Id="{c7773936-77b0-42da-86b5-ef706272183a}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
<Set Name="Set" Id="{1ecab2de-a6ae-4a48-a0d3-c65c8bfe8a22}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Set>
|
||||
</Property>
|
||||
<Property Name="P_NextReqCap" Id="{ea007dca-197b-4284-b65b-0f7c1a14e1fa}">
|
||||
<Declaration><![CDATA[PROPERTY P_NextReqCap : DWORD]]></Declaration>
|
||||
<Get Name="Get" Id="{0abf4eb3-351d-4342-a687-7722bc63fdaa}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
</Itf>
|
||||
</TcPlcObject>
|
||||
84
PLC/POUs/Scheduler/ITFs/I_Station.TcIO
Normal file
84
PLC/POUs/Scheduler/ITFs/I_Station.TcIO
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<Itf Name="I_Station" Id="{f863fe97-4162-4b2e-b60e-3fee73b74d3a}">
|
||||
<Declaration><![CDATA[INTERFACE I_Station
|
||||
]]></Declaration>
|
||||
<Method Name="M_HasCapabilty" Id="{b116dc84-553d-4994-acaf-ce410825ba36}">
|
||||
<Declaration><![CDATA[METHOD M_HasCapabilty : BOOL
|
||||
VAR_INPUT
|
||||
dwReqCap : DWORD;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Method Name="M_InsertProduct" Id="{6d808715-3e3b-47f8-9bce-8110ddf0fadc}">
|
||||
<Declaration><![CDATA[METHOD M_InsertProduct : BOOL;
|
||||
VAR_INPUT
|
||||
fbProduct : I_Product;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Method Name="M_Release" Id="{8a898aac-0cc9-477d-9998-62f5f31391c7}">
|
||||
<Declaration><![CDATA[METHOD M_Release : BOOL
|
||||
VAR_INPUT
|
||||
udiHandle : UDINT;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Method Name="M_RemoveProduct" Id="{90af1fde-9aed-4c2f-990d-d0ad1af5a705}">
|
||||
<Declaration><![CDATA[METHOD M_RemoveProduct : I_Product
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Method Name="M_Reserve" Id="{6c535852-3b02-41fc-a4fc-9b0284412ec7}">
|
||||
<Declaration><![CDATA[METHOD M_Reserve : UDINT
|
||||
]]></Declaration>
|
||||
</Method>
|
||||
<Property Name="P_Available" Id="{3075cb0b-1920-4207-a4f7-c06c6ad91a05}">
|
||||
<Declaration><![CDATA[PROPERTY P_Available : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{8936bdb5-2331-44ac-804b-848836e7e78f}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Busy" Id="{c7a782a6-d9d8-4f37-ab05-aa446f3c2ade}">
|
||||
<Declaration><![CDATA[PROPERTY P_Busy : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{0bee0f8b-b5f7-4a72-b050-a4b75337d9bb}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Capabilities" Id="{3066b824-0e0c-4a74-9959-559c483d2106}">
|
||||
<Declaration><![CDATA[PROPERTY P_Capabilities : DWORD]]></Declaration>
|
||||
<Get Name="Get" Id="{e550ce47-de92-4f19-a7f9-98ddde2d0ceb}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_HasError" Id="{9d27caa3-2913-4127-9dc4-3c0085468476}">
|
||||
<Declaration><![CDATA[PROPERTY P_HasError : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{ce1554ec-8c79-4cec-ba5a-7f52f7858b24}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_ProdAvail" Id="{8be4500d-7028-4fcc-a7fe-1999aec0ad49}">
|
||||
<Declaration><![CDATA[PROPERTY P_ProdAvail : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{f64416d4-c6fe-4557-a6a6-a815d611ad92}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Product" Id="{20f38cff-89b3-4ebd-9f5f-171721cc7f4c}">
|
||||
<Declaration><![CDATA[PROPERTY P_Product : I_Product]]></Declaration>
|
||||
<Get Name="Get" Id="{54f46645-3bb5-477e-a037-282c55914608}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Result" Id="{703e039e-b718-4d79-86bd-e01bd8c2d16b}">
|
||||
<Declaration><![CDATA[PROPERTY P_Result : UINT]]></Declaration>
|
||||
<Get Name="Get" Id="{5a6206de-d50c-4c20-be99-7f2f851fee69}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_StationID" Id="{9004f009-99e0-41c2-a1a1-57af78c8e0c6}">
|
||||
<Declaration><![CDATA[PROPERTY P_StationID : UINT]]></Declaration>
|
||||
<Get Name="Get" Id="{060c4b1d-c578-4e27-95fc-86c34f0eedd4}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
</Itf>
|
||||
</TcPlcObject>
|
||||
19
PLC/POUs/Scheduler/ITFs/I_Transport.TcIO
Normal file
19
PLC/POUs/Scheduler/ITFs/I_Transport.TcIO
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<Itf Name="I_Transport" Id="{ab102a71-b12c-47a4-86f6-0ac81eba046a}">
|
||||
<Declaration><![CDATA[INTERFACE I_Transport
|
||||
]]></Declaration>
|
||||
<Property Name="P_Available" Id="{3d35d7bc-8757-4198-a19d-30d68f948ed9}">
|
||||
<Declaration><![CDATA[PROPERTY P_Available : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{4a84e659-1971-4dc0-87d2-0fe5edfa2e18}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_HasError" Id="{57c92e5a-3721-42db-811d-3913f54f35ee}">
|
||||
<Declaration><![CDATA[PROPERTY P_HasError : BOOL]]></Declaration>
|
||||
<Get Name="Get" Id="{ce549bea-4b32-46cf-b739-cdadf8dfa005}">
|
||||
<Declaration><![CDATA[]]></Declaration>
|
||||
</Get>
|
||||
</Property>
|
||||
</Itf>
|
||||
</TcPlcObject>
|
||||
87
PLC/POUs/Scheduler/POUs/FB_Product.TcPOU
Normal file
87
PLC/POUs/Scheduler/POUs/FB_Product.TcPOU
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_Product" Id="{aeaa85d2-80b5-4274-aa7e-dadad9f0dcfb}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Product IMPLEMENTS I_Product
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
// Product recipe
|
||||
_stRecipe : ST_Recipe;
|
||||
|
||||
_uiCurrNodeID : UINT := 0;
|
||||
_uiNextNodeID : UINT := 0;
|
||||
|
||||
_xResult : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_SetCurrProcRes" Id="{478e39cf-00d0-4253-8c4e-ed30567e421d}">
|
||||
<Declaration><![CDATA[METHOD M_SetCurrProcRes
|
||||
VAR_INPUT
|
||||
xSuccess : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_uiCnt : UINT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Check all possible transition
|
||||
FOR _uiCnt := 0 TO (_stRecipe.astNodes[_uiCurrNodeID].uiTransCnt - 1) DO
|
||||
CASE _stRecipe.astNodes[_uiCurrNodeID].astTransitions[_uiCnt].eCondition OF
|
||||
E_TransitCond.ALWAYS:
|
||||
_uiNextNodeID := _stRecipe.astNodes[_uiCurrNodeID].astTransitions[_uiCnt].uiNextNodeID;
|
||||
EXIT;
|
||||
|
||||
E_TransitCond.RESULT_OK:
|
||||
IF xSuccess THEN
|
||||
_uiNextNodeID := _stRecipe.astNodes[_uiCurrNodeID].astTransitions[_uiCnt].uiNextNodeID;
|
||||
EXIT;
|
||||
END_IF
|
||||
|
||||
E_TransitCond.RESULT_NIO:
|
||||
IF (NOT xSuccess) THEN
|
||||
_uiNextNodeID := _stRecipe.astNodes[_uiCurrNodeID].astTransitions[_uiCnt].uiNextNodeID;
|
||||
EXIT;
|
||||
END_IF
|
||||
END_CASE
|
||||
END_FOR
|
||||
]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Property Name="P_CurrNodeID" Id="{896d8e88-c324-42f7-8ec5-28782223405a}">
|
||||
<Declaration><![CDATA[PROPERTY P_CurrNodeID : UINT
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{e1aeb000-7306-4b12-ab29-6078214076ea}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_CurrNodeID := _uiCurrNodeID;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
<Set Name="Set" Id="{6b281f43-823b-4830-a917-2539de62e216}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[_uiCurrNodeID := P_CurrNodeID;]]></ST>
|
||||
</Implementation>
|
||||
</Set>
|
||||
</Property>
|
||||
<Property Name="P_NextReqCap" Id="{4c4a03ed-4074-46c1-8f2a-b964a788faf6}">
|
||||
<Declaration><![CDATA[PROPERTY P_NextReqCap : DWORD
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{a7e4e08c-166a-4234-b8b1-9d5ae2650ea7}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_NextReqCap := _stRecipe.astNodes[_uiNextNodeID].dwReqCap;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
108
PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU
Normal file
108
PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_Scheduler" Id="{af4eba28-c46c-4c30-8885-00e91057da4d}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Scheduler
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
_aiStations : ARRAY[1..(GVL_Scheduler.MAX_STATIONS)] OF I_Station;
|
||||
_uiStationCount : UINT := 0;
|
||||
|
||||
_fbTransport : ARRAY[1..(GVL_Scheduler.MAX_STATIONS)] OF I_Station;
|
||||
_uiTransportCnt : UINT := 0;
|
||||
|
||||
_uiCnt : UINT;
|
||||
_uiNextAvailStation : UINT;
|
||||
|
||||
_fbProduct : I_Product;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[FOR _
|
||||
|
||||
|
||||
FOR _uiCnt := 1 TO _uiStationCount DO
|
||||
IF _aiStations[_uiCnt].P_ProdAvail THEN
|
||||
// Find next available station according to recipe and available station
|
||||
_uiNextAvailStation := M_FindNextAvailStation(_aiStations[_uiCnt].P_Product);
|
||||
|
||||
// Check if there is a station available
|
||||
IF _uiNextAvailStation <> 0 THEN
|
||||
// _aiStations[_uiNextAvailStation].M_Reserve();
|
||||
END_IF
|
||||
END_IF
|
||||
END_FOR]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_ClearStations" Id="{7c667e8a-38f2-48a9-afff-834e87e4d3f6}">
|
||||
<Declaration><![CDATA[METHOD M_ClearStations
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Remove all registered stations from array
|
||||
MEMSET(destAddr := ADR(_aiStations), fillByte := 0, n := SIZEOF(_aiStations));
|
||||
|
||||
// Reset number of registered stations
|
||||
_uiStationCount := 0;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_FindNextAvailStation" Id="{75382296-32be-4724-b020-39273aa8358c}">
|
||||
<Declaration><![CDATA[METHOD PRIVATE M_FindNextAvailStation : UINT
|
||||
VAR_INPUT
|
||||
_fbProduct : I_Product;
|
||||
END_VAR
|
||||
VAR
|
||||
_uiCnt : UINT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[FOR _uiCnt := 1 TO _uiStationCount DO
|
||||
IF _aiStations[_uiCnt].M_HasCapabilty(_fbProduct.P_NextReqCap) AND _aiStations[_uiCnt].P_Available THEN
|
||||
M_FindNextAvailStation := _uiCnt;
|
||||
EXIT;
|
||||
END_IF
|
||||
END_FOR
|
||||
|
||||
M_FindNextAvailStation := 0;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_Register" Id="{6a14034a-d5c0-46c1-a13b-418885a02563}">
|
||||
<Declaration><![CDATA[METHOD M_Register
|
||||
VAR_INPUT
|
||||
fbStation : I_Station;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Check if station is valid interface
|
||||
IF fbStation = 0 THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
// Check if we have free slots
|
||||
IF _uiStationCount < GVL_Scheduler.MAX_STATIONS THEN
|
||||
_aiStations[_uiStationCount] := fbStation;
|
||||
_uiStationCount := _uiStationCount + 1;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_RegisterTransport" Id="{a85ebd03-27a5-40c5-bd8f-ade9f2eac962}">
|
||||
<Declaration><![CDATA[METHOD M_RegisterTransport
|
||||
VAR_INPUT
|
||||
fbTransport : I_Transport;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Check if transport is valid interface
|
||||
IF fbTransport = 0 THEN
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
// Check if we have free slots
|
||||
IF _uiTransportCnt < GVL_Scheduler.MAX_STATIONS THEN
|
||||
_aiStations[_uiTransportCnt] := fbTransport;
|
||||
_uiTransportCnt := _uiTransportCnt + 1;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
204
PLC/POUs/Scheduler/POUs/FB_StationBase.TcPOU
Normal file
204
PLC/POUs/Scheduler/POUs/FB_StationBase.TcPOU
Normal file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_StationBase" Id="{e987477c-14c3-4a7d-9e57-317d0837328f}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_StationBase IMPLEMENTS I_Station
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
// Product available for pickup
|
||||
_xProdAvail : BOOL;
|
||||
|
||||
// Station available for new product
|
||||
_xAvailable : BOOL;
|
||||
_xBusy : BOOL;
|
||||
_xDone : BOOL;
|
||||
_xError : BOOL;
|
||||
|
||||
_uiStationID : UINT := 0;
|
||||
_dwCapabilities : DWORD;
|
||||
_uiResult : UINT;
|
||||
|
||||
// Reserve token handle
|
||||
_xReserved : BOOL;
|
||||
_udiCurrHandle : UDINT;
|
||||
_udiHandleCounter : UDINT := 1;
|
||||
|
||||
_fbProduct : I_Product;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="M_HasCapabilty" Id="{d05e7240-ab9b-469b-8867-87a70dbef84e}">
|
||||
<Declaration><![CDATA[METHOD M_HasCapabilty : BOOL
|
||||
VAR_INPUT
|
||||
dwReqCap : DWORD;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[M_HasCapabilty := (dwReqCap AND _dwCapabilities) = dwReqCap;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_InsertProduct" Id="{d323f806-9a97-49f2-9986-a997415883bf}">
|
||||
<Declaration><![CDATA[METHOD M_InsertProduct : BOOL;
|
||||
VAR_INPUT
|
||||
fbProduct : I_Product;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF fbProduct <> 0 AND _fbProduct = 0 THEN
|
||||
_fbProduct := fbProduct;
|
||||
M_InsertProduct := TRUE;
|
||||
ELSE
|
||||
M_InsertProduct := FALSE;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_Release" Id="{924bffc5-44cc-4d02-a67d-fb0f3ab51cc2}">
|
||||
<Declaration><![CDATA[METHOD M_Release : BOOL
|
||||
VAR_INPUT
|
||||
udiHandle : UDINT;
|
||||
END_VAR]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF _xReserved AND (udiHandle = _udiCurrHandle) THEN
|
||||
_xReserved := FALSE;
|
||||
_udiCurrHandle := 0;
|
||||
M_Release := TRUE;
|
||||
ELSE
|
||||
M_Release := FALSE;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_RemoveProduct" Id="{e5d01ee0-a885-4496-b522-46d093416622}">
|
||||
<Declaration><![CDATA[METHOD M_RemoveProduct : I_Product
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[M_RemoveProduct := _fbProduct;
|
||||
_fbProduct := 0;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="M_Reserve" Id="{42a69458-4b78-4d35-bd61-3bb1ee3cafec}">
|
||||
<Declaration><![CDATA[METHOD M_Reserve : UDINT
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF (NOT _xReserved) THEN
|
||||
_xReserved := TRUE;
|
||||
_xAvailable := FALSE;
|
||||
|
||||
_udiCurrHandle := _udiHandleCounter;
|
||||
|
||||
// Increment handle
|
||||
_udiHandleCounter := _udiHandleCounter + 1;
|
||||
|
||||
// Prevent invalid token when overflowing
|
||||
IF _udiHandleCounter = 0 THEN
|
||||
_udiHandleCounter := 1;
|
||||
END_IF
|
||||
|
||||
// Return handle
|
||||
M_Reserve := _udiCurrHandle;
|
||||
ELSE
|
||||
M_Reserve := 0;
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Property Name="P_Available" Id="{44abe6d9-f47e-47fa-8e00-c1822708d7bb}">
|
||||
<Declaration><![CDATA[PROPERTY P_Available : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{3bc760b0-1ae6-43b4-920e-8dd9987fe3f7}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Available := _xAvailable;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Busy" Id="{5b025893-318c-4480-ab72-6ffb8bedb715}">
|
||||
<Declaration><![CDATA[PROPERTY P_Busy : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{596ebd24-6d36-4141-9b46-0ba6929a7256}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Busy := _xBusy;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Capabilities" Id="{3e87d0bb-3b77-4aa6-bc89-587ee89028c2}">
|
||||
<Declaration><![CDATA[PROPERTY P_Capabilities : DWORD
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{4acbb119-eda4-4b57-8a60-16f1e982c21f}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Capabilities := _dwCapabilities;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_HasError" Id="{1126bae7-5dd1-4592-8f95-62ea6e252ed0}">
|
||||
<Declaration><![CDATA[PROPERTY P_HasError : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{3b3e65f8-9d92-48aa-9006-6a688edebb28}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_HasError := _xError;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_ProdAvail" Id="{47526379-0732-4031-8d2b-4380310ef64c}">
|
||||
<Declaration><![CDATA[PROPERTY P_ProdAvail : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{c498f522-3394-4950-acf2-2e6ab02869cd}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_ProdAvail := _xProdAvail;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Product" Id="{78d9c0d5-87fc-4940-8596-ddfb9f581df8}">
|
||||
<Declaration><![CDATA[PROPERTY P_Product : I_Product
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{16260053-c4bc-45d7-9a2b-60c60dd338ad}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Product := _fbProduct;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_Result" Id="{84eed0af-ed7f-4d3e-964c-fa5fda4093f1}">
|
||||
<Declaration><![CDATA[PROPERTY P_Result : UINT
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{72d03065-7320-43e6-8295-5250a7641abc}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Result := _uiResult;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_StationID" Id="{6655f302-05b0-4a57-b6f3-aa70ddd6a9f3}">
|
||||
<Declaration><![CDATA[PROPERTY P_StationID : UINT
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{06281909-79f6-4e9b-a8d9-9b210420e132}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_StationID := _uiStationID;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
42
PLC/POUs/Scheduler/POUs/FB_TransportBase.TcPOU
Normal file
42
PLC/POUs/Scheduler/POUs/FB_TransportBase.TcPOU
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_TransportBase" Id="{27acb860-a7d2-4ad3-adc1-3999bf7b2d0f}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_TransportBase IMPLEMENTS I_Transport
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
_xAvailable : BOOL;
|
||||
_xError : BOOL;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
<Property Name="P_Available" Id="{b86daa99-acd7-4a83-9de5-8155146759bd}">
|
||||
<Declaration><![CDATA[PROPERTY P_Available : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{b5275c3b-e101-4786-a7c8-b2f25babf8a7}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_Available := _xAvailable;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
<Property Name="P_HasError" Id="{fc4055b6-6553-4a3a-9b04-c5bb792578a6}">
|
||||
<Declaration><![CDATA[PROPERTY P_HasError : BOOL
|
||||
]]></Declaration>
|
||||
<Get Name="Get" Id="{da490431-bb00-4006-9c7f-3c5d4dab3bd2}">
|
||||
<Declaration><![CDATA[VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[P_HasError := _xError;]]></ST>
|
||||
</Implementation>
|
||||
</Get>
|
||||
</Property>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Stations/FB_Etcher.TcPOU
Normal file
16
PLC/POUs/Stations/FB_Etcher.TcPOU
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Stations/FB_HVTest.TcPOU
Normal file
16
PLC/POUs/Stations/FB_HVTest.TcPOU
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Stations/FB_Input.TcPOU
Normal file
16
PLC/POUs/Stations/FB_Input.TcPOU
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Stations/FB_NIO.TcPOU
Normal file
16
PLC/POUs/Stations/FB_NIO.TcPOU
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
16
PLC/POUs/Stations/FB_Output.TcPOU
Normal file
16
PLC/POUs/Stations/FB_Output.TcPOU
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user