Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
2.85/5 (5 votes)
See more:
ckquote class="FQ">
Quote:
</div>pre></blockquote>
Expression for Sigma and CpK
Input
DataTable1 --- table1

|Parameter Name| Lower |Upper   |point90      |point10     |point50    |
  Diff_IC[1]   |  1.5  |2.5     |0.1471839    |0.137499005 |0.141139999 |
  Prog_IC[2]   |-10    |10000000|0.148519993  |0.137592003 |0.141236007 |
  Nam_IC[3]    |-64    |64      |0.157493005  |0.117183459 |0.141788006|
  ADCI_N[1 ]   |-0.8   |-0.1    |0.138519993  | 0.117592003|0.142398   |


Output
|Parameter Name| Lower |Upper    |point 90     |point10    |point50  |Sigma       |CpK |
  Diff_IC[1]   |  1.5  |2.5      |0.147183999  |0.137499005|0.141139999 |            |    |
  Prog_IC[2]   |-10    |10000000 |0.148519993  |0.137592003 |0.141236007|            |    |
  Nam_IC[3]    |-64    |64       |0.157493005  |0.117183459|0.141788006|             |    |
  ADCI_N[1 ]   |-0.8   | -0.1    |0.138519993  |0.117592003 |0.142398   |            |    |


Formula:
Sigma = (P90 point-P10 point)/2.56
Cpk =  Minimum|[  (P50 point - Lower) / 3 (sigma), (upper - P50 pint)  / 3 (sigma)]|
Posted
Updated 12-Mar-14 0:24am
v12
Comments
agent_kruger 11-Mar-14 6:27am    
sir, i supposed instead of posting question you posted an answer. :laugh
FarhanShariff 11-Mar-14 6:31am    
No its a question and how the answer should look like yeah with values filled for Sigma and CpK of Course :D
Kenneth Haugland 11-Mar-14 7:10am    
So, you want excel functions on a DataGridView?
phil.o 11-Mar-14 8:55am    
It's not a question. A question is something formulated in a human-readable language. It has to have a meaning, and expose some kind of problem/issue. Usually questions are punctued with a question mark.
Yours is just a repost.
FarhanShariff 11-Mar-14 8:00am    
Yeah Exactly on DataTable

C#
DataTable dtDemo =  new DataTable();
dtDemo.columns["Sigma"].readonly = false;
for(int i =0 ; i < dtDemo.rows.count; i++)
{
	dtColumns.rows[i]["Sigma"] = Convert.ToDouble(dtColumns.rows[i]["Upper"]) - Convert.ToDouble(dtColumns.rows[i]["Lower"]);
// here i just given one demo u need to change as per your requirement
}
 
Share this answer
 
Comments
FarhanShariff 11-Mar-14 9:21am    
thank you...Ganesh
Ganesh Rana <> 11-Mar-14 9:24am    
int i = 5 ;
int j = 15;
// now to find min??
int min = i > j ? j : i;
FarhanShariff 11-Mar-14 11:33am    
I get Error Object cannot be cast from DBNull to other types.

dtColumns.rows[i]["Sigma"] = Convert.ToDouble(dtColumns.rows[i]["Upper"]) - Convert.ToDouble(dtColumns.rows[i]["Lower"]);
FarhanShariff 11-Mar-14 9:57am    
I want to add columns and set their expression properties is it possible ?
Ganesh Rana <> 11-Mar-14 10:05am    
yes , it is possible ..
take care of providing data type of column.
// provide float
DataColumn sigma = table1.Columns.Add("Sigma", typeof(double));
DataColumn cpKL = table1.Columns.Add("CpKL", typeof(double));
DataColumn cpKR = table1.Columns.Add("CpKR", typeof(double));
DataColumn cpK = table1.Columns.Add("CpK", typeof(double));


sigma.Expression="(Convert(point90,'System.Double')-Convert(point10,'System.Double'))/2.56";
cpKL.Expression="(Convert(point50,'System.Double')-Convert(LSL,'System.Double'))/(3.0*sigma)";
cpKR.Expression="(Convert(USL,'System.Double')-Convert(point50,'System.Double'))/(3.0*sigma)";
cpK.Expression = "IIF(cpKL < cpKR, cpKL, cpKR)";
 
Share this answer
 
v4

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900