Example #1
0
 /// <summary>
 /// 2018.12.04
 /// 更新栅格的反射、绕射建筑物ID
 /// </summary>
 /// <param name="gs"></param>
 /// <param name="rays"></param>
 public void updateBuildingIDBeam(ref GridStrength gs, List <Beam.NodeInfo> rays)
 {
     Beam.NodeInfo ray;
     for (int i = 0; i < rays.Count; i++)
     {
         ray = rays[i];
         if (ray.rayType == Beam.RayType.HReflection || ray.rayType == Beam.RayType.VReflection) //反射
         {
             //最终合并时去重,此处不去重
             gs.RefBuildingID += ";" + ray.buildingID;
         }
         else if (ray.rayType == Beam.RayType.HDiffraction || ray.rayType == Beam.RayType.VDiffraction) //绕射
         {
             gs.DiffBuildingID += ";" + ray.buildingID;
         }
     }
 }
Example #2
0
        /// <summary>
        /// 合并室内栅格的场强
        /// </summary>
        /// <param name="curGrid3D">入地点栅格</param>
        /// <param name="rays"></param>
        /// <param name="Pwr"></param>
        /// <param name="buildingID"></param>
        public void mergeIndoorGridStrength(Grid3D curGrid3D, List <NodeInfo> rays, double Pwr, int buildingID)
        {
            GridStrength gs;
            string       key = String.Format("{0},{1},{2}", curGrid3D.gxid, curGrid3D.gyid, curGrid3D.gzid);

            if (this.gridStrengths.ContainsKey(key))
            {
                gs = this.gridStrengths[key];
                gs.TransmitBuildingID += buildingID.ToString();
                updateBuildingID(ref gs, rays);
                gs.TransNum    += 1;
                gs.TransPwrW   += Pwr;
                gs.MaxTransPwrW = Math.Max(gs.MaxTransPwrW, Pwr);

                this.gridStrengths[key] = gs;
            }
            else
            {
                gs                    = new GridStrength();
                gs.GXID               = curGrid3D.gxid;
                gs.GYID               = curGrid3D.gyid;
                gs.Level              = curGrid3D.gzid;
                gs.RefBuildingID      = "";
                gs.DiffBuildingID     = "";
                gs.TransmitBuildingID = buildingID.ToString();
                gs.GCenter            = GroundGrid.getBGridCenter(curGrid3D.gxid, curGrid3D.gyid, curGrid3D.gzid);

                if (gs.GCenter == null)
                {
                    gs.GCenter = new Point(-1, -1, -1);
                }

                updateBuildingID(ref gs, rays);

                gs.TransNum       = 1;
                gs.ReceivedPowerW = gs.MaxTransPwrW = gs.TransPwrW = Pwr;

                this.gridStrengths.Add(key, gs);
            }
        }
Example #3
0
        /// <summary>
        /// 将共享内存传递的计算结果转换为GridStrength
        /// </summary>
        /// <param name="ret"></param>
        /// <returns></returns>
        private GridStrength convertFromMMFGSStruct(MMFGSStruct ret)
        {
            GridStrength gs = new GridStrength();

            gs.GXID    = ret.GXID;
            gs.GYID    = ret.GYID;
            gs.Level   = ret.Level;
            gs.GCenter = new LTE.Geometric.Point(ret.x, ret.y, ret.z);
            gs.eNodeB  = ret.eNodeB;
            gs.CI      = ret.CI;

            gs.FieldIntensity = ret.FieldIntensity;
            gs.DirectNum      = ret.DirectNum;
            gs.DirectPwrW     = ret.DirectPwrW;
            gs.MaxDirectPwrW  = ret.MaxDirectPwrW;

            gs.RefNum        = ret.RefNum;
            gs.RefPwrW       = ret.RefPwrW;
            gs.MaxRefPwrW    = ret.MaxRefPwrW;
            gs.RefBuildingID = ret.RefBuildingID;

            gs.DiffNum        = ret.DiffNum;
            gs.DiffPwrW       = ret.DiffPwrW;
            gs.MaxDiffPwrW    = ret.MaxDiffPwrW;
            gs.DiffBuildingID = ret.DiffBuildingID;

            gs.TransNum           = ret.TransNum;
            gs.TransPwrW          = ret.TransPwrW;
            gs.MaxTransPwrW       = ret.MaxTransPwrW;
            gs.TransmitBuildingID = ret.TransmitBuildingID;

            gs.BTSGridDistance  = ret.BTSGridDistance;
            gs.ReceivedPowerW   = ret.ReceivedPowerW;
            gs.ReceivedPowerdbm = ret.ReceivedPowerdbm;
            gs.PathLoss         = ret.PathLoss;
            gs.ground           = ret.ground;
            return(gs);
        }
