Engee documentation

Assignment

Assigns new values to the specified signal elements.

assignment

Description

The Assignment block assigns input signal values to selected signal elements. The indices of the elements to be assigned values are set either by entering the indices in the block dialogue box, or by connecting an external index source or sources to the block. The signal on the block’s data port, U, specifies the values to be assigned to Y. The block replaces the specified Y0 elements with elements from the data signal.

Depending on the value you enter for the Number of output dimensions parameter, a table of index options is displayed. Each row of the table corresponds to one of the output dimensions in the Number of output dimensions parameters. For each dimension, you can define the signal elements to work with. Specify a vector signal as one-dimensional and a matrix signal as two-dimensional. To enable an external index port, set Index Option to Index vector (port) or Starting index (port) in the corresponding row of the table.

For example, consider a two-dimensional signal with indexing mode from one. The table in the Assignment block dialogue box will change to include one row for each dimension. If you define each dimension using the following entries:

Row Index Option Index

1

Assign all

2

Index vector (dialogue)

[1 3 5]

The assigned values are of the form Y[1:end,[1 3 5]]=U.

When usage of the Assignment block is normal, Engee initialises the block outputs with zero, even if they are not explicitly initialised in the model.

The block can be used to assign values to vector or matrix signals.

Ports

Input

Y0 - input initialisation signal
vector | matrix

Initialisation signal for the output signal. If no other value is assigned to the element, the value of the output element coincides with the value of this input signal.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

U - input data port
scalar | vector | matrix

The value assigned to the output element, if specified.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

IndxN - signal of the N-th index
scalar | vector

An external port that specifies the index to assign to the corresponding output element.

Dependencies

To use this port, set the Index Option parameters to Index vector (port) or Starting index (port).

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Output

Y - output signal with assigned values
vector| matrix

Output signal with assigned values for the specified elements.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool.

Parameters

Number of output dimensions - number of dimensions to be processed
1 (by default) | ` integer`

The number of processed dimensions (N), specified by the user, must match the actual number of input dimensions.

Usage in program code

Block parameter

NumberOfDimensions

Value

Integer

By default

1

Index mode - specify the initial iteration number
One-based (by default) | Zero-based

Specify the indexing mode as Zero-based or One-based.

For Zero-based indexing, index 0 specifies the first element of the input vector. Index 1 specifies the second element and so on.

For One-based indexing, index 1 specifies the first element of the input vector. Index 2, specifies the second element and so on.

Usage in program code

Block parameters

IndexMode

Values

Zero-based |One-based

By default

One-based

Index option - item indexing method
Index vector (dialog) (By default) | Assign all | Index vector (port) | Starting index (dialog) | Starting index (port)

Determines, based on the dimensionality of the input signal, how the elements of the signal should be indexed. From the list, select:

  • Assign all - no further setting is required. All items are selected.

  • Index vector (dialogue) - includes the Index parameters. Enter a vector of element indexes. Do not select this option if the input signal is of variable size.

  • Index vector (port) - no further setting is required.

  • Starting index (dialog) - includes the Index and Output size parameters. Enter the starting index of the range of elements to select in the Index parameter and the number of elements to select in the Output size parameter. Do not select this option if the input signal is of variable size.

  • Starting index (port) - Enables the Output size parameters. Enter the number of items to be selected in the Output size parameters.

When the Index vector (port) or Starting index (port) options are selected, the block has a corresponding port and one of these values can be specified for the Initialise output (Y) parameters:

  • Initialise using input port <Y0>

  • Specify size for each dimension in table

Otherwise Y0 always initialises the output port Y.

The Index and Output size parameters, if not used for the selected Index option mode, are simply ignored.

Usage in program code

Block parameter

IndexOptionArray1

Value

Index vector (dialog) | Assign all | Index vector (port) | Starting index (dialog) | Starting index (port)

* By default*

Index vector (dialog)

Index - element index
1 (by default) | ` integer`

If the Index Option parameters is Index vector (dialog), enter the index of each element of interest.

If the Index Option parameter is Starting index (dialogue), enter the starting index of the range of elements to be selected. The number of items from the starting point is determined by the size of this dimension in U.

Usage in program code

Block parameter

IndexParamArray

Value

scalar | vector | matrix

By default

1

Output size - block output width
1 (By default) | ` integer`

Sets the width of the block output signal.

Dependencies

To use this parameter, set the Initialise output (Y) parameters to Specify size for each dimension in table.

Usage in program code

Block parameter

OutputSizeArray1

Value

scalar | vector | matrix

By default

1

Initialise output (Y) - method of receiving the input signal
Initialize using input port <Y0> (By default) | Specify size for each dimension in the table

Specify how to initialize the output signal.

Initialize using input port <Y0> - the signal on input port Y0 initialises the output signal.

Specify size for each dimension in the table - it is required to specify the block output width in the Output Size parameters. If the output has unassigned elements, the value of these elements is undefined.

Dependencies

To use this parameter, set the Index Option parameters to Index vector (port) or Starting index (port) for one or more dimensions.

Usage in program code

Block parameters

OutputInitialize

Values

Initialise using input port <Y0> | Specify size for each dimension in the table

By default

Initialise using input port <Y0>

Action if any output element is not assigned - action if all output elements are not assigned
None (By default) | Error

Specify whether to generate an error if all output elements are not assigned. Options include:

  • None - no action.

  • Error - Engee terminates the simulation and displays an error.

Dependencies

To use this parameter, set the Index Option parameter to Index vector (port) or Starting index (port) for one or more dimensions, then set the Initialise output (Y) parameter to Specify size for each dimension in the table.

Usage in program code

Block parameters

DiagnosticForDimensions

Values

None | Error

By default

None