Hold token until activity content count drops below a certain number

Hold token until activity content count drops below a certain number

david_h3
Not applicable
34 Views
8 Replies
Message 1 of 9

Hold token until activity content count drops below a certain number

david_h3
Not applicable

[ FlexSim 18.1.1 ]

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

0 Likes
Accepted solutions (1)
35 Views
8 Replies
Replies (8)
Message 2 of 9

SCHamoen
Advisor
Advisor

@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

Message 3 of 9

david_h3
Not applicable

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
Message 4 of 9

joshua_s
Not applicable

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

0 Likes
Message 5 of 9

SCHamoen
Advisor
Advisor

@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
Message 6 of 9

david_h3
Not applicable

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
Message 7 of 9

JordanLJohnson
Autodesk
Autodesk
Accepted solution

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

12226-wfe-problem-solution.gif

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:

12223-wfe-limited-properties.png

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.

.


Jordan Johnson
Principal Software Engineer
>

Message 8 of 9

david_h3
Not applicable

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
Message 9 of 9

JordanLJohnson
Autodesk
Autodesk

Here is one possibility:

12291-wfe-problem-solution-2.gif

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.

.


Jordan Johnson
Principal Software Engineer
>

0 Likes