How can I accurately send items to a specific slot on the rack?

How can I accurately send items to a specific slot on the rack?

j08j
Not applicable
708 Views
6 Replies
Message 1 of 7

How can I accurately send items to a specific slot on the rack?

j08j
Not applicable

[ FlexSim 24.0.2 ]

I use the following code to define how items in the queue are processed and transported to the rack, but TASKTYPE_UNLOAD can only specify the transfer to the rack without explicitly specifying the transfer to a specific slot on the rack. How can I modify this code to accurately send items to a specific slot on the rack?

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\
\n\
/***popup:PushToList:listType=TaskSequence*/\n\
/**Push to Task Sequence List*/\n\
/***tag:showAdvanced*//**1*/\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\
");

model.fsm

Thank you.

0 Likes
Accepted solutions (1)
709 Views
6 Replies
Replies (6)
Message 2 of 7

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

You already have code for the source that feeds directly into the rack to assign a random slot to the exiting item.

int i = duniform(1, Bay, 1);\n\
int j = duniform(1, Level, 1);\n\ int k = duniform(1, Slot, 1);\n\ Storage.Item(item).as(Storage.Item).assignedSlot = current.outObjects[1].as(Storage.Object).getSlot(i, j, k);\n\

You can do the same for the items transported by ASRS.

0 Likes
Message 3 of 7

j08j
Not applicable
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\
\n\
/***popup:PushToList:listType=TaskSequence*/\n\
/**Push to Task Sequence List*/\n\
/***tag:showAdvanced*//**1*/\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\
int i = duniform(1, Bay, 1);\n\
int j = duniform(1, Level, 1);\n\
int k = duniform(1, Slot, 1);\n\
Storage.Item(item).as(Storage.Item).assignedSlot = current.outObjects[1].as(Storage.Object).getSlot(i, j, k);\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\
");

I've tried this code before, but I couldn't simulate the model successfully. It stops when it tries to execute the action of placing items from the queue into the rack.

model.fsm

0 Likes
Message 4 of 7

FelixMoehlmann
Collaborator
Collaborator
"Bay", "Level" and "Slot" are not defined at that point in the code. I only copied part of the source's code to highlight the relevant part: Determining the bay, level and slot ID and assigning the slot to the item.

I assumed you'd use labels to assign the items to specific slots, not use random number distributions.

The "transportdispatcher" variable node is also currently not toggled as FlexScript in your model.

0 Likes
Message 5 of 7

j08j
Not applicable

Is there a way to define "Bay", "Level" and "Slot" in this code?

0 Likes
Message 6 of 7

FelixMoehlmann
Collaborator
Collaborator
Of course you can define those variables in the code. You can also use different names or labels.

As I said, you already have working code in place for the source, so I don't understand what you are struggling with to adapt that code for the queue.

0 Likes
Message 7 of 7

j08j
Not applicable

I found my mistake, sorry for causing you trouble, thank you for your reply.

0 Likes