For Iterator
Control unit for the for-iterator subsystem.
Description
The For Iterator block, placed in the Subsystem block, 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 for a 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
Input
N - external value of iteration limit
scalar
Input port to connect 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 Iteration limit source parameter to external
.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Next_i - external value of the iterator variable
scalar
Input port to connect to an external source of iteration variables. The value of the input at the current iteration is used as the value of the iteration variable at the next iteration. The input port accepts data of mixed numeric types.
Dependencies
To use this port, select the Set Next i (iteration variable) externally checkbox.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, UInt8
, UInt16
, UInt32
, UInt64
, Bool
.
Parameters
Iteration limit source - source for number of iterations
internal (by default)
| external
Select the source for the number of iterations.
internal
- the value of the Iteration limit parameter determines the number of iterations.
external
- the value of the signal on the N port determines the number of iterations.
Dependencies
Selecting internal
displays and enables the Iteration limit parameter. Selecting external
adds an input port labelled N.
Block parameter |
|
Values |
|
By default |
|
Iteration limit - specify the number of iterations
5 (by default)
| an integer
Specify the number of iterations. This parameter supports storage classes.
5
- repeat blocks in the For Iterator Subsystem block 5 times.
` integer` - specify an integer or a named constant variable.
Dependencies
To use this parameter, select internal
for the Iteration limit source parameter.
Block parameter |
|
Values |
|
By default |
|
Set Next i (iteration variable) externally - control input port mapping
off (by default)
| on
Control the input port display.
disabled
- do not display the input port.
on
- display the input port with the inscription Next_i to connect to an external source of iteration variables. The value of the input at the current iteration is used as the value of the iteration variable at the next iteration.
Dependencies
To use this parameter, select the checkbox for Show iteration variable, which also displays an output port labelled 1:N.
Block parameter |
|
Values |
|
By default |
|
Show iteration variable - output port display control
On (By default)
| Off
Control the output port display.
disabled
- do not display the output port.
enabled
- display the output port with 1:N.
Dependencies
To use this parameter, tick the checkbox for Set next i (iteration variable) externally.
Block parameter |
|
Values |
|
By default |
|
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.
Block parameter |
|
Values |
|
By default |
|
Iteration variable data type - output data type
Int32 (by default)
| Int16
| Int8
| Float64
Set the data type to output the iteration value from the iteration number port.
Block parameter |
|
Values |
|
By default |
|