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.

treenode forkliftdispatcher = Model.find("Distpatcher 1");
string thisDrop-off;
//looping into a for loop with j as index
//if loop to check Station and Type is matching as per the below given table with the pallet variables.(same)
thisDrop-off = Table("Part_Location")[j][Destination];
TaskSequence ts = TaskSequence.create(forkliftDispatcher,0,0);
ts.addTask(TASKTYPE_TRAVEL, Model.find("buffer");
ts.addTask(TASKTYPE_LOAD, item,Model.find("buffer");
ts.addTask(TASKTYPE_TRAVEL, Model.find(thisDropOff);
ts.addTask(TASKTYPE_UNLOAD, item,Model.find(thisDropOff);
ts.dispatch();
//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.

Joerg Vogel avatar image Joerg Vogel commented ·
May I suggest you initialize your values for ‘thisDrop-off’ and ‘item‘ with an always valid value. I think off a similar structure for item like ‘thisDrop-off‘. You initialize a local variable for item from a queue that stores enough replacement items to carry. You can record events when an replacement item is transported. Now your model works without exceptions, but you are still able to identify when something goes wrong.
0 Likes 0 ·

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.

hermione12 avatar image hermione12 commented ·
@Jason Lightfoot
After removing the double quotes also I am still getting the same error
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ hermione12 commented ·
Put a breakpoint in your code and step through it using the debugger to check the local variable values. If needed add watch expressions to make sure each line works correctly.
0 Likes 0 ·
hermione12 avatar image hermione12 Jason Lightfoot ♦ commented ·
@Jason Lightfoot the problem was with excel import. When I imported the Destination values it had a space (as I am using data validation >list) in excel.

It is solved now. Thank you

0 Likes 0 ·