Model Parameters in Activate

Learn about the types and identification of model parameters.

An Activate model may contain hundreds or thousands of parameters. The parameters are used to define the behavior of the blocks inside the model. Their values must be provided before any simulation can be performed. Model parameters in Activate are OML variables; they are defined and processed using the OML language.

The values of the model parameters are provided directly or they can be computed. The definition and the computation of these parameters occurs in the Initialization script of the model, or inside the Super block Context scripts. Expressions to evaluate block parameters can also be used directly inside the block GUIs and Super Block masks, where parameter values are defined.

At the start of any model simulation, the model parameters are evaluated, and their values are used to instantiate the model for compilation and simulation. This stage, called Model Evaluation, creates a new structure called the Compiled Model. The Compiled Model contains only the numerical values of the parameters. The parameter names and expressions are stripped since they are not required for simulation. All computations on model parameters are constant over time, unlike signals, and are performed at the Model Evaluation stage.

Parameter Types

The word parameter is used to designate different entities in Activate. It is important to distinguish these different types of parameters:

  • Block and mask parameters are the mask and block parameters that are defined in the GUIs; their names are not readily visible. They can be seen by placing the cursor on top of the corresponding parameter description field. OML variables with corresponding names are “implicitly” defined by evaluating the expressions provided in the GUI.
  • Model parameters include any OML variable defined in the Initialization script of the model, or inside any of the Super block Context scripts, in addition to the block and mask parameters, introduced above. During the Model Evaluation stage, all the model parameters are evaluated by executing the OML scripts and evaluating the OML expressions.
  • Block simulation function parameters are internal parameters that are defined and evaluated by the OML functions associated with blocks. Their values are computed as functions of block parameter values; they are not visible to the end-user. These parameters are not documented and may change from one version of Activate to the next. They should not be manipulated directly, except for creating new blocks (for example through the CCustomBlock or OMLCustomBlock blocks).

Model with a Constant Block

Consider the following model containing a single Constant block:



The variables h and A are defined in the Initialization script of the model. The Constant block has three parameters: Constant, named C; Output datatype, named typ; and Extern Activation, named externalActivation. The block parameter C is defined by the expression A+1 where A is defined in the Initialization script. The other parameters: typ and externalActivation are defined directly by a string value and a checkbox. Here the model parameters are h, A, C, typ and externalActivation; the block parameters are C, typ and externalActivation; and the simulation function of the block (which depend on the data type) has one parameter having the same value as the value of C. Note however that the parameters of the simulation function of a block do not always correspond exactly to the parameters of the block. For example, the block realizing a transfer function (ContTransFunc) has for parameters the numerator and the denominator of the transfer function, but the parameters of the corresponding simulation function are the A, B, C, D matrices corresponding to a state-space realization of this transfer function.

What You See Is Not Always What You Get

The identification of model parameters is made more complicated by the fact that an Evaluated Model may be very different from an original model, which is visible in the graphical editor. Model Evaluation, not only processes model parameters, but also flattens them and inlines the library blocks used inside the model. Some blocks in Activate libraries are in fact Super Blocks, which are inlined during the evaluation stage. On the other hand, some blocks in the model may be virtual blocks, which are removed in this stage. So, the Evaluated Model may contain more or less (basic) blocks compared to the original model. The set of model parameters is in general much larger than the set that you see in a graphical inspection of the model. Consequently, the simulation model often contains many simulation function parameters that are obscure and cryptic for the end user.

Fortunately you need not manipulate the block simulation functions and their parameters, and you are shielded from the additional model parameters that result from the inlining of the library blocks through the semi-global scoping mechanism used in the definition of the model parameters at the different levels of the model hierarchy. Thus, in most cases, you need only to work with the parameters of the blocks that are visible in the model. It is important however to be aware of the introduction of additional library blocks when the model is compiled so that you can understand the error messages from the compiler.