コード例 #1
0
ファイル: 坐标转换.cs プロジェクト: FATspring/XYZ-BLH
        private void button8_Click(object sender, EventArgs e)
        {
            double CGCSa = 6378137.0, CGCSf = 1 / 298.257222101;
            double CGCSb = CGCSa * (1 - CGCSf);
            double CGCSe = Math.Sqrt(CGCSa * CGCSa - CGCSb * CGCSb) / CGCSa;
            double CGCSe1 = Math.Sqrt(CGCSa * CGCSa - CGCSb * CGCSb) / CGCSb;
            double B, L, H, X, Y, Z;

            X = double.Parse(textBox10.Text);
            Y = double.Parse(textBox11.Text);
            Z = double.Parse(textBox12.Text);
            double CGCSu = Math.Atan((CGCSa * Z) / (CGCSb * Math.Sqrt(X * X + Y * Y)));

            B = Math.Atan((Z + CGCSe1 * CGCSe1 * CGCSb * Math.Pow(Math.Sin(CGCSu), 3)) / (Math.Sqrt(X * X + Y * Y) - CGCSe * CGCSe * CGCSa * Math.Pow(Math.Cos(CGCSu), 3)));
            L = Math.Atan2(Y, X);
            double WGSw = Math.Sqrt(1 - Math.Pow(CGCSe * Math.Sin(B), 2));
            double WGSn = CGCSa / WGSw;

            H = Math.Sqrt(X * X + Y * Y) / Math.Cos(B) - WGSn;
            B = B * 180 / Math.PI;
            L = L * 180 / Math.PI;
            double B1, B2, B3;

            B1 = Math.Truncate(B);
            B2 = Math.Truncate((B - B1) * 60);
            B3 = ((B - B1) * 60 - B2) * 60;
            string strB = B1.ToString() + '.' + B2.ToString() + B3.ToString("f6");
            double L1, L2, L3;

            L1 = Math.Truncate(L);
            L2 = Math.Truncate((L - L1) * 60);
            L3 = ((L - L1) * 60 - L2) * 60;
            string strL = L1.ToString() + '.' + L2.ToString() + L3.ToString("f6");

            textBox4.Text = strB;
            textBox5.Text = strL;
            textBox6.Text = H.ToString("f4");
        }
コード例 #2
0
ファイル: 坐标转换.cs プロジェクト: FATspring/XYZ-BLH
        private void button6_Click(object sender, EventArgs e)
        {
            double WGSa = 6378137.0, WGSb = 6356752.3;
            double WGSe = Math.Sqrt(WGSa * WGSa - WGSb * WGSb) / WGSa;
            double WGSe1 = Math.Sqrt(WGSa * WGSa - WGSb * WGSb) / WGSb;
            double B, L, H, X, Y, Z;

            X = double.Parse(textBox7.Text);
            Y = double.Parse(textBox8.Text);
            Z = double.Parse(textBox9.Text);
            double WGSu = Math.Atan((WGSa * Z) / (WGSb * Math.Sqrt(X * X + Y * Y)));

            B = Math.Atan((Z + WGSe1 * WGSe1 * WGSb * Math.Pow(Math.Sin(WGSu), 3)) / (Math.Sqrt(X * X + Y * Y) - WGSe * WGSe * WGSa * Math.Pow(Math.Cos(WGSu), 3)));
            L = Math.Atan2(Y, X);
            double WGSw = Math.Sqrt(1 - Math.Pow(WGSe * Math.Sin(B), 2));
            double WGSn = WGSa / WGSw;

            H = Math.Sqrt(X * X + Y * Y) / Math.Cos(B) - WGSn;
            B = B * 180 / Math.PI;
            L = L * 180 / Math.PI;
            double B1, B2, B3;

            B1 = Math.Truncate(B);
            B2 = Math.Truncate((B - B1) * 60);
            B3 = ((B - B1) * 60 - B2) * 60;
            string strB = B1.ToString() + '.' + B2.ToString() + B3.ToString("f6");
            double L1, L2, L3;

            L1 = Math.Truncate(L);
            L2 = Math.Truncate((L - L1) * 60);
            L3 = ((L - L1) * 60 - L2) * 60;
            string strL = L1.ToString() + '.' + L2.ToString() + L3.ToString("f6");

            textBox1.Text = strB;
            textBox2.Text = strL;
            textBox3.Text = H.ToString("f4");
        }
