question

Jungeun W avatar image
0 Likes"
Jungeun W asked Jungeun W commented

reorder task to task executer

Hi

I have 14 AGVs connected to the dispatcher, with looped AGV path.

I want to let AGV receive task by shortest distance queue strategy.


More specifically, if AGV is passing specific points with unloading state, task be reassigned by shortest distance strategy again.


How to let dispatcher assign task again as AGV pass specific control point? All 14 AGVs would move independently.

plz help! Thx!!

FlexSim 21.1.5
tasksequencetaskexecuterassigntask
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jungeun W commented

You can copy the AGV's current task sequence to the queue of the dispatcher and dispatch it again. Before that, the AGV should receive a new, preempting task sequence, to overwrite the previous one.

  1. /**Custom Code*/
  2. TaskExecuter te = param(1);
  3. AGV agv = AGV(te);
  4. Object currentCP = param(2);
  5.  
  6. // Save current time (used to prevent infinite loops)
  7. te.LastUpdate = Model.time;
  8.  
  9. // Get Task Sequence
  10. treenode TSNode = te.find(">variables/activetasksequence/1");
  11. TaskSequence TS = TSNode;
  12.  
  13. // Create a copy in the queue of the dispatcher
  14. treenode TSCopyNode = createcopy(TSNode, Model.find("Dispatcher1>variables/tasksequencequeue"));
  15. TaskSequence TSCopy = TSCopyNode;
  16.  
  17. // Give self new task (to abort travel)
  18. te.DontRepeatWaypoint = 1;
  19. TaskSequence abort = TaskSequence.create(te, 100, PREEMPT_AND_ABORT_ACTIVE);
  20. abort.addTask(TASKTYPE_TRAVEL, currentCP, NULL, 999);
  21. abort.dispatch();
  22.  
  23. // Dispatch copied sequence
  24. TSCopy.dispatch();

To apply this to multiple control points in the network, I would suggest to use the way points.

ReassignTasks.fsm


reassigntasks.fsm (34.1 KiB)
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.