question

Tony Nikolov avatar image
2 Likes"
Tony Nikolov asked Brandon Peterson edited

How do I code into the flow output port such that it filters by processor empty time?

So I am making a simulation where items are being filtered from a queue into several different processors, but before they can be processed, they must be split up into smaller subcomponents of the original item with a separator that happens instantaneously (no separator process time). The "pieces" of each item then get individually processed through their respective processor, with each piece waiting in a queue to get processed. For the sake of my project, I must not allow any new items to enter a pre-process queue until all of the pieces of the previous item have been processed. I started coding this into the filtering queue's flow port but came across a roadblock when I was trying to reference the state of the processor. The way my logic works is: If the processor is busy, then you must not send a new item to that processor's separator. I created a for loop to cycle through all of the output ports of the filter queue but I don't know what variable is used to determine whether the processor is busy or not. Can someone help me out?

FlexSim 16.0.1
codeuser commandvariable declaration
· 2
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
0 Likes"
Jeff Nordgren answered Tony Nikolov commented

If the flowitems are waiting in a queue before the processor, here is what I would do.

I close the input port of the pre-processing queue when the last flowitem in that "batch" has entered. Then in the OnExit trigger of the queue, if it is the last flowitem left in the queue, then reopen that queue for more flowitems.

If you could send your model or a sample, I could show you how to put that into practice.

· 3
5 |100000

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

Regan Blackett avatar image
1 Like"
Regan Blackett answered Matthew Gillespie edited

I'm not sure if I am fully understanding the problem, but I'll try to answer this using a simple example that uses some process flow elements to manage the processing of the sub-components.

So what I did was to create a Token that will represent my primary part. That Token tries to acquire a Queue, if successful I can go ahead and place the primary part in the Queue via a Create Object activity. Then I have that token start a Subflow which will create Child tokens that belong to the primary part.

The Child tokens are going to Acquire one of the processors I have in a Group, wait (using a Wait for Event activity) for the processors to release the sub-components. Once released, that allows the primary piece be moved to the Finish Queue.

That will make sure the all the sub-components for a given Primary part are done before mvoing on and allowing the next primary to begin.

processing-subcomponents.fsm.


· 1
5 |100000

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