# Add Color Thresholds to the Highest and 2nd Highest Values on a Scorecard

## Recommended Posts

It is common in manufacturing processing plants such as oil and gas refineries, to monitor the temperature trend in furnaces. Example in the refineries, the furnaces tube metal temperature (TMT) monitoring severity increases for dirty services such as crude distillation and coker units. Operation team uses this information to decide either to go for rate cut or feed rate skewing before the TMT reaching mechanical limits to prolong the run length. Upon reaching the limit, the furnace will be taken out-of-service by means of spalling or pigging, and consequently impacts the production rate.

Use case: The objective is to highlight the highest and the second highest temperature out of several temperatures in a matrix. Seeq enables users to build a matrix table (or Scorecard prior to R51) to highlight the temperature priority sequence by using a combination of functions and tools including max(), splice(), composite condition and scorecard metrics.

Step 1: Start by loading all of the signals we want to include in the matrix into the display.

Step 2: Use max() to look for the highest value signal at any time in the formula tool. Type in formula below into formula editor.

`\$t.max(\$t2).max(\$t3).max(\$t4).max(\$t5).max(\$t6).max(\$t7).max(\$t8)` Step 3: Create the second highest signal using splice() and composite condition.

To capture the second highest signal, we need first to exclude a signal with the highest temperature at any time and then identify the highest value out of the remaining seven signals.

To achieve that, use the highest temperature signal we created in step 2, we then create a condition when a signal reads the highest value, for each eight signals.

```//Which is the max
\$if_t1_is_the_max = \$t1 == \$max
\$if_t2_is_the_max = \$t2 == \$max
\$if_t3_is_the_max = \$t3 == \$max
\$if_t4_is_the_max = \$t4 == \$max
\$if_t5_is_the_max = \$t5 == \$max
\$if_t6_is_the_max = \$t6 == \$max
\$if_t7_is_the_max = \$t7 == \$max
\$if_t8_is_the_max = \$t8 == \$max```

Prior to looking for the max a second time, we must remove or replace the values from each of the signals when they are equal to the max. In this method, we will replace the highest signal values with zero using the splice function during the condition when that signal was the max. With these highest values replaced by zero (or removed), applying the same technique with the max function will yield the value of the second highest signal.

```//replace the max with 0
\$removing_the_max_value =
(\$t1.splice(0,\$if_t1_is_the_max))
.max(\$t2.splice(0,\$if_t2_is_the_max))
.max(\$t3.splice(0,\$if_t3_is_the_max))
.max(\$t4.splice(0,\$if_t4_is_the_max))
.max(\$t5.splice(0,\$if_t5_is_the_max))
.max(\$t6.splice(0,\$if_t6_is_the_max))
.max(\$t7.splice(0,\$if_t7_is_the_max))
.max(\$t8.splice(0,\$if_t8_is_the_max))
.toStep()

return
\$removing_the_max_value```

Step 4: Create Metric Threshold Limits

Subtract the highest signal by a fairly small value using Formula tool in order to use signal as a threshold limit. Repeat the step for second highest limit.

`\$max-0.001` Step 5: Create scorecard metric for each signal.

Create scorecards for all 8 signals, as an example we choose value at the end for statistic for daily condition and apply the threshold accordingly.

In the table view:

Do check this post by Nick. He used different approach to yield the maximum of three signals, and displayed signal string in a matrix table.

Edited by Azhar Ariffin
• 4

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