예제 #1
0
        int z = 0; //flag


        private void recountBtn_Click(object sender, EventArgs e)
        {
            I1 -= 0.09;
            I2 -= 0.09;
            I3 -= 0.09;
            I4 -= 0.09;
            I5 -= 0.09;
            I6 -= 0.09;

            I1tb.Text = I1.ToString();
            I2tb.Text = I2.ToString();
            I3tb.Text = I3.ToString();
            I4tb.Text = I4.ToString();
            I5tb.Text = I5.ToString();
            I6tb.Text = I6.ToString();

            U2 = I2 * EU * IV / ((IV + I2 + I1) * (I2 + I3 + I4 + I5 - Math.Pow(I2, 2) / (IV + I2 + I1) - Math.Pow((I4 + I5), 2) / (I4 + I5 + I6)));
            U1 = U2 * I2 / (IV + I2 + I1) + EU * IV / (IV + I2 + I1);
            U3 = U2 * (I4 + I5) / (I4 + I5 + I6);
            U1 = Math.Round(U1, 3);
            U2 = Math.Round(U2, 3);
            U3 = Math.Round(U3, 3);

            U1label.Text = "U1 = " + U1.ToString();
            U2label.Text = "U2 = " + U2.ToString();
            U3label.Text = "U3 = " + U3.ToString();

            if (z == 1)
            {
                F1 = Math.Round(Math.Pow(U11 - U1, 2), 3);
            }
            if (z == 2)
            {
                F1 = Math.Round(Math.Pow(U22 - U2, 2), 3);
            }
            if (z == 3)
            {
                F1 = Math.Round(Math.Pow(U33 - U3, 2), 3);
            }

            if (F1 < F)
            {
                FTB.Text = F1.ToString();
                F        = F1;
                logsRTB.AppendText("Целевая функция уменьшается F=" + F1.ToString() + "\n");
                logsRTB.ScrollToCaret();
            }
            else
            {
                logsRTB.AppendText("Целевая функция увеличилась F=" + F1.ToString() + "\n");
                logsRTB.ScrollToCaret();
                recountBtn.Enabled = false;
            }
            Fz = 0;

            calculateGrad();
            calculateHessian();
        }
예제 #2
0
        public override ArrayList GetItemInfo()
        {
            ArrayList itemInfo = new ArrayList
            {
                new InputText(this, "P1:", P1.ToString(), true, "p1"),
                new InputText(this, "U1:", U1.ToString(), true, "u1"),
                new InputText(this, "V1:", V1.ToString(), true, "v1"),

                new InputText(this, "P2:", P2.ToString(), true, "p2"),
                new InputText(this, "U2:", U2.ToString(), true, "u2"),
                new InputText(this, "V2:", V2.ToString(), true, "v2"),

                new InputText(this, "P3:", P3.ToString(), true, "p3"),
                new InputText(this, "U3:", U3.ToString(), true, "u3"),
                new InputText(this, "V3:", V3.ToString(), true, "v3"),

                new InputText(this, "Material:", Enum.GetName(typeof(P3DMaterial), Material), false, ""),
            };

            return(itemInfo);
        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            IV = Double.Parse(Ivtb.Text);
            I1 = Double.Parse(I1tb.Text);
            I2 = Double.Parse(I2tb.Text);
            I3 = Double.Parse(I3tb.Text);
            I4 = Double.Parse(I4tb.Text);
            I5 = Double.Parse(I5tb.Text);
            I6 = Double.Parse(I6tb.Text);
            EU = Double.Parse(Etb.Text);

            U2 = I2 * EU * IV / ((IV + I2 + I1) * (I2 + I3 + I4 + I5 - Math.Pow(I2, 2) / (IV + I2 + I1) - Math.Pow((I4 + I5), 2) / (I4 + I5 + I6)));
            U1 = U2 * I2 / (IV + I2 + I1) + EU * IV / (IV + I2 + I1);
            U3 = U2 * (I4 + I5) / (I4 + I5 + I6);

            U2 = Math.Round(U2, 3);
            U1 = Math.Round(U1, 3);
            U3 = Math.Round(U3, 3);

            U1label.Text = "U1 = " + U1.ToString();
            U2label.Text = "U2 = " + U2.ToString();
            U3label.Text = "U3 = " + U3.ToString();
        }