Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / C# 4.0
Article

Process Performance Determination in C# Part 4

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
29 Jun 2012CPOL4 min read 16.2K   144   2   1
The program presented here provides a simple way to obtain process performance through Z-transformation.

Introduction

Process performance metrics are important to determine the performance capability (of a process) in terms of customer requirement. Process performance can be determined via the following ways:

  • Via DPMO (Defect per Million Opportunity)
  • Via PPM (Part per Million)
  • Via Yield
  • Via Z-transformation

This is the fourth of a four parts that determine the Process Performance.

For the first part (via DPMO), see Process Performance Determination in C#.

For the second part (via PPM), see Process Performance Determination in C#: Part 2.

For the third part (via Yield), see Process Performance Determination in C#: Part 3.

For Excel function NORMSDIST which is used in Z-transformation, see Excel Function: NORMSDIST(z).

Background

This article describes how to determine the process performance from a Z-transformation.  

The Z-transformation method is based on the standardized the z value calculated as follow.

z(LSL) = (LSL - X-bar) / s 

and

z(USL) = (USL - X-bar) / s

where

  • z(LSL) is the z score when LSL is standardized
  • z(USL) is the z score when USL is standardized
  • LSL is the lower spec limit
  • USL is the upper spec limit
  • X-bar is the mean and
  • s is the standard deviation.

After the z values are determined, they are converted into probability or area under Normal curve using z-table or the Excel function NORMSDIST. The code for NORMSDIST, along with some explanations can be found here.

Let's look at an example on delivery time, with the assumption that it follows a Normal distribution.

After placing an order, the customer expects a delivery time of more than 7 days but less than 20 days. The average delivery time is 13.5 days with a standard deviation of 4 days. We thus have z(USL) = (20 - 13.5) / 4 = 1.625 and z(LSL) = (7 - 13.5) / 4 = -1.625.

Using z table or Excel function NORMSDIST, we obtain probability more than z(USL) as 0.05208 and probability less than z(LSL) as 0.05208. Those values can be interpreted as percentage of delivery time more than 20 days is 5.208, and percentage of delivery time less than 7 days is also 5.208. Thus percentage of delivery time in between 7 to 20 days is 100 - 5.208 - 5.208 = 89.58. Using such percentages, we can rate the performance of the process (in this case the delivery time) with respect to the USL and/or LSL. Cost of failure due to delivery can also be estimated.

Requirement

To run the code, you need to have the following:

  • .NET Framework 2.0 and above
  • Microsoft Visual Studio 2005 if you want to open the project files included in the download project
  • Nunit 2.4 if you want to run the unit tests included in the download project

Using the Code

We envisage that the user will perform the following code to get the desired results. This involves a simple 4-steps process:

  1. Instantiate a ProcessPerformanceFrZ object
  2. Input XBar, StdDev, LowerSpecLimit and UpperSpecLimit.
  3. Invoke its .Analyze() method
  4. Retrieve results from its .Result object.

 Here is a typical user’s code:

C#
ProcessPerformanceFrZ z = new ProcessPerformanceFrZ();
z.XBar = 13.5;
z.StdDev = 4;
z.LowerSpecLimit = 7;
z.UpperSpecLimit = 20;
z.Analyze();
Console.WriteLine("Expected % > USL is: " + z.Result.PercentMoreThanUSL);
Console.WriteLine("Expected % < LSL is: " + z.Result.PercentLessThanLSL);
Console.WriteLine("Expected yield (overall) % is: " + z.Result.PercentMoreThanUSL);

Two classes are implemented:

  1. ProcessPerformanceFrZResult
  2. ProcessPerformanceFrZ

ProcessPerformanceFrZResult is a class from which a result object derives, which holds the analysis results. In our implementation, the .Result member variable is defined as follows:

C#
 /// <summary>
