question

hermione12 avatar image
0 Likes"
hermione12 asked hermione12 commented

Dispatcher code

Hello,

I have a model with one dispatcher and 4 forklifts. I want to assign tasks to forklifts through dispatcher. The dispatcher has to send forklifts based on the task triggered from global table. In the global table, the required destination will be mentioned for particular item and the forklift has to pick the part and deliver to the destination. The dispatcher has to check for the available forklifts which are not performing any task and assign a task to it.

How to write the code in the dispatcher to send the transporters to perform task whenever the forklifts are available?

As of now, in my model I have assigned each task to one forklift but I want to access all the forklifts not to restrict one forklift to one task but multiple forklifts to multiple tasks.

The global table to be referred is "ProcessFlow1"

Please help me to write the code.

Model Name : Model_using_code_V3

FlexSim 20.0.10
global tableforkliftdispatchers
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

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered hermione12 commented

Do this in Process Flow!

  • You transform your table data of assignable transporters into groups OR partitioned / child group
  • You evaluate which group has to be chosen.
  • You tell this data in activity acquire resource.

The Rest does FlexSim

· 7
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 ·

In 3D model logic you replace groups by dispatcher objects. Each dispatcher is connected to all transporters of a group. A Main Dispatcher transfers tasksequences matching to the group dispatchers.

The only code you need is to evaluate which destination is worked on a dispatcher group.

The destination is in a standard tasksequence in Parameter involved 1 in 4th task or in involved second parameter in 5th task

You get their names by property name.

If you need to translate an array of names into numbers to return an output port number of an array element, you can use the method indexOf for it.

You can use this approach probably with an array of treenodes, too.

You get an array of output port objects by

current.outObjects.toArray()

in a trigger or function in main dispatcher.

0 Likes 0 ·
hermione12 avatar image hermione12 Joerg Vogel commented ·

Thank you @Joerg Vogel

I want to use a single dispatcher and control all the forklifts with only one dispatcher. In this case what command to use? Also I want to do this without processflow.

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann hermione12 commented ·

What you describe is not possible with a single dispatcher, because if a task sequence can not be dispatched when received and enters the task sequence queue it will always be dispatched to the first task executer that becomes available.

The closest you get would be to always dispatch the sequence when they come in to the forklift with the least tasks queued up.

1660128809478.png

1660128820809.png

0 Likes 0 ·
1660128809478.png (48.3 KiB)
1660128820809.png (8.3 KiB)
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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