private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            Dictionary <int, double[]> dicArgs = e.Argument as Dictionary <int, double[]>;
            //将数据按照大于一小时和小于一小时来分类
            string        minHour      = string.Empty;
            string        minHourValue = string.Empty;
            string        maxHour      = string.Empty;
            string        maxHourValue = string.Empty;
            StringBuilder builder      = new StringBuilder();

            builder.AppendLine("*******************计算参数***********************");
            foreach (var item in dicArgs)
            {
                double during = item.Value[0];  //范围-值
                double value  = item.Value[1];
                minHour      += during;
                minHourValue += value;
                minHour      += ",";
                minHourValue += ",";
                builder.AppendLine(string.Format("a{0} = {1}", item.Key, value));
                builder.AppendLine(string.Format("t{0} = {1}", item.Key, during));
            }
            builder.AppendLine("***************************************************");
            builder.AppendLine("开始计算暴雨衰减参数...");
            FormOutput.AppendLog(builder.ToString());

            builder = new StringBuilder();
            builder.Append(MethodName.RainStormSub0);
            builder.Append(" ");
            builder.Append(minHour.Substring(0, minHour.Length - 1));
            builder.Append(" ");
            builder.Append(minHourValue.Substring(0, minHourValue.Length - 1));
            RunExeHelper.RunMethod(builder.ToString());
            e.Result = "1";
        }
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            string[] args = e.Argument as string[];  //state-percent
            FormOutput.AppendLog(string.Format("读取数据库站点【{0}】时间段为【{1}】的年统计最大值...", args[0], args[1]));
            //读取数据库某个站点某个统计频率的年统计最大值
            string  commandText = string.Format("select {0} from RAINFALL_YEAR_MAX where MONITORNUM='{1}' order by {0} desc", args[1], args[0]);
            DataSet ds          = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, commandText);
            //整理数据
            List <PercentStaticsModel> lstStatics = new List <PercentStaticsModel>();
            string points = string.Empty;

            if (ds.Tables[0].Rows.Count == 0)
            {
                FormOutput.AppendLog("统计数据不足,请重新选择统计条件!");
                return;
            }
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                if (ds.Tables[0].Rows[i][0] == DBNull.Value)
                {
                    continue;
                }
                PercentStaticsModel temp = new PercentStaticsModel()
                {
                    RowIndex = i + 1,
                    MaxValue = Convert.ToDecimal(ds.Tables[0].Rows[i][0]),
                    CArg     = ((decimal)(i + 1)) / ds.Tables[0].Rows.Count
                };
                lstStatics.Add(temp);
                points += ds.Tables[0].Rows[i][0];
                if (i < ds.Tables[0].Rows.Count - 1)
                {
                    points += ",";
                }
            }
            FormOutput.AppendLog(string.Format("统计值的数量为{0}个..", ds.Tables[0].Rows.Count));
            FormOutput.AppendLog(string.Format("统计值为[{0}]", points));
            string filePath = Path.Combine(Application.StartupPath, "SStatic.xls");

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            //保存数据到xls
            XmlHelper.SaveDataToExcelFile <PercentStaticsModel>(lstStatics, filePath);

            FormOutput.AppendLog("开始计算暴雨频率曲线..");
            RunExeHelper.RunMethod(MethodName.SWCure);
            e.Result = "1";
        }
Example #3
0
        /// <summary>
        /// 适线计算
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCaculate_Click(object sender, EventArgs e)
        {
            FormOutput.AppendLog("开始重新适配曲线,获取新的拟合度和曲线..");
            StringBuilder builder = new StringBuilder();

            builder.Append(MethodName.NiHeCure);
            builder.Append(" ");
            builder.Append(numX.Value.ToString());
            builder.Append(" ");
            builder.Append(numCv.Value.ToString());
            builder.Append(" ");
            builder.Append(numCs.Value.ToString());
            RunExeHelper.RunMethod(builder.ToString());
            RunExeHelper.FindFigureAndTodo(ShowNiHe);
        }
Example #4
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            //bysj,byss,hchl,pmhl,Qm,p1,eps1,eps2,tc
            object[]   args = e.Argument as object[];
            BYSJResult bysj = args[0] as BYSJResult;
            BYSSResult byss = args[1] as BYSSResult;
            HCHLResult hchl = args[2] as HCHLResult;
            PMHLResult pmhl = args[3] as PMHLResult;
            //获取计算需要的参数值
            //p1,Qm,eps1,sd,R,d,nd,r1,F,L1,L2,I1,I2,A1,A2,tc,eps2
            StringBuilder builder    = new StringBuilder();
            StringBuilder logBuilder = new StringBuilder();

            logBuilder.AppendLine("*********洪峰流量计算参数**********");
            builder.Append(MethodName.FloodPeak);
            builder.Append(" ");
            builder.Append(args[5]);
            logBuilder.AppendLine("P1:" + args[5]);
            builder.Append(" ");
            builder.Append(args[4]);
            logBuilder.AppendLine("Qm:" + args[4]);
            builder.Append(" ");
            builder.Append(args[6]);
            logBuilder.AppendLine("eps1:" + args[6]);
            builder.Append(" ");
            builder.Append(bysj.Sd);
            logBuilder.AppendLine("Sd:" + bysj.Sd);
            builder.Append(" ");
            builder.Append(byss.R);
            logBuilder.AppendLine("R:" + byss.R);
            builder.Append(" ");
            builder.Append(bysj.d);
            logBuilder.AppendLine("d:" + bysj.d);
            builder.Append(" ");
            builder.Append(bysj.nd);
            logBuilder.AppendLine("nd:" + bysj.nd);
            builder.Append(" ");
            builder.Append(byss.r1);
            logBuilder.AppendLine("r:" + byss.r1);
            builder.Append(" ");
            builder.Append(byss.F);
            logBuilder.AppendLine("F:" + byss.F);
            builder.Append(" ");
            builder.Append(hchl.L1);
            logBuilder.AppendLine("L1:" + hchl.L1);
            builder.Append(" ");
            builder.Append(pmhl.L2);
            logBuilder.AppendLine("L2:" + pmhl.L2);
            builder.Append(" ");
            builder.Append(hchl.l1);
            logBuilder.AppendLine("I1:" + hchl.l1);
            builder.Append(" ");
            builder.Append(pmhl.l2);
            logBuilder.AppendLine("I2:" + pmhl.l2);
            builder.Append(" ");
            builder.Append(hchl.A1);
            logBuilder.AppendLine("A1:" + hchl.A1);
            builder.Append(" ");
            builder.Append(pmhl.A2);
            logBuilder.AppendLine("A2:" + pmhl.A2);
            builder.Append(" ");
            builder.Append(args[8]);
            logBuilder.AppendLine("tc:" + args[8]);
            builder.Append(" ");
            builder.Append(args[7]);
            logBuilder.AppendLine("eps2:" + args[7]);
            builder.Append(" ");
            builder.Append(Path.Combine(_projectForlder, ConfigNames.FloodPeak));
            FormOutput.AppendLog(logBuilder.ToString());
            FormOutput.AppendLog("***********************************");
            RunExeHelper.RunMethod(builder.ToString());
            e.Result = "1";
        }