How to make the ASRS place items in the racks on both the left and right sides?

How to make the ASRS place items in the racks on both the left and right sides?

j08j
Not applicable
2,489 Views
12 Replies
Message 1 of 13

How to make the ASRS place items in the racks on both the left and right sides?

j08j
Not applicable

[ FlexSim 24.0.2 ]

If I have two racks as different destinations, how can I modify the code to make the ASRS travel to either of the racks?

1720107085211.png

queue.setProperty("TransportRef", "Object current = ownerobject(c);\n\
Object item = param(1);\n\
int port = param(2);\n\
Object destination = param(3);\n\
double priority = param(4);\n\
int preempt = param(5);\n\
Object destination1 = current.outObjects[2];\n\
\n\
if (true) {\n\
TaskSequence taskSequence = TaskSequence.create(assertattribute(current, \"stored\", 0), priority, preempt);\n\
\n\
taskSequence.addTask(TASKTYPE_TRAVEL, current, NULL);\n\
taskSequence.addTask(TASKTYPE_LOAD, item, current, port);\n\
taskSequence.addTask(TASKTYPE_BREAK, NULL, NULL);\n\
taskSequence.addTask(TASKTYPE_TRAVEL, destination, NULL);\n\
taskSequence.addTask(TASKTYPE_UNLOAD, item, destination, opipno(current,port));\n\
string listName = \"TSList1\";\n\
List(listName).push(taskSequence, 0);\n\
current.centerObjects[1].message(0.01, current);\n\
}\n\
return 0;\n\
");


0 Likes
Accepted solutions (1)
2,490 Views
12 Replies
Replies (12)
Message 2 of 13

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

The "Use Transport" code you show here already gets the destination passed into it. You have to modify the "Send to Port" option of the queue because that is where the routing happens.

0 Likes
Message 3 of 13

j08j
Not applicable


I see, but even though I have set the queue's "send to port" to "random port", it still only sends items to one of the racks.

1720150618266.png

model.fsm

0 Likes
Message 4 of 13

FelixMoehlmann
Collaborator
Collaborator
It does send the fourth and fifth item to the other rack. But since that rack does not have the "Use Transport" option set the items move to the sink immediately.
0 Likes
Message 5 of 13

j08j
Not applicable

Got it. Now I have another question. I have set the TransportRef for both racks, but the items placed on the rack in the front cannot be taken down. What could be the problem? (Originally, it was supposed to perform extraction or placement actions according to the 0, 1 array displayed in the output console.)model.fsm

0 Likes
Message 6 of 13

FelixMoehlmann
Collaborator
Collaborator

The "bound" list field is only 0 if the load task happens at the first rack in the model. (Both racks have the same name, "Model.find("Rack")" will always find the first one.

1720164233984.png

I would suggest to set "bound" based on a label on the origin or destination object. Using names for such things will quickly lead to such errors when changes are made to the model.

0 Likes
Message 7 of 13

j08j
Not applicable

Is it something like this?

/**Custom Code*/
Variant value = param(1);
Variant puller = param(2);
treenode entry = param(3);
double pushTime = param(4);
Object destination = param(5);
if(value.as(TaskSequence).tasks[2].involved2 == destination) return 0;
return 1;

But it seems to have some syntax errors.

0 Likes
Message 8 of 13

FelixMoehlmann
Collaborator
Collaborator

Where would the fifth parameter assigned to "destination" come from? I mean something like this:

1720166292730.png

With "Bound" being a label on the queue and racks with a value of either 1 (queue - inbound) or 0 (racks - outbound).

0 Likes
Message 9 of 13

j08j
Not applicable

It shows the following error:

time: 2.651519 exception: FlexScript exception: Label property Bound retrieved on /Queue. Label does not exist. at MODEL:/Tools/GlobalLists/TSList1>variables/fields/bound/expression

I understand what you mean, but I have no idea how to modify the code.

0 Likes
Message 10 of 13

FelixMoehlmann
Collaborator
Collaborator
You do have to first add the label to the objects before this expression will work.
0 Likes
Message 11 of 13

j08j
Not applicable

Do you mean adding asrs's label1 to the queue as well?

0 Likes
Message 12 of 13

FelixMoehlmann
Collaborator
Collaborator
No, I mean adding a label called "Bound" to the racks and the queue. Where the ones on the rack have the value 0 and the one on the queue has the value 1.
0 Likes
Message 13 of 13

j08j
Not applicable

It works smoothly now! Thank you so much for helping me with so many questions.

0 Likes