private void buttonGO_Click(object sender, EventArgs e) { MathGraphic m; #region in/out try { h = double.Parse(textBoxH.Text); b11 = double.Parse(textBoxB11.Text); b12 = double.Parse(textBoxB12.Text); b21 = double.Parse(textBoxB21.Text); b22 = double.Parse(textBoxB22.Text); C2 = double.Parse(textBoxC2.Text); Y0[0] = double.Parse(textBoxN1_0.Text); Y0[1] = double.Parse(textBoxN2_0.Text); T0 = double.Parse(textBoxT1.Text); Tmax = double.Parse(textBoxT2.Text); } catch (FormatException) { MessageBox.Show("Wrong number format"); textBoxH.Text = h.ToString(); textBoxB11.Text = b11.ToString(); textBoxB12.Text = b12.ToString(); textBoxB21.Text = b21.ToString(); textBoxN1_0.Text = Y0[0].ToString(); textBoxN2_0.Text = Y0[1].ToString(); textBoxB22.Text = b22.ToString(); textBoxC2.Text = C2.ToString(); textBoxT1.Text = T0.ToString(); textBoxT2.Text = Tmax.ToString(); return; } #endregion Compute(); if (radioN1T.Checked) { grsN1T.Clear(); m = new MathGraphic(Color.Green, DrawModes.DrawLines, ft, fN1, 0, n - 1, 1); grsN1T.Add(m); } if (radioN2T.Checked) { grsN2T.Clear(); m = new MathGraphic(Color.Green, DrawModes.DrawLines, ft, fN2, 0, n - 1, 1); grsN2T.Add(m); } if (radioN1N2.Checked) { grsN1N2.Clear(); grsN1N2.Add(new MathGraphic(Color.Green, DrawModes.DrawLines, fN1, fN2, 0, n - 1, 1)); grsN1N2.Add(new MathGraphic(Color.BlueViolet, DrawModes.DrawLines, fAsympt, 0, pictureBox1.Width / zoom, (float)h)); } pictureBox1.Refresh(); }
private void Calc() { double Pk, L, Ti, Tm, Gp, Tp, Var_A, Var_B, D1, k, k_Qnpp, Tmin, Tmax; int n, Qz, Qnpp; ClearResult(); if (kToolStripMenuItem.Checked == true) { k_Qnpp = 0.7; } else { k_Qnpp = 1; } try { Pk = Convert.ToDouble(txtPk.Text); L = Convert.ToDouble(txtL.Text); n = Convert.ToInt16(txtn.Text); Qz = Convert.ToInt16(txtQz.Text); Ti = Convert.ToDouble(txtT1.Text); Qnpp = Convert.ToInt16(txtQnpp.Text); Qz = Qz * 1000; Qnpp = Qnpp * 1000; Tm = Ti / 60; Gp = 4 * Pk * L * n; Tp = 3600 * Gp / Qz; Var_A = Qz * Tm - 60 * Gp; //Var_B = 0.7 * Qnpp; Var_B = k_Qnpp * Qnpp; D1 = Var_A / (Var_B * Tm) * 100; k = Tp / Ti; Tmin = (6 * 60 * Gp) / (100 * Qz / 1000 - k_Qnpp * Qnpp / 1000); Tmax = (6 * 60 * Gp) / (k_Qnpp * Qnpp / 1000 + 100 * Qz / 1000); label1.Text = label1.Text + " " + Gp.ToString("0.###") + " кг"; label4.Text = label4.Text + " " + Tp.ToString("0.###") + " c"; label5.Text = label5.Text + " " + Tmax.ToString("0.###") + " c"; label7.Text = label7.Text + " " + Tmin.ToString("0.###") + " c"; label6.Text = label6.Text + " " + k.ToString("0.###"); label3.Text = label3.Text + " " + D1.ToString("0.##") + " %"; if (D1 > 1 || D1 < -1) { lblError.Visible = true; } } catch (Exception ex) { MessageBox.Show("Проверьте введенные данные!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } // MessageBox.Show(Pk.ToString("0.##")); }