コード例 #1
0
        /// <summary>
        /// 将反射绕射过程中发射机接收机和其他各点的位置信息放到要输出的StringBuider对象中
        /// </summary>
        /// <param name="path">发射机和一组接收机所有的路径信息</param>
        private static void NotDirect(CalculateModelClasses.Path path)
        {
            string stylestring = "Tx-";

            for (int i = 1; i < path.node.Count - 1; i++)
            {
                if (path.node[i].NodeStyle == NodeStyle.ReflectionNode)
                {
                    stylestring = stylestring + "R-";
                }
                else
                {
                    stylestring = stylestring + "D-";
                }
            }
            stylestring = stylestring + "Rx";
            sbtemp.AppendLine(stylestring);
            string tempx, tempy, tempz;

            for (int i = 0; i < path.node.Count; i++)
            {
                tempx = path.node[i].Position.X.ToString("0.#######E+00");
                tempy = path.node[i].Position.Y.ToString("0.#######E+00");
                tempz = path.node[i].Position.Z.ToString("f3");

                sbtemp.AppendFormat("{0,20}{1,20}{2,20}", tempx, tempy, tempz);
                sbtemp.Append("\r\n");
            }
        }
コード例 #2
0
        /// <summary>
        ///把态势中的一条路径分成每条路径只有一个Rx点的路径list
        /// </summary>
        public static List <CalculateModelClasses.Path> makeNewPath(CalculateModelClasses.Path path)
        {
            List <CalculateModelClasses.Path> test = new List <CalculateModelClasses.Path>();
            List <Node> temp = new List <Node>();

            foreach (Node item in path.node)   //对路径的每个节点进行遍历
            {
                List <Node> nodes = new List <Node>();
                if (item.NodeStyle == NodeStyle.Tx)
                {
                    temp.Add(item);
                }
                else if (item.NodeStyle == NodeStyle.ReflectionNode)
                {
                    temp.Add(item);
                }
                else if (item.NodeStyle == NodeStyle.DiffractionNode)
                {
                    temp.Add(item);
                }
                else
                {
                    Node pathnode = (Node)item.Clone();
                    pathnode.NodeStyle = NodeStyle.Rx;
                    for (int i = 0; i < temp.Count; i++)
                    {
                        nodes.Add(temp[i]);
                    }
                    nodes.Add(pathnode);
                    CalculateModelClasses.Path path1 = new CalculateModelClasses.Path(nodes);
                    test.Add(path1);
                }
            }
            return(test);
        }
コード例 #3
0
        /// <summary>
        /// 根据不同的频率进行态势区域路径的分类,并进行场强,功率的计算
        /// </summary>
        ///  <param name="TxFrequencyBand">频段信息</param>
        ///  <param name="multiple">绕射距离倍数</param>
        /// <returns>筛选后的路径</returns>
        public List <List <Path> > ScreenAreaPathsByFrequencyAndCalculation(List <FrequencyBand> TxFrequencyBand, int multiple)
        {
            List <List <Path> > classifiedPath = new List <List <CalculateModelClasses.Path> >();

            if (this.rayPaths.Count == 0)//若态势区域内没有射线,加入空的链表到输出结果中
            {
                for (int c = 0; c < TxFrequencyBand.Count; c++)
                {
                    classifiedPath.Add(new List <Path>());
                }
            }
            else
            {
                for (int i = 0; i < TxFrequencyBand.Count; i++)                                      //对频段进行遍历
                {
                    double      freDistance = multiple * 300 / TxFrequencyBand[i].MidPointFrequence; //波长的倍数,是判断发生绕射的条件
                    List <Path> paramPaths  = new List <CalculateModelClasses.Path>();
                    for (int j = 0; j < this.rayPaths.Count; j++)                                    //对在态势区域的射线进行遍历
                    {
                        if (JudgeIfDiffractionHappen(this.rayPaths[j], freDistance))                 //若该射线在该频段会发生
                        {
                            List <Node> pathNode   = new List <Node>();                              //存放所有节点
                            List <Node> originNode = new List <Node>();                              //存放Tx,ReflectionNode,DiffractionNode节点,用于计算其后面节点
                            for (int n = 0; n < this.rayPaths[j].node.Count; n++)
                            {
                                Node temp = new Node(this.rayPaths[j].node[n]);
                                temp.Frequence      = TxFrequencyBand[i].MidPointFrequence;
                                temp.FrequenceWidth = TxFrequencyBand[i].FrequenceWidth;
                                if (n == 0)
                                {
                                    temp.Power = TxFrequencyBand[i].Power;//第一个点为Tx点,输入功率
                                }
                                if (n != 0)
                                {
                                    this.GetEfield(temp.UAN, originNode[originNode.Count - 1], ref temp);   //计算场强
                                    //接收点求功率,有问题,电导率和节点常数是面的还是空气的
                                    temp.Power = Power.GetPower(temp, originNode[originNode.Count - 1])[0]; //计算功率
                                }
                                if (temp.NodeStyle != NodeStyle.Rx)
                                {
                                    originNode.Add(temp);
                                }
                                pathNode.Add(temp);
                            }
                            Path midpath = new CalculateModelClasses.Path(pathNode);
                            midpath.Rxnum = this.rayPaths[j].Rxnum;
                            if (midpath.Rxnum != 0)
                            {
                                GetLossAndComponentOFPath(midpath);//计算路径的损耗,延时,相位
                                paramPaths.Add(midpath);
                            }
                        }
                    }
                    classifiedPath.Add(paramPaths);
                }
            }
            return(classifiedPath);
        }
