public Item(int bitrate, int fileType, string rid, DTInfo dtInfo) { Bitrate = bitrate; FileType = fileType; Rid = rid; DtInfo = dtInfo; }
public ActionResult <DTInfo> JsonAction([FromBody] DTInfo dtInfo) { var newDt = new DTInfo() { Time = dtInfo.Time.AddDays(1) }; return(new JsonResult(newDt)); }
//路测数据字典,by jinhj //key:“cellid,gxid,gyid” //value: List<DTInfo> cellIdList public static Dictionary <string, List <DTInfo> > getDTInfoFromtbDT(ref DataTable dtTb) { Dictionary <string, List <DTInfo> > dtDic = new Dictionary <string, List <DTInfo> >(); for (int i = 0; i < dtTb.Rows.Count; i++) { //拼接key if (dtTb.Rows[i]["x"] == System.DBNull.Value || dtTb.Rows[i]["y"] == System.DBNull.Value) { continue; } double x = double.Parse(dtTb.Rows[i]["x"].ToString()); double y = double.Parse(dtTb.Rows[i]["y"].ToString()); int gxid = -1; int gyid = -1; GridHelper.getInstance().XYToGGrid(x, y, ref gxid, ref gyid); string cellId = dtTb.Rows[i]["CI"].ToString(); string key = string.Format("{0},{1},{2}", cellId, gxid, gyid); //if (key == "35653633,4045,4427") { // int a = 1; //} //路测接收信号强度放入value double pwrDbm = double.Parse(dtTb.Rows[i]["RSRP"].ToString()); double distance = double.Parse(dtTb.Rows[i]["SCell_Dist"].ToString()); DTInfo dtInfo = new DTInfo(pwrDbm, distance); if (!dtDic.ContainsKey(key)) { dtDic[key] = new List <DTInfo>(); } dtDic[key].Add(dtInfo); } return(dtDic); }
public void Add(int bitrate, int ft, string rid, DTInfo dtinfo) { items.Add(new Item(bitrate, ft, rid, dtinfo)); }
//过滤路测点,和计算点,路测点将含距离信息 private void filterWithDTInfo(ref DataTable rayAdjTb, ref DataTable DTTb, ref Dictionary <string, List <DTInfo> > meaPwr, ref Dictionary <string, TrajInfo> rayDic) { //筛选前 Dictionary <string, TrajInfo> rayDicOri = CalRays.buildingGrids(ref rayAdjTb); //计算生成的轨迹数据 Dictionary <string, List <DTInfo> > meaPwrOri = CalRays.getDTInfoFromtbDT(ref DTTb); //路测数据 //Dictionary<string, List<double>> meaPwrOri = CalRays.getMeaPwr(ref rayDicOri, this.sceneNum); //模拟路测 #region 将原始的计算数据及路测数据转换为rayID字典及meaID字典:key: (gxid,gyid), value: 该栅格对应的小区ID组成的list Dictionary <string, List <int> > rayID = new Dictionary <string, List <int> >(); Dictionary <string, List <int> > meaID = new Dictionary <string, List <int> >(); foreach (string key in rayDicOri.Keys) { string[] k = key.Split(','); string id = k[1] + "," + k[2]; if (rayID.Keys.Contains(id)) { rayID[id].Add(Convert.ToInt32(k[0])); } else { rayID[id] = new List <int>(); rayID[id].Add(Convert.ToInt32(k[0])); } } foreach (string key in meaPwrOri.Keys) { string[] k = key.Split(','); string id = k[1] + "," + k[2]; if (meaID.Keys.Contains(id)) { meaID[id].Add(Convert.ToInt32(k[0])); } else { meaID[id] = new List <int>(); meaID[id].Add(Convert.ToInt32(k[0])); } } #endregion #region 筛选 HashSet <string> keys = new HashSet <string>(); //(cellID,gxid,gyid) foreach (string key in meaID.Keys) //遍历路测数据包含的栅格 { if (!rayID.Keys.Contains(key)) { continue; } List <int> list = meaID[key].Intersect(rayID[key]).ToList(); // 求交集,得到两者的公共小区 // 一个栅格会收到来自多个小区的信号 // 如果两者的公共小区数<3,都选;否则,选一个真实路测最强的,一个射线计算最强的,一个两者差值最大的 if (list.Count <= 3) { for (int i = 0; i < list.Count; i++) { string k = string.Format("{0},{1}", list[i], key); keys.Add(k); } } else { double max = Double.MinValue; string maxK = ""; double max1 = Double.MinValue; string maxK1 = ""; double max2 = Double.MinValue; string maxK2 = ""; for (int i = 0; i < list.Count; i++) { string k = string.Format("{0},{1}", list[i], key); // 真实路测最强的 for (int j = 0; j < meaPwrOri[k].Count; ++j) { double tmp = meaPwrOri[k][j].pwrDbm; if (tmp > max2) { max2 = tmp; maxK = k; } } // 射线计算最强的 if (rayDicOri[k].sumPwrDbm > max1) { max1 = rayDicOri[k].sumPwrDbm; maxK1 = k; } // 两者差值最大的 for (int j = 0; j < meaPwrOri[k].Count; ++j) { double tmp = Math.Abs(rayDicOri[k].sumPwrDbm - meaPwrOri[k][j].pwrDbm); if (tmp > max2) { max2 = tmp; maxK2 = k; } } } keys.Add(maxK); keys.Add(maxK1); keys.Add(maxK2); } } #endregion // 筛选后 rayDic = new Dictionary <string, TrajInfo>(); meaPwr = new Dictionary <string, List <DTInfo> >(); foreach (string key in keys) { rayDic[key] = rayDicOri[key]; meaPwr[key] = meaPwrOri[key]; } //一个小区一个栅格,只选择一个与计算值差的最大的路测点 int BigErrorPointCnt = 0; foreach (string key in keys) { double recePwr = rayDic[key].sumPwrDbm; ////测试用 查找某一栅格的计算值 //if (key == "35653633,4045,4427") { // int testPoint = 1; //} DTInfo maxDiffDtInfo = meaPwr[key][0]; //与实际值差值最大的路测点,初始化为第一个路测点 double maxDiff = -1; //差值最大值 foreach (DTInfo dtInfo in meaPwr[key]) { double diff = Math.Abs(recePwr - dtInfo.pwrDbm); if (diff > maxDiff) { maxDiff = diff; maxDiffDtInfo = dtInfo; } } //更新路测数据为一个栅格一个(与真实值差的最大的)路测值 meaPwr[key] = new List <DTInfo>(); meaPwr[key].Add(maxDiffDtInfo); } //找到真实值与路测值差的最大的小区,写入文件 double maxDiffVal = -1;//最大差值 double maxDifRecePwr = -1; double maxDifDtPwr = -1; string maxDifKey = ""; //最大差值对应的小区key foreach (string key in keys) { double recePwr = rayDic[key].sumPwrDbm; foreach (DTInfo dtInfo in meaPwr[key]) { double diff = Math.Abs(recePwr - dtInfo.pwrDbm); if (diff > maxDiffVal) { maxDiffVal = diff; maxDifKey = key; maxDifRecePwr = recePwr; maxDifDtPwr = dtInfo.pwrDbm; } } } StreamWriter maxDiffPointFile; string path1 = EA.basePath + @"maxDiffPoint.txt"; maxDiffPointFile = File.CreateText(path1); maxDiffPointFile.WriteLine(maxDifKey + "\t" + "路测值:" + maxDifDtPwr.ToString("0.00") + "计算值:" + maxDifRecePwr.ToString("0.00")); maxDiffPointFile.Close(); //测指定点用,测试完删掉 //指定点 //string testKey = "35653633,4045,4427"; //double testPwr = meaPwr[testKey][0]; ////指定点:最大误差点 //string testKey = maxDifKey; //double testPwr = maxDifDtPwr; //meaPwr = new Dictionary<string, List<double>>(); //meaPwr[testKey] = new List<double>(); //meaPwr[testKey].Add(testPwr); }