Esempio n. 1
0
        public void EfieldCalTest8()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                   // TODO: 初始化为适当的值
            double frequency   = 1000;                // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);  // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, -1, 0); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                // TODO: 初始化为适当的值
            EField expected    = new EField();        // TODO: 初始化为适当的值

            expected.X.Re = -0.867524790988055;
            expected.X.Im = 3.77457292114235;
            expected.Y.Re = -0.867524790988055;
            expected.Y.Im = 3.77457292114236;
            expected.Z.Re = 2.11128514574735;
            expected.Z.Im = -9.18613487791125;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 2
0
        public void EfieldCalTest9()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                                 // TODO: 初始化为适当的值
            double frequency   = 1000;                              // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);                // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, Math.Sqrt(3) / 3, 0); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                              // TODO: 初始化为适当的值
            EField expected    = new EField();                      // TODO: 初始化为适当的值

            expected.X.Re = -1.95443401965821;
            expected.X.Im = -2.72583705727299;
            expected.Y.Re = 3.38517902208908;
            expected.Y.Im = 4.72128827635085;
            expected.Z.Re = -6.72668373552254;
            expected.Z.Im = -9.38166426413794;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 3
0
        public void EfieldCalTest11()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                  // TODO: 初始化为适当的值
            double frequency   = 1000;               // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0); // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, 0, 1); // TODO: 初始化为适当的值
            Point  rotateAngle = null;               // TODO: 初始化为适当的值
            EField expected    = new EField();       // TODO: 初始化为适当的值

            expected.X.Re = -1.05564268913923;
            expected.X.Im = 4.59306794482337;
            expected.Y.Re = -1.22686532511019;
            expected.Y.Im = 5.33805221724575;
            expected.Z.Re = 1.05564268913923;
            expected.Z.Im = -4.59306794482337;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 4
0
        public PowerTest()
        {
            StreamReader sr = new StreamReader(@"C:\Users\wangnan\Desktop\EMC_Project\FinalCode6\1st_ctrl\WI_Wrapper\TestForCal\bin\Debug\HalfWaveDipole.uan");
            string       s2 = sr.ReadToEnd();

            ReadUan.GetGainPara(s2);
        }
