question

wooram-kim avatar image
0 Likes"
wooram-kim asked Felix Möhlmann answered

Delay does not work in Decide Activity.

Hi,

I used “await Delay” in Decide Activity. But the command seems not to work well.

In the model that I attached (delay_problem.fsm), the token is supposed to be routed to Delay_2 when the value of the flag becomes 1. But it seems that the token is released to port 1 as soon as it encounters “await Delay” command.

Thank you.

FlexSim 24.1.1
delaydecide activityawait
delay-problem.fsm (30.4 KiB)
5 |100000

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

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

What assume is happening: The Decide activity always releases the token immediately, the code just tells it where to send it. If no return value is given (because the code execution is delayed) it will assume a 0 value and send the token to the first connector.

I don't quite understand the purpose of the Decide activity here. If it waits for the "flag" to become one then the token would never be released through the other connector, no?

With that said, continually checking a value in a fixed interval until it reaches a certain value is pretty much antithetical to the concept of discrete event simulation. It just creates unnecessary computation load (especially with "await Delay", which is quite slow).

If you want to wait for a value to change, then either use a Tracked Variable to store that value and wait for the "On Change" event. Or wait for an event that might change the value and check do the check again.

delay-problem_1.fsm


delay-problem-1.fsm (30.8 KiB)
5 |100000

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