IfThenElse

The IfThenElse block redirects its activation signal to one of its output activation ports, creating synchronism between its outgoing event and activating event. The activation port the block selects depends on the value of the regular input: when the value is larger than zero, the block selects the first output activation port, otherwise the block selects the second port.

    IfThenElse

Library

Activate/ActivationOperations

Description

The IfThenElse block is the counterpart to the conditional If Statement used in programming languages, such as C. Known, as a Synchro type of block, the IfThenElse block is special because it has the property to redirect its activation signal to one of its output activation ports, creating synchronism between its outgoing event and activating event.

One event is generated on one of the output event ports when an input event arrives. Depending on the sign of the regular input, the event is generated on the first or second output: when the value is larger than zero, the block selects the first output activation port, otherwise the block selects the second port.

The explicit input should be a scalar of any data type. In case of complex, only the real part is taken into account.

Parameters

IfThenElse_0

NameLabelDescriptionData TypeValid Values

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.

Number

0
1

nmod

Zero-Crossing

Turn this parameter ON to detect the zero crossings. Default is OFF.

Scalar

0
1

Ports

NameTypeDescriptionIO TypeNumber

Port 1

activation

input

externalActivation

then

activation

output

1

else

activation

output

2

If in>0

explicit

input

1

Advanced Properties

NameValueDescription

always active

no

direct-feedthrough

yes

zero-crossing

no

depends on block parameters.

mode

no

continuous-time state

no

discrete-time state

no

See Also