question

Lenny C avatar image
0 Likes"
Lenny C asked Felix Möhlmann answered

Creating timetable using custom code

Hi,

I am trying to control the availability of rooms using a global table "StaffRosters" and a custom code in ProcessFlow2. Understand that timetables can be created directly in Flexsim, but doing so will be extremely tedious in my use case where there is 100+ timetables to control. The problem that seemed to exist for using the custom code is that patients after the rows of "0"s, are unable to acquire the rooms even when the global table is reverted back to "1"s.

Please find the attached model with the problem described above. Thank you!

small_model (1).fsm

FlexSim 20.1.3
custom codeacquire resourcetimetables
small-model-1.fsm (124.1 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

The acquire activity is not automatically reevaluated when you change the "Close" label. In order to have the tokens reevalutae the resource availability you could activate the "Max Wait Timer" option and send the tokens to a "wait for event" activity. This then releases them back to the acquire activity when either a token has gone through the custom code in the other process flow or when a resource becomes available again.

Note that the bed can only be reacquired if the patient has gotten up from it, not immediately after the token has passed the release activity. This is why I use a five second max wait time in the acquire activity; to give the patient time to get up from the bed and then still acquire it.

For safety I also listen for tokens finishing the last "Walk" activity in the "wait for event", as at that point a bed has definitely been freed up.

small-model-1_1.fsm


small-model-1-1.fsm (127.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.