Jump to content
Software FX Community

WECO Rules Configuration


Recommended Posts

 Hi There,

We're trying to implement Control Charting using Line Charts with SPC Statistics. I'm trying to obtain info on supported WECO Rule configurations. I am able to add the WECO Rule test using the following code:

statistics1.Studies.Add(Test.Weco);

This only displays if the test 'Passed' or 'Failed'. But I am wondering if there are any additional WECO Rule configurations available. I would like to see if we can flag data points if:

7 points in a row are above 1Sigma;

5 points in a row are on one side of the Mean; etc..

Please let me know if this is possible with Chart FX Statistical

Thanks

Abt 

 

 

Link to post
Share on other sites

The Weco rules test is passed when none of the conditions apply. There is no information that can be extracted to indicate which of the specific rules failed.

Here is how we do Weco:

/// If ANY of the following is true, Weco fails. /// Any Point Above +3 Sigma  /// ---------------------------------------------   +3  LIMIT /// 2 Out of the Last 3 Points Above +2 Sigma  /// ---------------------------------------------   +2  LIMIT /// 4 Out of the Last 5 Points Above +1 Sigma  /// ---------------------------------------------   +1  LIMIT /// 8 Consecutive Points on This Side of Control Line  ///=================================== CENTER LINE  /// 8 Consecutive Points on This Side of Control Line  /// ---------------------------------------------   -1  LIMIT /// 4 Out of the Last 5 Points Below - 1 Sigma  ///---------------------------------------------- -2  LIMIT /// 2 Out of the Last 3 Points Below -2 Sigma  /// ---------------------------------------------   -3  LIMIT /// Any Point Below -3 Sigma  /// Trend Rules:  /// 6 in a row trending up or down. /// 14 in a row alternating up and down 

 All of this information can be obtained from the Calculator class so you can actually program your own Weco rules and have them display as independent Custom tests.

Link to post
Share on other sites

Frank, Thanks for your response. I tried looking through the documentation for more information on WECO and the Calculator class for details on how to perform atleast one of these tests programmatically. But without much luck.

Is there an example or a code snippet that I can use to do the following: Add a '4of5 Above +1Sigma' Test & Display the result (Pass/Fail) on the chart, Flag/mark the points on the chart that made the test fail.

Thanks for any infoTejo

Link to post
Share on other sites

I think I didn't express myself correctly.

There is NO way to get the individual result for each rule directly from the Calculator class, however, the data on which these rules are applied is.

You have access to the data through Calculator.Data, the mean and sigma can be obtained from Calculators.Get(Analysis.Mean) and Calculators.Get(Analysis.Sigma1) respectively.

But you need to loop through the data and evaluate each of the rules.

Link to post
Share on other sites

Frank, So it looks like it will take retrieving and comparing each Data value against the retrieved Mean and Sigma values first and then comparing against previous such Data values to see if the Data point is one of the Last X points to arrive at each rule.

If Chart FX already had some kind of program/code that does this to arrive at the WECO pass or fail, incorporating such analysis into the API could save a great deal of effort for end users in recreating the analysis. So, here's one for the Wish List!! :o)

Either way, that was very useful info and thanks for all your help.

Tejo

Link to post
Share on other sites

Added to wish list.

It is sometimes hard to forsee this type of needs, that's why we value your input so much. And that's the main reason I contribute to this forum, to hear from you.

Here is the code I wrote for this. As you can see I stop when I find a rule that fails but it can easily be modified to continue:

private bool WecoRulesPassed (double sigma,double mean)
{
 int over2SigmaCount = 0,under2SigmaCount = 0,over1SigmaCount = 0,under1SigmaCount = 0;
 int underMeanCount = 0,overMeanCount = 0,trendUpCount = 0,trendDownCount = 0,trendAlternateCount = 0;
 double xPrevious = m_data[0];
 int i;
 for (i = 0; i < m_N; i++) {
double x = m_data;
// 3 Sigma
if ((x > (mean + 3 * sigma)) || (x < (mean - 3 * sigma)))
 break;

// 2 Sigma
if (x > (mean + 2 * sigma)) {
 over2SigmaCount++;
 if (over2SigmaCount >= 2)
break;
} else
 over2SigmaCount = 0;
if (x < (mean - 2 * sigma)) {
 under2SigmaCount++;
 if (under2SigmaCount >= 2)
break;
} else
 under2SigmaCount = 0;

// 1 Sigma
if (x > (mean + sigma)) {
 over1SigmaCount++;
 if (over1SigmaCount >= 4)
break;
} else
 over1SigmaCount = 0;
if (x < (mean - sigma)) {
 under1SigmaCount++;
 if (under1SigmaCount >= 4)
break;
} else
 under1SigmaCount = 0;

// Mean
if (x > mean) {
 overMeanCount++;
 if (overMeanCount >= 8)
break;
} else
 overMeanCount = 0;
if (x < mean) {
 underMeanCount++;
 if (underMeanCount >= 8)
break;
} else
 underMeanCount = 0;

// Trends
if (x > xPrevious) {
 if (trendDownCount > 0)
trendAlternateCount++;
 else
trendAlternateCount = 0;
 trendUpCount++;
 if (trendUpCount >= 6)
break;
} else
 trendUpCount = 0;

if (x < xPrevious) {
 if (trendUpCount > 0)
trendAlternateCount++;
 else
trendAlternateCount = 0;
 trendDownCount++;
 if (trendDownCount >= 6)
break;
} else
 trendDownCount = 0;

if (trendAlternateCount >= 14)
 break;

xPrevious = x;
 }
 return (i >= m_N);
}

This should save you some time.

Link to post
Share on other sites

 Frank Hi,

When trying to mark/flag the points that are beyond +/-3Sigma, I tried to use the following:

double dX = m_statistics.Calculators[0].Data;

if ((dX > (dMean + 3 * dSigma)) || (dX < (dMean - 3 * dSigma)))

m_chart.Points[0, i].Color = Color.Red;

It looks like the m_chart.Points[0,i] is different from the Calculators[0].Data point. So how do I access the data point in the calculators class for changing color (or displaying the point label, etc..)..

how do I access the data point in the calculators class for changing color (or displaying the point label, etc..)..

Even using the m_statistics.Chart.Points[0, i] doen't mark the right point..

Thanks for any insight

Tejo

Link to post
Share on other sites
  • 2 months later...

I am completey new to ChartFX and I need to do pretty much the same thing as this example here, but what I don't get is how/when to set this new procedures up to be called?  I am using VB. Net and webforms.

I assume that

statistics1.Studies.Add(Statistical.Test.Weco)

is what will calls the default WECO tests  but how do you make sure the new code is called? 

 Is it a new "Study"?  Like I said I am new to this.

Thanks for any help,

Caroline

Link to post
Share on other sites

This post explains how Weco Rules are calculated in Chart FX Statistical with the objective of providing you with the tools to run the rules on your own code and therefore get the detailed result about which rule fails and which rule passes.

It is up to you how you want to display this information. A custom study is one way.

Please explain exactly what you are trying to achieve so that we can direct you to the appropriate APIs.

Link to post
Share on other sites
  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...