question

Rob Davies avatar image
0 Likes"
Rob Davies asked Matthew Gillespie commented

Update patient label with Global process?

I want to make EVERY PATIENT in my model age yearly. I'm guessing a global process would do this, but I cannot get the label to update.

I'm using patiet label "AgeNow" to track age. I setup global process to kick off at time zero and repeat every 60 min. (scale: 60 min model time = 1 year)

And I've set the finished trigger activity to increment the variable.

I know the global process is running because I added a MSG() code to pop up. I'm not sure what I'm missing. Any ideas?

FlexSim HC 5.1.0
global process
jai5f.png (3.7 KiB)
yjild.png (4.5 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

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

A global process is not associated with any patients (thus the term "global"). The patient variable in a global process is a reference to the global process itself, so you're setting a label on the global process, but not on any patients. You would need to write some code to loop through all the object's in the model to find all the patients and then increment their label. For example:

forobjecttreeunder(model()) {
	if(getobjecttype(a) == OBJECT_Patient)
		inc(label(a, "AgeNow"), 1);
}
· 1
5 |100000

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

Rob Davies avatar image Rob Davies commented ·

Thanks Matt, That's the insight I'm looking for. I'm still learning how Flexsim thinks.

0 Likes 0 ·