public void WriteDt(DataRange dataRange) { RedisMq.subscriber.Subscribe("cover2db_finish", (channel, message) => { Hashtable ht = new Hashtable(); DataTable dtable = new DataTable(); //数据模拟阶段,选取top k int sRec = 2000 * 2000; int k = sRec / (canGridL * canGridW); ht["eNodeB"] = message; ht["k"] = k; //删除已有的路测点 ht["fromName"] = dataRange.infAreaId + "_" + message; IbatisHelper.ExecuteDelete("delSelectDt", ht); DataTable dt = DB.IbatisHelper.ExecuteQueryForDataTable("qureyMockDT", ht); dtable.Columns.Add("ID", System.Type.GetType("System.Int32")); dtable.Columns.Add("x", System.Type.GetType("System.Decimal")); dtable.Columns.Add("y", System.Type.GetType("System.Decimal")); //dtable.Columns.Add("Lon", System.Type.GetType("System.Decimal")); //dtable.Columns.Add("Lat", System.Type.GetType("System.Decimal")); dtable.Columns.Add("RSRP", System.Type.GetType("System.Double")); dtable.Columns.Add("InfName", System.Type.GetType("System.String")); //dtable.Columns.Add("DtType", System.Type.GetType("System.String")); int initOff = 5000; int uid = (int)UIDHelper.GenUIdByRedis("DT", dt.Rows.Count) + initOff; string infName = dataRange.infAreaId + "_" + message; for (int i = 0; i < dt.Rows.Count; i++) { var row = dt.Rows[i]; int gxid = (int)row["GXID"]; int gyid = (int)row["GYID"]; double rsrp = (double)row["ReceivedPowerdbm"]; Point geo = GridHelper.getInstance().GridToGeo(gxid, gyid); Point proj = GridHelper.getInstance().GridToXY(gxid, gyid); DataRow thisrow = dtable.NewRow(); thisrow["ID"] = uid + i; thisrow["x"] = proj.X; thisrow["y"] = proj.Y; //thisrow["Lon"] = geo.X; //thisrow["Lat"] = geo.Y; thisrow["RSRP"] = rsrp; thisrow["InfName"] = infName; //thisrow["DtType"] = "mock"; dtable.Rows.Add(thisrow); } //DataUtil.BCPDataTableImport(dtable, "tbUINTF"); SelectDT(infName, dtable); }); }
public void Wdt() { Hashtable ht = new Hashtable(); DataTable dtable = new DataTable(); dtable.Columns.Add("ID", System.Type.GetType("System.Int32")); dtable.Columns.Add("x", System.Type.GetType("System.Decimal")); dtable.Columns.Add("y", System.Type.GetType("System.Decimal")); dtable.Columns.Add("Lon", System.Type.GetType("System.Decimal")); dtable.Columns.Add("Lat", System.Type.GetType("System.Decimal")); dtable.Columns.Add("RSRP", System.Type.GetType("System.Double")); dtable.Columns.Add("InfName", System.Type.GetType("System.String")); dtable.Columns.Add("DtType", System.Type.GetType("System.String")); for (int vir = 50369; vir <= 50458; vir++) { dtable.Clear(); ht["eNodeB"] = vir; DataTable dt = DB.IbatisHelper.ExecuteQueryForDataTable("qureyMockDT", ht); int initOff = 5000; int uid = (int)UIDHelper.GenUIdByRedis("DT", dt.Rows.Count) + initOff; for (int i = 0; i < dt.Rows.Count; i++) { var row = dt.Rows[i]; int gxid = (int)row["GXID"]; int gyid = (int)row["GYID"]; double rsrp = (double)row["ReceivedPowerdbm"]; Point geo = GridHelper.getInstance().GridToGeo(gxid, gyid); Point proj = GridHelper.getInstance().GridToXY(gxid, gyid); DataRow thisrow = dtable.NewRow(); thisrow["ID"] = uid + i; thisrow["x"] = proj.X; thisrow["y"] = proj.Y; thisrow["Lon"] = geo.X; thisrow["Lat"] = geo.Y; thisrow["RSRP"] = rsrp; thisrow["InfName"] = "v1" + "_" + vir; thisrow["DtType"] = "mock"; dtable.Rows.Add(thisrow); } DataUtil.BCPDataTableImport(dtable, "tbUINTF"); } }
public List <CellRayTracingModel> interfeCellGen(DataRange dataRange) { List <CellRayTracingModel> res = new List <CellRayTracingModel>(); Point pMin = new Point(); pMin.X = dataRange.minLongitude; pMin.Y = dataRange.minLatitude; pMin.Z = 0; LTE.Utils.PointConvertByProj.Instance.GetProjectPoint(pMin); Point pMax = new Point(); pMax.X = dataRange.maxLongitude; pMax.Y = dataRange.maxLatitude; pMax.Z = 0; LTE.Utils.PointConvertByProj.Instance.GetProjectPoint(pMax); double maxBh = 90; //最大建筑物高度 int radius = 1200; //干扰源覆盖半径 String tarBaseName = dataRange.infAreaId + "_"; List <CELL> cells = new List <CELL>(); int batch = 10; int cnt = 0; //计算测试数据总数 int lx = (int)Math.Ceiling((pMax.X - pMin.X) / dataRange.tarGridX); int ly = (int)Math.Ceiling((pMax.Y - pMin.Y) / dataRange.tarGridY); int lz = (int)Math.Ceiling(maxBh / dataRange.tarGridH); long uidBatch = long.Parse((lx * ly * lz).ToString()); String dbName = "CELL"; int initOff = 1500000; int uid = (int)UIDHelper.GenUIdByRedis(dbName, uidBatch) + initOff; for (double x = pMin.X; x < pMax.X; x += dataRange.tarGridX) { for (double y = pMin.Y; y < pMax.Y; y += dataRange.tarGridY) { for (double z = 30; z <= maxBh; z += 30) { cnt++; Random r = new Random(uid); CELL cELL = new CELL(); cELL.ID = uid; cELL.CellName = dataRange.infAreaId + "_" + uid; cELL.Altitude = 13; cELL.AntHeight = (decimal)z; cELL.x = (decimal)x; cELL.y = (decimal)y; cELL.CI = uid; cELL.eNodeB = uid; cELL.EIRP = 32; cELL.Azimuth = 0; cELL.Tilt = r.Next(4, 16); //下倾角范围4~16之间随机取 cELL.EARFCN = 63; cELL.CoverageRadius = radius; cells.Add(cELL); CellRayTracingModel rayCell = new CellRayTracingModel(); rayCell.cellName = cELL.CellName; rayCell.reflectionNum = 3; rayCell.diffPointsMargin = 5; rayCell.diffractionNum = 2; rayCell.threadNum = 3; rayCell.incrementAngle = 180; rayCell.computeIndoor = false; rayCell.computeDiffrac = true; rayCell.distance = radius; res.Add(rayCell); uid++; } if (res.Count >= batch) { IbatisHelper.ExecuteInsert("CELL_BatchInsert", cells); cells.Clear(); } } } if (cells.Count > 0) { IbatisHelper.ExecuteInsert("CELL_BatchInsert", cells); } return(res); }