コード例 #3
0
        private void frm_PSC_CG_Load(object sender, EventArgs e)
        {
            dgv.Rows.Clear();

            dgv.Rows.Add("Distance (m)",
                         L1.ToString("f3"),
                         L2.ToString("f3"),
                         L3.ToString("f3"),
                         L4.ToString("f3"),
                         L5.ToString("f3"),
                         L6.ToString("f3"),
                         L7.ToString("f3"),
                         L8.ToString("f3"),
                         L9.ToString("f3"));

            dgv.Rows.Add("Cable 'e' (mm)",
                         Cable_E.F1.ToString("f3"),
                         Cable_E.F2.ToString("f3"),
                         Cable_E.F3.ToString("f3"),
                         Cable_E.F4.ToString("f3"),
                         Cable_E.F5.ToString("f3"),
                         Cable_E.F6.ToString("f3"),
                         Cable_E.F7.ToString("f3"),
                         Cable_E.F8.ToString("f3"),
                         Cable_E.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'd' (mm)",
                         Cable_D.F1.ToString("f3"),
                         Cable_D.F2.ToString("f3"),
                         Cable_D.F3.ToString("f3"),
                         Cable_D.F4.ToString("f3"),
                         Cable_D.F5.ToString("f3"),
                         Cable_D.F6.ToString("f3"),
                         Cable_D.F7.ToString("f3"),
                         Cable_D.F8.ToString("f3"),
                         Cable_D.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'c' (mm)",
                         Cable_C.F1.ToString("f3"),
                         Cable_C.F2.ToString("f3"),
                         Cable_C.F3.ToString("f3"),
                         Cable_C.F4.ToString("f3"),
                         Cable_C.F5.ToString("f3"),
                         Cable_C.F6.ToString("f3"),
                         Cable_C.F7.ToString("f3"),
                         Cable_C.F8.ToString("f3"),
                         Cable_C.F9.ToString("f3"));


            dgv.Rows.Add("Cable 'b' (mm)",
                         Cable_B.F1.ToString("f3"),
                         Cable_B.F2.ToString("f3"),
                         Cable_B.F3.ToString("f3"),
                         Cable_B.F4.ToString("f3"),
                         Cable_B.F5.ToString("f3"),
                         Cable_B.F6.ToString("f3"),
                         Cable_B.F7.ToString("f3"),
                         Cable_B.F8.ToString("f3"),
                         Cable_B.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'a' (mm)",
                         Cable_A.F1.ToString("f3"),
                         Cable_A.F2.ToString("f3"),
                         Cable_A.F3.ToString("f3"),
                         Cable_A.F4.ToString("f3"),
                         Cable_A.F5.ToString("f3"),
                         Cable_A.F6.ToString("f3"),
                         Cable_A.F7.ToString("f3"),
                         Cable_A.F8.ToString("f3"),
                         Cable_A.F9.ToString("f3"));

            //Average
            Cable_CG = ((Cable_A + Cable_B + Cable_C + Cable_D + Cable_E) / 5.0);


            dgv.Rows.Add("CG",
                         Cable_CG.F1.ToString("f3"),
                         Cable_CG.F2.ToString("f3"),
                         Cable_CG.F3.ToString("f3"),
                         Cable_CG.F4.ToString("f3"),
                         Cable_CG.F5.ToString("f3"),
                         Cable_CG.F6.ToString("f3"),
                         Cable_CG.F7.ToString("f3"),
                         Cable_CG.F8.ToString("f3"),
                         Cable_CG.F9.ToString("f3"));


            dgv.Rows[0].ReadOnly = true;
            dgv.Rows[0].Frozen   = true;
            dgv.Rows[0].DefaultCellStyle.ForeColor = Color.Blue;

            dgv.Rows[6].ReadOnly = true;
            dgv.Rows[6].Frozen   = true;
            dgv.Rows[6].DefaultCellStyle.ForeColor = Color.Blue;
        }
