question

Willie Chung avatar image
0 Likes"
Willie Chung asked Willie Chung edited

Change the name of the original machine


I use a For loop to execute the logic of copying the machine in OnModelReset, and directly change the name of the copied machine in the GlobalTable.

However, as mentioned earlier, I want the names of the original machine and the Queue to also change accordingly. The following error occurred while writing the code.

Thank you for your assistance.

1709607049602.png

File:Question.fsm


FlexSim 23.0.0
onmodelresetcopy machineerror code
1709607049602.png (329.9 KiB)
question.fsm (69.9 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.

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Willie Chung edited

Line 4 is missing a semicolon.

You declare the variable Obj, then proceed to use obj, which is only declared further down and thus not valid at that point in the code.

· 7
5 |100000

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

Willie Chung avatar image Willie Chung commented ·

Thank you

0 Likes 0 ·
Willie Chung avatar image Willie Chung commented ·

Hello @Felix Möhlmann , I apply a similar logic to regulate the Number of "Operators" and encounter these issue.

The copying logic functions, but the operators overlap and lack the spacing seen in the processor.

Additionally, the dashboard fails to display the copied operator names as the picture.1709782432399.png1709782443735.png

0 Likes 0 ·
1709782432399.png (222.0 KiB)
Felix Möhlmann avatar image Felix Möhlmann Willie Chung commented ·

The position is overridden by the original operator's reset position. You can update it with either of the two expressions below.

1709796532188.png

The "Invalid ID" is caused by you using "switch_destroyonreset()". I believe this marks the object as 'non-persistent' and it doesn't possess an object id as a result (similar to a flow item). You can instead delete all but the first member of the group before creating new ones to achieve the same effect.

(As I have pointed out numerous times, the "Delete and Copy Group Members" option for a parameter in the parameter table contains a working example of how you can change the number of objects in a group)

0 Likes 0 ·
1709796532188.png (3.2 KiB)
Willie Chung avatar image Willie Chung Felix Möhlmann commented ·


@Felix Möhlmann I use while loop to remove Operator when the GroupMember>1, and it can work in first run, but in second run, it will continue to copy Operators, how can I make sure the number of Operators is what I need and show the Operator's name in dashboard, thank you

1709816668936.png



0 Likes 0 ·
1709816668936.png (308.1 KiB)
Show more comments
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.