While Iterator
The control unit for the while-iterator subsystem.
blockType: WhileIterator
Path in the library: 
 | 
Description
Block While Iterator, placed in the block Subsystem, executes the subsystem during the current time step if the value of the input condition is true (1). Use this block to implement logic equivalent to a loop. while in a programming language.
Ports
Input
#
 cond
—
The logical state
scalar
Details
A signal with the result of evaluating a logical condition. Since the subsystem is not started externally during the time step, evaluating the condition as true (1) or false (0) must be located inside the subsystem.
The data type and signal values can be:
- 
Logical (Boolean) —
true (1)orfalse (0). - 
Numeric —
true (any positive or negative number)orfalse (0). 
| Data types | 
 Data types:   | 
| Complex numbers support | 
 Yes  | 
#
 IC
—
the initial logical condition
scalar
Details
A signal with an initial logical condition. At the beginning of each time step:
- 
If IC is false (
0), the subsystem is not executed during the time step. - 
If IC is true (the value is not equal to
0), the subsystem starts execution and continues to repeat execution until the cond signal is true. 
Dependencies
To use this port, set the parameter While loop type meaning while.
| Data types | 
 
  | 
| Complex numbers support | 
 Yes  | 
Output
#
 OUT_1
—
number of iterations
scalar
Details
A signal with the number of block executions at each time step.
Dependencies
To use this port, check the box Show iteration number port.
| Data types | 
 
  | 
| Complex numbers support | 
 Yes  | 
Parameters
Main
#
Maximum number of iterations (-1 for unlimited) —
maximum number of iterations
Int64 integer
Details
Set the maximum number of iterations allowed during the time step.:
- 
−1— any number of iterations until the cond signal is true (the value is not equal to0). If you specify−1and the cond signal never becomes false (0), then the simulation runs in an infinite loop. In this case, the only way to stop the simulation is to close Engee. - 
An integer— the maximum number of iterations per time step. 
| Default value | 
 
  | 
| Program usage name | 
 
  | 
| Tunable | 
 No  | 
| Evaluatable | 
 Yes  | 
#
While loop type —
block type
while | do-while
Details
Select the block type.
- 
while— block While Iterator It has two inputs: input cond (logic condition) and input IC (initial logic condition).The IC signal source must be external to the While Iterator Subsystem block. At the beginning of each time step:
- 
if the input IC is true (the value is not equal to
0), then the blocks in the subsystem repeat execution until the input cond is true. This process continues during the time step until the input data cond is true, and the number of iterations is Maximum number of iterations (-1 for unlimited). - 
if the input IC is false, then the block While Iterator does not execute the contents of the subsystem.
 
 - 
 - 
do-while— block While Iterator it has one input, the cond input (the while condition).At each time step, the blocks in the subsystem are executed until the value at the input cond is true (not equal to
0).This process continues as long as the value in the input cond is true and the number of iterations is Maximum number of iterations (-1 for unlimited).
 
| Values | 
 
  | 
| Default value | 
 
  | 
| Program usage name | 
 
  | 
| Tunable | 
 No  | 
| Evaluatable | 
 No  | 
#
Show iteration number port —
control of the output port display
Logical
Details
Control the display of the output port for the signal with the number of block executions. The signal value from this port starts with 1 and increases by 1 for each subsequent iteration.
- 
If the checkbox is not checked, the output port with the iteration number is not displayed.
 - 
If the check box is selected, the output port with the iteration number is displayed.
 
| Default value | 
 
  | 
| Program usage name | 
 
  | 
| Tunable | 
 No  | 
| Evaluatable | 
 No  |