Some New Ways to Compare Signals in Formula

Recommended Posts

• Seeq Team

As of Seeq R21.044 we have a couple interesting new ways to compare signals in formula!

When creating a value based condition, the usual default is the value search tool, but it has always been possible using formula as well, however these functions have typically been limited to signal against scalar comparisons. As of R21.044 however, common math operators like <, <=, >, >=, == (is equal to), != (is not equal to), and && (logical and) are all available for use as signal against scalar, or signal against signal comparisons!

Whenever the mathematical condition is met, a condition will be created just like a typical value search, however unlike value search the mathematical operators in formula will also work with two signals. For more information, search for "Comparison Functions for Signals" in your formula documentation.

Here are a few examples of these operators in use:

Signal and scalar comparison:

Signal and scalar comparison with logical and:

Signal against Signal:

For a full list of whats new in R21.044 check out this KB article: https://seeq12.atlassian.net/wiki/spaces/KB/pages/571375775/What+s+New+in+R21.0.44

Share on other sites

• Seeq Team

In addition to the common math symbols, there are also some new concise ways to search for other signal states:

• \$signal.isValid() - make a condition that enumerates when the signal has data
• \$signal.isNotValid() - make a condition that enumerates the gaps in the signal
• \$signal.isBetween(10, 20) - make a condition whenever the signal is between 10 and 20
• \$signal.isNotBetween(10, 20) - make a condition whenever the signal is outside the boundary of 10-20

Also for string signals, you can search for regular expressions or glob-like syntax:

• \$signal ~= "*STAG*" - find whenever the state signal contains "STAG".
• \$signal !~ "*STAG*" - find whenever the state signal does not contain "STAG".

All of these things can be combined and given precedence with parenthesis. For example, to find "when is temp < 90 and either of humidity > 60 or compressor is off "

`\$temp < 90 && ( \$humidity > 60 || \$compressor == 'OFF')`

• 1
Share on other sites

• 5 months later...

Hello,

Is there a way to compare signals (i.e. is greater than, is equal to etc.) prior to R21.044?

Kind regards,

Isaac

Share on other sites

• Seeq Team

Comparing 2 signals in earlier versions requires a bit more slight of hand, comparing the difference between the two signals to 0.

\$s1 > \$s2 is the same as

`(\$s1-\$s2).valueSearch(isGreaterThan(0))`

This is

• 2
• 1
Share on other sites

Ah that's great, thanks Ben!

Create an account

Register a new account