Yifei Wang avatar image
Yifei Wang asked Jordan Johnson answered

How to limit the amount of each itemtype a source will produce?


Please see the attached model. I have a few questions about my model.

1. I would like to have the source to keep producing items until all itemtypes' capacity in queque 1 to 5 have been reached. Then, after flowitems goes out of the storage queue 1-5 (when certain itemtype is below its capacity in any queue 1~5) , the source should start producing the itemtype in shortage again. Otherwise, the source will be at rest. Could you please show me how to make it happen?

2. I tried to let Queue_1 and Queue_2 to pull desired itemtypes from Queue 1~5. However, it is not working properly. Could you please let me know what is wrong with it?


Yifei Wang

FlexSim 16.0.1
pull strategyforklift
combined.fsm (28.4 KiB)
· 4
5 |100000

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

Jeff Nordgren avatar image Jeff Nordgren commented ·

I'm a little confused as to what you are wanting to do. Do you only want one specific itemtype to occupy one of the individual, 1-5 queues? Or can there be mixed itemtypes in any or all of the queues 1-5?

More specific information would be helpful.

0 Likes 0 ·
Yifei Wang avatar image Yifei Wang Jeff Nordgren commented ·

does it make sense? Please let me know if there is anything else unclear to you. Thanks!

0 Likes 0 ·
Yifei Wang avatar image Yifei Wang commented ·

Yes, there can be mixed itemtypes in any or all of the queues. Please see my global table named "Capacities". It lists the capacity of each itemtype on each queue.

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Yifei Wang commented ·

Your "pull" from Queue_1 and Queue_2 do not work because you are using custom code in the Send To Port on the other 5 queues. After deleting all of the code in the Send To Port for the 5 queues, then your pull will work on the other 2 queues. But you have a problem there as well, because you are trying to pull itemtype 4 from both queues. Since all of you 5 queues have their first output port going to Queue_1, Queue_2 will never receive any itemtype 4s.

Haven't looked at your code in the OnEntry and OnExit triggers of the 5 queues but that code isn't working either.

I still don't understand how you want flowitems to flow in the model. If you want any itemtype 4s to go to Queue_2, then that connection to any or all of the 5 queues needs to be the first output port. If you set all of the 5 queues to have the first output port go to Queue_2, then no itemtype 4s will go to Queue_1. So you are going to have to explain how you want to determine the flow of flowitems in the model. I don't understand the ultimate goal of the model.

0 Likes 0 ·

1 Answer

Jordan Johnson avatar image
Jordan Johnson answered

To make a source that keeps queues full based on a table, you can use process flow:

This flow has many activities, but it's easier to understand than it looks.

  • Each schedule source (Items for Queue N) creates a single token. That token get a label pointing to the correct queue, and a label with the column number for that queue in the Capacities table.
  • That token then creates tokens that represent possible items in the queue. There are enough "possible item" tokens to fill the queue to total capacity.
  • Each "possible item" passes through a Zone with a Max Content of 1, and a Queue Strategy of "ORDER BY RAND()", which randomizes the possible items, and sends the random order through. This simulates a source with an inter-arrival time.
  • Once through the Zone, each "possible item" token creates a 3D item on the correct queue, and sets its itemtype and color.
  • Then, each "possible item" waits for the 3D item to leave the queue. When that happens, the "possible item" loops back to wait in the Zone again, and to create another item.

The end result is that the queues will stay full of the correct kinds of items. You can change the table, and those changes will be reflected in the model.

Based on the other code you had in the source (which I replaced with a Process Flow), this probably isn't exactly what you want. However, it might give you a better idea of how you could do what you want.

You should also consider using the Zone's Partition and Partition Constraints features (new in version 16.1). You may find it helpful to achieve the behavior you need.


autofillsource.png (39.5 KiB)
combined-2.fsm (32.6 KiB)
5 |100000

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

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.