question

wooram-kim avatar image
0 Likes"
wooram-kim asked Phil BoBo edited

Problem on funtion memberremove()

I have two machines. The machines have the same name, but they are on different planes. They are members of an MTBFMTTR object. I want to remove the red machine from the object with “memberremove(Model.find("Plane2/Processor"), "MTBFMTTR1", 2)”. But the machine is not removed, and the green machine is removed instead. I attahced the file and chapter image. Please help me.

memberremove.fsm

화면-캡처-2024-11-13-150508.png

FlexSim 24.1.0
object namemtbfmttr interfacememberremove
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

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Phil BoBo edited

This is a bug with the memberremove() command. It is searching for the coupling node by the object's name. Because both of your objects are named "Processor", it isn't working properly.

I'll add a case to the development list.

In the meantime, you can work around the issue by finding the coupling by value. Attached is your model with a MemberRemove user command that does this.

  1. treenode child = param(1);
  2. string parentname = param(2);
  3. int type = param(3);
  4.  
  5. treenode members;
  6. if (type==1) {
  7. members = Model.find("/Tools/TimeTables/"+parentname+">variables/members");
  8. } else if (type==2) {
  9. members = Model.find("/Tools/MTBFMTTR/"+parentname+">variables/members");
  10. }
  11. treenode childcoupling;
  12. for (int r = 1; r <= members.subnodes.length; r++) {
  13. treenode membercoupling = members.subnodes[r];
  14. if (ownerobject(membercoupling.value) == child)
  15. childcoupling = membercoupling;
  16. }
  17. if (objectexists(childcoupling))
  18. destroyobject(childcoupling);

memberremove_1.fsm


memberremove-1.fsm (28.4 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.