public void SetStaticCalcProperty() { StaticModel.Usl = ProcessModel.Usl; StaticModel.Lsl = ProcessModel.Lsl; StaticModel.Target = ProcessModel.Target; StaticModel.Mean = ProcessModel.Mean; StaticModel.Sigma = StaticModel.Mean.HasValue? StDev(ValueList.Select(s => Convert.ToDouble(s)).ToArray()):StaticModel.Mean; StaticModel.Ucl = ProcessModel.Ucl.HasValue ?StaticModel.Mean + (3 * StaticModel.Sigma): ProcessModel.Ucl; StaticModel.Lcl = ProcessModel.Lcl.HasValue ? StaticModel.Mean - (3 * StaticModel.Sigma) : ProcessModel.Lcl; StaticModel.Ca = (StaticModel.Mean - StaticModel.Target) * 2 / (StaticModel.Usl - StaticModel.Lsl); var cpk1 = (StaticModel.Usl - StaticModel.Mean) / (3 * StaticModel.Sigma); var cpk2 = (StaticModel.Mean - StaticModel.Lsl) / (3 * StaticModel.Sigma); StaticModel.Cpk = cpk1 < cpk2 ? cpk1 : cpk2; var cp = (StaticModel.Usl - StaticModel.Lsl) / (6 * StaticModel.Sigma); StaticModel.Cp = cp.HasValue ? cp : StaticModel.Cpk; StaticModel.Cpkv = StaticModel.Ca.HasValue ? (1 - Math.Abs(StaticModel.Ca.Value)) * StaticModel.Cp : null; }
private void ImportList_Click(object sender, EventArgs e) { string fileName = UIMisc.GetOpenFilename("List File to Import", "", "List Files (*.lst; *.txt)|*.lst; *.txt|All files (*.*)|*.*", "LST"); if (fileName == "") { return; } StreamReader sr = new StreamReader(fileName); List <string> list = new List <string>(); while (true) { string item = sr.ReadLine(); if (item == null) { break; } if (item.IndexOf("\r") >= 0) { item = item.Replace("\r", ""); } item = item.Trim(); if (item == "") { continue; } list.Add(item); } sr.Close(); string listText = Csv.JoinCsvString(list); ValueList.Text = listText; if (listText.Length > 0) // no text selected { ValueList.Select(0, 0); } return; }