Fengjun0113 avatar image
Fengjun0113 asked Fengjun0113 commented

Processor only produce specific items by using "Query"

Hello, this is a FlexSim 2016 model. In this model, there're three kind of processors and items. each processor can only produce specific items. I've made a Global Table "ItemType_Processor" to set the constraint for each processor. For example, Processor1 can only produce ItemType1. My questions are:

1. How to use "Query" to make each processor get the constaint information in "ItemType_Processor"?

2. As you can see, ItemType1 can be produced by both Processor1 and Processor2. With this constaint, How can I push them to these two processors randomly?

FlexSim 16.1.2
global tablequeryrandom
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

Felix Möhlmann avatar image
Felix Möhlmann answered Fengjun0113 commented

1. For the processors to influence which items are send to them, they have to be set to "Pull" items.

A "query" would be used to filter the items when pulling them off a list. If they are pulled from an upstream object this is done with the "Pull Requirement". If it evaluates to 'true' (a non-zero number), then the item can be pulled, if the result is 'false' (0) the item will not be pulled.

As such, to restrict the processor to items depending on the table you can use the value from the respective table cell as the pull requirement. The row is given by assigning a label to each processor denoting which row it belongs to. The column is the "ItemType" label on the item (note the offset of 1 for the column number, since the first column is the processor name)


The same expression could be used to query the items when pulling off a list. By adding an expression field to the list you can then use it in the query. Note that its the same expression as above - only the reference are adjusted (current -> puller, refers to the processor and item -> value to the item).


2. With the Pull option used as described in 1., the items would be distributed between the processors according to the constraints and enter the processor that is available first.

If you add the constraint to the "Send to Port" logic of the queue, the settings from 1. become redundant since the processor need not check anymore if they allowed to pull the item.

To do this you would have to write code that first finds all eligible port ranks and then choose one from those at random. Note that this does not work like the "First Available" logic above. An item might be send to a processor that is currently busy even if another eligible processor might be available.


For this code I changed the first column to contain the respective port numbers, so they can be used as the return value.


1661420022614.png (15.6 KiB)
1661420129766.png (11.6 KiB)
1661420239041.png (8.9 KiB)
1661421564579.png (29.7 KiB)
1661421609402.png (2.8 KiB)
· 5
5 |100000

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

Fengjun0113 avatar image Fengjun0113 commented ·

Hello @Felix Möhlmann, is there any typo in your code (yellow line)?


0 Likes 0 ·
1661504942539.png (40.0 KiB)
Felix Möhlmann avatar image Felix Möhlmann Fengjun0113 commented ·
Your code is missing the "=" between 'queryString' and the value.
1 Like 1 ·
Fengjun0113 avatar image Fengjun0113 Felix Möhlmann commented ·

1. Why it needs bracket in line 9 and lin 10?1661609714952.png

2. The minimun num in this uniform distribution would be 1. But, Processor2 doesn't produce ItemType1. 1661609779826.png

0 Likes 0 ·
1661609714952.png (17.9 KiB)
1661609779826.png (8.2 KiB)
Show more comments