Scope

Navigation:  Editor > Global Relations Editor >

Scope

Previous pageReturn to chapter overviewNext page

Global parameters and variables are defined using the keyword global. In equation models, this keyword is added after the definition of the data type in the Equation Editor. In 20-sim we can define which submodels share the same parameter or variable. This is called the scope of this parameter or variable.

Part of the Model

You can set the scope by using the Global Relations Editor. In this editor you can enter parameters or variables. All global parameters or variables that are defined in submodels lower in the hierarchy, share the same value.

 

LocalScope

Setting the scope of global parameters with the Global Relations Editor.

The image above shows an example. In the model hierarchy we see the submodel MassSpringDamper2 selected. The Globals Relations Editor, shows three parameters: f, m and b. If these parameters exists in the submodels lower in the hierarchy (Mass, SpringDamper, Damper, Spring), and use the keyword global, they share the same value. Submodels higher in the hierarchy, can never share these parameter values.

Whole Model

If no parameter or variable is defined using the Global Relations Editor, the scope is the whole model. I.e. global parameters and variables are shared across the whole model.