Engee documentation

For Iterator

The control unit for the for-iterator subsystem.

blockType: ForIterator

Path in the library:

/Basic/Ports & Subsystems/For Iterator

Description

Block For Iterator, placed in the block Subsystem, repeats the execution of the subsystem during the current time step until the iteration variable exceeds the specified iteration limit. You can use this block to implement a flowchart equivalent to a for loop in a programming language.

The output of the For Iterator Subsystem block cannot be a function call signal. Engee displays an error message when the model is updated.

Ports

Output

# 1:N — the value of the iterator variable during the step
scalar

Details

The value of the iterator variable during the step.

Dependencies

To use this port, check the box Show iteration variable.

Data types

Int8, Int16, Int32, Float64

Complex numbers support

Yes

Input

# Next_i — external value of the iterator variable
scalar

Details

Input port for connecting to an external source of iteration variables. The value of the input in the current iteration is used as the value of the iteration variable in the next iteration. The input port accepts data of mixed numeric types.

Dependencies

To use this port, check the box Set next i (iteration variable) externally.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

# N — the external value of the iteration limit
scalar

Details

An input port for connecting to an external iteration limit source. The value on the port is used as the maximum number of iterations of the loop. The input port accepts data of mixed numeric types.

Dependencies

To use this port, set the parameter Iteration limit source in value external.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool

Complex numbers support

Yes

Parameters

Main

# States when startingdescription missing
held | reset

Details

description missing

Values

held | reset

Default value

held

Program usage name

StatesWhenStarting

Tunable

No

Evaluatable

No

# Iteration limit source — source for the number of iterations
internal | external

Details

Select the source for the number of iterations.

internal — parameter value Iteration limit (N) defines the number of iterations.

external — the value of the signal on port N determines the number of iterations.

Dependencies

Choice internal displays and enables the parameter Iteration limit (N). Choice external adds an input port labeled N.

Values

internal | external

Default value

internal

Program usage name

IterationSource

Tunable

No

Evaluatable

No

# Iteration limit (N) — specify the number of iterations
Int64 integer

Details

Specify the number of iterations. This parameter supports storage classes.

  • 5 — Repeat the blocks in the For Iterator Subsystem block 5 times.

  • an integer — specify an integer or a named constant variable.

Dependencies

To use this parameter, set for the parameter Iteration limit source meaning internal.

Default value

5

Program usage name

IterationLimit

Tunable

No

Evaluatable

Yes

# Set next i (iteration variable) externally — control of the input port display
Logical

Details

Control the display of the input port:

  • if the checkbox is not checked, the input port Next_i is not displayed.

  • If this option is selected, the input port Next_i is used to connect to an external source of iteration variables. The value of the input in the current iteration is used as the value of the iteration variable in the next iteration.

Dependencies

To use this option, check the box for the option Show iteration variable.

Default value

false (switched off)

Program usage name

ExternalIncrement

Tunable

No

Evaluatable

No

# Show iteration variable — control of the output port display
Logical

Details

Control the display of the output port:

  • if the box is not checked, then the input port is 1:N is not displayed.

  • if the box is checked, the input port is 1:N is displayed.

Dependencies

To use this option, check the box Set next i (iteration variable) externally.

Default value

true (switched on)

Program usage name

ShowIterationPort

Tunable

No

Evaluatable

No

# Index mode — specify the initial iteration number
Zero-based | One-based

Details

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

For Zero-based Indexing index 0 sets the first element of the input vector. Index 1 defines the second element and so on.

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

Values

Zero-based | One-based

Default value

One-based

Program usage name

IndexMode

Tunable

No

Evaluatable

No

# Iteration variable data type — type of output data
Int32 | Int16 | Int8 | Float64

Details

Set the data type to output the iteration value from the iteration number port.

Values

Int32 | Int16 | Int8 | Float64

Default value

Int32

Program usage name

IterationVariableDataType

Tunable

No

Evaluatable

No

Additional options

C code generation: Yes