private void btnSolve_Click(object sender, EventArgs e)
        {
            if (cbNU1.SelectedIndex > -1 && cbNU2.SelectedIndex > -1)
            {
                NU_Holder nu1 = NUs[cbNU1.SelectedIndex];
                NU_Holder nu2 = NUs[cbNU2.SelectedIndex];

                zedGraphControl1.GraphPane.YAxis.Scale.Min = Convert.ToDouble(TB_min_Y.Text);
                zedGraphControl1.GraphPane.YAxis.Scale.Max = Convert.ToDouble(TB_max_Y.Text);

                dif1 = new Ur_Dif(nu1.l, nu1.coef_u1, nu1.coef_u2, 5);
                dif2 = new Ur_Dif(nu2.l, nu2.coef_u1, nu2.coef_u2, 5);
                setDiffParameters(dif1);
                setDiffParameters(dif2);
                dif1.set_n(Convert.ToInt32(NUD_n.Text));
                dif2.set_n(Convert.ToInt32(NUD_n.Text));

                timer2.Interval = Convert.ToInt32(NUD_Tick.Text);
                t    = Convert.ToDouble(TB_t.Text);
                time = 0;
                timer2.Start();
            }
            else
            {
                MessageBox.Show("Необходимо выбрать н.у. для сравнения");
            }
        }
        private void BT_GO_Click(object sender, EventArgs e)
        {
            zedGraphControl1.GraphPane.YAxis.Scale.Min = Convert.ToDouble(TB_min_Y.Text);
            zedGraphControl1.GraphPane.YAxis.Scale.Max = Convert.ToDouble(TB_max_Y.Text);
            double[] l       = new double[5];
            double[] coef_u1 = new double[5];
            double[] coef_u2 = new double[5];

            l[0] = Convert.ToDouble(NUD_GU_1.Value);
            l[1] = Convert.ToDouble(NUD_GU_2.Value);
            l[2] = Convert.ToDouble(NUD_GU_3.Value);
            l[3] = Convert.ToDouble(NUD_GU_4.Value);
            l[4] = Convert.ToDouble(NUD_GU_5.Value);

            coef_u1[0] = Convert.ToDouble(TB_GU1_1.Text);
            coef_u1[1] = Convert.ToDouble(TB_GU1_2.Text);
            coef_u1[2] = Convert.ToDouble(TB_GU1_3.Text);
            coef_u1[3] = Convert.ToDouble(TB_GU1_4.Text);
            coef_u1[4] = Convert.ToDouble(TB_GU1_5.Text);

            coef_u2[0] = Convert.ToDouble(TB_GU2_1.Text);
            coef_u2[1] = Convert.ToDouble(TB_GU2_2.Text);
            coef_u2[2] = Convert.ToDouble(TB_GU2_3.Text);
            coef_u2[3] = Convert.ToDouble(TB_GU2_4.Text);
            coef_u2[4] = Convert.ToDouble(TB_GU2_5.Text);


            dif = new Ur_Dif(l, coef_u1, coef_u2, 5);
            setDiffParameters(dif);
            dif.set_n(Convert.ToInt32(NUD_n.Text));
            timer1.Interval = Convert.ToInt32(NUD_Tick.Text);
            t    = Convert.ToDouble(TB_t.Text);
            time = 0;
            BT_tablU1.Enabled = false;
            BT_tablU2.Enabled = false;
            timer1.Start();

            DialogResult result = DialogResult.Yes;

            if (dif.isDivirge() && CB_count_GU.SelectedIndex > 0 &&
                (TB_GU1_2.Text != "0" || TB_GU1_3.Text != "0" || TB_GU1_4.Text != "0" || TB_GU1_5.Text != "0" ||
                 TB_GU2_2.Text != "0" || TB_GU2_3.Text != "0" || TB_GU2_4.Text != "0" || TB_GU2_5.Text != "0"))
            {
                result = MessageBox.Show("При данных параметрах схема расходится. Продолжить?", "Внимание!",
                                         MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
            }

            if (result == DialogResult.Yes)
            {
                timer1.Interval = Convert.ToInt32(NUD_Tick.Text);
                t    = Convert.ToDouble(TB_t.Text);
                time = 0;

                timer1.Start();
            }
        }
Пример #3
0
        private void BT_GO_Click(object sender, EventArgs e)
        {
            zedGraphControl1.GraphPane.YAxis.Scale.Min = Convert.ToDouble(TB_min_Y.Text);
            zedGraphControl1.GraphPane.YAxis.Scale.Max = Convert.ToDouble(TB_max_Y.Text);
            double[] l       = new double[5];
            double[] coef_u1 = new double[5];
            double[] coef_u2 = new double[5];

            l[0] = Convert.ToDouble(NUD_GU_1.Value);
            l[1] = Convert.ToDouble(NUD_GU_2.Value);
            l[2] = Convert.ToDouble(NUD_GU_3.Value);
            l[3] = Convert.ToDouble(NUD_GU_4.Value);
            l[4] = Convert.ToDouble(NUD_GU_5.Value);

            coef_u1[0] = Convert.ToDouble(TB_GU1_1.Text);
            coef_u1[1] = Convert.ToDouble(TB_GU1_2.Text);
            coef_u1[2] = Convert.ToDouble(TB_GU1_3.Text);
            coef_u1[3] = Convert.ToDouble(TB_GU1_4.Text);
            coef_u1[4] = Convert.ToDouble(TB_GU1_5.Text);

            coef_u2[0] = Convert.ToDouble(TB_GU2_1.Text);
            coef_u2[1] = Convert.ToDouble(TB_GU2_2.Text);
            coef_u2[2] = Convert.ToDouble(TB_GU2_3.Text);
            coef_u2[3] = Convert.ToDouble(TB_GU2_4.Text);
            coef_u2[4] = Convert.ToDouble(TB_GU2_5.Text);


            dif = new Ur_Dif(l, coef_u1, coef_u2, 5);
            dif.set_c(Convert.ToDouble(TB_c.Text));
            dif.set_y(Convert.ToDouble(TB_y.Text));
            dif.set_v(Convert.ToDouble(TB_v.Text));
            dif.set_t(Convert.ToDouble(TB_t.Text));
            dif.set_p(Convert.ToDouble(TB_p.Text));
            dif.set_k(Convert.ToDouble(TB_k.Text));
            dif.set_lymb1(Convert.ToDouble(TB_lymb1.Text));
            dif.set_lymb2(Convert.ToDouble(TB_lymb2.Text));
            dif.set_n(Convert.ToInt32(NUD_n.Text));
            timer1.Interval = Convert.ToInt32(NUD_Tick.Text);
            t    = Convert.ToDouble(TB_t.Text);
            time = 0;
            timer1.Start();
        }