Scope

Navigation:  Editor > Global Parameters and Variables >

Scope

Previous pageReturn to chapter overviewNext page

By adding the keyword global to a parameter or variable in the Equation Editor, its value is shared all over the model. For certain models this is not wanted. You may want the parameter or variables only to be shared in a certain branch of the model hierarchy. This is known as limiting the scope of a global parameter or variable to a branch.

Example

Suppose we have model "RaceCar.emx" with a model hierarchy that consists of front wheels, rear wheels and a car body. The front wheels may consist of a left and a right wheel and each wheel has a tire, a rim and a suspension. In the picture below you can see the model hierarchy in the tree at the left of the Editor.

 

ScopeWithRaceCar

 

Suppose the tire and the rim models share the same parameter diameter. We can make this parameter global, so we have to specify the value only once. However for a racecar the diameter of the front wheels may be different from the diameter of the rear wheels. In that case we can limit the scope of the global parameter diameter to the branch FrontWeels. This is done in the Global Relations Editor at the left bottom of the Editor as shown in the picture above.

Global Realtions Editor

You can limit the scope by using the Global Relations Editor. In this editor you can enter parameters or variables. All global parameters or variables in the same branch of the model hierarchy will share the same value.

OneUp

You can limit the scope by using the keyword oneup. This will allow you to define the values of a global parameter or global variable in a submodel.

 

 

 

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.