Creating and deleting parameters

There are two different ways to create new parameters. You can either:

Create a new parameter

To create a new formal parameter, you must ensure that the Model Properties plane is activated in the Property Editor window by clicking on the model background. Open the context menu in the Property Editor. Select New Parameter to create a new parameter entry in the model property list. MLDesigner creates a default collapsed entry that shows the new parameter name and a default value. MLDesigner generates a unique name for the new parameter that can be changed later.

Export a model instance parameter

By selecting a model instance, the property editor will show entries for all parameters defined by the referenced model component. Click with the right mouse button on any of these parameter entries to open the context menu. Then you can select menu items Export or Export as to create a new formal parameter for the model with the same parameter properties.

The difference between Export and Export as is that you can define the name of the exported parameter in the latter case. If a parameter with the name already exists MLDesigner generates a unique one by extending the specified name with an integer.

Exporting an instance parameter automatically links the actual instance parameter to the exported formal model parameter (see Linking Parameters).

Change parameter properties

The property editor can be used to change the properties of formal parameter definitions. The figure on the right shows the expanded parameter entry.

Name
If you change the name, you must ensure that the name is unique for the model. The port name has to be a valid identifier, that is, it can contain letters, digits and the underscore but must start with a letter or an underscore.
Scope
The scope of a parameter specifies whether it is visible in instances of the model component. If visible it can be linked to other parameters on the next higher model hierarchy level. A parameter is visible if you set the scope as External.
Data Type
Defines the data type of the formal parameter. The table Parameter data types supported by MLDesigner below shows the data types for parameters supported by MLDesigner. The parameter types fix and precision are only allowed for primitive model components.
Value
Defines the default value. This value is used for model instances where the default value is not set explicitly. For more detailed information about the syntax of parameter values, see Set parameters of model instances.
Description
The description is used in the hypertext documentation of the model component.
Annotation
Defines an arbitrary annotion for custom purposes, which are only shown in the Property Editor. They can be separately edited for each model instance.
Attributes
Defines parameter attributes. Attributes are only used for primitive models. Click the button on the right of the input field to open the dialog where you can select the parameter attributes. For more information see the Parameters section in the primitive language constructs and also the defparameter keyword.

Delete a parameter

Activate the Module Properties plane in the property editor by clicking the background of the model. Then right-click on the parameter entry in the Property Editor window to open the context menu shown on the right. Select the Delete Parameter context menu option to delete the parameter.

Parameter data types

Parameter data types supported by MLDesigner

Type name

Description

Example

int

integer

10

float

floating point number

0.2/PI

complex

pair specified as (real-part, imag-part)

(1.0,2.0)

string

string

this is a string

fix

fixed point numbers

(2.546,3.5)

intarray

array of integers

1 2 3 4 5 6 7

floatarray

array of floating point numbers

0.0 [10] 1.0 0.0 [10]

complexarray

array of complex numbers

(0.1,0.2) (0.3,0.4) (0.5,0.6)

stringarray

array of strings

this string array "has five" elements

fixarray

array of fixed point numbers

41.78 2.546 [2] -3.5

precision

precision for fixed point numbers

3.5

boolean

enumeration with values FALSE and TRUE

FALSE

enum

enumeration with user-defined values

 

expression

an expression of constant values, parameters, ports and memories

$Input+$Memory*$Parameter-3.2

file

filename (obsolete)

/tmp/input.txt

filename

filename

$MLD_USER/output.txt

filenamelist

a list (array) of filenames

 

datastruct

data structure instance

Root

datastructname

data structure name

Root

datastructmembername

name of a composite data structure's member

Byte1

modelname

an XML or OCT model

$MLD_USER/M/M.mml

integrator

an array describing continuous states

see floatarray

stateevent

continuous state variable used by ODE solver

see floatarray