コード例 #4
0
ファイル: Form32.cs プロジェクト: Minteger/gts3v4
        public void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Hpl = Convert.ToDouble(textBox1.Text.Replace('.', ','));
                H1  = Convert.ToDouble(textBox2.Text.Replace('.', ','));
                h0  = Convert.ToDouble(textBox4.Text.Replace('.', ','));
                d0  = Convert.ToDouble(textBox3.Text.Replace('.', ','));

                b   = Convert.ToDouble(textBox8.Text.Replace('.', ','));
                m1  = Convert.ToDouble(textBox7.Text.Replace('.', ','));
                m2  = Convert.ToDouble(textBox6.Text.Replace('.', ','));
                Kt  = Convert.ToDouble(textBox5.Text.Replace('.', ','));
                Ke  = Convert.ToDouble(textBox41.Text.Replace('.', ','));
                tzv = Convert.ToDouble(textBox44.Text.Replace('.', ','));
                tzn = Convert.ToDouble(textBox43.Text.Replace('.', ','));

                E = Convert.ToDouble(textBox9.Text.Replace('.', ','));

                delta_v = Convert.ToDouble(textBox39.Text.Replace('.', ','));
                delta_n = Convert.ToDouble(textBox40.Text.Replace('.', ','));
            }
            catch
            {
                MessageBox.Show("Введите корректные данные");
            }


            delta_sr = (delta_n + delta_v) / 2;
            tzsr     = (tzn + tzv) / 2;
            teta     = Math.Atan(m1);
            n        = Kt / Ke;
            z0       = delta_sr * Math.Cos(teta);



            h2isk = 0;
            do
            {
                h2isk += 0.001f;
                Lisk   = (Hpl - h2isk) * m1 + b + m2 * Hpl - (delta_sr + tzsr) / Math.Sin(teta);
                h1isk  = Lisk / m2 - Math.Sqrt(Math.Pow(Lisk, 2) / Math.Pow(m2, 2) - Math.Pow(h2isk - h0, 2)) + h0;
                F1     = (Math.Pow(h2isk, 2) - Math.Pow(h1isk, 2)) / (2 * (Lisk - m2 * h1isk));
                F2     = (Math.Pow(H1, 2) - Math.Pow(h2isk, 2) - Math.Pow(z0, 2)) / (2 * delta_sr * n * Math.Sin(teta));
            }while (F1 < F2);   //находим h2 при пересечении функций



            h23 = 1.3f * h2isk;
            h22 = h2isk;
            h21 = 0.7f * h2isk;

            L1 = (Hpl - h21) * m1 + b + m2 * Hpl - (delta_sr + tzsr) / Math.Sin(teta);
            L2 = (Hpl - h22) * m1 + b + m2 * Hpl - (delta_sr + tzsr) / Math.Sin(teta);
            L3 = (Hpl - h23) * m1 + b + m2 * Hpl - (delta_sr + tzsr) / Math.Sin(teta);

            h11 = L1 / m2 - Math.Sqrt(Math.Pow(L1, 2) / Math.Pow(m2, 2) - Math.Pow(h21 - h0, 2)) + h0;
            h12 = L2 / m2 - Math.Sqrt(Math.Pow(L2, 2) / Math.Pow(m2, 2) - Math.Pow(h22 - h0, 2)) + h0;
            h13 = L3 / m2 - Math.Sqrt(Math.Pow(L3, 2) / Math.Pow(m2, 2) - Math.Pow(h23 - h0, 2)) + h0;

            F11 = (Math.Pow(h21, 2) - Math.Pow(h11, 2)) / (2 * (L1 - m2 * h11));
            F12 = (Math.Pow(h22, 2) - Math.Pow(h12, 2)) / (2 * (L2 - m2 * h12));
            F13 = (Math.Pow(h23, 2) - Math.Pow(h13, 2)) / (2 * (L3 - m2 * h13));

            F21 = (Math.Pow(H1, 2) - Math.Pow(h21, 2) - Math.Pow(z0, 2)) / (2 * delta_sr * n * Math.Sin(teta));
            F22 = (Math.Pow(H1, 2) - Math.Pow(h22, 2) - Math.Pow(z0, 2)) / (2 * delta_sr * n * Math.Sin(teta));
            F23 = (Math.Pow(H1, 2) - Math.Pow(h23, 2) - Math.Pow(z0, 2)) / (2 * delta_sr * n * Math.Sin(teta));    //данные для таблицы



            qt = (Kt * (Math.Pow(h2isk, 2) - Math.Pow(h1isk, 2))) / (2 * (Lisk - m2 * h1isk));
            H  = H1 - h0;


            x1 = 0;
            x6 = Lisk - m2 * h1isk;
            x2 = x1 + (x6 - x1) / 5;
            x3 = x2 + (x6 - x1) / 5;
            x4 = x3 + (x6 - x1) / 5;
            x5 = x4 + (x6 - x1) / 5;



            r1 = Math.Round((2 * qt * x1) / Kt, 2);
            r2 = Math.Round((2 * qt * x2) / Kt, 2);
            r3 = Math.Round((2 * qt * x3) / Kt, 2);
            r4 = Math.Round((2 * qt * x4) / Kt, 2);
            r5 = Math.Round((2 * qt * x5) / Kt, 2);
            r6 = Math.Round((2 * qt * x6) / Kt, 2);


            yq1 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x1;
            yq2 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x2;
            yq3 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x3;
            yq4 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x4;
            yq5 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x5;
            yq6 = Math.Pow(h2isk, 2) - (2 * qt / Kt) * x6;

            x1 = Math.Round(x1, 2);
            x2 = Math.Round(x2, 2);
            x3 = Math.Round(x3, 2);
            x4 = Math.Round(x4, 2);
            x5 = Math.Round(x5, 2);
            x6 = Math.Round(x6, 2);


            y1 = Math.Round(Math.Sqrt(yq1), 2);
            y2 = Math.Round(Math.Sqrt(yq2), 2);
            y3 = Math.Round(Math.Sqrt(yq3), 2);
            y4 = Math.Round(Math.Sqrt(yq4), 2);
            y5 = Math.Round(Math.Sqrt(yq5), 2);
            y6 = Math.Round(Math.Sqrt(yq6), 2);

            yq1 = Math.Round(yq1, 2);
            yq2 = Math.Round(yq2, 2);
            yq3 = Math.Round(yq3, 2);
            yq4 = Math.Round(yq4, 2);
            yq5 = Math.Round(yq5, 2);
            yq6 = Math.Round(yq6, 2);


            h2isk    = Math.Round(h2isk, 2);
            h1isk    = Math.Round(h1isk, 2);
            Lisk     = Math.Round(Lisk, 2);
            qt       = Math.Round(qt, 5);
            tzsr     = Math.Round(tzsr, 2);
            delta_sr = Math.Round(delta_sr, 2);

            h21 = Math.Round(h21, 2);
            h22 = Math.Round(h22, 2);
            h23 = Math.Round(h23, 2);

            L1 = Math.Round(L1, 2);
            L2 = Math.Round(L2, 2);
            L3 = Math.Round(L3, 2);

            h11 = Math.Round(h11, 2);
            h12 = Math.Round(h12, 2);
            h13 = Math.Round(h12, 2);

            F11 = Math.Round(F11, 2);
            F12 = Math.Round(F12, 2);
            F13 = Math.Round(F13, 2);

            F21 = Math.Round(F21, 2);
            F22 = Math.Round(F22, 2);
            F23 = Math.Round(F23, 2);


            textBox47.Text = h21.ToString();
            textBox48.Text = h22.ToString();
            textBox49.Text = h23.ToString();

            textBox52.Text = L1.ToString();
            textBox51.Text = L2.ToString();
            textBox50.Text = L3.ToString();

            textBox55.Text = h11.ToString();
            textBox54.Text = h12.ToString();
            textBox53.Text = h13.ToString();

            textBox58.Text = F11.ToString();
            textBox57.Text = F12.ToString();
            textBox56.Text = F13.ToString();

            textBox61.Text = F21.ToString();
            textBox60.Text = F22.ToString();
            textBox59.Text = F23.ToString();



            textBox34.Text = h1isk.ToString();
            textBox45.Text = h2isk.ToString();
            textBox35.Text = Lisk.ToString();
            textBox36.Text = qt.ToString();
            textBox42.Text = delta_sr.ToString();
            textBox46.Text = tzsr.ToString();

            textBox10.Text = x1.ToString();
            textBox11.Text = x2.ToString();
            textBox12.Text = x3.ToString();
            textBox13.Text = x4.ToString();
            textBox14.Text = x5.ToString();
            textBox15.Text = x6.ToString();

            textBox21.Text = r1.ToString();
            textBox20.Text = r2.ToString();
            textBox19.Text = r3.ToString();
            textBox18.Text = r4.ToString();
            textBox17.Text = r5.ToString();
            textBox16.Text = r6.ToString();

            textBox27.Text = yq1.ToString();
            textBox26.Text = yq2.ToString();
            textBox25.Text = yq3.ToString();
            textBox24.Text = yq4.ToString();
            textBox23.Text = yq5.ToString();
            textBox22.Text = yq6.ToString();

            textBox33.Text = y1.ToString();
            textBox32.Text = y2.ToString();
            textBox31.Text = y3.ToString();
            textBox30.Text = y4.ToString();
            textBox29.Text = y5.ToString();
            textBox28.Text = y6.ToString();

            linkLabel1.Enabled = true;
            linkLabel3.Enabled = true;
            linkLabel5.Enabled = true;
            linkLabel4.Enabled = true;
            linkLabel6.Enabled = true;
            linkLabel7.Enabled = true;
        }