Example #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            ScndTablice scndTablice = new ScndTablice();

            scndTablice.textBox11_1.Text = textBox51.Text;
            scndTablice.textBox11_2.Text = textBox52.Text;
            scndTablice.textBox11_3.Text = textBox53.Text;


            scndTablice.textBox13_1.Text = textBox53.Text;
            scndTablice.textBox13_2.Text = textBox54.Text;
            scndTablice.textBox13_3.Text = textBox55.Text;

            scndTablice.textBox14_1.Text = textBox65.Text;
            scndTablice.textBox14_2.Text = textBox66.Text;
            scndTablice.textBox14_3.Text = textBox67.Text;
            //scndTablice.textBox15_1.Text = textBox59.Text;

            scndTablice.textBox15_1.Text = string.Format("{0}{1}", Math.Round((Convert.ToDouble(textBox50.Text) / Convert.ToDouble(textBox59.Text) * 100), 0, MidpointRounding.AwayFromZero), "%");
            scndTablice.textBox15_2.Text = string.Format("{0}{1}", Math.Round((Convert.ToDouble(textBox51.Text) / Convert.ToDouble(textBox59.Text) * 100), 0, MidpointRounding.AwayFromZero), "%");

            scndTablice.ShowDialog();
        }
Example #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            ScndTablice scndTablice = new ScndTablice();

            const double A  = 200;
            const double F  = 1;
            const double PI = 3.14;


            if (
                String.IsNullOrEmpty(H.Text) ||
                String.IsNullOrWhiteSpace(D.Text) ||
                String.IsNullOrWhiteSpace(Mu.Text) ||
                String.IsNullOrWhiteSpace(Tg.Text) ||
                String.IsNullOrWhiteSpace(Tw.Text) ||
                String.IsNullOrWhiteSpace(Cfonmehceh.Text) ||
                String.IsNullOrWhiteSpace(PDKmehceh.Text) ||
                String.IsNullOrWhiteSpace(Cfonderevo.Text) ||
                String.IsNullOrWhiteSpace(PDKderevo.Text) ||
                String.IsNullOrWhiteSpace(Cfonsvarka.Text) ||
                String.IsNullOrWhiteSpace(PDKsvarka.Text)
                )
            {
                errorProvider1.SetError(button1, "Заполните все поля");
            }


            else
            {
                double deltaT = Math.Abs((Convert.ToDouble(Tw.Text) - Convert.ToDouble(Tg.Text)));
                if (deltaT == 0)
                {
                    errorProvider1.SetError(button1, "Error Tg = Tw");
                }
                else
                {
                    double V1 = PI * Math.Pow((double.Parse(D.Text)), 2) * double.Parse(Mu.Text) / 4;
                    double f  = (Math.Pow(double.Parse(Mu.Text), 2) * double.Parse(D.Text) * 1000) / (Math.Pow(double.Parse(H.Text), 2) * deltaT);
                    double m  = 1 / (0.67 + 0.1 * Math.Sqrt(f) + 0.34 * Math.Pow(f, 1.0 / 3));
                    double Vm = 0.65 * Math.Pow((V1 * deltaT) / double.Parse(H.Text), 1.0 / 3);
                    double n;
                    if (Vm < 0.5)
                    {
                        n = 4.4 * Vm;
                    }
                    else if (Vm >= 0.5 & Vm < 2)
                    {
                        n = (0.53 * Math.Pow(Vm, 2)) - (2.13 * Vm) + 3.13;
                    }
                    else
                    {
                        n = 1;
                    }

                    ScndTablice.PDV.PDV1 = Math.Round((((double.Parse(PDKmehceh.Text) - double.Parse(Cfonmehceh.Text)) * Math.Pow(double.Parse(H.Text), 2) * Math.Pow(V1 * deltaT, 1.0 / 3)) / (A * F * m * n)), 2, MidpointRounding.AwayFromZero).ToString();
                    ScndTablice.PDV.PDV2 = Math.Round((((double.Parse(PDKderevo.Text) - double.Parse(Cfonderevo.Text)) * Math.Pow(double.Parse(H.Text), 2) * Math.Pow(V1 * deltaT, 1.0 / 3)) / (A * F * m * n)), 2, MidpointRounding.AwayFromZero).ToString();
                    ScndTablice.PDV.PDV3 = Math.Round((((double.Parse(PDKsvarka.Text) - double.Parse(Cfonsvarka.Text)) * Math.Pow(double.Parse(H.Text), 2) * Math.Pow(V1 * deltaT, 1.0 / 3)) / (A * F * m * n)), 2, MidpointRounding.AwayFromZero).ToString();

                    this.Close();
                }
            }
        }