The parameter values of model instances are edited using the property editor. When selecting the model instance to be changed, MLDesigner activates the **Instance Properties** plane. In this plane, the property editor shows the actual parameters of the selected model instance. By clicking the value field of the relevant parameter, it becomes editable. To open a multiple line text editor, you can click on the icon to the right of the edit field. Parameter properties that cannot be edited have gray text.

Parameter values set through MLDesigner can be arithmetic expressions. This is particularly useful for propagating values from a system model parameter to primitive parameters lower down in the hierarchy. An example of a valid parameter expression is:

`PI/(2*$order)`

where *order* is a formal parameter defined in the module or system model. The basic arithmetic operators are

- +
- addition,
- -
- subtraction,
- *
- multiplication,
- /
- division, and
- ^
- exponentiation.

These operators work on integers and floating-point numbers. Currently all intermediate expressions are converted to the type of the parameter being computed. Hence, it is necessary to be very careful when, for example, using floating-point values to compute an integer parameter. In an integer parameter specification, all intermediate expressions will be converted to integers.

The **Parameter Value Expression** dialog helps you to build parameter expressions and can be reached by clicking the ellipsis button on the right of a parameter value.

Arbitrary PTcl expressions can be embedded in a parameter expression by preceding the expression with the `tcl` keyword as in the following example:

`tcl(expression)`

Firstly, parameters in the form of `{parameter}` appearing in the expression are replaced by their values. Then the string is sent to the built-in interpreter for evaluation. Finally, the result is spliced into the parameter expression and re-parsed.

This facility is generalized and supports both numeric and symbolic computing of expressions. Through PTcl, you can access all of its math functions, which generally behave the same as ANSI C functions of the same name: `abs`, `acos`, `asin`, `atan`, `atan2`, `ceil`, `cos`, `cosh`, `double`, `exp`, `floor`, `fmod`, `hypot`, `int`, `log`, `log10`, `pow`, `round`, `sin`, `sinh`, `sqrt`, `tan`, and `tanh`.The availability of these function may vary in future version of MLDesigner. To see which functions are actually supported you may consult the **Parameter Value Expression** dialog, it provides a drop-down menu with the available functions.

A parameter expression could be

`tcl(expr sqrt(2.0 / $BitDuration))`

for the amplitude of the oscillators in a binary frequency shift keying system, in which `BitDuration` is a parameter. The `expr` command is a PTcl command that treats its arguments as a single mathematical expression that must evaluate to a number.

There are several PTcl commands embedded in MLDesigner that help support parameter calculations. They are: `listApplyExpression`, `max`, `min`, `range`, `rangeApplyExpression`, and `sign`. For example,

`tcl(min [max 1 2 3] [sign {-2}])`

first evaluates to `min 3 -1` and then to `-1`. The procedure `range` returns a consecutive sequence of numbers:

`tcl(range 0 5)`

returns `0 1 2 3 4 5`. The `rangeApplyExpression` procedure generates a sequence of values by applying a consecutive sequence of numbers to a PTcl expression that is a function of `i`. For example, you can generate the taps of an FIR filter that is a sampled sinusoid by using

`tcl(rangeApplyExpression { cos(2*$PI*$i/5) } 0 4)`

This generates one period of sinusoidal function and returns

`1.0 0.309042 -0.808986 -0.809064 0.308916`

The `listApplyExpression` is similar to `rangeApplyExpression` except that it only takes two arguments: the second argument is a list of numbers to substitute for `i` in the expression. The command

` tcl(listApplyExpression { cos(2*$PI*$i/5) } [range 0 4])`

is equivalent to the previous example of the `rangeApplyExpression` function.

You can receive help on these PTcl procedures by typing

`help <procedure name>`

at the prompt.

When defining arrays of integers, floats, complex numbers, fixed-point numbers, or strings, the basic syntax is a simple list separated by spaces. For example,

`1 2 3 4 5`

defines an integer array with five elements. The elements can be expressions if they are surrounded by parentheses:

