# Parametrizing Modelica Components

Learn about parametrizing Modelica components with OML expressions.

In Activate, Modelica components, like regular Activate blocks, can have parameters with values that are defined using OML expressions. These expressions are evaluated in the workspace of the diagram where the component is placed, following the usual scoping rules for Activate blocks.

In most cases, Modelica component parameters are numbers, vectors, matrices, Booleans, or strings, and can be provided with OML expressions of corresponding type. Consider for example an electrical capacitor. The value of capacitance, which is a component parameter, can be defined using an OML number or an expression:

where C1 and C2 are OML variables defined in a diagram context or the model Initialization script.

The parameters of Activate Modelica components correspond to those of the underlying Modelica library components. The values of these parameters can in most cases be defined in OML, however, some Modelica component parameter values are more conveniently defined using constants and functions available in Modelica libraries. In some cases, they cannot even be expressed using OML standard data types because they refer to Modelica-specific entities

To enable access to the Modelica environment for evaluating component parameters, Activate provides the OML function, FromModelica. This function creates and returns an OML object of type ModelicaExpression, which can be used in OML expressions to define parameter values. Some variables of type ModelicaExpression, in particular, when the entity returned by FromModelica is not Modelica-specific, can be used in simple OML expressions. These expressions are translated into Modelica code and treated by the Modelica compiler. This process is transparent to you.