ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 08-21-2012
Vadim Fooks's Avatar
Vadim Fooks Vadim Fooks is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 67
Downloads: 26
Uploads: 0
Thanks: 50
Thanked 24 Times in 13 Posts
Rep Power: 118
Vadim Fooks will become famous soon enough
Question Problem with a coordinated task sequence. Could somebody please help spotting the problem?

Ladies and Gentlemen,

I am stuck trying to simulate a simple AGV-based order fulfillment line.
The tasks are generated by a "WMS" (A basic FR, used as a control center) and handled by two AGVs. The AGVs go through the pallet loading station, than order fullfillment area, unloading dock, and staging (parking) area.
Exclusive access is implemented by approaching the entry of a workcell, trying to allocate the operator of this workcell, and proceeding in only after the operator has been allocated.


I have ran into several problems and I worked around one, but cannot solve the other.

Problem 1:
When I use more than one TaskExecuter, my CTS fails straight away if the CALLSUBTASKS is the first proxy task. I worked around it by adding a proxytask DELAY at the beginning of the tasksequence, but I do not understand the reason for the problem or why the solution worked.
I am a bit worried about this.


Problem 2:
When I use more than one TaskExecuter, the last generated task always fails.
In the attached model, I generate 10 tasks in a loop (10 orders sent from the "WMS"). The last one fails.
I tried to change it to 100 and still the last one fails.
I commented out all materials handling operations, leaving only allocations, TRAVEL, and TRAVELTOLOC proxy tasks, to reduce the number of possible causes.
The problem seems fundamental in nature - I must be doing something wrong.

Here is the code for the task sequence in question:

Code:
/**Dispatch orders*/
treenode current = ownerobject(c);
int msgCode = msgparam(1);
/* Message is fired by the one-off user event */
if (msgCode == START_SIMULATION)
{
 for (int i = 1; i <= 10; i++)
 {
  treenode cts = createcoordinatedtasksequence(vehicleProxy);
  int agvKey = insertallocatetask(cts, vehicleProxy, PICKING_PRIO, PREEMPT_NOT);
  int dummy;
  /* When this task is not included, task sequence immediately fails on startup. Why??? */
  dummy = insertproxytask(cts, agvKey, TASKTYPE_DELAY, NULL, NULL, 0);
  insertsynctask(cts, dummy);
  int prepVehicle = insertproxytask(cts, agvKey, TASKTYPE_CALLSUBTASKS, current, NULL, PREPARE_VEHICLE);
  insertsynctask(cts, prepVehicle);
  int loadOrders = insertproxytask(cts, agvKey, TASKTYPE_CALLSUBTASKS, current, NULL, PERFORM_PICK);
  insertsynctask(cts, loadOrders);
  int unloadVehicle = insertproxytask(cts, agvKey, TASKTYPE_CALLSUBTASKS, current, NULL, UNLOAD_VEHICLE);
  insertsynctask(cts, unloadVehicle);
  int parkVehicle = insertproxytask(cts, agvKey, TASKTYPE_CALLSUBTASKS, current, NULL, PARK_VEHICLE);
  insertsynctask(cts, parkVehicle);  
  dummy = insertproxytask(cts, agvKey, TASKTYPE_DELAY, NULL, NULL, 0);
  insertsynctask(cts, dummy);
  insertdeallocatetask(cts, agvKey);
  profiletasksequence(cts);
  dispatchcoordinatedtasksequence(cts);
 }
}
/* Load a pallet on the AGV */
else
if (msgCode == PREPARE_VEHICLE)
{
 treenode palletDisplenserStation =  node("/PalletDispenserStation", model());
 treenode terminal =  node("/VehicleControlTerminal", model());
 treenode palletDispenser =  node("/PalletDispenser", model());
 treenode agv = msgsendingobject();
 treenode placeFunc = node("/MAIN:/project/model/Tools/UserCommands/PlaceItemInAShortPc/code", model());
 treenode cts = createcoordinatedtasksequence(agv);
 int agvKey = insertallocatetask(cts, agv, PICKING_PRIO,PREEMPT_NOT); 
 int opKey = insertallocatetask(cts, vehicleDispatcherProxy, PICKING_PRIO,PREEMPT_ONLY); 
 int gotoControl = insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(terminal), yloc(terminal), 0);
 insertsynctask(cts, gotoControl);
 int opStartVehicle = insertproxytask(cts, opKey, TASKTYPE_DELAY, NULL, NULL, 2);
 insertsynctask(cts, opStartVehicle);
 int appr2 = insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, palletDisplenserStation);
 insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(palletDispenser), yloc(palletDispenser), 0);
 treenode item = NULL;
 /* Materials Handling operation has been commented out
 //v
 for (int i= 1; i <= content(palletDispenser); i++)
 {
  item = rank(palletDispenser, i);
  treenode tmp = label(item,"allocated");
  if (!objectexists(tmp))
  {
   assertlabel(item, "allocated", DATATYPE_NUMBER);
   break;
  }
 }
 insertproxytask(cts, opKey, TASKTYPE_FRLOAD, item, palletDispenser);
 */
 int appr1 = insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(palletDisplenserStation), yloc(palletDisplenserStation), 0);
 /* Materials Handling operation has been commented out 
 //v
 int dropPallet = insertproxytask(cts, opKey, TASKTYPE_FRUNLOAD, item, agv);
 insertsynctask(cts, dropPallet);
 insertproxytask(cts, opKey, TASKTYPE_NODEFUNCTION, placeFunc, NULL, tonum(item));
 */
 int opLoadPallet = insertproxytask(cts, opKey, TASKTYPE_DELAY, NULL, NULL, 0);
 insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(terminal), yloc(terminal), 0);
 insertdeallocatetask(cts, opKey);
 insertdeallocatetask(cts, agvKey);
 return cts;
}
else
/* Fulfill the order */
if (msgCode == PERFORM_PICK)
{
 treenode rack =  node("/Rack", model());
 treenode station =  node("/OrderPickerStation", model());
 treenode agv = msgsendingobject();
 treenode dest = first(agv);
 treenode cts = createcoordinatedtasksequence(agv);
 int agvKey = insertallocatetask(cts, agv, PICKING_PRIO,PREEMPT_NOT); 
 insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, node("/PickAreaEntry", model()));
 int opKey = insertallocatetask(cts, orderPickerProxy, 0,0); 
 int approachRack = insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, node("/PickArea", model()));
 insertsynctask(cts, approachRack);
 /* Materials Handling operation has been commented out
 //v
 treenode item = NULL;
 for (int i= 1; i <= content(rack); i++)
 {
  item = rank(rack, i);
  treenode tmp = label(item,"allocated");
  if (!objectexists(tmp))
  {
   break;
  }
 }
 for (int i = 1; i <= 8; i++)
 {
  assertlabel(item, "allocated", DATATYPE_NUMBER);
  insertproxytask(cts, opKey, TASKTYPE_FRLOAD, item, rack);
  insertproxytask(cts, opKey, TASKTYPE_UNLOAD, item, dest);
  item = next(item);
 }*/
 insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(station), yloc(station), 0);
 insertdeallocatetask(cts, opKey);
 insertdeallocatetask(cts, agvKey);
 return cts;
}
else
/* Unload the full pallet into the trailer */
if (msgCode == UNLOAD_VEHICLE)
{
 treenode unloadingDockEntry =  node("/UnloadingDockEntry", model());
 treenode unloadingDock =  node("/UnloadingDock", model());
 treenode gate =  node("/Gate", model());
 treenode station =  node("/TruckLoaderStation", model());
 treenode truck =  node("/Truck", model());
 treenode agv = msgsendingobject();
 treenode cts = createcoordinatedtasksequence(agv);
 int agvKey = insertallocatetask(cts, agv, PICKING_PRIO,PREEMPT_NOT); 
 insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, unloadingDockEntry);
 int opKey = insertallocatetask(cts, truckLoaderProxy, PICKING_PRIO,PREEMPT_NOT); 
 insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, unloadingDock);
 int gotoVehicle = insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(unloadingDock), yloc(unloadingDock), 0);
 insertsynctask(cts, gotoVehicle);
 int opStartVehicle = insertproxytask(cts, opKey, TASKTYPE_DELAY, NULL, NULL, 2);
 insertsynctask(cts, opStartVehicle);
 insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, gate);
 /* Materials Handling operation has been commented out
 //v
 insertproxytask(cts, agvKey, TASKTYPE_FRUNLOAD, first(agv), truck);
 */
 int gotoStation = insertproxytask(cts, opKey, TASKTYPE_TRAVELTOLOC, NULL, NULL, xloc(station), yloc(station), 0);
 insertsynctask(cts, gotoStation);
 insertproxytask(cts, agvKey, TASKTYPE_TRAVEL, gate);
 insertdeallocatetask(cts, opKey);
 insertdeallocatetask(cts, agvKey);
 return cts;
}
else
/* Go to the vehicle staging area */
if (msgCode == PARK_VEHICLE)
{
 treenode agv = msgsendingobject();
 treenode parking = node(concat(nodetomodelpath(agv, true), "Parking"), model());
 treenode ts = createemptytasksequence(agv, PICKING_PRIO,PREEMPT_NOT); 
 inserttask(ts, TASKTYPE_TRAVEL, parking);
 return ts;
}
else
{
 msg("WMS Error", concat("Unhandled message: ", numtostring(msgCode), "\n from object: ", nodetomodelpath(msgsendingobject(), true)), 1);
 stop();
}
Please help!
Thank you!
Vadim
Attached Files
File Type: fsm dm_qpr_debug.fsm (196.4 KB, 170 views)

