# Selecting 2nd or 3rd Highest/Lowest Signal

## Recommended Posts

• Seeq Team

A common industrial use case is to select the highest or lowest signal value among several similar measurements. One example is identifying the highest temperature in a reactor or distillation column containing many temperature signals. One of many situations where this is useful is in identifying the current "hot spot" location to analyze catalyst deactivation/performance degradation.

When selecting the highest value over time among many signals, Seeq's max() Formula function makes this easy. Likewise, if selecting the lowest value, the min() Formula function can be used. A more challenging use case is to select the 2nd highest, 3rd highest, etc., among a set of signals.

There are several approaches to do this using Seeq Formula and there may be caveats with each one. I will demonstrate one approach below.

For our example, we will use a set of 4 temperature signals (T100, T200, T300, T400). Viewing the raw temperature data:

1. We first convert each of the raw temperature signals to step interpolated signals, and then resample the signals based on the sample values of a chosen reference signal that has representative, regular data samples (in this case, T100). This makes the later formulas a little simpler overall and provides slightly cleaner results when signal values cross each other.

For the T100 step signal Formula:

Note that the T200 step signal Formula includes a resample based on using 'T100 Step' as a reference signal:

The 'T300 Step' and 'T400 Step' formulas are identical to that for T200 Step, with the  raw T signals substituted.

2. We now create the "Highest T Value" signal using the max() function and the step version T signals:

3. To create the '2nd Highest T Value' signal, we use the splice() function to insert 0 values where a given T signal is equal to the 'Highest T Value'. Following this, the max() function can again be used but this time will select the 2nd highest value:

4. The process is repeated to find the '3rd Highest T Value', with a very similar formula, but substituting in values of 0 where a given T signal is >= the '2nd Highest Value':

The result is now checked for a time period where there are several transitions of the T signal ordering:

5. The user may also want to create a signal which identifies the highest value temperature signal NAME at any given point in time, for trending, display in tables, etc. We again make use of the splice() function, to insert the corresponding signal name when that signal is equal to the 'Highest T Value':

Similarly, the '2nd Highest T Sensor' is created, but using the '2nd Highest T Value':

(The '3rd Highest T Sensor' is created similarly.)

We now have correctly identified values and sensor names... highest, 2nd highest, 3rd highest:

This approach (again, one possible approach of several) can be extended to as many signals as needed, can be adapted for finding low values instead of high values, can be used for additional calculations, etc.

Edited by John Cox
• 2

## 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