/// <summary> /// 得到土层 /// </summary> /// <param name="batGridView"></param> /// <returns></returns> private List <Soillayer> GetSoillayerList(BatGridView batGridView) { List <Soillayer> ret = new List <Soillayer>(); for (int i = 0; i < batGridView.Rows.Count; i++) { DataGridViewRow item = batGridView.Rows[i]; Soillayer soillayer = new Soillayer(); //排除最后一行,并且如果钢束名称为空,则删除此钢束 if (item.Cells[0].Value != null && !string.IsNullOrEmpty(item.Cells[0].Value.ToString())) { //如果是新增加的行,还没有与之关联的对象,则new并关联 soillayer.Height = double.Parse(item.Cells[0].Value.ToString()); soillayer.Qik = double.Parse(item.Cells[1].Value.ToString()); soillayer.Fa0 = double.Parse(item.Cells[2].Value.ToString()); soillayer.Frk = double.Parse(item.Cells[2].Value.ToString()); soillayer.Gama = double.Parse(item.Cells[3].Value.ToString()); if (item.Cells[4].Value != null) { soillayer.Describe = item.Cells[4].Value.ToString(); } ret.Add(soillayer); } } return(ret); }
private void button1_Click(object sender, EventArgs e) { try { List <Soillayer> listSoillayer = GetSoillayerList(this.batGridView1); if (listSoillayer.Count > 0) { double fn = double.Parse(textBox1.Text); double designLength = double.Parse(textBox2.Text); double depth = double.Parse(textBox3.Text); if (listSoillayer.Select(l => l.Height).Sum() < (designLength + depth)) { MessageBox.Show("钻孔深度不足", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } double diametra = double.Parse(textBox4.Text); double waterdepth = double.Parse(textBox5.Text); if (mPileLengthCalculationType == PileLengthCalculationType.摩擦桩) { mCalculationText = "按摩擦桩计算:"; double f1 = Soillayer.GetSumQik(listSoillayer, designLength, diametra * Math.PI, depth); mCalculationText += "\nΣQikL=" + S0(f1) + "kN"; double gama2 = Soillayer.GetSoilWeight(listSoillayer, designLength, depth, waterdepth); mCalculationText += "\n加权土重=" + S1(gama2) + "kN/m3"; double m0 = double.Parse(textBox11.Text); double gama = double.Parse(textBox10.Text); double k2 = double.Parse(textBox9.Text); double h = designLength + depth; if (h > 40) { h = 40; } mCalculationText += "\n桩端埋置深度=" + S1(designLength + depth) + "m"; double fa0 = Soillayer.Getfa0(listSoillayer, designLength, depth); mCalculationText += "\nfa0=" + S0(fa0) + "kPa"; double f2 = (diametra * diametra * Math.PI / 4) * (m0 * gama * (fa0 + k2 * gama2 * (h - 3))); mCalculationText += "\nApQr=" + S0(f2) + "kN"; //桩自重与置换土层的差值 double pileW = 25 * designLength * diametra * diametra * Math.PI / 4; mCalculationText += "\n桩自重=" + S0(pileW) + "kN"; double soilW = gama2 * (designLength + depth) * diametra * diametra * Math.PI / 4; mCalculationText += "\n置换土重=" + S0(soilW) + "kN"; double dw = pileW - soilW; textBox6.Text = S0(fn + dw); textBox7.Text = S0(f1 + f2); textBox8.Text = S1((f1 + f2) / (fn + dw)); } else if (mPileLengthCalculationType == PileLengthCalculationType.嵌岩桩) { mCalculationText = "按嵌岩桩计算:"; double c2 = double.Parse(textBox13.Text); double c1 = double.Parse(textBox12.Text); mCalculationText += "\n桩端埋置深度=" + S1(designLength + depth) + "m"; double frk = Soillayer.GetFrk(listSoillayer, designLength, depth); mCalculationText += "\nfrk=" + S0(frk) + "Mpa"; double f1 = c1 * diametra * diametra * Math.PI / 4 * frk * 1000; mCalculationText += "\nc1Apfrk=" + S0(f1); double ls = 0.8; if (frk > 30) { ls = 0.2; } else if (frk > 15) { ls = 0.5; } mCalculationText += "\n侧阻力发挥系数=" + S1(ls); double f2 = Soillayer.GetSumQik(listSoillayer, designLength, diametra * Math.PI, depth) * ls; mCalculationText += "\nΣQikl=" + S0(f2) + "kN"; double f3 = Soillayer.GetSumFrk(listSoillayer, designLength, diametra * Math.PI, depth); mCalculationText += "\nΣfrkh=" + S0(f3) + "kN"; //桩自重与置换土层的差值 double pileW = 25 * designLength * diametra * diametra * Math.PI / 4; mCalculationText += "\n桩自重=" + S0(pileW) + "kN"; double g = Soillayer.GetSoilWeight(listSoillayer, designLength, depth, waterdepth); mCalculationText += "\n加权土重=" + S1(g) + "kN/m3"; double soilW = g * (designLength + depth) * diametra * diametra * Math.PI / 4; mCalculationText += "\n置换土重=" + S0(soilW) + "kN"; double dw = pileW - soilW; textBox6.Text = S0(fn + dw); textBox7.Text = S0(f1 + f2 + f3); textBox8.Text = S1((f1 + f2 + f3) / (fn + dw)); } } } catch (System.Exception ex) { MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }