question

dougdurbin avatar image
0 Likes"
dougdurbin asked Kavika F commented

Model Help (Assigning Gurney to Location?)

In the attached model I'm trying to figure out the best way to replenish a location resource with a gurney. I'm using location groups (Endo or Pulm Rooms, IR or Brachy Rooms) as a floor spot to symbolize an exam room. I then placed gurneys over that floor spot, similarly labeled "Endo or Pulm Beds", and "IR or Brachy Beds". The patient will acquire both of these resources after checking in. The patients will stay on these transports for the duration of their visits. When the patient is transported to the procedure area, I release the location resource and staff will get a gurney from the group "Replenish Beds" and take it to the empty room (Endo or Pulm Rooms, IR or Brachy Rooms). I'm able to accomplish this piece but at the split activity before the procedure process box, the preop RN will take the replenish bed back to its original location, which isn't intended, as the replenish bed should stay in the room. This led me to believe that:

1. When a future patient enters, they can't acquire the replenish bed unless it's group changes to "Endo or Pulm Beds", or "IR or Brachy beds". Is there any way to change the replenish bed group to whichever "location" group the bed would currently be in?

2. Is there a way to assign the gurney to the location and update it's group based on the room location when a replenish bed is moved to the exam room?


I'm wondering if there's an easier way to dynamically change groups as the model runs or if there's a better way to accomplish this process?


Capacity Simulation.fsm

FlexSim 23.0.1
transportlocation
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

·
Kavika F avatar image
0 Likes"
Kavika F answered Kavika F commented

Hey @doug.durbin, you may want to use the Group API for this. It has methods to add and remove members from a group, allowing you to dynamically change which group a gurney belongs to. You may write something like this:

// Remove the gurney from the "Replenish Beds" group
Group replenishGroup = Group("Replenish Beds");
Object replenishGurney = token.Replenish;
replenishGroup.removeMember(replenishGurney);

// Find out the gurney's destination
// Add it to the corresponding group based on destination name
Object acquiredPreOp = token.Location;
if (acquiredPreOp.name.startsWith("Endo")) {
  Group("Endo or Pulm Beds").addMember(replenishGurney);
}
else if (acquiredPreOp.name.startsWith("IR")) {
  Group("IR or Brachy Beds").addMember(replenishGurney);
}

Note, if you add or remove members from a group, this change is permanent, meaning that on reset the groups are different. To change them back each time, you'll need to setup an On Model Reset trigger to rearrange the members of groups. It may be easiest to have a second set of groups to act as the "Reset" groups so you can keep track of which gurney should be in which groups.

1701804277422.png

Your On Model Reset may start like this:

Group changedGroup = Group("Replenish Beds");

// Remove the current group if it exists if (changedGroup)   changedGroup.destroy(); // Make a new group Group resetGroup = Group("Replenish Beds RESET"); Group newGroup = resetGroup.copy(); newGroup.name = "Replenish Beds"; // Copy the members from the RESET group to the new group Array resetArray = resetGroup.toFlatArray(); for (int i = 1; i <= resetArray.length; i++) {   newGroup.addMember(resetArray[i]); }

This is just an example, hope it helps.


1701804277422.png (37.4 KiB)
· 14
5 |100000

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

dougdurbin avatar image dougdurbin commented ·

Thank you @Kavika F,


I've made a few adjustments to get it working using your code as a basis. At this point, the transport box in the "Replenish Beds" transport resource in the patient flow gets wiped out. What would be the correct code to assign the replenish bed group to this resource on model reset so that it assigns the resource as it would when it says "Any member of ...." ?

Also, at 97.96 time, the EndoPulm RN moves the gurney back to it's original location, and I'm wondering why the RN does this? Is it because the token releases the gurney therefore forcing the RN to take the gurney back?

0 Likes 0 ·
Kavika F avatar image Kavika F ♦ dougdurbin commented ·

Hey @doug.durbin, if you're going to be referencing the groups throughout the Process Flow, then I would revise the code to not delete the group and instead just remove all the members and reset it with a second group, like this:

Group resetGroup = Group("Replenish Beds RESET");
Group changedGroup = Group("Replenish Beds");
// Remove all Group Members
Array changedGroupMembers = changedGroup.toFlatArray();
for (int i = 1; i <= changedGroupMembers.length; i++) {
    changedGroup.removeMember(changedGroupMembers[i]);
}

// Re-add Group Members
Array resetArray = resetGroup.toFlatArray();
for (int i = 1; i <= resetArray.length; i++) {
    changedGroup.addMember(resetArray[i]);
}

I'll get back to you about the gurney resetting positions.

0 Likes 0 ·
dougdurbin avatar image dougdurbin Kavika F ♦ commented ·
So far this is working great, I just had to add another piece to remove any of the "Replenish Beds" transports from the Endo or Pulm Beds/IR or Brachy Beds if they were assigned.

I'm still trying to solve the issue with the staff returning the transport to its original location. This doesn't happen anywhere else in the model.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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