Defining Parameters and Editing Properties of Parameters

The properties of a parameter/variable are its variability, type, name, array dimension, and value. You define these properties when creating a parameter/variable, and you can modify them later.


Before you begin:
  • From the Package Browser, select a class containing parameters.

    The components of the active class appear from the Component Browser.

  • From the Component Browser, select a class.

    Parameters and variables appear from the Parameter and Variable Editor.

See Also
About Parameters and Variables
  1. From the Parameter and Variable Editor, select the parameter you want to edit.
  2. Select Edit the selected parameter, constant or variable (or Create a parameter, constant or variable if you need a new parameter/variable).

    Tips:

    The Parameter and Variable Edition dialog box for that parameter/variable appears (or the Parameter and Variable Definition dialog box if you create a new variable/parameter) .
  3. From the Declaration tab, modify or enter your Modelica specifications. This information appears in the Modelica text browser.
    1. In the first box Variability select the variability: any of the variable types Parameter, Constant, or Discrete, or keep this box empty. By default, the box is empty and a continuous variable is created.
    2. Type: from the box, select a basic type (Real, Integer, Boolean, or String) or one of the other classes under the basic types. You can also click Switch between class and basic type selection to select a class from the Package Browser.

      Notes: For the Type box:
      • By default, there are some SI unit types available from the box, in addition to the basic types. Your own type selections are later inserted before those SI unit types.
      • The list in the box is limited to 20 types, excluding the basic types.

      Tip: You can select a class in a number of ways, including searching for it; see Using the Class Selector Field.

    3. Name: type the name to appear from the Parameter and Variable Editor.
    4. Array Dimension: If need be, define an array. By default, this box is left empty and the value is 1.
    5. Value: Enter the default value for this parameter/variable. The value can be a number or the complete modifier of the variable. Example for a Resistor instance "(R=4)".
    6. Description box: If need be, enter a description for the parameter/variable.
  4. Select the Attributes tab to specify additional type prefixes.
  5. From the Properties area on the Attributes tab, specify how the parameter/variable can be accessed or changed in modifiers.
    1. Select Final if the value of the parameter/variable should not be able to modify.
    2. Select Protected if the parameter/variable should not be accessible from outside the model.
    3. Select Replaceableif the parameter/variable should be re-declarable in a modifier.
  6. From the Connector members, specify connector attributes, if needed.
    1. Select Flow to specify that this quantity sums to zero when connected. This option is available for the parameters/variables of a connector. Examples of such quantities are torque and current.
    2. Select Stream to specify that this quantity
  7. From the Causality area on the Attributes tab, specify the causality that is required for public parameters/variables.
    • None: the parameter/variable has unspecified causality (determined during translation).
    • Input: the parameter/variable is an input to the model.
    • Output: the parameter/variable is calculated by the model.
  8. From the Dynamic Typing area on the Attributes tab, specify type properties for the parameter/variable:
    • Normal: the parameter/variable has no dynamic type.
    • Inner: the parameter/variable can be referenced by the inner parameter/variable in nested components.
    • Outer: the parameter/variable matches an outer parameter/variable in an enclosing scope.
  9. From the Expose in Knowledgeware area on the Attributes tab, specify attributes for the linked Knowledge parameter. See Exposing Modelica Parameters as Knowledgeware Parameters.
  10. Select Annotations tab to create and edit annotations.
  11. From the Evaluate area on the Annotations tab, specify whether a parameter is to be evaluated during translation.
    • Default: the parameter is evaluated as defined in the Execution Setup dialog box. See Execution Setup.
    • On: the parameter is always evaluated during translation.
    • Off: the parameter is never evaluated during translation.
  12. From the Hide area on the Annotations tab, specify whether a variable should be hidden.

    Note: If a variable is internal, it is better to declare it protected using the Attributes tab.

    • Default: show variable (if not declared as protected).
    • On: never show variable in variable browser.
    • Off: always show variable in variable browser.
  13. From the Parameter dialog placement area on the Annotations tab, define the following options:
    1. Tab: Specify in which tab of the parameter dialog the box should be added.
    2. Group: Specify in which group of parameters in the parameter dialog the box should be added.
    3. Enable: Specify if the box should be enabled in the parameter dialog. If true, the conditional box in the parameter dialog box is enabled.
    4. Show start: Specify if the box should be displayed as a box with a corresponding start value box, under the Initialization group of the parameter dialog.
      As an example, if you define a parameter MyTest and specify this option to true for it, the result in the parameter dialog is:

  14. From the Graphical information area on the Annotations tab, specify the attributes of the graphical component.
    1. Extent: Define the extent of the graphical component. Accepted value format is {{real,real},{real,real}}, for example {{-10, -10},{10,10}}.
    2. Origin: Define the origin of the graphical component. Accepted value format is {real,real}, for example {0,0}.
    3. Rotation: Define the rotation of the graphical component. Accepted value format is real, for example 90.
  15. Click OK to exit the Variable and Parameter Declaration dialog box and validate your modifications.