Port Selector block

The Port Selector block makes use of an integer field to decide which one of its input ports it should use to define the output field for the current execution.  The tags in the selected input port are copied to the output port.  The number, with their associated names and data types, of tags in each of the switch ports must be the same.  The output port contains the same number, with their associated names and data types, of tags as in each of the switch ports.  It is possible to smooth the transfers from one selection to the next.

Return to Overview of blocks

Port Selector block

Description

The Port Selector block uses an integer field (an input to the block) to select which input port to use as the source for its output field.  It copies the contents of the selected input port (as determined by the integer field) to its output port.  All the input ports must have identical fields, thus the number, names and data types of tags in the switch ports must be the same.  The output port will contain the same number of tags with their associated names and data types. The selector port may contain only 1 integer field. The value of the integer field is used to determine which input port will be selected as follows; a value of 0 selects switch port 1, a value of 1 selects switch port 2, a value of 2 selects switch port 3 and so on (up to the number of ports minus 1).  It is possible to enable transfer smoothing.  If transfer smoothing is enabled and the switch port used changes between 2 consecutive executions, an interpolation is performed that uses the previous output value and the current output value to determine a smoothed output value for each of the fields.  The time span used for the interpolation calculation is configurable in the block.

Port Selector block

Block Type

General block

Input/Output ports

  • The top input port is the Selector port, it may contain only one field of type integer

  • There may be 2 or more switch ports below the Selector port.  The number of switch ports is specified during block configuration.  The number of fields in each of the switch ports must be the same.  The names and corresponding data types of these fields must also be identical.  Thus if switch port 1 contains 3 fields; Head (double), Flow (double) and Pump Status (integer) then all the subsequent ports must also contain 3 fields named Head (double), Flow (double) and Pump Status (integer).

  • The Output port contains the same number of fields as occurs in each of the switch ports.  The corresponding names and data types of these fields is the same as those in each of the switch ports.

Return to top   

Functions performed on tags

  • On the values - The output port values are copied from the selected input port.  If a change in input selection occurs and the smooth transition option is enabled, an output value is calculated from an interpolation between the output value from the previous execution and the output value for the current execution. The time span used in the interpolation calculation is configurable.

  • On the timestamp - Each output field tag takes the timestamp attribute of its corresponding input field tag in the switch port.  When transfer smoothing is in progress, the time stamp of the smoothed output tags is set to the current execution time.  If, at the end of a transfer smoothing phase, one or more of the input field tags in the switch port has a time stamp that is older than the time stamp of the last smoothing transfer value, then the corresponding output field tag will keep the time stamp of the last smoothing transfer value. Thus the time stamp of an output field tag will never go back in time.

  • On the quality - Typically the output field takes the quality attribute of the input field.  If; however, the value of the integer field in the selector port is less than 0 or larger than the number of input ports minus 1, all the outputs are set to bad quality.  

Example

In the example below, involving no transfer smoothing, it may be seen that the port selector chooses Switch port 1 if the Selector field is 0 and Switch port 2 if the Selector field is 1.

 

Example to illustrate the working of the port selector block (transfer smoothing disabled)  

Return to top

Terminology

  • Tag - One of the items in a database (or other) record: for example, Bottoms Flowrate, Outlet Pressure, Inlet Temperature, etc. In other words a tag is a column name.

  • Field - One or more items of information in a database (their values at a particular timestamp).  Each field has a timestamp, quality and value attribute.

Return to top


Related topics:

  

CSense 2023- Last updated: June 24,2025