Example #4
0
        // Pwr0  发射功率,单位w
        // Pwr1  接收功率,单位w
        // isT   是否穿过建筑物
        // ci    小区标识
        public void mergeGridStrength(int gxid, int gyid, int gzid, Point p, List <NodeInfo> rays, double Pwr0, double Pwr1, bool isT)
        {
            GridStrength gs;
            string       key = String.Format("{0},{1},{2}", gxid, gyid, gzid);

            if (this.gridStrengths.ContainsKey(key))
            {
                gs = this.gridStrengths[key];

                // 当前射线存在绕射和反射
                if (rays.Count > 0)
                {
                    updateBuildingID(ref gs, rays);
                    NodeInfo ray = rays[rays.Count - 1];
                    if (ray.rayType == RayType.HReflection || ray.rayType == RayType.VReflection)
                    {
                        gs.RefNum    += 1;
                        gs.RefPwrW   += Pwr1;
                        gs.MaxRefPwrW = Math.Max(gs.MaxRefPwrW, Pwr1);
                    }
                    else if (ray.rayType == RayType.HDiffraction || ray.rayType == RayType.VDiffraction)
                    {
                        gs.DiffNum    += 1;
                        gs.DiffPwrW   += Pwr1;
                        gs.MaxDiffPwrW = Math.Max(gs.MaxDiffPwrW, Pwr1);
                    }

                    //反射、绕射建筑物id去重
                    gs.RefBuildingID  = DistinctStringArray(gs.RefBuildingID.Split(';'));
                    gs.DiffBuildingID = DistinctStringArray(gs.DiffBuildingID.Split(';'));
                }
                else if (rays.Count == 1)
                {
                    //当前射线是直射
                    gs.DirectNum    += 1;
                    gs.DirectPwrW   += Pwr1;
                    gs.MaxDirectPwrW = Math.Max(gs.MaxDirectPwrW, Pwr1);
                }

                this.gridStrengths[key] = gs;  // 更新
            }
            else
            {
                gs                    = new GridStrength();
                gs.GXID               = gxid;
                gs.GYID               = gyid;
                gs.Level              = gzid;
                gs.eNodeB             = this.cellInfo.eNodeB;
                gs.CI                 = this.cellInfo.CI;
                gs.RefBuildingID      = "";
                gs.DiffBuildingID     = "";
                gs.TransmitBuildingID = "";
                gs.GCenter            = p;
                gs.TransPwrW          = gs.RefPwrW = gs.DiffPwrW = gs.DirectPwrW = gs.ReceivedPowerW = 0;
                gs.TransNum           = gs.RefNum = gs.DiffNum = gs.DirectNum = 0;

                //当前射线存在绕射和反射
                if (rays.Count > 1)
                {
                    updateBuildingID(ref gs, rays);

                    NodeInfo ray = rays[rays.Count - 1];
                    if (ray.rayType == RayType.HReflection || ray.rayType == RayType.VReflection)
                    {
                        gs.RefNum         = 1;
                        gs.ReceivedPowerW = gs.MaxRefPwrW = gs.RefPwrW = Pwr1;
                    }
                    else if (ray.rayType == RayType.HDiffraction || ray.rayType == RayType.VDiffraction)
                    {
                        gs.DiffNum        = 1;
                        gs.ReceivedPowerW = gs.MaxDiffPwrW = gs.DiffPwrW = Pwr1;
                    }
                }
                else if (rays.Count == 1)
                {
                    //当前射线是直射
                    gs.DirectNum      = 1;
                    gs.ReceivedPowerW = gs.MaxDirectPwrW = gs.DirectPwrW = Pwr1;
                }

                this.gridStrengths.Add(key, gs);
            }
        }