コード例 #4
0
        /// <summary>
        /// 根据不同的频率进行分类和场强,功率的计算
        /// </summary>
        ///  <param name="paths">路径</param>
        ///  <param name="TxFrequencyBand">频段信息</param>
        ///  <param name="multiple">绕射距离倍数</param>
        /// <returns>筛选后的路径</returns>
        public List <List <Path> > ScreenPunctiformPathsByFrequencyAndCalculateEField(List <FrequencyBand> TxFrequencyBand, int multiple)
        {
            List <List <Path> > classifiedPath = new List <List <CalculateModelClasses.Path> >();

            if (this.rayPaths.Count == 0)//若没有射线,加入空的链表到输出结果中
            {
                for (int c = 0; c < TxFrequencyBand.Count; c++)
                {
                    classifiedPath.Add(new List <Path>());
                }
            }
            else
            {
                for (int i = 0; i < TxFrequencyBand.Count; i++)                                      //对频段进行遍历
                {
                    double      freDistance = multiple * 300 / TxFrequencyBand[i].MidPointFrequence; //波长的倍数,是判断发生绕射的条件
                    List <Path> tempPath    = new List <CalculateModelClasses.Path>();
                    for (int j = 0; j < this.rayPaths.Count; j++)
                    {
                        if (JudgeIfDiffractionHappen(this.rayPaths[j], freDistance))//若发生
                        {
                            List <Node> pathNodes = new List <Node>();
                            for (int n = 0; n < this.rayPaths[j].node.Count; n++)//对该射线除了第一个Tx点外的节点进行计算
                            {
                                Node temp = new Node(this.rayPaths[j].node[n]);

                                if (n == 0)
                                {
                                    temp.Power = TxFrequencyBand[i].Power;
                                }
                                temp.Frequence      = TxFrequencyBand[i].MidPointFrequence;
                                temp.FrequenceWidth = TxFrequencyBand[i].FrequenceWidth;
                                if (n != 0)
                                {
                                    this.GetEfield(temp.UAN, pathNodes[n - 1], ref temp);   //计算场强
                                    //接收点求功率,有问题,电导率和节点常数是面的还是空气的
                                    temp.Power = Power.GetPower(temp, pathNodes[n - 1])[0]; //计算功率
                                }
                                pathNodes.Add(temp);
                            }
                            Path midpath = new CalculateModelClasses.Path(pathNodes);

                            if (midpath.Rxnum != 0)
                            {
                                GetLossAndComponentOFPath(midpath);
                                tempPath.Add(midpath);
                            }
                        }
                    }
                    classifiedPath.Add(tempPath);
                }
            }
            return(classifiedPath);
        }
