question

hermione12 avatar image
0 Likes"
hermione12 asked hermione12 commented

Setting a destination for item using transporter in the code

Hello,

In my model I am trying to reference object as a destination for the transporter to pick the pallet and place it on to the object destination.

This is how I am using it in the code.

  1. treenode forkliftdispatcher = Model.find("Distpatcher 1");
  2. string thisDrop-off;
  3. //looping into a for loop with j as index
  4. //if loop to check Station and Type is matching as per the below given table with the pallet variables.(same)
  5. thisDrop-off = Table("Part_Location")[j][Destination];
  6. TaskSequence ts = TaskSequence.create(forkliftDispatcher,0,0);
  7. ts.addTask(TASKTYPE_TRAVEL, Model.find("buffer");
  8. ts.addTask(TASKTYPE_LOAD, item,Model.find("buffer");
  9. ts.addTask(TASKTYPE_TRAVEL, Model.find(thisDropOff);
  10. ts.addTask(TASKTYPE_UNLOAD, item,Model.find(thisDropOff);
  11. ts.dispatch();
  12. //end of for loop

I am referring to the global table like this in my model

Station Type Destination
Station 1 L Drop1
Station 2 H Drop2
Station 3 L Drop3


Here in the Destination column, the values are the Queue names in my model. When I run this code, it is picking the pallet and dropping it in the mentioned Queue. But aftersometime it is giving me the Tasksequence error with invalid task and invalid task type. Involved 1 and 2 as NULL.

When I give all the values in the Destination column as "Drop1" (a single Queue as destination to all columns). Then it's running correctly.

If I give all the values in the Destination column as "Drop2" it is running correctly.

But If I give different Queue as destination in the Destination column in the Table shown above. It throws me the error.

How to resolve this? Please help.

@Felix Möhlmann @Jason Lightfoot @Jeanette F

FlexSim 20.0.10
forklift
· 1
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered hermione12 commented

I don't think you want "thisDropOff" as a string literal - remove the quotes to use the string value you assigned to the variable from the table.

· 3
5 |100000

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