Jump to content

Auto Boundary Calculation


Bryan

Recommended Posts

Dear All,

Thanks for your interest to know more about boundaries. My plant has 100+ grades and each grade operates with different operating envelopes. Instead of calculating the boundaries as a scalar and having to input into SeeQ using the splice or zipwith or transform or CSV force scalar formula, I am looking for an easier way to create these boundaries. 

Success Criteria:

  1. Least complex formula
  2. Least computational power needed on SeeQ
  3. For the same grade, the boundaries have to be the same.

 

Creating a condition that can recognize not just when the grade changes but also, when the same grade repeats again, the condition can recognize it and calculate my boundaries using both new and old data would be a success factor for this. 

 

 

Link to comment
Share on other sites

  • Seeq Team

Hi Bryan,

 

I am assuming that you have a signal showing which grade is being ran and that these operating envelopes are pre-set, such that for the same grade they will be the same throughout time. Since we’ll have to bring in these operating limits into Seeq, we will have to perform a lengthy formula either way.  

The first option is as you mentioned, manually making scalars for the operating envelopes in Seeq and splicing them together. The below example shows an example of how it looks for a demo grade signal, where we are first making the limits, and then splicing them together based on what grade is being ran.

image.png

Another option is to leverage capsule properties. Rather than making the scalars for splicing, we can assign them as capsule properties during each time a grade is being ran. We can then convert the properties into a signal. Below is an example of this formula.

image.png

Both of these options result in the same limit and both would also result in a lengthy formula. Creating the formula in Excel and copying and pasting it over to Seeq would be great for this, especially if you already have the limits in an Excel worksheet. Apart from the grade and the limit, the text is the same for each line. A mixture of Excel concatenation and copying and pasting will streamline this process. Let us know if we can help.

Link to comment
Share on other sites

7 hours ago, Kristopher Wiggins said:

Hi Bryan,

 

I am assuming that you have a signal showing which grade is being ran and that these operating envelopes are pre-set, such that for the same grade they will be the same throughout time. Since we’ll have to bring in these operating limits into Seeq, we will have to perform a lengthy formula either way.  

The first option is as you mentioned, manually making scalars for the operating envelopes in Seeq and splicing them together. The below example shows an example of how it looks for a demo grade signal, where we are first making the limits, and then splicing them together based on what grade is being ran.

image.png

Another option is to leverage capsule properties. Rather than making the scalars for splicing, we can assign them as capsule properties during each time a grade is being ran. We can then convert the properties into a signal. Below is an example of this formula.

image.png

Both of these options result in the same limit and both would also result in a lengthy formula. Creating the formula in Excel and copying and pasting it over to Seeq would be great for this, especially if you already have the limits in an Excel worksheet. Apart from the grade and the limit, the text is the same for each line. A mixture of Excel concatenation and copying and pasting will streamline this process. Let us know if we can help.

Hey Kristopher,

Thanks for the reply to this post. Really appreciate it. These formula are definitely useful but in terms of scaling to 100+ grades & each grade operates with different conditions, it posts a challenge to replicate the formula.

I am looking for something more automated and require less manual input, in terms of, calculating the standard deviation based on grade for that condition and use it as boundaries. 

Link to comment
Share on other sites

  • Seeq Team

Hi Bryan,

Sorry but it looks as though it is not currently possible to achieve this in a succinct formula. We've made sure to document this request and will hopefully have it available in a future release. One workaround we found allows you to look back over a certain time frame and determine the statistical limits of the current grade being ran. I've included the formula code below with comments as to what occurs in it. This won't solve your problem but will at least allow you to compare your current grade. One thing to note is where there is a toNumber function. This function is only needed if your grades are coming as numeric values. If instead they are strings, the .toNumber() can be removed. 

//Inputs
$time_to_lookback = 2 month //Replace the 2mo with how far you'd like to look back to determine the limits
$max_grade_run_time = 4wk //Replace the 4wk with a value greater than the longest amount of time a grade would be ran

//Making a condition out of the grade signal, which retains the grade used as a capsule property
$grade_condition = $grade.toCondition().removeLongerThan($max_grade_run_time) 
$current_time = capsule(now()-$time_to_lookback , now())
//Retrieve all of the capsules over the lookback time where the current grade is being ran
$cap_filtered = $grade_condition.filter($cap -> $cap.getProperty('Value').toNumber()==$grade.getValue($current_time.getEnd()))
//Determine the stastical limit over the previous times where the current grade was ran
$avg = $pv.aggregate(average(), $cap_filtered,durationKey()).average($current_time)
$std_dev = $pv.aggregate(stdDev(), $cap_filtered,durationKey()).average($current_time)
$avg + 2* $std_dev

image.png

Edited by Kristopher Wiggins
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
On 2/6/2020 at 1:59 AM, Bryan said:

Hey Kristopher,

Thanks for the reply to this post. Really appreciate it. These formula are definitely useful but in terms of scaling to 100+ grades & each grade operates with different conditions, it posts a challenge to replicate the formula.

I am looking for something more automated and require less manual input, in terms of, calculating the standard deviation based on grade for that condition and use it as boundaries. 

Hi Bryan,

you can do this by using Seeq Data Labs.

I prepared an example based on the data @Kristopher Wiggins used.

image.thumb.png.7dff31a39d26de6002a9eaf17f5fbbc3.png

The following code creates a boundary signal (in this case the mean), which can be used for further calculations:

import pandas as pd

#search signals
signals = spy.search(pd.DataFrame([{"Name": "/(Product_Viscosity|Grade_Code_String)/"}]), 
                     workbook="4218D647-C7CB-4062-A6CF-D114F2E5E559")

#get data for last 60 days
data = spy.pull(signals, grid= None, start = pd.datetime.utcnow() - pd.Timedelta("60d"))

#calculate mean
means = data.groupby('Grade_Code_String').mean()

#create boundary signal and push back to Seeq
calc_dict = dict()
calc_dict['Name'] = 'BoundarySignal'
calc_dict['Type'] = 'Signal'
formula = "0.tosignal(5min)"

for m in means.itertuples():
    formula = formula + ".splice(" + str(m.Product_Viscosity) + ".toSignal(5min), $s == '" + m.Index + "')"

calc_dict['Formula'] = formula
calc_dict['Formula Parameters'] = {
    '$s': signals[signals["Name"] == 'Grade_Code_String']
}

metadata_for_calcs = list()
metadata_for_calcs.append(calc_dict)

spy.push(metadata=pd.DataFrame(metadata_for_calcs), workbook="4218D647-C7CB-4062-A6CF-D114F2E5E559")

image.thumb.png.6938c1c70a6a28f96d06c9306330b38d.png

Hope this helps.

Regards,

Thorsten

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