question

JIANYUAN, HALLEY L avatar image
0 Likes"
JIANYUAN, HALLEY L asked Matthew Gillespie commented

What is the best process flow model to resolve this issue?

Hello all,

I am trying to create a model that has 2 queries using process flow. The idea is that when global table value is above 1 (value is keyed in at the start), the item will be sent to processor 1/2 (depending on the value). Else, it would wait in queue 1 until the wait times exceeds 300 seconds, at which, the item will be sent to sink 3.

Which method of approach would be the best to create such a logic? I have tried writing some codes but it didn't seem to work. On a side note, if there are more than 2 processors, is there a way to identify which processor to go to without creating too many "decide" process?

model-6.fsm

FlexSim 20.0.0
process flow
model-6.fsm (34.4 KiB)
· 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.

Regan Blackett avatar image
2 Likes"
Regan Blackett answered Matthew Gillespie commented

I took an attempt at what I think you are looking for in the attached model. I had to make some changes to a couple of things vs. the way you had it set up.

First I moved all the List interaction to Process flow rather than using Global Lists.I also removed your Port Connections from Queue1 to the Processors and will handle moving Flowitems using the List behavior. I assumed that any Flowitems with Type 1 Goes to Processor 1 and Type 2 to Processor 2. I also changed your Global Table value datatype from a simple number to a Tracked Variable.I’ll explain why below.

Based on your description of the desired behavior, it sounds like Flowitems on the List will wait for a Puller basically forever unless the Global Table value is 0 or less, at which point the 300 seconds wait time kicks in. Normally, you could use the Max Wait Timer property on the Push to List activity to start the clock before things get moved to the Sink. However, since your wait timer doesn’t kick in until the Table value hits zero, I don’t think it will quite that easy.

So in my model I set up a simple Process Flow set of activities that functionally allows the Tokens that represent Processors to act as pullers from the List, and Tokens that represent the Flowitems to be pushed. Both sets of Tokens have a Type Label for the Query and the Entries have an age-field so you can know how long they have been on the List.

Then I set up another puller that will look for Flowitems that have been waiting for 300 seconds or more, but only if the Global table value is 0 or less. To know the value of the Global Table value, I use a Wait for Event activity that listens for the Global Table value to “decrease to or through” 0 and to Fire if “initial value meets rule”. This event is only available if the cell data type is a Tracked Variable.

When the Global table value reaches 0, the puller can pull from the List Where age >= 300. To make this work the way you want I also set a Backorder property of the list to reevaluate all list values on push, so that when the puller becomes a back order it can re-query everything on the list whenever something new is pushed.

I hope this is what you were looking for, let us know if this isn’t quite it.

early-release-on-table-value-reached.fsm


· 13
5 |100000

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

Braydn T avatar image
1 Like"
Braydn T answered JIANYUAN, HALLEY L commented

@JIANYUAN, HALLEY L

When an item enters Queue1 it adds the item to a list and when it leaves Queue1 it decrements the counter. The counter only increments when an item goes into the sink. How would the counter ever go over 1? what does the counter represent?

You can do a timeout on a pull from list. If you do an event triggered source on entry to the queue, and then try and pull from the list, you can have a timeout that will assign a label if it is unable to pull in that time. Perhaps you could use the list to represent what you are doing with the counter, instead of representing items. You could have a decide after the pull from list that would check and see if the timeout label has a certain value, and if it does, send it to the sink. Otherwise, you could send it to the processors.

As far as selecting a different processor, you can assign that destination in a label and send the item to the destination in that label. You would just have to have some other process flow block higher up in your flow that assigned a destination label.

Please let us know what the counter represents and what you are trying to achieve, so we can help you better.

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