Example #5
0
        // 2018.12.04
        // Pwr0  发射功率,单位w
        // Pwr1  接收功率,单位w
        // isT   是否穿过建筑物
        // ci    小区标识
        public void mergeGridStrengthBeam(int gxid, int gyid, int gzid, Point p, ref List <Beam.NodeInfo> rays, double Pwr0, double Pwr1)
        {
            GridStrength gs;
            string       key = String.Format("{0},{1},{2}", gxid, gyid, gzid);

            if (this.gridStrengths.ContainsKey(key))
            {
                gs = this.gridStrengths[key];

                // 当前射线存在反射
                if (rays.Count > 1)
                {
                    updateBuildingIDBeam(ref gs, rays);

                    gs.RefNum    += 1;
                    gs.RefPwrW   += Pwr1;
                    gs.MaxRefPwrW = Math.Max(gs.MaxRefPwrW, Pwr1);

                    //反射建筑物id去重
                    gs.RefBuildingID  = DistinctStringArray(gs.RefBuildingID.Split(';'));
                    gs.DiffBuildingID = DistinctStringArray(gs.DiffBuildingID.Split(';'));
                }
                else if (rays.Count == 1)
                {
                    //当前射线是直射
                    gs.DirectNum    += 1;
                    gs.DirectPwrW   += Pwr1;
                    gs.MaxDirectPwrW = Math.Max(gs.MaxDirectPwrW, Pwr1);
                }

                gs.ReceivedPowerW += Pwr1;

                this.gridStrengths[key] = gs;  // 更新
            }
            else  // 没有出现在栅格中
            {
                gs                    = new GridStrength();
                gs.GXID               = gxid;
                gs.GYID               = gyid;
                gs.Level              = gzid;
                gs.eNodeB             = this.cellInfo.eNodeB;
                gs.CI                 = this.cellInfo.CI;
                gs.RefBuildingID      = "";
                gs.DiffBuildingID     = "";
                gs.TransmitBuildingID = "";
                gs.GCenter            = p;
                gs.TransPwrW          = gs.RefPwrW = gs.DiffPwrW = gs.DirectPwrW = gs.ReceivedPowerW = 0;
                gs.TransNum           = gs.RefNum = gs.DiffNum = gs.DirectNum = 0;

                //当前射线存在反射
                if (rays.Count > 1)
                {
                    updateBuildingIDBeam(ref gs, rays);

                    gs.RefNum         = 1;
                    gs.ReceivedPowerW = gs.MaxRefPwrW = gs.RefPwrW = Pwr1;
                }
                else if (rays.Count == 1)
                {
                    //当前射线是直射
                    gs.DirectNum      = 1;
                    gs.ReceivedPowerW = gs.MaxDirectPwrW = gs.DirectPwrW = Pwr1;
                }

                this.gridStrengths.Add(key, gs);
            }
        }
