Jump to content

Count of total signals above a threshold value


Kareem

Recommended Posts

Hello,

I would like to come up with a clean method of showing me the count of signals are above a specific threshold over a specific period of time.

Say I have 30 temperatures, and one dips below my threshold. I would like my counter to reflect "29", indicating that one signal has dipped.

I know I can begin with a value search and count them on a  scorecard, but I do not want to write out a value search on 30 signals!

Link to comment
Share on other sites

  • Seeq Team

Kareem,

Do all of your temperature signals have the same threshold value? If so, we could possibly do some math to create 1/0 signals for each of your temperatures in formula and add them up giving you a total above threshold value. 

If each of the temperature signals has a different value, we could still potentially do it in formula, but it might be advantageous to use the value search functionality to create capsules at that point.

-Sean

Link to comment
Share on other sites

  • 3 weeks later...

The objective of creating a new signal that has a value equal to the number of instruments reading above a certain threshold can be achieved in one step using Seeq Formula. It is a good bit of code, but the majority is copy and paste.

1. Add all relevant signals to be used in count. image.png

2. Open a new Seeq Formula window and use the following code to get your counter. 

//Create a value search for when each area temperature is above 80F
$HighTempAreaA = $a.valueSearch(isGreaterThan(80))
$HighTempAreaB = $b.valueSearch(isGreaterThan(80))
$HighTempAreaC = $c.valueSearch(isGreaterThan(80))
$HighTempAreaG = $g.valueSearch(isGreaterThan(80))
$HighTempAreaH = $h.valueSearch(isGreaterThan(80))
$HighTempAreaI = $i.valueSearch(isGreaterThan(80))

//Create a new signal for each temperature tag that is 1 if temp > 80, else 0
$AreaA = 0.toSignal().splice(1.toSignal(),$HighTempAreaA)
$AreaB = 0.toSignal().splice(1.toSignal(),$HighTempAreaB)
$AreaC = 0.toSignal().splice(1.toSignal(),$HighTempAreaC)
$AreaG = 0.toSignal().splice(1.toSignal(),$HighTempAreaG)
$AreaH = 0.toSignal().splice(1.toSignal(),$HighTempAreaH)
$AreaI = 0.toSignal().splice(1.toSignal(),$HighTempAreaI)

//Create a new Signal that is the sum of the 1-0 signals for all temperatures
add($AreaA, $AreaB, $AreaC, $AreaG, $AreaH, $AreaI)

The result is the brown step function below.

image.png

Optionally add a threshold line and use cursors to validate the counter. 

image.png

Note that this approach works for signals that share a common threshold, but can also be applied to variable thresholds since each 1,0 signal is determined by a unique value search. 

Link to comment
Share on other sites

  • 1 year later...
  • Seeq Team

In later Seeq versions, an alternative to the method above may be to use the countOverlaps() function, which will also generate a signal showing the number of capsules simultaneously occurring based on the input conditions.

countOverlaps(
$a > 80,
$b > 80,
$c > 80,
$g > 80,
$h > 80,
$i > 80)

Take note that countOverlaps has a default sample period of 1 second, but this can be amended by adding a sample period before the conditions to be counted. Further details can be found in the formula documentation. 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...