IfExpressions

This block implements the conditional construct if-then-elseif-...-else-end. One and only one of the output activation ports is fired synchronously when the block is activated.

    IfExpressions

Library

ActivationOperations

Description

The IfExpressions block implements the conditional construct if-then-elseif-...-else-end. The if and elseif condition expressions are block parameters. The syntax for their definitions are the same as that used in the MathExpression block, in particular the expressions are expressed in terms of variables u1,...un where ui is the ith entry of the input vector. One and only one of the output activation ports is fired synchronously when the block is activated:

The first output fires if the "if" condition is true. Subsequent outputs correspond to the following "elseif" conditions. The last output corresponds to the "else" condition so it is fired when none of the expressions are strictly larger than zero.

Parameters

IfExpressions_0

NameLabelDescriptionData TypeValid Values

work

Workspace evaluation

used_names

Used names

Hidden parameter used by the block to indicate used environment variables.

nexx

Number of expressions

Number

Exp

Structure

Exp/exx

Expressions

Cell of strings

zc

Apply zero-crossing

Turn this parameter on to detect the zero crossings. Default is off.

Scalar

0
1

externalActivation

External activation

This parameter specifies whether the block receives an external activation or inherits its activation through its regular input ports. When External Activation is used, an additional activation port is added to the block. Default is OFF.

Scalar

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

activation

input

externalActivation

Port 2

activation

output

nexx+1

Port 3

explicit

input

1

Advanced Properties

NameValueDescription

always active

no

direct-feedthrough

yes

zero-crossing

no

mode

no

continuous-time state

no

discrete-time state

no