Exemplo n.º 1
0
 private int GetDelayIndex(int xIndex, int yIndex, TransceiverPathLossMatrix matrix)
 {
     int num = (matrix.YWayPoint * xIndex) + yIndex;
     if (num >= matrix.DlPathLoss.Length)
     {
         num = matrix.DlPathLoss.Length - 1;
     }
     return num;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 供计算射线路损时使用
        /// </summary>
        /// <param name="transceiverPathLossMatrix"></param>
        /// <param name="structAntennaParam"></param>
        /// <param name="rowIndex"></param>
        /// <param name="colIndex"></param>
        public void ConvertPolarToXY(TransceiverPathLossMatrix transceiverPathLossMatrix, StructAntennaParam structAntennaParam, int rowIndex, int colIndex)
        {

            double cellX = structAntennaParam.CellX;
            double cellY = structAntennaParam.CellY;
            double msX = structAntennaParam.MsX;
            double msY = structAntennaParam.MsY;

            //得到正北方向下移动台水平方位角
            float horizonAzimuth = CalculateHorizontalAzimuth(structAntennaParam.CellX, structAntennaParam.CellY, structAntennaParam.MsX, structAntennaParam.MsY);

            //得到移动台和基站连线的索引值
            int rayIndex = CalculateRayIndex(structAntennaParam, horizonAzimuth, transceiverPathLossMatrix, colIndex, rowIndex);

            //得到移动台至基站的距离
            float distanceFromRxToTx = (float)Math.Sqrt((cellX - msX) * (cellX - msX) + (cellY - msY) * (cellY - msY));

            if (distanceFromRxToTx < transceiverPathLossMatrix.Radius)
            {
                //得到移动台在PeakDot矩阵中的相对位置
                int dotMsIndex = (int)Math.Floor(distanceFromRxToTx / transceiverPathLossMatrix.Resolution);
                if (dotMsIndex == (int)Math.Floor(transceiverPathLossMatrix.Radius / transceiverPathLossMatrix.Resolution))//防止溢出
                {
                    dotMsIndex -= 1;
                }

                //得到一条射线上采样点的个数
                int rayDotNum = (int)(transceiverPathLossMatrix.Radius / transceiverPathLossMatrix.Resolution);

                //得到移动台在dot矩阵中的绝对位置
                int absDotMsIndex = rayIndex * rayDotNum + dotMsIndex;

                //取出该点存储的障碍物位置
                int peakDotIndex = transceiverPathLossMatrix.PeakDotMatrix[absDotMsIndex];

                if (peakDotIndex != 0)
                {
                    //得到障碍物和基站之间的距离
                    float distanceFromTxToPeak = peakDotIndex * transceiverPathLossMatrix.Resolution;

                    //取出该点存储障碍物的高度
                    short peakHeight = transceiverPathLossMatrix.PeakHeightMatrix[absDotMsIndex];

                    structAntennaParam.MsHeight = peakHeight;

                    TransPolarToXYHelper(structAntennaParam, horizonAzimuth, distanceFromTxToPeak);

                }
            }
        }
Exemplo n.º 3
0
 private int GetBinIndex(int index, TransceiverPathLossMatrix matrix)
 {
     return ((index >= matrix.DlPathLoss.Length) ? (matrix.DlPathLoss.Length - 1) : index);
 }
Exemplo n.º 4
0
 private bool ValidateResolution(float resolution, TransceiverPathLossMatrix transceiverPathLossMatrix)
 {
     return ((resolution != float.MinValue) && (resolution <= transceiverPathLossMatrix.Resolution));
 }
Exemplo n.º 5
0
 private bool RangeXY(double x, double y, TransceiverPathLossMatrix transceiverPathLossMatrix)
 {
     return ((((x < transceiverPathLossMatrix.LeftTopX) || (x > transceiverPathLossMatrix.RightBottomX)) || (y < transceiverPathLossMatrix.RightBottomY)) || (y > transceiverPathLossMatrix.LeftTopY));
 }
Exemplo n.º 6
0
 private bool IsUsingMatrixs(double x, double y, float resolution, TransceiverPathLossMatrix transceiverPathLossMatrix)
 {
     return (this.ValidateResolution(resolution, transceiverPathLossMatrix) || this.IsPointOverlapped(x, y, transceiverPathLossMatrix));
 }
Exemplo n.º 7
0
 private bool IsPointOverlapped(double x, double y, TransceiverPathLossMatrix transceiverPathLossMatrix)
 {
     return ((((x - transceiverPathLossMatrix.LeftTopX) % ((double) transceiverPathLossMatrix.Resolution)) == 0) && (((transceiverPathLossMatrix.LeftTopY - y) % ((double) transceiverPathLossMatrix.Resolution)) == 0));
 }
Exemplo n.º 8
0
 private bool IsMatixInvalid(TransceiverPathLossMatrix transceiverPathLossMatrix, int delayIndex)
 {
     return ((transceiverPathLossMatrix.DlPathLoss[delayIndex] == -32768) || (transceiverPathLossMatrix.AntGain[delayIndex] == -32768));
 }
Exemplo n.º 9
0
        /// <summary>
        /// 根据权重得到路损值
        /// </summary>
        /// <param name="xIndex"></param>
        /// <param name="yIndex"></param>
        /// <param name="dX"></param>
        /// <param name="dY"></param>
        /// <param name="transceiverPathLossMatrix"></param>
        /// <returns></returns>
        private float getPathLossByWeight(int xIndex, int yIndex, float dX, float dY, TransceiverPathLossMatrix transceiverPathLossMatrix)
        {
            //Modified by wj

            //float weight = dX;
            //float num2 = 1f - dX;
            //float num3 = dY;
            //float num4 = 1f - dY;
            int index = (transceiverPathLossMatrix.YWayPoint * xIndex) + yIndex;
            index = this.GetBinIndex(index, transceiverPathLossMatrix);
            int binIndex = ((transceiverPathLossMatrix.YWayPoint * xIndex) + yIndex) + 1;
            binIndex = this.GetBinIndex(binIndex, transceiverPathLossMatrix);
            int num7 = (transceiverPathLossMatrix.YWayPoint * (xIndex + 1)) + yIndex;
            num7 = this.GetBinIndex(num7, transceiverPathLossMatrix);
            int num8 = ((transceiverPathLossMatrix.YWayPoint * (xIndex + 1)) + yIndex) + 1;
            num8 = this.GetBinIndex(num8, transceiverPathLossMatrix);
            short num9 = transceiverPathLossMatrix.DlPathLoss[index];
            short num10 = transceiverPathLossMatrix.DlPathLoss[binIndex];
            short num11 = transceiverPathLossMatrix.DlPathLoss[num7];
            short num12 = transceiverPathLossMatrix.DlPathLoss[num8];
            if (((num9 == this.m_SingleInvalidValueFloat) && (num10 == this.m_SingleInvalidValueFloat)) || ((num11 == this.m_SingleInvalidValueFloat) && (num12 == this.m_SingleInvalidValueFloat)))
            {
                return float.MinValue;
            }
            float valueA = this.GetMiddleValue((float) num9, (float) num10, dX);
            float valueB = this.GetMiddleValue((float) num11, (float) num12, dX);
            float num15 = this.GetMiddleValue(valueA, valueB, dY);
            if (num15 != this.m_SingleInvalidValueFloat)
            {
                num15 *= 0.01f;
            }
            return num15;
        }
Exemplo n.º 10
0
 private static void GetExistsPLMatrix(bool isGetAntGain, float[][] pathLossMatrix, TransceiverPathLossMatrix transceiverPathLossMatrix, int delayIndex, float deltaLoss)
 {
     short num = transceiverPathLossMatrix.DlPathLoss[delayIndex];
     short num2 = transceiverPathLossMatrix.AntGain[delayIndex];
     pathLossMatrix[0][1] = isGetAntGain ? ((num - num2) * 0.01f) : (num * 0.01f);
     pathLossMatrix[0][0] = isGetAntGain ? (((num - num2) * 0.01f) + deltaLoss) : ((num * 0.01f) + deltaLoss);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 得到移动台和基站连线的索引值
        /// </summary>
        /// <param name="structAntennaParam"></param>
        /// <param name="horizonAzimuth"></param>
        /// <param name="transceiverPathLossMatrix"></param>
        /// <param name="colIndex"></param>
        /// <param name="rowIndex"></param>
        /// <returns></returns>
        private int CalculateRayIndex(StructAntennaParam structAntennaParam, float horizonAzimuth, TransceiverPathLossMatrix transceiverPathLossMatrix, int colIndex, int rowIndex)
        {
            int rayIndex = 0;
            double absHorizonAzimuth = 0;

            //float offset = ConvRadianToAngle(transceiverPathLossMatrix.Offset);
            float offset = (transceiverPathLossMatrix.Offset);


            #region 坐标转换 X轴正方向为正,逆时针旋转

            if (structAntennaParam.MsX < structAntennaParam.CellX)//左半平面
            {
                //基站和移动台的相对夹角
                absHorizonAzimuth = Math.PI + horizonAzimuth;

            }
            else//右半平面
            {
                //基站和移动台的相对夹角
                absHorizonAzimuth = (Math.PI * 2 + horizonAzimuth) % (Math.PI * 2);
            }

            //得到射线索引
            rayIndex = (int)(absHorizonAzimuth / offset);

            //防止溢出
            if (rayIndex == (int)(Math.PI * 2 / offset))
                rayIndex -= 1;

            return rayIndex;

            #endregion
        }