Polybench® for biosignals / reference 1.34.1
Selects input bus Sa if the gate is 1, and Sb if the gate is 0, and directs that bus to the output.

Switch Converge


Use this operator to switch two different inputs to one output channel bus, so that either one of the inputs is linked to the output.

The switch is controled by the Gate input that must have 1 channel.

This operator is the counter part of the Switch operator ("Switch"), but can also be used to select different signal sources.

The Gate input expects a pseudo-boolean signal, which is either around 0 or around 1.

This operator may also be used as a data source selector, where both inputs have completely different data sources.

Operator ports

Input Sa: Any sample type. The connection is not limited to one type of signal.

Input Sb: Any sample type. The connection is not limited to one type of signal.

Input Gate: Floating point values

Output Sa|Sb: Any sample type. The connection is not limited to one type of signal.


Find more information about changing properties here: "Properties Viewer"

type: Word or phrase
The name of the object in the project. This name must not contain '.', '$' nor '@' characters.

For more information about the rules and usage of the Caption property, please refer to "Caption property - background and usage".

type: See description
Optional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.


Working of the Gate input

Signal values on the Gate input (the input on the bottom) determine if signals from inputs Sa or from input Sb are copied to the output.

All channels of inputs Sa or Sb are switched at once; therefore the Gate input must have only one channel.

The Gate input expects a pseudo-boolean signal, read more here: "Pseudo-booleans and triggers".
If the Gate signal has value pseudo-true (for example 1.0), input Sa is copied to the output.
If the Gate signal has value pseudo-false (for example 0.0), input Sb is copied to the output.

Normal mode: counter part of the Switch

The Switch Converge has two different operation modes: normal mode and source selection mode. Which mode is active is determined by the Switch Converge automatically.

In Normal mode, the signal inputs must have equal channel configurations, because they both must fit the output channel configuration. This means that both front inputs must stem from the same signal source, and that number of channels, sample frequency and sample type must be equal on both front inputs. If the operator is switched in this mode, the output configuration does not change; only the origin of the sample stream changes. If the input channel configurations are not compatible, the operator will indicate that it runs in Source Selection mode (see below).

The schematic above shows a typical use of the Switch and Switch Converge, that together form the equivilent of what in other computer languages would be called IF..THEN..ELSE. Using the constant button either the high pass filter is chosen, or the low pass filter.

Source selector mode: select independent data sources

The Switch Converge operator automatically runs in Source Selector mode if both front inputs have different channel configurations. Below the operator symbol 'Source Selector mode' will be displayed to inform you of its operation.

In this mode, the Switch Converge does not check the input configurations. The output of the operator will have the channels copied from the input that is currently switched on. If the data sources at both front inputs have completely different channel configurations, then if you switch (using the Gate input), the output configuration will change.

The output configuration change that happens when you switch is done in a way that the channels at the output keep their IDs. As a result, channel settings in viewers will not change if you switch.

Beware that this all comes with a prize: in Source Selector mode, switching is a heavy operation. If your data sources force the Switch Converge to use this mode, then you should switch only very seldomly - for example only to let the end-user select a signal source. In Normal mode (described above) switching is very 'cheap', because the output configuration does not have to be changed all the time.
Another hazard during switching in this mode, is that immediately after switching a number of samples from the input source may get lost! This is because the switching may take a few milliseconds in which time no sample data are processed.

Since the Switch Converge can be connected to different data sources without any synchronization, it can be used to switch data sources. You could use this feature, for example, if you make an application with a hardware source and a file replay source, where the file replay source is used for demo or testing purposes, and the hardware source for real operation.


Example: Switch Converge Data Source Demo
Demonstrates that two different data sources can be connected to the Switch Converge without synchronization. Push the button to show data source 1, or release the button to show data source 2.

Example: Switch Converge Disabled Data Source test
Demonstrates that different data sources can be selected using the Switch Converge, also if one of the data sources does not actually run. Press Enable 1 or Enable 2 to stop the sources and then start only one of the sources. By pressing the Push button, you can see that one data source shows a signal, and the other data sources does not put out a signal.