How to filter or route variables

Revision as of 12:12, 17 August 2020 by Registered User

1. How to filter or route variable to UI?

In some cases it is useful to filter some variables. For instance, when you perform post-processing you may want to plot only the post-processed variable and not the original one. Here are the solutions to :

  • Hide useless variables
  • Plot 2 variables on 2 charts
  • Hide a "post processing" variable. When a variable is hide in the chart this variable is taken into account to calculate minimum and maximum values.

Several solutions can perform this routing or filtering.

1.1. Create 2 groups of variables

You can create 2 different groups of variables (variable nodes), and consequently the same amount of processing nodes. One can be connected to the gauge and the other one to the chart.

1.2. Use the "switch node"

You can use the “switch node”, used like a filtering node on the output of the processing node. The switch node filters your variable on the following property : msg.payload.variablename and set == myVariable.

Switch node configuration :

  • Name - Choose a name for your node
  • Property - msg.payload.variablename is the condition to select a variable. Here you are going to select the needed variable thanks to its variable name.
  • Condition - == yourVariableName if you want to filter only a variable. You can use other rules such as != yourVariableName to filter all variables except a variable.

Here is an example of a "switch node" configuration panel :

You can either use several “switch nodes” in series or in parallels to filter multiple variables :

1.2.1. "Switch nodes" in series

If you want to "block" some variables you can use "switch nodes" in series with the != condition.

In this example, the first "switch node" allows to block the temperature variable and the second "switch node" to block the voltage variable. Thus, this two variables won't be plotted in the graph.

1.2.2. "Switch nodes" in parallel

If you want to select specific variables you can use "switch nodes" in parallel with the == condition.

In the previous flow, the temperature and the voltage variables are each one routed by a switch node. The two switch nodes are in parallels. Thus you can either plot the two variables in the same or in different graphs.