Showing results for 
Search instead for 
Did you mean: 

Call a constant value with methods

Hello everyone!


My model contains a main frame with multiple sub-frames. In each subframes I am using methods to do some statistical calculations. In these calculations, I am using some constant values.

To save time between all simulations I do, I would like to define the value of every constant I am using in the simulation. Th goal would be to define all my constants somehow/somewhere and then to make each method call the constant value it needs.

It would be like "declaring the constants" at the beginning and then use them every time I want by calling them by their names.


Thanks a lot for your help!








Re: Call a constant value with methods


You can have a lot of different approaches: if you wanna use global variable you can create a subframe in the main frame called "CostantVariable". Inside this frame you insert every variable you need. Then each code will call the variable like






I would do something similar creating a tablefile in the root frame instead of a subframe. In the tablefile I would store a variable for each row:






There a lot of other possibilities, depending by how you write the code you need.



Re: Call a constant value with methods

Valued Contributor
Valued Contributor
You can have pointers for each of the variables as suggested by Alessio in a Frame called "Constant Variable", and to save the Input time even more, you could make use of the User Defined Dialogs. Create your own Dialogs for the values you want to set. This way, you do not Need to open each variable and set it or go into the Networks to set the values.

If you Need more Information about the Dialogs and how to Programme them, refer to the Step by Step Help and search for "Dialog". Hope this helps. Smiley Happy


Re: Call a constant value with methods

Thanks to you two!


It works perfectly and the communication with the user is vers easy!


Thanks again?