question

David H3 avatar image
0 Likes"
David H3 asked Jordan Johnson commented

Hold token until activity content count drops below a certain number

Hi there, I'm relatively new to Flexsim and probably have a very basic question.

With a wait for event, I'm trying to fire the tokens until the next activity contains more than 3 tokens. I posted my problem below. Specifically for this problem, I want my tokens to go through my process flow, create a subprocessflow and run through it until the "delay" activity in the subflow (not the whole subflow, only the activity, contains more than 3 tokens. Then all other incoming tokens should wait inside the "wait for event" until the count of tokens inside the delay drops below a certain value (3 or less in my case) again.

Thanks a lot for your help,

David

FlexSim 18.1.1
process flowwait for eventcontrol
5 |100000

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

Jordan Johnson avatar image
1 Like"
Jordan Johnson answered Jordan Johnson commented

Here is what I think you want (wait-for-event-problem-solution.fsm):

The Resource only has one available value, so only one token at a time can wait for the event. The Wait for Event is designed so that all waiting tokens, if they are waiting for the same event, move forward. We only want one token at a time to check (or that's the idea I get).

After adding the resource, I also changed the Wait for Event:

The change rule is set to "Decrease To Or Through Value", which means any change in content that sets it to 2 or below will move the token along. In addition, I checked the "Fire If Initial Value Meets Rule" box, so that any tokens arriving when the content is at or below 2 will not wait for the content to change before moving on.


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

David H3 avatar image David H3 commented ·

Hi @jordan.johnson

yeah! this is actually the solution I needed! Thanks a lot! I have one question left on the same topic that I hope you can answer.

Now the case is that my token stays inside the wait for event as soon there are three tokens in the delay and until the delay reaches the value of 2 or less tokens. One variation I would like to add is the following:

I want my token to stay inside the wait for event as soon there are three tokens in the delay BUT until the delay reaches the value of zero tokens (a bit more complicated). Do you have any suggestions?

Thank you a lot for your help!

David

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ David H3 commented ·

Here is one possibility:

wait-for-event-problem-solution-2.fsm

To me, it sounds like you are trying to handle incoming things in groups of three. So I pushed all incoming things to a list. The token from the Batch Manager source grabs the tokens as fast as they are available, and then waits for all of them to finish whatever they do (by pulling 3 tokens off the Finished list).

There may be a simpler solution, though. It depends on the system you are trying to model. If you could describe the system you are trying to model, then we might be able to help you get a simpler solution.

0 Likes 0 ·
Steven Hamoen avatar image
1 Like"
Steven Hamoen answered David H3 commented

@David H3 I think the easiest is to use a zone with a maximum of three. When one leaves the zone the next one can enter

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

David H3 avatar image David H3 commented ·

Hi Steven,

thanks for your reply, but this isnt going to work as I want to create my subflow with the "create token" activity and not the "run subflow" activity. in your solution the subflow would allow only 3 tokens, but the main flow will continue, which is what i don't want to happen.

kindly,

david

0 Likes 0 ·
Joshua S avatar image Joshua S David H3 commented ·

Is there a specific reason you are using the create tokens activity rather than a run subflow activity?

0 Likes 0 ·
David H3 avatar image David H3 Joshua S commented ·

Hi @Joshua S,

yes there is. I don't want to stop the main flow in general when the subflow is running. I only want to stop the main flow if there are 3 tokens inside the delay activity of the sub flow. Put into context, I don't want anymore products to be produced until the three broken products (that go to the subflow delay) are repaired.

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen David H3 commented ·

@David H3 You could always use the enter zone instead of the wait for delay and put the exit zone in the subflow. If you want to do it the way you do it know, you have to let the first 3 tokens go into the subflow and then the rest could wait in de wait for event. So have a decide just before the wait for event and let the first 3 go directly to the create tokens ( or even directly to the subflow) and have the rest go into wait for event. One other remark, the "or" statement is || ( so 2) pipe symbols and not 1.

0 Likes 0 ·