Adding Local Variables to the Method or Process

  1. Open the signature editor for the method or process.
  2. Go to the Locals tab of the Signature Editor.
  3. Do one of the following:

    • Click the Add local variable button.
    • In the Local Variable menu, select Add.

    A new local variable is added to the Locals list.

  4. Enter a name for the local variable.
  5. Specify the type for the local variable.

    Note

    Since ASCET V6.4.0, complex local variables (except records) are always explicit references. Composite local variables (i.e. arrays and matrices) and local variables of record type can be specified as instances or explicit references.

  6. If you selected an array or matrix of enumeration or record type, Closedthe following happens.

    The Choose a enumeration type or Choose a record type window opens.

    • In the 1 Database/1 Workspace field, select the enumeration or record you want to use, then click OK.
  7. To edit the size of an array or matrix selected as local variable, Closeddo the following.

    1. Open the Argument menu or the context menu and select Edit Max Size.

      The Max and Variant Size for: <argument> window opens.

    2. In the Max Size x (and Max Size y) field(s), enter the array or matrix size.

    3. To specify a variant size, use the Variant Size x (and Variant Size y) field(s) to select the system constants you want to use as dimension values.

      Both normal and user-defined system constants can be used. The value of a system constant should be in the range 1 ... X (or 1 ... Y).

    4. To specify a variable size, use the Variant Size x (and Variant Size y) field(s) to select *.

      The Max Size x (and Max Size y) field(s) are disabled.

    5. Click OK to close the window and accept your settings.

  8. Enter a comment and a unit for the variable.

    If you selected an array, matrix or record as type, additional steps may be necessary:

  9. Activate (deactivate) the Reference option to mark the local variable as explicit reference (instance).

    Note

    You can export models that use non-scalar method-/process-local variables marked as instances only in AMD format V6.4.0 or higher. An AMD format V6.3.* or older will result in an export error.

  10. Use the Read for Referenced Element and Write for Referenced Element options to set internal access to the referenced element to Read, Write, or both.

Note

Non-scalar local variables specified as instances must be initialized before they are read.

For method-/process-local records marked as instances, the separate assignment to each record element is recognized as initialization. The expression must only contain accesses to record elements that are already initialized.

Assigning each element of an array or matrix is recognized as initialization.

Passing a local variable of array, matrix or record type as Out argument is recognized as initialization.

See also

Editing the Signature of a Method or Process

Locals Tab

Variant Size for Arrays and Matrices

Variable Size for Arrays and Matrices

Explicit References

Constants and System Constants

Reserved Keywords

Editing Arguments and Local Variables

Directions of Method Arguments