diff --git a/PLC/PLC.plcproj b/PLC/PLC.plcproj index 6ad7914..f0b56a0 100644 --- a/PLC/PLC.plcproj +++ b/PLC/PLC.plcproj @@ -36,6 +36,9 @@ Code + + Code + Code true @@ -49,6 +52,9 @@ Code + + Code + Code @@ -112,8 +118,8 @@ - - + + "<ProjectRoot>" {192FAD59-8248-4824-A8DE-9177C94C195A} @@ -189,14 +195,14 @@ - - - System.Boolean - System.Collections.Hashtable - {54dd0eac-a6d8-46f2-8c27-2f43c7e49861} - System.String - - + + + System.Boolean + System.Collections.Hashtable + {54dd0eac-a6d8-46f2-8c27-2f43c7e49861} + System.String + + \ No newline at end of file diff --git a/PLC/POUs/Scheduler/DUTs/ST_TransJob.TcDUT b/PLC/POUs/Scheduler/DUTs/ST_TransJob.TcDUT new file mode 100644 index 0000000..7db2753 --- /dev/null +++ b/PLC/POUs/Scheduler/DUTs/ST_TransJob.TcDUT @@ -0,0 +1,26 @@ + + + + + + \ No newline at end of file diff --git a/PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL b/PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL index bd4cc00..5db23dd 100644 --- a/PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL +++ b/PLC/POUs/Scheduler/GVLs/GVL_Scheduler.TcGVL @@ -9,6 +9,12 @@ VAR_GLOBAL CONSTANT // Scheduler constants MAX_STATIONS : UINT := 10; + + // Factor to calc dynmaic priority from age of job in prio/s + AGE_FACTOR : REAL := 1.0; + + // Job queue constants + MAX_JOBS_IN_QUEUE : UINT := 10; END_VAR]]> \ No newline at end of file diff --git a/PLC/POUs/Scheduler/POUs/FB_JobQueue.TcPOU b/PLC/POUs/Scheduler/POUs/FB_JobQueue.TcPOU new file mode 100644 index 0000000..0f1c725 --- /dev/null +++ b/PLC/POUs/Scheduler/POUs/FB_JobQueue.TcPOU @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + = GVL_Scheduler.MAX_JOBS_IN_QUEUE THEN + M_AddJob := FALSE; + RETURN; +END_IF + +_uiJobCount := _uiJobCount + 1; +_astJobQueue[_uiJobCount] := stJob; +_astJobQueue[_uiJobCount].xValid := TRUE; +_astJobQueue[_uiJobCount].uliTimeCreated := F_GetSystemTime(); +M_AddJob := TRUE;]]> + + + + + + 32767.0 THEN + _rDynPrio := 32767.0; + END_IF + _astJobQueue[_uiCnt].iDynPrio := REAL_TO_INT(_rDynPrio); + + // Check for highest priority + IF (_astJobQueue[_uiCnt].iStatPrio + _astJobQueue[_uiCnt].iDynPrio) > _iMaxPrio THEN + _iMaxPrio := + END_IF + END_IF + +END_FOR]]> + + + + \ No newline at end of file diff --git a/PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU b/PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU index 75469db..a6a3ce9 100644 --- a/PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU +++ b/PLC/POUs/Scheduler/POUs/FB_Scheduler.TcPOU @@ -10,7 +10,7 @@ VAR _aiStations : ARRAY[1..(GVL_Scheduler.MAX_STATIONS)] OF I_Station; _uiStationCount : UINT := 0; - _fbTransport : ARRAY[1..(GVL_Scheduler.MAX_STATIONS)] OF I_Station; + _fbTransport : I_Station; _uiTransportCnt : UINT := 0; _uiCnt : UINT; @@ -19,7 +19,10 @@ VAR _fbProduct : I_Product; END_VAR]]> - 0 THEN + // Skip reservation for now // _aiStations[_uiNextAvailStation].M_Reserve(); + // Create transport job END_IF END_IF END_FOR]]>