ASW – Switch with automatic selection of input

Block SymbolLicensing group: ADVANCED
PIC

Function Description
The ASW block copies one of the inputs u1, …, u4 or one of the parameters p1, …, p4 to the output y. The appropriate input signal is copied to the output as long as the input signal iSW belongs to the set {1,2,3,4} and the parameters are copied when iSW belongs to the set {1,2,3,4} (i.e. y= p1 for iSW = 1, y= u3 for iSW = 3 etc.). If the iSW input signal differs from any of these values (i.e. iSW = 0 or iSW < 4 or iSW > 4), the output is set to the value of input or parameter which has changed the most recently. The signal or parameter is considered changed when it differs by more than delta from its value at the moment of its last change (i.e. the changes are measured integrally, not as a difference from the last sample). The following priority order is used when changes occur simultaneously in more than one signal: p4, p3, p2, p1, u4, u3, u2, u1. The identifier of input signal or parameter which is copied to the output y is always available at the oSW output.

The ASW block has one special feature. The updated value of y is copied to all the parameters p1, …, p4. This results in all external tools reading the same value y. This is particularly useful in higher-level systems which use the set&follow method (e.g. a slider in Iconics Genesis). This feature is not implemented in Simulink as there are no ways to read the values of inputs by external programs.

ATTENTION! One of the inputs u1, …, u4 can be delayed by one step when the block is contained in a loop. This might result in an illusion, that the priority is broken (the oSW output then shows that the most recently changed signal is the delayed one). In such a situation the LPBRK block(s) must be used in appropriate positions.

Inputs

u1..u4

Analog input signals to be selected from

Double (F64)

iSW

Active signal or parameter selector

Long (I32)

Outputs

y

The selected analog signal or parameter

Double (F64)

oSW

Identifier of the selected signal or parameter

Long (I32)

Parameters

delta

Threshold for detecting a change  1e-06

Double (F64)

p1..p4

Parameters to be selected from

Double (F64)

2020 © REX Controls s.r.o., www.rexygen.com