question

ana.pc2 avatar image
0 Likes"
ana.pc2 asked Braydn T commented

Check if all members in group are busy

Hello!


I was wondering how to check the status of all members in a group, so I can send the item to a different port if all are busy. For example:


  1. Object item = param(1);
  2. Object current = ownerobject(c);
  3.  
  4. /**Conditional Port*/
  5.  
  6. treenode stations = Model.find("Tools/Groups/SB_Group");
  7.  
  8. if (stations.stats.state().value == STATE_BUSY)
  9. {
  10.     return 2;
  11. }
  12. else
  13. {
  14. return 1;
  15.  
  16. }


Thanks for the help!

FlexSim 20.1.1
flexsim 20.1.1send to portstatus
· 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.

1 Answer

Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Braydn T commented

@Ana PC2 Please check out the group class. To go through every member of a group you can use an index. So in your case

for(int 1 = 1; i <= Group("SB_Group").length; i++)

{

Object station = Group("SB_Group")[i];

etc...

}

· 5
5 |100000

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