コード例 #5
0
        /// <summary>
        /// 根据不同的频率进行场强,功率的计算
        /// </summary>
        ///  <param name="TxFrequencyBand">频段信息</param>
        /// <returns>筛选后的路径</returns>
        public List <List <Path> > ScreenPunctiformPathsByFrequencyAndCalculateEField(List <FrequencyBand> TxFrequencyBand)
        {
            List <List <Path> > classifiedPath = new List <List <CalculateModelClasses.Path> >();

            if (this.receivedPaths.Count == 0)//若没有射线,加入空的链表到输出结果中
            {
                for (int c = 0; c < TxFrequencyBand.Count; c++)
                {
                    classifiedPath.Add(new List <Path>());
                }
            }
            else
            {
                for (int i = 0; i < TxFrequencyBand.Count; i++)//对频段进行遍历
                {
                    List <Path> tempPath = new List <CalculateModelClasses.Path>();
                    for (int j = 0; j < this.receivedPaths.Count; j++)
                    {
                        List <Node> pathNodes = new List <Node>();
                        for (int n = 0; n < this.receivedPaths[j].node.Count; n++)//对该射线除了第一个Tx点外的节点进行计算
                        {
                            Node temp = (Node)this.receivedPaths[j].node[n].Clone();

                            if (n == 0)
                            {
                                temp.Power = TxFrequencyBand[i].Power;
                            }
                            temp.Frequence      = TxFrequencyBand[i].MidPointFrequence;
                            temp.FrequenceWidth = TxFrequencyBand[i].FrequenceWidth;
                            if (n != 0)
                            {
                                this.GetEfield(temp.UAN, pathNodes[n - 1], ref temp);   //计算场强
                                //接收点求功率,有问题,电导率和节点常数是面的还是空气的
                                temp.Power = Power.GetPower(temp, pathNodes[n - 1])[0]; //计算功率
                            }
                            pathNodes.Add(temp);
                        }
                        Path midpath = new CalculateModelClasses.Path(pathNodes);

                        if (midpath.Rxnum != 0)
                        {
                            this.GetLossAndComponentOFPath(midpath);
                            tempPath.Add(midpath);
                        }
                    }
                    classifiedPath.Add(tempPath);
                }
            }
            return(classifiedPath);
        }
コード例 #6
0
        public void GetTotalPowerInDifferentPhaseTest1()
        {
            Node node1 = new Node();

            node1.Position  = new Point(0, 0, 0);
            node1.Frequence = 100;
            Node node2 = new Node();

            node2.Frequence = 100;
            node2.Position  = new Point(0, 1, -1);
            Node node3 = new Node();

            node3.Position  = new Point(0, 3, 0);
            node3.Frequence = 100;
            node3.TotalE    = new EField(new Plural(1, 1), new Plural(1, 1), new Plural(1, 1));
            List <Node> lists = new List <Node> {
                node1, node2, node3
            };

            node1.TxNum = 1; node3.RxNum = 1;
            CalculateModelClasses.Path path1 = new CalculateModelClasses.Path(lists);
            Node node4 = new Node();

            node4.Position  = new Point(0, 3, 0);
            node4.Frequence = 100;
            node4.TotalE    = new EField(new Plural(2, 2), new Plural(2, 2), new Plural(2, 2));
            Node node5 = new Node();

            node5.Position  = new Point(0, 0, 0);
            node5.Frequence = 100;
            List <Node> lists2 = new List <Node> {
                node5, node4
            };

            node4.RxNum = 1;
            CalculateModelClasses.Path        path2     = new CalculateModelClasses.Path(lists2);
            List <CalculateModelClasses.Path> areaPaths = new List <CalculateModelClasses.Path> {
                path1, path2
            };                                                                                                  // TODO: 初始化为适当的值

            //areaPaths.Add(path1);
            //areaPaths.Add(path2);
            double[] expected = new double[2] {
                0.0692341, -135.0
            };                                                       // TODO: 初始化为适当的值
            double[] actual;
            actual = Power.GetTotalPowerInDifferentPhase(areaPaths);
            Assert.IsTrue((Math.Abs(expected[0] - (actual[0])) <= 0.0001) && (Math.Abs(expected[1] - (actual[1])) <= 0.0001));
        }
コード例 #7
0
        /// <summary>
        /// 将直接过程辐射源和接收机的位置信息放到要输出的StringBuider对象中
        /// </summary>
        /// <param name="path">发射机和一组接收机所有的路径信息</param>
        private static void Direct(CalculateModelClasses.Path path)
        {
            sbtemp.AppendLine("Tx-Rx");

            string tempx1 = path.node[0].Position.X.ToString("0.#####E+00");
            string tempy1 = path.node[0].Position.Y.ToString("0.#####E+00");
            string tempz1 = path.node[0].Position.Z.ToString("f3");

            string tempx2 = path.node[path.node.Count - 1].Position.X.ToString("0.#####E+00");
            string tempy2 = path.node[path.node.Count - 1].Position.Y.ToString("0.#####E+00");
            string tempz2 = path.node[path.node.Count - 1].Position.Z.ToString("f3");

            sbtemp.AppendFormat("{0,20}{1,20}{2,20}", tempx1, tempy1, tempz1);
            sbtemp.Append("\r\n");
            sbtemp.AppendFormat("{0,20}{1,20}{2,20}", tempx2, tempy2, tempz2);
            sbtemp.Append("\r\n");
        }