コード例 #1
0
        private void GenerateCosOnStepApperture(CVector i_a, CVector m_a, double delta) //i_a, m_a - двумерные вектора, связанные с плоскостью апертуры)
        {
            CVector[] VectorI  = new CVector[Count];
            CVector[] VectorM  = new CVector[Count];
            Point3D[] Segments = new Point3D[Count];
            double[]  Square   = new double[Count];

            double xlen = XMax - XMin;
            double ylen = YMax - YMin;
            double zlen = ZMax - ZMin;

            double Ra = 0;

            if (xlen >= ylen && xlen >= zlen)
            {
                Ra = xlen / 2;
            }
            else if (ylen >= zlen)
            {
                Ra = ylen / 2;
            }
            else
            {
                Ra = zlen / 2;
            }


            for (int p = 0; p < Count; p++)
            {
                Point3D position = this[p].Center;
                DVector n        = this[p].Norma;

                DVector ran = new DVector(1, 0, 0);
                if (DVector.IsEqual(n, ran, 4) || DVector.IsEqual((-1) * n, ran, 4))
                {
                    ran = new DVector(0, 1, 0);
                }
                //базисные вектора в плоскости апертуры
                DVector e_u = DVector.Cross(n, ran);
                e_u.Normalize();
                DVector e_v = DVector.Cross(n, e_u);
                e_v.Normalize();



                double  c1 = (1 + delta * Math.Cos(Math.PI * Point3D.Distance(position, this.Center) / Ra)) / (1 + delta);
                CVector i  = c1 * (i_a.X * e_u + i_a.Y * e_v);
                CVector m  = c1 * (m_a.X * e_u + m_a.Y * e_v);

                VectorI[p]  = i;
                VectorM[p]  = m;
                Segments[p] = this[p].Center;
                Square[p]   = this[p].Area;
            }

            ApertureCurrent = new Current(VectorI, VectorM, Segments, Square);
            //electricCurrent = new Current(VectorI, Segments);
            //magneticCurrent = new Current(VectorM, Segments);
        }
コード例 #2
0
        public static DVector GetUVector(DVector n)
        {
            DVector ran = new DVector(1, 0, 0);

            if (DVector.IsEqual(n, ran, 4) || DVector.IsEqual((-1) * n, ran, 4))
            {
                ran = new DVector(0, 1, 0);
            }

            DVector e_u = DVector.Cross(n, ran);

            e_u.Normalize();
            return(e_u);
        }
コード例 #3
0
        private void SquareCalc()
        {
            //double a = Math.Sqrt(Math.Pow(V2.X - V1.X, 2) + Math.Pow(V2.Y - V1.Y, 2) + Math.Pow(V2.Z - V1.Z, 2));
            //double b = Math.Sqrt(Math.Pow(V3.X - V2.X, 2) + Math.Pow(V3.Y - V2.Y, 2) + Math.Pow(V3.Z - V2.Z, 2));
            //double c = Math.Sqrt(Math.Pow(V1.X - V3.X, 2) + Math.Pow(V1.Y - V3.Y, 2) + Math.Pow(V1.Z - V3.Z, 2));
            //double p = (a + b + c) / 2;

            DVector ab = new DVector(V2.X - V1.X, V2.Y - V1.Y, V2.Z - V1.Z);
            DVector ac = new DVector(V3.X - V1.X, V3.Y - V1.Y, V3.Z - V1.Z);

            //DVector val =
            Square = 0.5d * DVector.Cross(ab, ac).Module;
            //Square = Math.Sqrt((p - a) * (p - b) * (p - c) * p);
            //double diff = Square - sq;
            //MessageBox.Show("" + diff);
        }