Esempio n. 5
0
        static Plural Atheta(string uan, double power, Point originPoint, Point targetPoint)
        {
            //List<string> thetaGain = new List<string>();  //这四个数组的值以后从uan格式的天线文件中获取
            //List<string> phiGain = new List<string>();
            //List<string> thetaPhase = new List<string>();
            //List<string> phiPhase = new List<string>();
            //          ReadUan.GetGainPara(uan);
            Plural Atheta = new Plural();

            if (ReadUan.thetaGain.Count < 10)
            {
                return(Atheta);

                throw new Exception("Could not get the value of Antenna thetaGain!");
            }
            else
            {
                try
                {
                    int    row   = (ReadUan.GetPhiAngle(originPoint, targetPoint)) * 181 + ReadUan.GetThetaAngle(originPoint, targetPoint);
                    double A     = Math.Sqrt(60 * power * Math.Abs(Math.Pow(10, Convert.ToDouble(ReadUan.thetaGain[row]) / 10)));
                    Plural theta = new Plural(Math.Cos(Math.PI / 180 * Convert.ToDouble(ReadUan.thetaPhase[row])),
                                              Math.Sin(Math.PI / 180 * Convert.ToDouble(ReadUan.thetaPhase[row])));
                    Atheta = Plural.PluralMultiplyDouble(theta, A);
                    //Console.WriteLine("theta="+ReadUan .GetThetaAngle (originPoint ,targetPoint )+" phi="+ReadUan .GetPhiAngle (originPoint ,targetPoint ));
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
                return(Atheta);
            }
        }
Esempio n. 6
0
        public void EfieldCalTest12()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                                 // TODO: 初始化为适当的值
            double frequency   = 1000;                              // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);                // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, 0, Math.Sqrt(3) / 3); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                              // TODO: 初始化为适当的值
            EField expected    = new EField();                      // TODO: 初始化为适当的值

            expected.X.Re = 2.9127396218559;
            expected.X.Im = 4.06237996247662;
            expected.Y.Re = 3.90886803931641;
            expected.Y.Im = 5.45167411454598;
            expected.Z.Re = -5.04501301427337;
            expected.Z.Im = -7.03624849465925;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 7
0
        //求得电场的xyz方向的量
        public static EField EfieldCal(string uan, double power1, double frequency, Point originPoint, Point targetPoint, Point rotateAngle = null)
        {
            double power = power1;     //传入的power1单位是dBm,转换为单位为瓦的power
            //      ReadUan.GetGainPara(uan);
            Plural Etheta = DirectEThetaCal(uan, power, frequency, originPoint, targetPoint, rotateAngle);
            Plural Ephi   = DirectEPhiCal(uan, power, frequency, originPoint, targetPoint, rotateAngle);
            //        double The = ReadUan.GetThetaAngle(originPoint, targetPoint) * Math.PI / 180.0;
            //        double Ph = ReadUan.GetPhiAngle(originPoint, targetPoint) * Math.PI / 180.0;
            EField e          = new EField();
            double thetaAngle = Convert.ToInt32(ReadUan.GetThetaAngle(originPoint, targetPoint));
            double phiAngle   = Convert.ToInt32(ReadUan.GetPhiAngle(originPoint, targetPoint));
            double Xtheta     = Math.Cos(thetaAngle * Math.PI / 180.0) * Math.Cos(phiAngle / 180 * Math.PI);
            double Xphi       = Math.Sin(ReadUan.GetPhiAngle(originPoint, targetPoint) * Math.PI / 180.0);
            double Ytheta     = Math.Cos(thetaAngle * Math.PI / 180.0) * Math.Sin(phiAngle / 180 * Math.PI);
            double Yphi       = Math.Cos(phiAngle * Math.PI / 180.0);
            double Ztheta     = Math.Sin(thetaAngle * Math.PI / 180.0);
            double Zphi       = 0;

            e.X = Plural.PluralMultiplyDouble(Etheta, Xtheta) - Plural.PluralMultiplyDouble(Ephi, Xphi);
            e.Y = Plural.PluralMultiplyDouble(Etheta, Ytheta) + Plural.PluralMultiplyDouble(Ephi, Yphi);
            e.Z = Plural.PluralMultiplyDouble(Ephi, Zphi) - Plural.PluralMultiplyDouble(Etheta, Ztheta);
            //string pathtest = "D:\\renwu\\"+DateTime.Today.ToString("yy/MM/dd")+".txt";
            //File.WriteAllText(pathtest, e.X.Re + "  " + e.X.Im + "|  " + e.Y.Re + "  " + e.Y.Im + "|  " + e.Z.Re + "  " + e.Z.Im);
            //需添加计算方法
            return(e);
        }
Esempio n. 8
0
        public void EfieldCalTest13()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                             // TODO: 初始化为适当的值
            double frequency   = 1000;                          // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);            // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, 0, Math.Sqrt(3)); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                          // TODO: 初始化为适当的值
            EField expected    = new EField();                  // TODO: 初始化为适当的值

            expected.X.Re = -1.44299978225551;
            expected.X.Im = 2.4993489381773;
            expected.Y.Re = -1.93649167310375;
            expected.Y.Im = 3.35410196624966;
            expected.Z.Re = 0.833116312725791;
            expected.Z.Im = -1.44299978225547;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 9
0
        public void EfieldCalTest15()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                             // TODO: 初始化为适当的值
            double frequency   = 1000;                          // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);            // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, 1, Math.Sqrt(2)); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                          // TODO: 初始化为适当的值
            EField expected    = new EField();                  // TODO: 初始化为适当的值

            expected.X.Re = 0.191101863744437;
            expected.X.Im = -0.330998137426465;
            expected.Y.Re = -2.54751092378142;
            expected.Y.Im = 4.41241835282609;
            expected.Z.Re = 1.66623282560157;
            expected.Z.Im = -2.88599991118093;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 10
0
        //从传入的文件中提取发射机点
        //public static double TxFrequence;
        // public static double TxFrequenceWideth;
        /// <summary>
        ///从传入的文件中提取发射机点
        /// </summary>
        public static List <Node> GetTx(string txpath, string setup, string terpath)
        {
            List <Node>     txnode = new List <Node>();
            List <TxObject> txs    = TxReader(txpath);
            Node            temp;

            for (int i = 0; i < txs.Count; i++)
            {
                temp            = new Node();
                temp.IsEnd      = false;
                temp.IsReceiver = false;
                temp.LayNum     = 1;
                temp.NodeStyle  = NodeStyle.Tx;
                temp.Position   = new Point(txs[i].Lc.vertical[0], txs[i].Lc.vertical[1], txs[i].Lc.vertical[2]);
                temp.Position.Z = (txs[i].Lc.vertical[2] + txs[i].cubesize);
                temp.TxNum      = txs[i].num;
                temp.Power      = (txs[i].at.power);
                temp.NodeName   = txs[i].name;
                //加从setup文件中获取的频率函数、UAN
                //temp.frequence = GetTxCarrierFrequence(txs[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                //TxFrequence = temp.frequence;
                //temp.FrequenceWidth = GetWidth(txs[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                //TxFrequenceWideth = temp.FrequenceWidth;
                temp.UAN    = ReadUan.GetUan(txs[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                temp.Height = txs[i].cubesize;
                txnode.Add(temp);
            }
            return(txnode);
        }
Esempio n. 11
0
        public void EfieldCalTest1()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                  // TODO: 初始化为适当的值
            double frequency   = 1000;               // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0); // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, 0, 0); // TODO: 初始化为适当的值
            Point  rotateAngle = null;               // TODO: 初始化为适当的值
            EField expected    = new EField();       // TODO: 初始化为适当的值

            expected.X.Re = 0;
            expected.X.Im = 0;
            expected.Y.Re = -3.8729833462074;
            expected.Y.Im = -6.70820393249938;
            expected.Z.Re = 6.66493056834915;
            expected.Z.Im = 11.5439983732997;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 12
0
        public void EfieldCalTest10()
        {
            string uan = uanstr; // TODO: 初始化为适当的值

            ReadUan.GetGainPara(uan);
            double power1      = 1;                             // TODO: 初始化为适当的值
            double frequency   = 1000;                          // TODO: 初始化为适当的值
            Point  originPoint = new Point(0, 0, 0);            // TODO: 初始化为适当的值
            Point  targetPoint = new Point(1, Math.Sqrt(3), 0); // TODO: 初始化为适当的值
            Point  rotateAngle = null;                          // TODO: 初始化为适当的值
            EField expected    = new EField();                  // TODO: 初始化为适当的值

            expected.X.Re = 1.67705098312488;
            expected.X.Im = -2.90473750965554;
            expected.Y.Re = -0.968245836551877;
            expected.Y.Im = 1.67705098312483;
            expected.Z.Re = 3.33246528417467;
            expected.Z.Im = -5.77199918664981;
            EField actual;

            actual = DirectEfieldCal.EfieldCal(uan, power1, frequency, originPoint, targetPoint, rotateAngle);
            Assert.IsTrue((Math.Abs(expected.X.Re - actual.X.Re) < 0.00001) && (Math.Abs(expected.X.Im - actual.X.Im) < 0.00001) &&
                          (Math.Abs(expected.Y.Re - actual.Y.Re) < 0.00001) && (Math.Abs(expected.Y.Im - actual.Y.Im) < 0.00001) &&
                          (Math.Abs(expected.Z.Re - actual.Z.Re) < 0.00001) && (Math.Abs(expected.Z.Im - actual.Z.Im) < 0.00001));
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 13
0
        public PowerTest()
        {
            StreamReader sr = new StreamReader(@"C:\Users\wangnan\Desktop\新建文件夹\FinalCode6\1st_ctrl\WI_Wrapper\TestForCal\bin\Debug\");
            string       s2 = sr.ReadToEnd();

            ReadUan.GetGainPara(s2);
        }
Esempio n. 14
0
 /// <summary>
 /// 计算路径的损耗,延时,相位
 /// </summary>
 private void GetLossAndComponentOFPath(Path midpath)
 {
     midpath.pathloss = 10 * Math.Log10(midpath.node[0].Power / midpath.node[midpath.node.Count - 1].Power);
     midpath.Delay    = midpath.GetPathLength() / 300000000;
     midpath.thetaa   = ReadUan.GetThetaAngle(midpath.node[0].Position, midpath.node[1].Position);
     midpath.thetab   = ReadUan.GetThetaAngle(midpath.node[midpath.node.Count - 2].Position, midpath.node[midpath.node.Count - 1].Position);
     midpath.phia     = ReadUan.GetPhiAngle(midpath.node[0].Position, midpath.node[1].Position);
     midpath.phib     = ReadUan.GetPhiAngle(midpath.node[midpath.node.Count - 2].Position, midpath.node[midpath.node.Count - 1].Position);
 }
Esempio n. 15
0
        /// <summary>
        ///计算威胁度时,需要把其他的发射机也当接收机来算,从发射机文件中提取接收球
        /// </summary>
        public static List <List <ReceiveBall> > GetTxAsRx(string txpath, string setup, string terpath)
        {
            List <List <ReceiveBall> > TxAsRxBalls = new List <List <ReceiveBall> >();
            List <TxObject>            txForRx     = TxReader(txpath);

            for (int i = 0; i < txForRx.Count; i++)
            {
                Point lc = new Point(txForRx[i].Lc.vertical[0], txForRx[i].Lc.vertical[1], txForRx[i].Lc.vertical[2]);
                lc.Z = txForRx[i].Lc.vertical[2] + txForRx[i].cubesize;
                List <ReceiveBall> temp   = new List <ReceiveBall>();
                ReceiveBall        rxtemp = new ReceiveBall(lc, txForRx[i].num, txForRx[i].name);
                // rxtemp.frequence = GetTxCarrierFrequence(txForRx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                // rxtemp.FrequenceWidth = GetWidth(txForRx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                rxtemp.UAN  = ReadUan.GetUan(txForRx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                rxtemp.isTx = true;
                temp.Add(rxtemp);
                TxAsRxBalls.Add(temp);
            }
            return(TxAsRxBalls);
        }
Esempio n. 16
0
        public static EField EfieldCalSingle(string uan, double power1, double frequency, Point originPoint, Point targetPoint, Point rotateAngle = null)
        {
            double power = Math.Pow(10, (power1 - 30) / 10);     //传入的power1单位是dBm,转换为单位为瓦的power
//            ReadUan.GetGainPara(uan);

            Plural Etheta = DirectEThetaCal(uan, power, frequency, originPoint, targetPoint, rotateAngle);
            Plural Ephi   = DirectEPhiCal(uan, power, frequency, originPoint, targetPoint, rotateAngle);
            //double The = ReadUan.GetThetaAngle(originPoint, targetPoint) * Math.PI / 180.0;
            // double Ph = ReadUan.GetPhiAngle(originPoint, targetPoint) * Math.PI / 180.0;
            EField e      = new EField();
            int    Xtheta = Convert.ToInt32(Math.Cos(ReadUan.GetThetaAngle(originPoint, targetPoint) * Math.PI / 180.0) * Math.Cos(ReadUan.GetPhiAngle(originPoint, targetPoint) / 180 * Math.PI));
            double Xphi   = Convert.ToInt32(Math.Sin(ReadUan.GetPhiAngle(originPoint, targetPoint) * Math.PI / 180.0));
            double Ytheta = Convert.ToInt32(Math.Cos(ReadUan.GetThetaAngle(originPoint, targetPoint) * Math.PI / 180.0) * Math.Sin(ReadUan.GetPhiAngle(originPoint, targetPoint) / 180 * Math.PI));
            double Yphi   = Convert.ToInt32(Math.Cos(ReadUan.GetPhiAngle(originPoint, targetPoint) * Math.PI / 180.0));
            double Ztheta = Convert.ToInt32(Math.Sin(ReadUan.GetThetaAngle(originPoint, targetPoint) * Math.PI / 180.0));
            double Zphi   = 0;

            e.X = Plural.PluralMultiplyDouble(Etheta, Xtheta) - Plural.PluralMultiplyDouble(Ephi, Xphi);
            e.Y = Plural.PluralMultiplyDouble(Etheta, Ytheta) + Plural.PluralMultiplyDouble(Ephi, Yphi);
            e.Z = Plural.PluralMultiplyDouble(Ephi, Zphi) - Plural.PluralMultiplyDouble(Etheta, Ztheta);
            //需添加计算方法
            return(e);
        }
Esempio n. 17
0
        /// <summary>
        /// 计算每条路径的功率(王楠)
        /// </summary>
        /// <param name="Rx_uan">接收机UAN文件</param>
        /// <param name="finalNode">最后一个节点</param>
        /// <param name="parentNode">倒数第二个节点</param>
        /// <returns></returns>
        static public double[] GetPower(Node finalNode, Node parentNode)
        {
            //先计算前面的系数temp1
            double lamada = 300 / finalNode.Frequence;
            double temp1  = (Math.Pow(lamada, 2) * GetBeta(finalNode, parentNode)) / (8 * Math.PI * 377); //377是真空中的本征阻抗
            //在计算后面的模的平方
            EField totalE         = finalNode.TotalE;                                                     //获得接收点场强
            Point  finalPosition  = finalNode.Position;                                                   //获得接收点的位置
            Point  parentPosition = parentNode.Position;                                                  //上一节点的位置
            //用两点的位置信息确定天线的theta和phi方向的增益和相位。
            double ThetaAngle  = ReadUan.GetThetaAngle(parentPosition, finalPosition);                    //获得射线的theta角thetaAngle
            double phiAngle    = ReadUan.GetPhiAngle(parentPosition, finalPosition);                      //获得射线的phi角phiAngle
            int    index       = Convert.ToInt32(Math.Floor(phiAngle * 181 + ThetaAngle));                //将相应的index对应到读取UAN所形成的数组中
            double thetagain1  = Convert.ToDouble(ReadUan.thetaGain[index]);                              //天线theta方向上的增益
            double phigain1    = Convert.ToDouble(ReadUan.phiGain[index]);                                //天线phi方向上的增益
            double thetaPhase1 = Convert.ToDouble(ReadUan.thetaPhase[index]);                             //天线theta方向上的相位
            double phiPhase1   = Convert.ToDouble(ReadUan.phiPhase[index]);                               //天线phi方向上的相位
                                                                                                          //求theta方向的场强
            Plural Etheta = new Plural(totalE.X.Re * Math.Cos(ThetaAngle) * Math.Cos(phiAngle) + totalE.Y.Re * Math.Cos(ThetaAngle) * Math.Sin(phiAngle) - totalE.Z.Re * Math.Sin(ThetaAngle), totalE.X.Im * Math.Cos(ThetaAngle) * Math.Cos(phiAngle) + totalE.Y.Im * Math.Cos(ThetaAngle) * Math.Sin(phiAngle) - totalE.Z.Im * Math.Sin(ThetaAngle));
            //求phi方向的场强
            Plural Ephi = new Plural(totalE.X.Re * Math.Sin(phiAngle) * (-1) + totalE.Y.Re * Math.Cos(phiAngle), totalE.X.Im * Math.Sin(phiAngle) * (-1) + totalE.Y.Im * Math.Cos(phiAngle));

            //求g在theta和phi方向的向量
            Plural thetaGainPlural = new Plural(Math.Sqrt(Math.Pow(10, thetagain1 / 10.0)) * Math.Cos(thetaPhase1), Math.Sqrt(Math.Pow(10, thetagain1 / 10.0)) * Math.Sin(thetaPhase1));
            Plural phiGainPlural   = new Plural(Math.Sqrt(Math.Pow(10, phigain1 / 10.0)) * Math.Cos(phiPhase1), Math.Sqrt(Math.Pow(10, phigain1 / 10.0)) * Math.Sin(phiPhase1));
            //求得模的平方temp2
            Plural temp2 = (Etheta * thetaGainPlural + Ephi * phiGainPlural);
            double temp3 = Math.Pow((temp2.GetMag()), 2);
            double phase = 0;

            if (temp2.Re == 0)
            {
                if (temp2.Im >= 0)
                {
                    phase = 90;
                }
                else
                {
                    phase = -90;
                }
            }
            if (temp2.Im >= 0 && temp2.Re > 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI;
            }
            if (temp2.Im <= 0 && temp2.Re > 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI;
            }
            if (temp2.Im >= 0 && temp2.Re < 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI + 180;
            }
            if (temp2.Im <= 0 && temp2.Re < 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI - 180;
            }

            double[] powerAndPhase = new double[2];
            powerAndPhase[0] = temp1 * temp3;
            powerAndPhase[1] = phase;
            return(powerAndPhase);
        }
Esempio n. 18
0
        static public double[] GetTotalPowerInDifferentPhase(List <Path> areaPaths)
        {
            //在计算后面的模的平方
            Plural temp2 = new Plural(0, 0);

            double[] frequence = new double[areaPaths.Count];
            int      i         = 0;

            foreach (Path item in areaPaths)
            {
                frequence[i] = item.node[item.node.Count - 1].Frequence;
                i++;

                EField totalE         = item.node[item.node.Count - 1].TotalE;//获得最后一个节点rx的场强
                Point  finalPosition  = item.node[item.node.Count - 1].Position;
                Point  parentPosition = item.node[item.node.Count - 2].Position;
                double ThetaAngle     = ReadUan.GetThetaAngle(parentPosition, finalPosition);     //获得射线的theta角thetaAngle
                double phiAngle       = ReadUan.GetPhiAngle(parentPosition, finalPosition);       //获得射线的phi角phiAngle
                int    index          = Convert.ToInt32(Math.Floor(phiAngle * 181 + ThetaAngle)); //将相应的index对应到读取UAN所形成的数组中
                double thetagain1     = Convert.ToDouble(ReadUan.thetaGain[index]);               //天线theta方向上的增益
                double phigain1       = Convert.ToDouble(ReadUan.phiGain[index]);                 //天线phi方向上的增益
                double thetaPhase1    = Convert.ToDouble(ReadUan.thetaPhase[index]);              //天线theta方向上的相位
                double phiPhase1      = Convert.ToDouble(ReadUan.phiPhase[index]);                //天线phi方向上的相位
                //求theta方向的场强
                Plural Etheta = new Plural(totalE.X.Re * Math.Cos(Math.PI * ThetaAngle / 180.0) * Math.Cos(Math.PI * phiAngle / 180.0) + totalE.Y.Re * Math.Cos(Math.PI * ThetaAngle / 180.0) * Math.Sin(Math.PI * phiAngle / 180.0) - totalE.Z.Re * Math.Sin(Math.PI * ThetaAngle / 180.0), totalE.X.Im * Math.Cos(Math.PI * ThetaAngle / 180.0) * Math.Cos(Math.PI * phiAngle / 180.0) + totalE.Y.Im * Math.Cos(Math.PI * ThetaAngle / 180.0) * Math.Sin(Math.PI * phiAngle / 180.0) - totalE.Z.Im * Math.Sin(Math.PI * ThetaAngle / 180.0));
                //求phi方向的场强
                Plural Ephi = new Plural(totalE.X.Re * Math.Sin(phiAngle * Math.PI / 180.0) * (-1) + totalE.Y.Re * Math.Cos(phiAngle * Math.PI / 180.0), totalE.X.Im * Math.Sin(phiAngle * Math.PI / 180.0) * (-1) + totalE.Y.Im * Math.Cos(Math.PI * phiAngle / 180.0));

                //求g在theta和phi方向的向量
                Plural thetaGainPlural = new Plural((Math.Pow(10, thetagain1 / 20.0)) * Math.Cos(thetaPhase1 * Math.PI / 180.0), (Math.Pow(10, thetagain1 / 20.0)) * Math.Sin(thetaPhase1 * Math.PI / 180.0));
                Plural phiGainPlural   = new Plural((Math.Pow(10, phigain1 / 20.0)) * Math.Cos(phiPhase1 * Math.PI / 180.0), (Math.Pow(10, phigain1 / 20.0)) * Math.Sin(phiPhase1 * Math.PI / 180.0));
                //求得模的平方temp2
                //Plural mul1 = Etheta * thetaGainPlural;
                //Plural mul2 = Ephi * phiGainPlural;
                temp2 += (Etheta * thetaGainPlural + Ephi * phiGainPlural);
            }
            Array.Sort(frequence);

            //先计算前面的系数temp1
            double lamada = 300 / frequence[(int)(frequence.Length / 2)];
            double temp1  = (Math.Pow(lamada, 2)) / (8 * Math.PI * 377);//377是真空中的本征阻抗
            double temp3  = Math.Pow((temp2.GetMag()), 2);
            double phase  = 0;

            if (temp2.Re == 0)
            {
                if (temp2.Im >= 0)
                {
                    phase = 90;
                }
                else
                {
                    phase = -90;
                }
            }
            if (temp2.Im >= 0 && temp2.Re > 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI;
            }
            if (temp2.Im <= 0 && temp2.Re > 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI;
            }
            if (temp2.Im >= 0 && temp2.Re < 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI + 180;
            }
            if (temp2.Im <= 0 && temp2.Re < 0)
            {
                phase = Math.Atan(temp2.Im / temp2.Re) * 180.0 / Math.PI - 180;
            }

            double[] powerAndPhase = new double[2];
            powerAndPhase[0] = temp1 * temp3;
            powerAndPhase[1] = phase;
            return(powerAndPhase);
        }
Esempio n. 19
0
        public static void Calculate(string setuppath, string terpath, string txpath, string rxpath)
        {
            //此判断用来将ter文件中的三角面读入Intersection.Tris中
            Terrain     newTer        = new Terrain(terpath);
            string      DirectoryPath = GetDirectory(setuppath) + "result\\";
            SetupObject setupOne      = SetupFileProceed.GetSetupFile.GetSetup(setuppath);
            int         txTotal       = setupOne.tr.FirstAvailableTxNumber;
            string      ProName       = GetProName(setuppath);
            List <Node> txs           = TxFileProceed.GetTx(txpath, setuppath, terpath);

            myLog.Info(txs.Count);
            List <List <ReceiveBall> > rxs = RxFileProceed.GetRx(rxpath, setuppath, terpath);

            myLog.Info(rxs.Count);
            //rxs.AddRange(TxFileProceed.GetTxAsRx(txpath, setuppath, terpath));
            City buildings = new City(GetDirectory(setuppath) + ProName + ".city");

            buildings.RestructTerrainByBuildings(newTer.TerRect);
            if (buildings.Build != null && buildings.Build.Count != 0)
            {
                newTer.OutPutNewTerrain(GetDirectory(setuppath));
            }                                                    //输出新地形
            int?[] index   = { null, null };
            int    txindex = 0;

            for (int i = 0; i < txs.Count; i++)
            {
                List <FrequencyBand> txFrequencyBand = TxFileProceed.GetTxFrequenceBand(txpath, setuppath, i);//获取频段信息
                myLog.Debug("这是第" + (i + 1) + "个发射机的射线追踪==========================================================================");
                for (int j = 0; j < rxs.Count; j++)
                {
                    //该接收区只有一个接收机
                    if (rxs[j].Count == 1)
                    {
                        if (rxs[j][0].GetType().ToString().Equals("CalculateModelClasses.ReceiveArea"))
                        {
                            //电磁态势的追踪模块
                            ReceiveArea reArea = (ReceiveArea)rxs[j][0];
                            //第一步:构建态势区域
                            myLog.Debug("构建态势区域");
                            reArea.CreateAreaSituation(newTer.TerRect);
                            //第二步:正向追踪,获取路径
                            myLog.Debug("正向追踪,获取粗略路径");
                            RayTubeMethod areaTracing = new RayTubeMethod(txs[i], reArea, newTer, buildings, 64);
                            //读取发射天线的极化信息
                            string txPol = GetRxTxPol("tx", txs[i].TxNum);
                            //读取接收天线的极化信息(删除??)
                            string rxPol = GetRxTxPol("areaSituation", rxs[j][0].RxNum);
                            //第三步:反向追踪,获取准确路径
                            //for (int m = 0; m < reArea.areaSituationNodes.Count; m++)
                            //{
                            //    areaTracing.ReverseAreaTracingPathsAndDeleteRepeatedPaths(reArea.areaSituationNodes[m].paths);
                            //}
                            //获取发射天线的4个参数
                            ReadUan.GetGainPara(txs[i].UAN);
                            for (int m = 0; m < reArea.areaSituationNodes.Count; m++)
                            {
                                reArea.areaSituationNodes[m].classifiedFrequencyPaths = new List <List <CalculateModelClasses.Path> >();
                                if (reArea.areaSituationNodes[m].paths.Count != 0)
                                {
                                    PathsafterPolization(reArea.areaSituationNodes[m].paths, txPol, rxPol);//极化代码
                                    //第四步:分频段求每条路径上的场强
                                    reArea.areaSituationNodes[m].classifiedFrequencyPaths = new List <List <CalculateModelClasses.Path> >();
                                    //areaTracing.ScreenAreaSituationPathsByFrequencyAndCalculateEField(txFrequencyBand, reArea.areaSituationNodes[m].paths, reArea.areaSituationNodes[m].classifiedFrequencyPaths);
                                    //计算每个频段上的各个路径叠加的总场强
                                    for (int n = 0; n < txFrequencyBand.Count; n++)
                                    {
                                        EField tempEfield = new EField();
                                        tempEfield.X = tempEfield.GetTolEx(reArea.areaSituationNodes[m].classifiedFrequencyPaths[n]);
                                        tempEfield.Y = tempEfield.GetTolEy(reArea.areaSituationNodes[m].classifiedFrequencyPaths[n]);
                                        tempEfield.Z = tempEfield.GetTolEz(reArea.areaSituationNodes[m].classifiedFrequencyPaths[n]);
                                        //得到每个频段上各个路径叠加的场强
                                        reArea.areaSituationNodes[m].totleEfields.Add(tempEfield);
                                        //得到各个频段上各个路径后得到的总场强
                                        reArea.areaSituationNodes[m].totleEfield.X += tempEfield.X;
                                        reArea.areaSituationNodes[m].totleEfield.Y += tempEfield.Y;
                                        reArea.areaSituationNodes[m].totleEfield.Z += tempEfield.Z;
                                    }
                                }
                            }
                            //文件输出
                            string path = ".\\.\\project\\station\\areaSituationResult.txt";
                            if (!System.IO.File.Exists(path))
                            {
                                System.IO.File.Create(path).Close();
                            }
                            StringBuilder sb = new StringBuilder();
                            for (int m = 0; m < reArea.areaSituationNodes.Count; m++)
                            {
                                if (reArea.areaSituationNodes[m].paths.Count != 0)
                                {
                                    //string appendText1 =  m+" "  + reArea.areaSituationNodes[m].paths.Count+" " ;
                                    //sb.Append(appendText1);
                                    //string appendText2 = "Ex " + reArea.areaSituationNodes[m].totleEfield.X.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.X.Im + ",Ey " + reArea.areaSituationNodes[m].totleEfield.Y.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.Y.Im + ",Ez " + reArea.areaSituationNodes[m].totleEfield.Z.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.Z.Im + "\r\n";
                                    //sb.Append(appendText2);
                                    string appendText1 = "第" + m + "个态势点上有" + reArea.areaSituationNodes[m].paths.Count + "条路径,";
                                    sb.Append(appendText1);
                                    string appendText2 = "总场强为:Ex " + reArea.areaSituationNodes[m].totleEfield.X.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.X.Im + ",Ey " + reArea.areaSituationNodes[m].totleEfield.Y.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.Y.Im + ",Ez " + reArea.areaSituationNodes[m].totleEfield.Z.Re + "+j" + reArea.areaSituationNodes[m].totleEfield.Z.Im + "\r\n";
                                    sb.Append(appendText2);
                                }
                                //else
                                //{
                                //    string appendText1 = "没有到达第" + m + "个态势点的路径\r\n";
                                //    sb.Append(appendText1);
                                //}
                            }
                            StreamWriter stw = new StreamWriter(path);
                            stw.Write(sb);
                            stw.Flush(); //清空缓冲区
                            stw.Close(); //关闭流
                            //---------------------------------
                            myLog.Debug("结果计算和文件输出过程结束,进入下一个接收机的追踪--------------------------------------");
                        }
                        else
                        {
                            if (("tx_" + txs[i].NodeName).Equals(rxs[j][0].RxName))
                            {
                                myLog.Debug("这是第" + (i + 1) + "个发射机第" + (j + 1) + "个接收机的射线追踪:是同一个发射机");
                                continue;
                            }
                            myLog.Debug("这是第" + (i + 1) + "个发射机第" + (j + 1) + "个接收机的射线追踪*****************************************************");
                            index[0] = j;
                            RayTubeMethod rayTubeMethod = new RayTubeMethod(txs[i], rxs[j][0], newTer, buildings, 32);
                            rayTubeMethod.ReverseTracingPathsAndDeleteRepeatedPaths();
                            rayTubeMethod.UpdateRayInForNodes();
                            //       PunctiformLaunchMethod punctiformMethod = new PunctiformLaunchMethod(txs[i], rxs[j][0], newTer, buildings, 64, txFrequencyBand);
                            //        List<CalculateModelClasses.Path> temp = punctiformMethod.GetPunctiformRxPath(tx, rxs[j][0], newTer,cityBuilding, 32, 128,TxFrequencyBand);

                            //        if (rayTubeMethod.ReceivedPaths.Count != 0)//若存在直射射线
                            //         {
                            //             string txPol = GetRxTxPol("tx", txs[i].TxNum);//极化代码
                            //             string rxPol = null;
                            //              if (rxs[j][0].isTx == true)
                            //              {
                            //                  rxPol = GetRxTxPol("tx", rxs[j][0].RxNum);
                            //              }
                            //              else
                            //              {
                            //                  rxPol = GetRxTxPol("rx", rxs[j][0].RxNum);//
                            //              }
                            //               PathsafterPolization(rayTubeMethod.ReceivedPaths, txPol, rxPol);//
                            //          }
                            myLog.Debug("射线追踪过程结束,进入射线筛选和计算过程-----------------------------------------");
                            //输出结果
                            ReadUan.GetGainPara(rxs[j][0].UAN);
                            List <List <CalculateModelClasses.Path> > ClassifiedPaths = rayTubeMethod.ScreenPunctiformPathsByFrequencyAndCalculateEField(txFrequencyBand);
                            for (int m = 0; m < txFrequencyBand.Count; m++)
                            {
                                P2mFileOutput.p2mfileoutput(ClassifiedPaths[m], DirectoryPath, ProName, txs[i].TxNum, txTotal, txindex, rxs[j][0], txs[i].Position, txFrequencyBand[m].MidPointFrequence, txFrequencyBand[m].FrequenceWidthMin, txFrequencyBand[m].FrequenceWidthMax);
                            }
                            List <CalculateModelClasses.Path> totalPowerPath = GetTotalPowerPath(ClassifiedPaths);
                            PowerOutput.GetRxTotalPower(totalPowerPath, DirectoryPath, ProName, txs[i].TxNum, txTotal, rxs[j][0], txs[i].Position);
                            myLog.Debug("结果计算和文件输出过程结束,进入下一个接收机的追踪---------------------------------------");
                        }
                    }
                    else
                    {
                        throw new Exception("没有接收机");
                    }
                }
            }
            GC.Collect();
        }
Esempio n. 20
0
        /// <summary>
        ///返回接收球,如果是区域状则返回多个接收球
        /// </summary>
        public static List <List <ReceiveBall> > GetRx(string rxpath, string setup, string terpath)
        {
            List <List <ReceiveBall> > RxBalls = new List <List <ReceiveBall> >();
            List <RxObject>            Rx      = RxReader(rxpath);

            for (int i = 0; i < Rx.Count; i++)
            {
                //这是点状和区域状
                if (Rx[i].flag != "<situation>")
                {
                    if (Rx[i].flag.Equals("<points>"))
                    {
                        Point lc = new Point(Rx[i].Lc.vertical[0], Rx[i].Lc.vertical[1], Rx[i].Lc.vertical[2]);
                        //GetZValue(ter, lc);
                        lc.Z = Rx[i].Lc.vertical[2] + Rx[i].cubesize;
                        List <ReceiveBall> temp   = new List <ReceiveBall>();
                        ReceiveBall        rxtemp = new ReceiveBall(lc, Rx[i].num, Rx[i].name);
                        rxtemp.UAN = ReadUan.GetUan(Rx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                        temp.Add(rxtemp);
                        RxBalls.Add(temp);
                    }
                    else  //现在不会进入这个分支
                    {
                        List <ReceiveBall> temp   = new List <ReceiveBall>();
                        double             length = (double)Rx[i].Lc.side1;
                        double             width  = (double)Rx[i].Lc.side2;
                        double             space  = (double)Rx[i].Lc.spacing;
                        for (int j = 0; j < width / space + 1; j++)
                        {
                            for (int k = 0; k < length / space + 1; k++)
                            {
                                Point lc = new Point(Rx[i].Lc.vertical[0] + k * space, Rx[i].Lc.vertical[1] - j * space, Rx[i].Lc.vertical[2]);
                                //GetZValue(ter, lc);
                                lc.Z += Rx[i].Lc.vertical[2] + Rx[i].cubesize;
                                ReceiveBall rxtemp = new ReceiveBall(lc, Rx[i].num, Rx[i].name);
                                rxtemp.UAN = ReadUan.GetUan(Rx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                                temp.Add(new ReceiveBall(lc, Rx[i].num, Rx[i].name));
                            }
                        }
                        RxBalls.Add(temp);
                    }
                }
                //这是态势显示
                else
                {
                    if ((double)Rx[i].Lc.side1 == 0 || (double)Rx[i].Lc.side2 == 0)//态势区域边长不能为0
                    {
                        LogFileManager.ObjLog.debug("态势区域边长为0,出错");
                    }

                    //         Rx[i].Lc.spacing = 50;
                    //         Spacing = (double)Rx[i].Lc.spacing;
                    List <ReceiveBall> temp        = new List <ReceiveBall>();
                    ReceiveBall        receiveArea = new ReceiveArea();
                    receiveArea.UAN = ReadUan.GetUan(Rx[i], SetupFileProceed.GetSetupFile.GetSetup(setup));
                    Point lc = new Point(Rx[i].Lc.vertical[0], Rx[i].Lc.vertical[1], Rx[i].Lc.vertical[2]);
                    receiveArea.temp = Rx[i].Lc.vertical[2];
                    //GetZValue(ter, lc);
                    lc.Z = Rx[i].Lc.vertical[2] + Rx[i].cubesize;
                    //receiveArea.rxLength = (double)Rx[i].Lc.side1;
                    //receiveArea.rxWidth = (double)Rx[i].Lc.side2;
                    //receiveArea.spacing =(double)Rx[i].Lc.spacing;
                    //receiveArea.origen = lc;
                    receiveArea.Instance((double)Rx[i].Lc.side1, (double)Rx[i].Lc.side2, (double)Rx[i].Lc.spacing, lc);
                    receiveArea.RxName = Rx[i].name;
                    receiveArea.RxNum  = Rx[i].num;

                    temp.Add(receiveArea);
                    RxBalls.Add(temp);
                }
            }
            return(RxBalls);
        }
Esempio n. 21
0
        private static void OutEveryRxPath(List <CalculateModelClasses.Path> paths, string Rxname, int Rxnum)//接收机的名字,加到path里面,Rxnum接收机的个数
        {
            int           N           = paths.Count;
            int           index       = 0;
            List <string> strListTemp = new List <string>();

            //StringBuilder sbtemp = new StringBuilder();
            sb.AppendLine("# Receiver Set:" + Rxname);
            sb.AppendLine("     " + Rxnum);//Rxnum是这一组有多少个接收机
            for (int i = 1; i <= Rxnum; i++)
            {
                sb.AppendLine("     " + i + "     " + "N");
                sb.Replace("N", N.ToString());
                if (paths.Count != 0)
                {
                    //string powertemp = ((10 * Math.Log10(Math.Sqrt(Math.Pow(P2mFileOutput.GetTolPower(paths), 2) ))) + 30).ToString("f2");
                    string powertemp = ((10 * Math.Log10(Math.Sqrt(Math.Pow(Power.GetTotalPowerInDifferentPhase(paths)[0], 2)))) + 30).ToString("f2");
                    //string powertemp = (10*Math.Log10(Math.Sqrt(Math.Pow(P2mFileOutput.GetTolPower(paths).Re, 2) + Math.Pow(P2mFileOutput.GetTolPower(paths).Im, 2)))).ToString("f2");
                    sb.AppendLine(powertemp + "   " + P2mFileOutput.GetTolTime(paths).ToString("0.#####E+00") + "  " + P2mFileOutput.GetTolDelay(paths).ToString("0.#####E+00"));
                    for (int j = 0; j < paths.Count; j++)
                    {
                        double distance = 0;
                        string theta_a  = ReadUan.GetThetaAngle(paths[j].node[0].Position, paths[j].node[1].Position).ToString("f4");
                        string phi_a    = ReadUan.GetPhiAngle(paths[j].node[0].Position, paths[j].node[1].Position).ToString("f4");
                        string theta_d  = ReadUan.GetThetaAngle(paths[j].node[paths[j].node.Count - 2].Position, paths[j].node[paths[j].node.Count - 1].Position).ToString("f4");
                        string phi_d    = ReadUan.GetPhiAngle(paths[j].node[paths[j].node.Count - 2].Position, paths[j].node[paths[j].node.Count - 1].Position).ToString("f4");

                        for (int k = 0; k < paths[j].node.Count - 1; k++)
                        {
                            distance += paths[j].node[k].Position.GetDistance(paths[j].node[k + 1].Position);
                        }

                        //string temp2 = Math.Sqrt(Math.Pow(paths[j].node[paths[j].node.Count - 1].power.Re, 2) + Math.Pow(paths[j].node[paths[j].node.Count - 1].power.Im, 2)).ToString("f4");
                        string temp2    = ((10 * Math.Log10(Math.Sqrt(Math.Pow(paths[j].node[paths[j].node.Count - 1].Power, 2)))) + 30).ToString("f4");
                        string weishuju = Math.Sqrt(Math.Pow(paths[j].node[paths[j].node.Count - 1].TotalE.Z.Re, 2) + Math.Pow(paths[j].node[paths[j].node.Count - 1].TotalE.Z.Im, 2)).ToString("f4");
                        sbtemp.AppendLine("    " + ("M") + "   " + (paths[j].node.Count - 2).ToString() + "     " + temp2 + "   " + (30 / distance).ToString("0.#####E+00") + "    " + theta_a + "   " + phi_a + "   " + theta_d + "   " + phi_d + "   " + weishuju);//达到时间需要计算,另外四个角度需要计算"(theta,phia,thetd,phid")
                        if (paths[j].node.Count == 2)
                        {
                            //if (paths[j].node[1].PointStyle.Equals("FinalPoint"))
                            //{
                            //    continue;
                            //}
                            //else
                            //{
                            //    Direct(paths[j]);
                            //    string[] temp = sbtemp.ToString().Split('|');
                            //    //检验是否重复
                            //    check(temp, strListTemp);
                            //    //清空临时字符串
                            //    sbtemp.Clear();
                            //}
                            Direct(paths[j]);
                            index++;
                            sb.Append(sbtemp.ToString().Replace("M", index.ToString()));
                            sbtemp.Clear();
                        }
                        else
                        {
                            NotDirect(paths[j]);
                            index++;
                            //string[] temp = sbtemp.ToString().Split('|');
                            //check(temp, strListTemp);
                            ////清空临时字符串
                            sb.Append(sbtemp.ToString().Replace("M", index.ToString()));
                            sbtemp.Clear();
                        }
                    }
                }
            }
        }