question

Michael Zabritski avatar image
0 Likes"
Michael Zabritski asked Michael Zabritski commented

Assign parent group location to patient label

In this sample model, I have a series of nested location groups (Depts > Pods > Beds). Patients are being moved to the dept with the most beds available. Once a patient gets a location, I'm trying to assign the top level group name (Dept in this case) to the patient so I can use it with A* navigation barriers later on. Would like to allow one barrier to only allow Dept 1 patients thru while another barrier only allows Dept 2 patients thru.

When I assign the label using last acquired location resource, it assigns the current location but I can't figure out a way to get which Dept the bed belongs to. I then need to make sure I can use that Dept label with A*

Thanks


Logic Flow Test.fsm

FlexSim 20.1.2
flexsim 20.1.2assign labellocation group
logic-flow-test.fsm (244.6 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.

Parker S avatar image
0 Likes"
Parker S answered Michael Zabritski commented

@Michael Zabritski

There may be a way to do this by accessing the parent groups, but I believe a simpler way would be to assign the Dept label directly onto your beds.

Let me know if this would work for what you are trying to achieve.


deptlabel.gif (935.6 KiB)
· 2
5 |100000

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

Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered

You can use the Group.isMember(obj, 1) method to find out if an object is a member of a certain group. For example, this code returns 1 if the bed is in Dept1 and 2 if it's in Dept2:

  1. Object bed = patient.Locations[1];
  2.  
  3. if (Group("Dept 1").isMember(bed, 1))
  4.     return 1;
  5.     
  6. if (Group("Dept 2").isMember(bed, 1))
  7.     return 2;   

DeptLabel.fsm


deptlabel.fsm (52.6 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.