question

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

Custom code to send patients direct to bed from arrival when a bed is available

I have a model where I want patients to move directly to bed when they arrive when there is an empty bed available. I have put the bed locations into a group which I have named "Examtables". I have tried this custom code:

Location Examtables = findObject("Examtables");

string locationGroupName = "Examtables";

int isAvailable = isLocationAvailable(Examtables, locationGroupName);

if (isAvailable == 1) {

return 1;

} else {

return 0;

}

However, I consistently get this error: Flexscript Error MODEL:/Tools/ProcessFlow/Patient Flow/Custom Code~2>variables/codeNode Unknown type Location in declaration of variable Examtables

What could be wrong with my code? I will be grateful with any assistance. Thank you.

FlexSim 24.1.0
direct bedding
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

"Unknown type Location in declaration of variable Examtables" -> "Location" is not a valid variable type. Neither does the command "isLocationAvailable()" exist (except if you set it up as a user command).

You can easily do this without coding. Try to acquire a bed with a maximum wait time set. If a bed can be acquired, send the patient there. If the time elapses (On Wait Timer Fired) send the token to a second connection.

1726645884516.png


1726645884516.png (30.0 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.