/// Process Performance from Z-Transformation Result class
/// </summary>
public class ProcessPerformanceFrZResult
{
    /// <summary>
    /// Default constructor
    /// </summary>
    public ProcessPerformanceFrZResult() { }
    /// <summary>
    /// Expected % > USL
    /// </summary>
    public double PercentMoreThanUSL;
    /// <summary>
    /// Expected % < LSL
    /// </summary>
    public double PercentLessThanLSL;
    /// <summary>
    /// Expected yield (overall) %
    /// </summary>
    public double PercentYieldOverall;
}

The following table lists the available results (assuming that the ProcessPerformanceFrZ object name you use is z:

Result Result stored in variable
Expected % > USL z.Result.PercentMoreThanUSL
Expected % < LSL z.Result.PercentLessThanLSL
Expected Yield (overall) % z.Result.PercentYieldOverall

ProcessPerformanceFrZ Class

The ProcessPerformanceFrZ class does the analysis (calculation), and it is implemented as follows:

C#
 /// <summary>
/// Determine Process Performance from Z
/// </summary>
public class ProcessPerformanceFrZ
{
    private double xBar = 0;
    private double s = 0;
    private double LSL = 0;
    private double USL = 0;
    private double percentMoreThanUSL = 0;
    private double percentLessThanLSL = 0;
    private double percentYieldOverall = 0;

    /// <summary>
    /// ProcessPerformanceFrZ Result
    /// </summary>
    public ProcessPerformanceFrZResult Result = new ProcessPerformanceFrZResult();

    #region constructor
    /// <summary>
    /// ProcessPerformanceFrZ default constructor
    /// </summary>
    public ProcessPerformanceFrZ() { }//default empty constructor
    #endregion//constructor

    /// <summary>
    /// Write only property: Mean
    /// </summary>
    public double XBar
    {
        set { xBar = value; }
    }

    /// <summary>
    /// Write only property: Std Dev
    /// </summary>
    public double StdDev
    {
        set { s = value; }
    }

    /// <summary>
    /// Write only property: Lower Spec Limit
    /// </summary>
    public double LowerSpecLimit
    {
        set { LSL = value; }
    }

    /// <summary>
    /// Write only property: Upper Spec Limit
    /// </summary>
    public double UpperSpecLimit
    {
        set { USL = value; }
    }

Once the ProcessPerformanceFrZ object is instantiated, the user needs to set input values for mean, standard deviation, lower spec limit, and upper spec limit as follows:

C#
ProcessPerformanceFrZ z = new ProcessPerformanceFrZ();
z.XBar = 13.5;
z.StdDev = 4;
z.LowerSpecLimit = 7;
z.UpperSpecLimit = 20;

Then the .Analyze() method is called to perform the analysis. Subsequently, the user can retrieve the analysis results from the .Result object in the ProcessPerformanceFrZ object.  

The Analyze() method is implemented as follows:

C#
 /// <summary>
/// Calculate the Process Performance from Z
/// </summary>
public void Analyze()
{
    percentMoreThanUSL = 100 * (1 - Excel.NORMSDIST((USL-xBar)/s));
    percentLessThanLSL = 100 * (Excel.NORMSDIST((LSL-xBar)/s));
    percentYieldOverall = 100 - percentMoreThanUSL - percentLessThanLSL;
    //Results
    Result.PercentMoreThanUSL = percentMoreThanUSL;
    Result.PercentLessThanLSL = percentLessThanLSL;
    Result.PercentYieldOverall = percentYieldOverall;
}

Conclusion

The program presented here provides a simple way to obtain process performance through Z-transformation. With USL and LSL bear in mind, this method can be used to estimate the chance or probability an event is out of spec. 

History

29th June 2012: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Foundasoft.com
Malaysia Malaysia
Consultant

Comments and Discussions

 
GeneralMy vote of 5 Pin
Kanasz Robert6-Nov-12 0:07
professionalKanasz Robert6-Nov-12 0:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.