コード例 #4
0
        public static Tuple <CVector, CVector> GetPolarizationCurrents(string changedPolarizatioin, string distribution)
        {
            //polarization detection
            //var d = DictionaryLibrary.PolarizationNames;
            //int polarization = d.FirstOrDefault(x => x.Value == changedPolarizatioin).Key;

            //set currents
            CVector electricCurrent = null;
            CVector magneticCurrent = null;

            if (distribution == "Постоянное поле" || distribution == "Косинус на пьедестале")
            {
                //ortogonal and parallel vectors detection
                double xlength = Logic.Instance.Antenna.XMax - Logic.Instance.Antenna.XMin;
                double ylength = Logic.Instance.Antenna.YMax - Logic.Instance.Antenna.YMin;
                double zlength = Logic.Instance.Antenna.ZMax - Logic.Instance.Antenna.ZMin;

                DVector probeVector;
                if (xlength > ylength)
                {
                    if (xlength > zlength)
                    {
                        probeVector = new DVector(1, 0, 0);
                    }
                    else
                    {
                        probeVector = new DVector(0, 0, 1);
                    }
                }
                else
                {
                    if (ylength > zlength)
                    {
                        probeVector = new DVector(0, 1, 0);
                    }
                    else
                    {
                        probeVector = new DVector(0, 0, 1);
                    }
                }

                DVector normaVector     = Logic.Instance.Antenna[0].Norma;
                DVector ortogonalVector = DVector.Cross(probeVector, normaVector);
                ortogonalVector.Normalize();
                DVector parallelVector = DVector.Cross(ortogonalVector, normaVector);
                parallelVector.Normalize();



                if (changedPolarizatioin == "Поляризация А")
                {
                    electricCurrent = new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0));
                    magneticCurrent = CV.Z_0 * new CVector(new Complex(ortogonalVector.X, 0), new Complex(ortogonalVector.Y, 0), new Complex(ortogonalVector.Z, 0));
                }
                else if (changedPolarizatioin == "Поляризация Б")
                {
                    electricCurrent = new CVector(new Complex(-ortogonalVector.X, 0), new Complex(-ortogonalVector.Y, 0), new Complex(-ortogonalVector.Z, 0));
                    magneticCurrent = CV.Z_0 * new CVector(new Complex(parallelVector.X, 0), new Complex(parallelVector.Y, 0), new Complex(parallelVector.Z, 0));
                }
                else if (changedPolarizatioin == "Круговая поляризация А")
                {
                    //!!!! запланировано, не работает
                    electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                    magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                }
                else if (changedPolarizatioin == "Круговая поляризация Б")
                {
                    //!!!!запланировано, не работает
                    electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                    magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                }
                else if (changedPolarizatioin == "Пользовательская")
                {
                    //!!!!запланировано, не работает
                    electricCurrent = new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                    magneticCurrent = CV.Z_0 * new CVector(new Complex(0, 0), new Complex(0, 0), new Complex(0, 0));
                }
            }
            else if (distribution == "Загрузить из файла")
            {
                int    count    = I.Length;
                double max      = I[0].Modulus;
                int    maxIndex = 0;
                for (int i = 1; i < count; i++)
                {
                    if (I[i].Modulus > max)
                    {
                        maxIndex = i;
                        max      = I[i].Modulus;
                    }
                }


                if (changedPolarizatioin == "Поляризация А")
                {
                    electricCurrent = I[maxIndex];
                    magneticCurrent = M[maxIndex];
                }
                else if (changedPolarizatioin == "Поляризация Б")
                {
                    electricCurrent = I[maxIndex];
                    magneticCurrent = M[maxIndex];

                    electricCurrent = Current.ChangeLoadedCurrentAnlorithm(electricCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90);
                    magneticCurrent = Current.ChangeLoadedCurrentAnlorithm(magneticCurrent, Logic.Instance.Antenna[maxIndex].Norma, 90);
                }
            }
            return(new Tuple <CVector, CVector>(electricCurrent, magneticCurrent));
        }
コード例 #5
0
        public DVector GetPolarization(double thetaG, double phiG)
        {
            double x = Math.Sin(thetaG * Math.PI / 180) * Math.Cos(phiG * Math.PI / 180);
            double y = Math.Sin(thetaG * Math.PI / 180) * Math.Sin(phiG * Math.PI / 180);
            double z = Math.Cos(thetaG * Math.PI / 180);

            DVector J = new DVector(x - Center.X, y - Center.Y, z - Center.Z);

            J.Normalize();
            DVector n = new DVector(this[0].Norma);

            n.Normalize();

            DVector e_u = Aperture.GetUVector(n);
            DVector e_v = Aperture.GetVVector(n);

            Complex i_u = CVector.Scal(ApertureCurrent.I[0].CVector, e_u);
            Complex i_v = CVector.Scal(ApertureCurrent.I[0].CVector, e_v);

            DVector e_y = i_v.Magnitude * e_v + i_u.Magnitude * e_u;
            DVector e_x = DVector.Cross(e_y, n);

            e_x.Normalize();
            e_y.Normalize();

            double J_zLoc = DVector.Scal(J, n);

            if (J_zLoc > 1)
            {
                J_zLoc = 1;
            }
            if (J_zLoc < -1)
            {
                J_zLoc = -1;
            }

            double thetaLoc = Math.Acos(J_zLoc);               // угол theta в локальной системе координат, в радианах

            double J_xLoc = DVector.Scal(e_x, J);

            if (J_xLoc > 1)
            {
                J_xLoc = 1;
            }
            double J_yLoc = DVector.Scal(e_y, J);

            if (J_yLoc > 1)
            {
                J_yLoc = 1;
            }

            double phiLoc = Math.Atan2(J_yLoc, J_xLoc);

            DVector e_phiLoc = DVector.Cross(n, J_xLoc * e_x + J_yLoc * e_y);

            e_phiLoc.Normalize();
            DVector e_thetaLoc = DVector.Cross(e_phiLoc, J);

            e_thetaLoc.Normalize();

            DVector p = (Math.Cos(thetaLoc) + 1) * Math.Sin(phiLoc) * e_thetaLoc + (1 + Math.Cos(thetaLoc)) * Math.Cos(phiLoc) * e_phiLoc;

            p.Normalize();
            return(p);
        }