Last edited by Vadim Fooks; 08-21-2012 at 08:54 PM.
  #2  
Old 08-27-2012
Vadim Fooks's Avatar
Vadim Fooks Vadim Fooks is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 67
Downloads: 26
Uploads: 0
Thanks: 50
Thanked 24 Times in 13 Posts
Rep Power: 118
Vadim Fooks will become famous soon enough
Cool Problem solved, thanks for looking

Ladies and Gentlemen,
I am happy to inform you that the problem has been identified.
As it turned out, the problem was not in the code of the CTS.
For a multi-vehicle configuration I was using one of the taskexecuters as a dispatcher to the other. That was a bad idea.
My CTS was structured in such a way that the top level task allocated taskexecuters from a pool and then called a series of subtasks (load, process, unload) which all had to be handled by the same TE. However, when the allocated TE was a team leader, on occasion that resulted in the subordinate TE being allocated for the subtask, which was resulting in chaos.
Replacing the master-slave relationship of the two TEs with a single dispatcher with links to both, has solved the problem.
The Following User Says Thank You to Vadim Fooks For This Useful Post:
Jörg Vogel (08-28-2012)

Tags
callsubtasks, coordinated task sequence, task executer


Thread Thread Starter Forum Replies Last Post
Coordinated Task Sequence Profiler Normand Côté User Development 4 07-12-2012 07:20 PM
Coordinated Task sequence and call sb tasks Lucie Lerivrey Q&A 1 11-02-2011 11:05 AM
Problem with Transporter pickup & unload sequence Tan Chun Hua Q&A 3 06-14-2011 12:15 AM
Can coordinated task sequence and "break to requirement" be used together? qin tian Q&A 1 05-26-2008 10:44 AM
coordinated task sequence, need help. qin tian Q&A 4 05-12-2008 05:52 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.