question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Tee Hiett commented

Why doesn't the Stop Model Based on Condition work in the attached HC model

idbc-triage-room-05-09-17-c.fsm

I have a Stop Model Based on Condition in the PatientExit1 object but the model still runs to the end of simulation time. The condition is:

int condition = /**/getthroughput(model) >= content(var(PatientArrivals1, VAR_ScheduledArrivals)).

It seems the getthroughput side of the equation is working properly.

Thanks,

Tee

FlexSim HC 5.1.0
healthcarecondition
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

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Tee Hiett commented

This is because at the time you're checking (in the On Entry trigger of the Exit) the patient leaving the model is still in the model. That means getthroughput(model) will be one less than it will be as soon as this code fires and then the patient actually leaves the model. So when the last (41st) patient enters the Exit, this code fires and you end up checking:

if(40 >= 41)
	finishreplication(); 

So this condition is never satisfied, even on the last patient, so it runs the full time. You could change the condition to:

int condition = /**/getthroughput(model) + 1 >= content(var(PatientArrivals1, VAR_ScheduledArrivals))
· 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.

Lou Keller avatar image Lou Keller commented ·

Do you mean that whenever you use the standard condition, that you should add the "+1"?

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Lou Keller commented ·

The default condition just says:

getsimtime() > 480 && getcensus(model) <= 1

If you're using the getthrougput() command you should keep in mind that the On Entry trigger of the Exit object happens before the throughput of the model is updated. So, I would think that in most cases you'd want to say getthroughput(model) +1 or decrement the number on the right side by one to account for that.

1 Like 1 ·
Tee Hiett avatar image Tee Hiett Matthew Gillespie ♦♦ commented ·

Thanks, Matthew. I suspected this was the case when there was no On Exit Trigger on the exit object.

Tee

0 Likes 0 ·