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 Jeff Nordgren commented ·

Tony,

Can you send your model or a sample so that we can look at it and give you a better answer?

0 Likes 0 ·
Tony Nikolov avatar image Tony Nikolov Jeff Nordgren commented ·

I attached the file. The issue I am having is when the operators are taking items from the HSTW Queue and sending it to a Circle Breakup Separator before the previous set of items has completely (all pieces of the item) passed through the HSTW Processor.

pgore-projectsacs-tapewrap-simulation-projectacs-t.fsm

0 Likes 0 ·
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.

Tony Nikolov avatar image Tony Nikolov commented ·

That sounds very logical to me. I would want to reopen the input port as the last flowitem has left the processor in this case. However, I don't know how to distinguish what the last flowitem is in the batch and also don't know how to close the input port. I'd appreciate some help with that syntax.

0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren Tony Nikolov commented ·

@Tony Nikolov

Tony,

Dang! I thought that I sent you your model with an explanation of what I did to it. But when I looked back here, it wasn't there. So here is another try.

Below is a summary of what I changed in your model. Take a look at it and see if it is now doing what you want it to do.

I added a second centerport connection from each HSTW back to its Circle Breakup separator. Then I rearranged the input ports on each HSTW so that the Multiple Passes Q would be the first input port to the processor instead of the second. That way, if the Placeholder Q is empty, all the "batch" has been processed.

In the OnExit trigger of the separator, I call a User Command called "LockBreakup". What this does is close the input port of the separator is all flowitems have left the separator.

In the OnExit trigger of the processor, I call a User Command called "ReleaseBreakup". What this does is check to see if the Placeholder Q is empty (all flowitem have been processed). If it is empty, it opens the input port of the second centerport connection of the processor (separator).

That's pretty much it in a nutshell. Take a look at the model and see if this is the way that you intend for it to function. If you have any questions or problems, please let us know.

pgore-projectsacs-tapewrap-fs1.fsm

Not sure why it won't delete the first two models. Use the named one above.

0 Likes 0 ·
Tony Nikolov avatar image Tony Nikolov Jeff Nordgren commented ·

Jeff,

Yes, this does exactly what I'm looking for! Thanks for the help, I will try and make good use of User Commands from here on out.

0 Likes 0 ·
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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

Here's another example of how to do this in Process Flow. The logic here is from the Queue's point of view rather than the individual items like Regan's model. The queue waits until all the items have been processed before grabbing a new item to separate.

processflowseparator.fsm

0 Likes 0 ·

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.