Engee documentation

Variant Sink

Variable routing between multiple outputs.

variant sink

Description

The Variant Sink block allows multiple realisations of a component to be included in a single layer at the signal destination (sink).

A Variant Sink block has only one input port and one or more output ports. Alternatives are connected to the output port of the block so that a maximum of one alternative is active during model execution.

Using the Variant Sink block allows you to:

  • Propagate the conditions for selecting alternatives throughout the model.

  • Engee eliminates inactive blocks throughout the model, which improves runtime performance. If all options are inactive, Engee completely removes the options area from your model.

  • Variant sources and assignment locations provide component interfaces that you can use to quickly model variants.

Ports

Input

Port_1 - input signal
scalar | vector | matrix

Input signal to be connected to the active output port.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool.

Output

Port_1 - output signal for the first variant
scalar | vector | matrix

Output signal for the first variant.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool.

Port_N - output signal for the n-th variant
scalar | vector | matrix

Output signal for the n-th variant.

Data types: Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool.

Parameters

Main

Variant control mode - variant control mode
expression (by default) | label | sim codegen switching

The variant control that determines the selection of the active variant can be of any of these types.

  • expression - In this mode, Engee selects the active variant based on an evaluation of the variant’s conditions. When the condition expression evaluates to true, the corresponding option becomes active. When the condition expression evaluates to false, the corresponding option becomes inactive.

  • label - In this mode, Engee selects the active variant based on the variant name. The variant control is a string and does not require the creation of variables in workspaces.

  • sim codegen switching - To automatically switch between variants for simulation and code generation workflows without creating variables in workspaces, use sim codegen switching mode. When you simulate a model, Engee automatically selects the sim branch as the active variant. Similarly, when you run a simulation in program-in-loop (SIL) or processor-in-loop (PIL) mode, generate code, or use external mode, Engee automatically selects the codegen branch. See Switching between variants for modelling and code generation workflows without control variables in variant blocks.

Dependencies

Usage in program code

Block parameter

VariantControlMode

Values

expression | label

By default

expression

Number of choices - number of choices
2 (by default) | positive integer

Number of choices as a positive integer. The maximum number of choices is `32.

Port N Variant control expression - expression defining the activity of the N-th output port

An expression that defines the activity of the Nth output port. The string "default" can be specified instead of the expression to select the active By default, which will be used if all other expressions are false.

Only one default option must be specified or an error will occur.

Port N Variant control label - Nth port label

All data entered in this field will be considered as a string. The active variant should be selected in the Label mode active choice field, where the label of the active variant should be entered.

Port N Variant control switch - label of the N-th port for the sim codegen switching mode

These fields are displayed if Variant control mode is equal to im codegen switching. In this mode two configurable ports are always available: one of them must be set to (sim) and the other to (codegen).

Label mode active choice - name of the active choice in label mode
none (By default)

Name of the active choice in label mode. The entered name will become the active label.

Dependencies

To use this parameter, set the Variant control mode parameter to label.

Allow zero active variant controls - modelling without selecting an active variant
off (By default) | `on

Select this checkbox to allow the possibility that none of the variants will be active.

If the checkbox is not selected Engee generates an error if no active option is selected.

Dependencies

To use this parameter, set the Variant control mode parameter to expression.

Usage in program code

Block parameter

AllowZeroVariantControls

Values

off

on

By default