question

G. Moser avatar image
0 Likes"
G. Moser asked Jeanette F commented

Use of tracked variables in an instanced sub flow create an error

I wanted to create an instanced sub flow that access to a different tracked variable for each instance (Instance 1 access to TV_1 and Instance 2 access to TV_2).


1715689103511.png

To achieve that I have written a code to link the “Variable” activity to the correct tracked variable in the “Variable of Value” formular and put the type as local (to be different for each instance).

Although the model is running well, when I select or open again the “Variable” activity, it changes itself the type to Global and then the model stops working with an error (exception: FlexScript exception: Property "name" accessed on invalid node. at MODEL:/Tools/ProcessFlow/SubFlow/Variable>variables/variableRef at line 6).

I was able to overcome this issue by using a “Custom Code” to access the tracked variable instead of the “Variable” activity, but I think it should be more convenient to do it by using the “Variable” activity (it make the process flow more readable). Is it a bug or dit I something wrong to make this work correctly ?

You can find attached a model that illustrated this issue.


TestVariable.fsm

FlexSim 24.1.0
tracked variablessub flowinstances
1715689103511.png (57.2 KiB)
testvariable.fsm (30.5 KiB)
· 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

Ralf Gruber avatar image
0 Likes"
Ralf Gruber answered Jason Lightfoot commented

G. Moser,

The Tracked Variables you defined through the Tools are always global. If you need local Tracked Variables you have to define those on a node manually, e.g. in the tree of instance you are creating:

Tracked Variables (flexsim.com)

Good luck

· 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.