Example #6
0
        public void outGS(GridStrength gs)
        {
            string s = string.Format("gxid={0}, gyid={1}, level={2}, lac={3}, ci={4}", gs.GXID, gs.GYID, gs.Level, gs.eNodeB, gs.CI);

            Console.WriteLine(s);
        }
        // getTb:读数据库的sql
        // flag:false--操作tbGridPathloss, true--操作tbBuildingGridPathloss
        // 只有半径比较大的时候才会用到,因为一次算不完
        private void mergePwr1(double EIRP, string getTb, bool flag, int eNodeB, int CI)
        {
            Hashtable ht = new Hashtable();

            ht["CI"]     = CI;
            ht["eNodeB"] = eNodeB;
            DataTable tb = IbatisHelper.ExecuteQueryForDataTable(getTb, ht);

            GridCover gc = GridCover.getInstance();

            if (flag)
            {
                gc.deleteBuildingCover(ht);
            }
            else
            {
                gc.deleteGroundCover(ht);
            }

            Dictionary <string, GridStrength> gridStrengths = new Dictionary <string, GridStrength>();

            foreach (DataRow dataRow in tb.Rows)
            {
                #region 读入数据,按栅格分组,合并
                int GXID = int.Parse(dataRow["GXID"].ToString());
                int GYID = int.Parse(dataRow["GYID"].ToString());
                int GZID = 0;
                if (flag)
                {
                    GZID = int.Parse(dataRow["Level"].ToString());
                }

                string key = String.Format("{0},{1},{2}", GXID, GYID, GZID);

                if (!gridStrengths.ContainsKey(key))
                {
                    GridStrength gs = new GridStrength();
                    gs.GXID   = GXID;
                    gs.GYID   = GYID;
                    gs.Level  = GZID;
                    gs.eNodeB = int.Parse(dataRow["eNodeB"].ToString());
                    gs.CI     = int.Parse(dataRow["CI"].ToString());
                    if (dataRow["FieldIntensity"].ToString() != "")
                    {
                        gs.FieldIntensity = double.Parse(dataRow["FieldIntensity"].ToString());
                    }
                    gs.DirectNum       = int.Parse(dataRow["DirectPwrNum"].ToString());
                    gs.DirectPwrW      = double.Parse(dataRow["DirectPwrW"].ToString());
                    gs.MaxDirectPwrW   = double.Parse(dataRow["MaxDirectPwrW"].ToString());
                    gs.RefNum          = int.Parse(dataRow["RefPwrNum"].ToString());
                    gs.RefPwrW         = double.Parse(dataRow["RefPwrW"].ToString());
                    gs.MaxRefPwrW      = double.Parse(dataRow["MaxRefPwrW"].ToString());
                    gs.RefBuildingID   = dataRow["RefBuildingID"].ToString();
                    gs.DiffNum         = int.Parse(dataRow["DiffNum"].ToString());
                    gs.DiffPwrW        = double.Parse(dataRow["DiffPwrW"].ToString());
                    gs.MaxDiffPwrW     = double.Parse(dataRow["MaxDiffPwrW"].ToString());
                    gs.DiffBuildingID  = dataRow["DiffBuildingID"].ToString();
                    gs.BTSGridDistance = double.Parse(dataRow["BTSGridDistance"].ToString());
                    //gs.ReceivedPowerW = double.Parse(dataRow["ReceivedPowerW"].ToString());
                    //gs.ReceivedPowerdbm = double.Parse(dataRow["ReceivedPowerdbm"].ToString());
                    //gs.PathLoss = double.Parse(dataRow["PathLoss"].ToString());
                    if (flag)
                    {
                        gs.TransNum           = int.Parse(dataRow["TransNum"].ToString());
                        gs.TransPwrW          = double.Parse(dataRow["TransPwrW"].ToString());
                        gs.MaxTransPwrW       = double.Parse(dataRow["MaxTransPwrW"].ToString());
                        gs.TransmitBuildingID = dataRow["TransmitBuildingID"].ToString();
                    }
                    else
                    {
                        gs.TransNum           = 0;
                        gs.TransPwrW          = 0;
                        gs.MaxTransPwrW       = 0;
                        gs.TransmitBuildingID = "";
                    }
                    gridStrengths.Add(key, gs);
                }
                else
                {
                    GridStrength ogs = gridStrengths[key];

                    ogs.DirectNum += int.Parse(dataRow["DirectPwrNum"].ToString());
                    double pwr = double.Parse(dataRow["DirectPwrW"].ToString());
                    ogs.DirectPwrW += double.Parse(dataRow["DirectPwrW"].ToString());
                    if (ogs.MaxDirectPwrW < double.Parse(dataRow["MaxDirectPwrW"].ToString()))
                    {
                        ogs.MaxDirectPwrW = double.Parse(dataRow["MaxDirectPwrW"].ToString());
                    }

                    ogs.RefBuildingID += dataRow["RefBuildingID"].ToString();
                    ogs.RefNum        += int.Parse(dataRow["RefPwrNum"].ToString());
                    ogs.RefPwrW       += double.Parse(dataRow["RefPwrW"].ToString());
                    if (ogs.MaxRefPwrW < double.Parse(dataRow["MaxRefPwrW"].ToString()))
                    {
                        ogs.MaxRefPwrW = double.Parse(dataRow["MaxRefPwrW"].ToString());
                    }

                    ogs.DiffNum        += int.Parse(dataRow["DiffNum"].ToString());
                    ogs.DiffPwrW       += double.Parse(dataRow["DiffPwrW"].ToString());
                    ogs.DiffBuildingID += dataRow["DiffBuildingID"].ToString();
                    if (ogs.MaxDiffPwrW < double.Parse(dataRow["MaxDiffPwrW"].ToString()))
                    {
                        ogs.MaxDiffPwrW = double.Parse(dataRow["MaxDiffPwrW"].ToString());
                    }

                    if (flag)
                    {
                        ogs.TransNum           += int.Parse(dataRow["TransNum"].ToString());
                        ogs.TransPwrW          += double.Parse(dataRow["TransPwrW"].ToString());
                        ogs.TransmitBuildingID += dataRow["TransmitBuildingID"].ToString();
                        if (ogs.MaxTransPwrW < double.Parse(dataRow["MaxTransPwrW"].ToString()))
                        {
                            ogs.MaxTransPwrW = double.Parse(dataRow["MaxTransPwrW"].ToString());
                        }
                    }

                    //dictionary不能自动更新
                    gridStrengths[key] = ogs;
                }
                #endregion

                if (gridStrengths.Count > 30000)
                {
                    # region 计算栅格最终功率
                    foreach (var k in gridStrengths.Keys.ToArray())
                    {
                        GridStrength ogs = gridStrengths[k];
                        double       p   = ogs.DirectPwrW + ogs.DiffPwrW + ogs.RefPwrW + ogs.TransPwrW;
                        if (p > 0)
                        {
                            ogs.ReceivedPowerW = p;
                        }

                        ogs.ReceivedPowerdbm = convertw2dbm(ogs.ReceivedPowerW);
                        ogs.PathLoss         = EIRP - ogs.ReceivedPowerdbm;

                        //反射、绕射建筑物id去重
                        ogs.RefBuildingID      = DistinctStringArray(ogs.RefBuildingID.Split(';'));
                        ogs.DiffBuildingID     = DistinctStringArray(ogs.DiffBuildingID.Split(';'));
                        ogs.TransmitBuildingID = DistinctStringArray(ogs.TransmitBuildingID.Split(';'));

                        //dictionary 不能自动更新
                        gridStrengths[k] = ogs;
                    }
                    #endregion

                    #region   写入数据库
                    gc.convertToDt(gridStrengths);

                    if (flag)
                    {
                        gc.writeBuildingCover(ht);
                        gc.clearBuilding();
                    }
                    else
                    {
                        gc.wirteGroundCover(ht);
                        gc.clearGround();
                    }
                    #endregion

                    gridStrengths.Clear();
                }
            }