Engee documentation

If

Subsystem selection by if-else condition.

if

Description

The If block implements the if-else logic to control the execution of the subsystem.

Restrictions

The If block has the following restrictions:

  • The block does not support on-the-fly adjustable parameters. Values for If expressions and Elseif expressions parameters cannot be configured during simulation in normal or accelerator mode, or during execution of generated code.

  • To implement on-the-fly configurable if-else expressions, configure the expression outside the If block. For example, use the Relational Operator block to evaluate an expression outside the If block, or add a customisable parameter as input to the If block.

Ports

Input

Logical operands - input signals for evaluating logical expressions
scalar

Inputs u1,u2,…​,un must have the same data type.

The If block does not support the Boolean data type.

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

Output

Action - action signal for if-else condition
scalar

The outputs of the if, else and elseif ports are action signals for subsequent blocks.

Data types: Bool.

Parameters

Number of inputs - number of input ports
1 (by default) | <integer number>
  • 1 - one input port.

  • ` integer` - number of input ports. The block ports are labelled with the symbol 'u' followed by a number: 1,2,…​,n, where n is equal to the number of specified inputs.

Usage in program code

Block parameter

NumInputs

Values

1 | <integer number>

By default

1

If expression is a logical if expression.
u1 > 0 (By default) | <логическое выражение>

Blocks connected to the if port are executed when the expression associated with the port takes the value true (1).

  • u1 > 0 - Sends an action signal to the output port if the input value on port u1 is greater than 0.

  • <логическое выражение>` - logical expression. This expression is displayed on the block icon next to the if output port.

Usage in program code

Block parameter

IfExpression

Values

'u1 > 0' | '<логическое выражение>'

By default

'u1 > 0'

Elseif expressions - logical expression elseif
' ' (By default) | <список логических выражений>

Blocks connected to the elseif port are executed if the expression associated with the port takes the value true (1) and all if and else expressions take the value false (0).

  • ' '` - logical expressions are not specified.

  • <список логических выражений> - comma-separated list of logical expressions. Expressions appear on the block icon under the if port.

Usage in program code

Block parameter

ElseIfExpressions

Values

' ' ` | '<список логических выражений>`

By default

' '`

Show else condition - port display control else
on (By default) | off

If the expression on port if and all expressions on port elseif are false, port else sends a signal to execute the connected blocks.

  • enabled - port else is displayed on the block icon.

  • disabled - the else port is hidden.

Usage in program code

Block parameter

ShowElse

Values

on | off

By default

On

Enable zero-crossing detection - managing the definition of zero crossing
включено (by default) | выключено

Managing the definition of zero crossing.

  • включено - define zero crossings.

  • выключено - do not define zero crossings.

Usage in program code

Block parameter

ZeroCross

Value

включено | выключено

By default

включено

Additional options

C code generation: Yes