`1 2 PI (2*PI)`

Repetition can be indicated using the following syntax:

`value[n]`

where `n` evaluates to an integer. An array or portion of an array can be an input from a file using the `<` symbol as in the following example:

`1 2 < filename 3 4`

Here the first two elements of the array will be 1 and 2, the next element(s) will be read from file `filename`, and the last two elements will be 3 and 4. The latter capability can be used in combination with the `WaveForm` primitive to read a signal from a file.

There are complications when you wish to set a `string` parameter or `stringarray` parameter equal to the value of a module or system model parameter. This is because a distinction must be made between a sequence of characters that give the name of a symbol and a sequence of characters to be interpreted literally. The syntax to use is:

`This string has the word $word taken from another parameter`

Here `$word` represents the value of a `string` module or system model parameter. This capability is especially useful for constructing labels for output plots. When using string parameter to specify options to execute a command, as in the options parameter in Xgraph primitives. You need either double quotes or single quotes to include white space:

`-0 'original signal' -1 'estimated signal'`

String arrays have a few more special restrictions. Each word (separated by whitespace) is a separate entry in the array. To include white space in an element of the array, use quotation marks. Thus, the following string array

`first "the second element" third`

has three elements in it. The string array

`repeat[10]`

has ten separate copies of the string `repeat` in 10 separate entries in the array.

Analogous to `string` you can use the dollar sign to refer to parameters. Thus, in

`$paramname`

`paramname` must be the name of either a string array or a scalar-valued parameter (an integer, float, or complex array, for example, is not permitted). If it is a string array, then each element of `paramname` becomes an element of the parameter. If it is some other kind of parameter, the value becomes a single element of the string array.

String array values may also be read from files using the `<` symbol. Note that for string arrays, the filename can be a literal string such as

`< $MLD_USER/wordlist.txt`

as well as a string that refers to parameters such as

`< $MLD_USER/$filename`

in this case the value of the parameter `filename` would be substituted. MLDesigner does not perform expansion of filenames such as `file{1,2}` into `file1` `file2` as a Bash might do.

When defining complex values, the basic syntax is

`(real, imag)`

where `real` and `imag` evaluate to integers or floats.

Fixed-point parameters may be directly assigned a `precision`. To do this, the parameter is given in the syntax `(value, precision)`, where `value` is an ordinary number and `precision` is given by either of two syntaxes:

- Syntax 1
- As a string like
`3.2`, or more generally`m.n`, where`m`is the number of integer bits (to the left of the binary point) and`n`the number of fractional bits (to the right of the binary point). Thus length is`m+n`. - Syntax 2
- A string like
`24/32`which means`24`fraction bits from a total length of`32`. This format is often more convenient because the word length often remains constant while the number of fraction bits changes with the normalization being used.

In both cases, the sign bit counts as one of the integer bits, so this number must be at least one. Thus, for example, a fixed-point parameter might be defined as `(0.8, 2/4)`. This means a `4-bit` word will be used with two fraction bits. Since the value `0.8` cannot be represented in this precision, the actual value of the parameter will be rounded to `0.75`.

A fixed-point parameter can also be given a value without a precision. In this case, the default precision is used. This has a total word length of 24 bits with the number of integer bits set as required to store the value. For example, the number `1.0` creates a fixed-point object with precision `2.22`, and a value of `0.5` would create one with precision `1.23`.

The precision of internal computations in a primitive is typically given by a parameter of type `precision`. A precision parameter has a value specified using either of the two syntaxes above.

Comments are supported for non-string parameters. A comment is specified with the hash (`#`) symbol. Everything after the hash until the end of the line is ignored when the parameter is evaluated. Comments are especially useful in combination with files, as they remind you about which module or primitive parameter the code refers to. Comments are, however, not supported for the `string` or `stringarray` parameter types. In fact, when the image processing primitives use `string` states to represent a filename, the hash character is used to denote the frame number of the image being processed.