Introduction
In this article today we can see in detail about how to create a simple Statistical Process Control (SPC) Cp and CPk Chart.
An automobile manufacturing Industries Quality Check is a very important part for all manufacturing products. The Quality Check can be done using the Statistical Process Control charts. The SPC charts will be used to analyze the performance of each process. In this article today let's see how to analyze the process using Cp, Cpk, Pp and Ppk.
Cp and Cpk - >Process Capability
Currently the automobile industry is interested in automated measuring machines to ensure quality and to compete in the global industry. Cp, Cpk, Pp, Ppk (in other words Process Capability) takes a major role in ensuring quality by measuring automobile components.
Cp: measures how well the data fits within the spec limits (USL and LSL).
Cpk: measures how centered the data is between the spec limits.
Cp and Cpk formula
Cp=(USL-LSL/6SIGMA) -> USL-LSL/6*RBAR/d2
Cpk=min(USL-XBAR/3Sigma,LSL-XBAR/3Sigma)
Pp and Ppk -> Process Performance
Pp: measures how well the data fits within the spec limits (USL and LSL).
Ppk: measures how centered the data is between the spec limits.
Pp and Ppk formula
Pp=(USL-LSL/6SIGMA) -> USL-LSL/6 STDEV
Ppk=min(USL-XBAR/3STDEV,LSL-XBAR/3STDEV)
Now let's see how I have created a SPC Cp and Cpk chart. My main purpose is to make a very simple SPC Chart that can be used by the end users.
I have created a SPC Cp and Cpk Chart as a User Control so that it can be used easily in all projects. In this article I have attached a Zip file named SHANUSPCCpandCpkChartSRC.zip. That contains the "ShanuCPCPKChart.dll". You can use this User Control in your project and pass the data as a DataTable to the User Cotnrol. In the User Control I will get the DataTable value and calculate:
-
Sum
-
Mean
-
Range
-
Cp
-
Cpk
-
Pp
-
Ppk
Bind all the results to the chart with a smiley alert image. If the data is good then display the Green smiley and if the data is Not Good (NG). Using the Mean and Range values I will plot the result as a Mean and Range chart with an Alert Image.
The user can pass the Upper Specification Limit (USL), Lower Specification Limit (LSL) Cpk Limit values to the ShanuCPCPKChart user control. Using the USL, LSL and Cpk value, the result will be calculated and display the appropriate alert in Red if the NG is for Cp, Cpk ,Pp, Ppk values. If the result is good then the Green text will be displayed to Cp, Cpk, Pp, Ppk in the chart.
ShanuCpCpkChart User control Features:
-
Display chart with Sum, Mean and Range values.
-
Cp, Cpk, Pp, Ppk with an alert result text warning with Red for NG and Green for OK result.
-
Mean (XBAR) and Range (RBAR) chart with an Alert image with Red for NG and Green for OK result.
-
Automatic Calculate and display the Upper Control Limit (UCL), Lower Control Limit (LCL) value with both XBAR and RBAR values.
-
Save the chart as an image (note: to save the chart image, double-click the chart or right-click and select save as Image).
-
Real Time data Gathering and display the chart.
-
The user can add Chart Watermark text.
The "ShanuSPCCpCPK_Demo" folder (this folder contains the Demo program that includes the ShanuCPCPKChart user control with the Random Data sample).
Note: I have used the DataTable as the data input for the User Control. From the Windows Forms form we need to pass the DataTable to the User Control to plot the Cp and Cpk Range Chart.
Code Part
I have used Visual Studio 2010. Create a Windows application and add and test our "ShanuCPCPKChart" User Control.
- Create a new Windows project.
- Open your form and then from Toolbox > right-click > choose items > browse to select your user control DLL and add.
- Drag the User Control to your Windows Forms form.
- Call the "Bindgrid" method of the user control and pass the DataTable to the User Control and check the result.
-
- #region Local Vairables
- DataTable dt = new DataTable();
- private static readonly Random random = new Random();
- Double gridMinvalue = 1.2;
- Double gridMaxvalue = 2.4;
- int totalColumntoDisplay = 20;
- Double USLs = 2.27;
- Double LSLs = 1.26;
- Double CpkPpkAcceptanceValue = 1.33;
-
- #endregion
Form Load event
In the Form Load event call the loadGridColumn() method. In this function I add the columns for the Data Table. I have used 20 columns for adding 20 sample data with 5 trials.
-
- public void loadGridColums()
- {
- dt.Columns.Add("No");
-
- for (int jval = 1; jval <= totalColumntoDisplay; jval++)
- {
- dt.Columns.Add(jval.ToString());
- }
- }
Next in the Form Load event I call the loadgrid() method. In this method I generate sample random numbers for 20 columns to plot our chart.
- public void loadgrid()
- {
- dt.Clear();
- dt.Rows.Clear();
- for (int i = 1; i <= 5; i++)
- {
- DataRow row = dt.NewRow();
- row["NO"] = i.ToString();
- for (int jval = 1; jval <= totalColumntoDisplay; jval++)
- {
- row[jval.ToString()] = RandomNumberBetween(gridMinvalue, gridMaxvalue);
- }
-
- dt.Rows.Add(row);
- }
- dataGridView1.AutoResizeColumns();
- dataGridView1.DataSource = dt;
- dataGridView1.AutoResizeColumns();
- }
Next in the form load I have passed the USL, LSL and Cpk values and DataTable to “shanuCPCPKChart” User Control to generate XBAR and Range Chart with Cp, Cpk, Pp and Ppk results.
- private void Form1_Load(object sender, EventArgs e)
- {
- loadGridColums();
- loadgrid();
- USLs = Convert.ToDouble(txtusl.Text);
- LSLs = Convert.ToDouble(txtLSL.Text);
- CpkPpkAcceptanceValue = Convert.ToDouble(txtData.Text);
-
- shanuCPCPKChart.USL = USLs;
- shanuCPCPKChart.LSL = LSLs;
- shanuCPCPKChart.CpkPpKAcceptanceValue = CpkPpkAcceptanceValue;
- shanuCPCPKChart.Bindgrid(dt);
- }
To display the real-time data chart result ,here I have used the timer and can bind the data using random data and pass all the results to the User Control to refresh and display the result.
- private void timer1_Tick(object sender, EventArgs e)
- {
- loadgrid();
- USLs = Convert.ToDouble(txtusl.Text);
- LSLs = Convert.ToDouble(txtLSL.Text);
- CpkPpkAcceptanceValue = Convert.ToDouble(txtData.Text);
-
- shanuCPCPKChart.USL = USLs;
- shanuCPCPKChart.LSL = LSLs;
- shanuCPCPKChart.CpkPpKAcceptanceValue = CpkPpkAcceptanceValue;
- shanuCPCPKChart.Bindgrid(dt);
- }