[HttpPost]//计算当前组数据 public ActionResult CalculateCurrentData(int udg_id) { List <UpDownView> list_udv = dbDrive.GetUpDownViews(udg_id); UpDownExperiment upDownExperiment = dbDrive.GetUpDownExperiment(list_udv[0].dudt_ExperimentId); var lr = LiftingPublic.SelectState(upDownExperiment); var up = LiftingPublic.Upanddown(list_udv, upDownExperiment, lr); double[] prec = lr.GetPrec(up.μ0_final, up.σ0_final); double[] rpse = lr.ResponsePointStandardError(up.Sigma_mu, up.Sigma_sigma); string[] value = { up.μ0_final.ToString(), up.σ0_final.ToString(), up.Sigma_mu.ToString(), up.Sigma_sigma.ToString(), up.A.ToString(), up.M.ToString(), up.B.ToString(), up.b.ToString(), prec[0].ToString(), prec[1].ToString(), rpse[0].ToString(), rpse[1].ToString(), up.p.ToString(), up.G.ToString(), up.n.ToString(), up.H.ToString() }; return(Json(value)); }
public ActionResult ComprehensiveList(int ude_id) { List <ComprehensiveResultsModel> list_crm = new List <ComprehensiveResultsModel>(); List <UpDownGroup> list_udg = dbDrive.GetUpDownGroups(ude_id); UpDownExperiment upDownExperiment = dbDrive.GetUpDownExperiment(ude_id); var lr = LiftingPublic.SelectState(upDownExperiment); for (int i = 0; i < list_udg.Count; i++) { ComprehensiveResultsModel comprehensiveResultsModel = new ComprehensiveResultsModel(); List <UpDownView> list_udv = dbDrive.GetUpDownViews(list_udg[i].Id); var up = LiftingPublic.Upanddown(list_udv, upDownExperiment, lr); double[] prec = lr.GetPrec(up.μ0_final, up.σ0_final); comprehensiveResultsModel.setNumber = i + 1; comprehensiveResultsModel.stimulusQuantity = list_udv[0].dtup_Initialstimulus; comprehensiveResultsModel.stepLength = list_udv[0].dudt_Stepd; comprehensiveResultsModel.sampleNumber = list_udv.Count(); comprehensiveResultsModel.average = up.μ0_final; comprehensiveResultsModel.standardDeviation = up.σ0_final; comprehensiveResultsModel.msde = up.Sigma_mu; comprehensiveResultsModel.sdsde = up.Sigma_sigma; comprehensiveResultsModel.temptationNumber = up.n; comprehensiveResultsModel.G = up.G; comprehensiveResultsModel.H = up.H; comprehensiveResultsModel.A = up.A; comprehensiveResultsModel.B = up.B; comprehensiveResultsModel.M = up.M; comprehensiveResultsModel.b = up.b; comprehensiveResultsModel.p = up.p; comprehensiveResultsModel.percentage01 = prec[1]; comprehensiveResultsModel.percentage999 = prec[0]; list_crm.Add(comprehensiveResultsModel); } list_crm.Reverse(); return(Json(new { code = "", msg = "", count = list_crm.Count(), data = list_crm }, JsonRequestBehavior.AllowGet)); }
//单组试验结果数据 public ActionResult GetAllsingleunitList(int udg_id) { List <UpDownView> list_udv = dbDrive.GetUpDownViews(udg_id); UpDownExperiment upDownExperiment = dbDrive.GetUpDownExperiment(list_udv[0].dudt_ExperimentId); var lr = LiftingPublic.SelectState(upDownExperiment); var up = LiftingPublic.Upanddown(list_udv, upDownExperiment, lr); List <SingleExperimentTable> singleExperimentTables = new List <SingleExperimentTable>(); for (int w = 0; w < up.result_i.Length; w++) { SingleExperimentTable singleExperimentTable = new SingleExperimentTable(); singleExperimentTable.i = up.result_i[w]; singleExperimentTable.i2 = up.result_i[w] * up.result_i[w]; singleExperimentTable.i2mi1 = up.result_i[w] * up.result_i[w] * up.mi[w]; singleExperimentTable.i2vi = up.result_i[w] * up.result_i[w] * up.vi[w]; singleExperimentTable.imi1 = up.result_i[w] * up.mi[w]; singleExperimentTable.ivi = up.result_i[w] * up.vi[w]; singleExperimentTable.mi = up.mi[w]; singleExperimentTable.vi = up.vi[w]; singleExperimentTables.Add(singleExperimentTable); } //code--信息状态,默认为0,msg--返回信息,count--数据条数,data--数据 return(Json(new { code = "", msg = "", count = up.result_i.Length, data = singleExperimentTables }, JsonRequestBehavior.AllowGet)); }
public static string UpDownFreeSpireExcel(UpDownExperiment upDownExperiment, List <UpDownView> upDownViews, int grop, List <UpDownView> upDownViews1, int[] nj, double[] Gj, double[] Hj, double[] muj, double[] sigmaj, LiftingAlgorithm lr, List <UpDownGroup> upDownGroups) { var up = LiftingPublic.Upanddown(upDownViews, upDownExperiment, lr); var mtr = lr.MultigroupTestResult(nj, Gj, Hj, muj, sigmaj); Workbook book = new Workbook(); Worksheet sheet = book.Worksheets[0]; var iCellcount = 1; //1.设置表头 if (grop == 0) { sheet.Range[1, iCellcount++].Text = "单组升降法试验记录及数据处理结果"; } else { sheet.Range[1, iCellcount++].Text = "多组升降法试验数据处理结果"; } sheet.Range["A1:AO1"].Merge(); sheet.Range["A1:AO1"].Style.HorizontalAlignment = HorizontalAlignType.Center; sheet.Range["A2:C2"].Text = "产品名称"; sheet.Range["A2:C2"].Merge(); sheet.Range["D2:L2"].Text = upDownExperiment.udt_ProdectName; sheet.Range["D2:L2"].Merge(); sheet.Range["M2:O2"].Text = "产品数量"; sheet.Range["M2:O2"].Merge(); if (grop == 0) { sheet.Range["P2:U2"].Text = upDownViews.Count.ToString(); } else { sheet.Range["P2:U2"].Text = upDownViews1.Count.ToString(); } sheet.Range["P2:U2"].Merge(); sheet.Range["V2:Z2"].Text = "技术条件"; sheet.Range["V2:Z2"].Merge(); sheet.Range["AA2:AO2"].Text = upDownExperiment.udt_Technicalconditions; sheet.Range["AA2:AO2"].Merge(); sheet.Range["A3:C3"].Text = "试验时间"; sheet.Range["A3:C3"].Merge(); sheet.Range["D3:L3"].Text = upDownExperiment.udt_Creationtime.ToString("yyyy-MM-dd HH:mm"); sheet.Range["D3:L3"].Merge(); int count = 7; string[] s = { "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO" }; if (grop == 0) { sheet.Range["M3:Q3"].Text = "初始刺激量"; sheet.Range["M3:Q3"].Merge(); sheet.Range["R3:U3"].Text = upDownViews[0].dtup_Initialstimulus.ToString(); sheet.Range["R3:U3"].Merge(); sheet.Range["V3:Y3"].Text = "步长"; sheet.Range["V3:Y3"].Merge(); sheet.Range["Z3:AG3"].Text = upDownViews[0].dudt_Stepd.ToString(); sheet.Range["Z3:AG3"].Merge(); sheet.Range["AH3:AK3"].Text = "台阶数"; sheet.Range["AH3:AK3"].Merge(); sheet.Range["AL3:AO3"].Text = up.n.ToString(); sheet.Range["AL3:AO3"].Merge(); sheet.Range["A4:C4"].Text = "假设分布/分析方法"; sheet.Range["A4:C4"].Merge(); sheet.Range["D4:L4"].Text = LiftingPublic.DistributionState(lr); sheet.Range["D4:L4"].Merge(); sheet.Range["M4:Q4"].Text = "翻转响应"; sheet.Range["M4:Q4"].Merge(); sheet.Range["R4:U4"].Text = upDownExperiment.udt_Flipresponse == 0 ? "否" : "是"; sheet.Range["R4:U4"].Merge(); sheet.Range["V4:Y4"].Text = "分辨率"; sheet.Range["V4:Y4"].Merge(); sheet.Range["Z4:AO4"].Text = upDownExperiment.udt_Instrumentresolution.ToString(); sheet.Range["Z4:AO4"].Merge(); sheet.Range["A5:AO5"].Merge(); sheet.Range["A6"].Text = "i"; sheet.Range["B6"].Text = "X"; if (upDownExperiment.udt_Standardstate == 1) { sheet.Range["C6"].Text = "Ln"; } else if (upDownExperiment.udt_Standardstate == 2) { sheet.Range["C6"].Text = "Log"; } else if (upDownExperiment.udt_Standardstate == 3) { sheet.Range["C6"].Text = "幂"; } for (int i = 0; i < s.Length; i++) { sheet.Range["" + s[i] + "6"].Text = (i + 1).ToString(); } int zero = 0; for (int i = 0; i < up.result_i.Length; i++) { sheet.Range["A" + count + ""].Text = up.result_i[i].ToString(); if (up.result_i[i] == 0) { zero = count; } count++; } for (int j = 0; j < upDownViews.Count; j++) { sheet.Range["B" + zero + ""].Text = upDownViews[j].dtup_Initialstimulus.ToString(); if (upDownExperiment.udt_Standardstate != 0) { sheet.Range["C" + zero + ""].Text = upDownViews[j].dtup_Standardstimulus.ToString(); } sheet.Range["" + s[j] + "" + zero + ""].Text = upDownViews[j].dtup_response.ToString(); if (upDownViews[j].dtup_response == 1) { zero++; } else { zero--; } } } else { sheet.Range["M3:Q3"].Text = "总组数"; sheet.Range["M3:Q3"].Merge(); sheet.Range["R3:U3"].Text = upDownGroups.Count.ToString(); sheet.Range["R3:U3"].Merge(); sheet.Range["V3:Y3"].Text = "仪器分辨率"; sheet.Range["V3:Y3"].Merge(); sheet.Range["Z3:AG3"].Text = upDownExperiment.udt_Instrumentresolution.ToString(); sheet.Range["Z3:AG3"].Merge(); sheet.Range["A4:C4"].Text = "假设分布/分析方法"; sheet.Range["A4:C4"].Merge(); sheet.Range["D4:L4"].Text = LiftingPublic.DistributionState(lr); sheet.Range["D4:L4"].Merge(); sheet.Range["M4:Q4"].Text = "翻转响应"; sheet.Range["M4:Q4"].Merge(); sheet.Range["R4:U4"].Text = upDownExperiment.udt_Flipresponse == 0 ? "否" : "是"; sheet.Range["R4:U4"].Merge(); } if (grop == 0) { count = UpDown(up.μ0_final, up.σ0_final, count, sheet, up.Sigma_mu, up.Sigma_sigma, lr, up.n); count++; sheet.Range["A" + count + ":AO" + count + ""].Text = "升降法中间数据:试探次数:" + up.n + ",A:" + up.A + ",B:" + up.B + ",M:" + up.M + ",b:" + up.b + ",G:" + up.G + ""; sheet.Range["A" + count + ":AO" + count + ""].Merge(); } else { int n = 0; foreach (var i in nj) { n += i; } count = UpDown(mtr.μ0_final, mtr.σ0_final, count, sheet, mtr.Sigma_mu, mtr.Sigma_sigma, lr, n); } for (int w = 0; w < s.Length; w++) { sheet.Range["" + s[w] + "1:" + s[w] + "" + count + ""].ColumnWidth = 4; } sheet.Range["A2:AO" + count + ""].BorderInside(LineStyleType.Thin, Color.Black); sheet.Range["A2:AO" + count + ""].BorderAround(LineStyleType.Medium, Color.Black); if (grop == 0) { var strFullName = @"C:\升降法\" + "单组升降法" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".xlsx"; book.SaveToFile(strFullName, ExcelVersion.Version2010); return(strFullName); } else { var strFullName = @"C:\升降法\" + "多组升降法" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".xlsx"; book.SaveToFile(strFullName, ExcelVersion.Version2010); return(strFullName); } }