예제 #1
0
        public JsonResult ImportCells(EvaluationInfrastructure infrastructure,
                                      string message)
        {
            IEnumerable <ENodeb> eNodebs;

            if (message != "")
            {
                string[] ids = message.GetSplittedFields(',');
                eNodebs
                    = from a in eNodebList
                      join b in ids
                      on a.ENodebId equals int.Parse(b)
                      select a;
            }
            else
            {
                eNodebs = eNodebList;
            }
            IEnumerable <IOutdoorCell> outdoorCellList = cellRepository.Query(eNodebs);

            infrastructure.AddCells(outdoorCellList as IEnumerable <EvaluationOutdoorCell>);

            return(Json(infrastructure.CellList.Select(x =>
                                                       new
            {
                CellName = x.CellName,
                CellInfo = x.Info()
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public JsonResult ImportCellsWithRange(EvaluationInfrastructure infrastructure,
                                               StatComplexFieldRepository repository,
                                               string fieldName, double southWestLon, double southWestLat,
                                               double northEastLon, double northEastLat)
        {
            infrastructure.ImportCellList(
                eNodebRepository,
                cellRepository,
                new GeoPoint(southWestLon - GeoMath.BaiduLongtituteOffset, southWestLat - GeoMath.BaiduLattituteOffset),
                new GeoPoint(northEastLon - GeoMath.BaiduLongtituteOffset, northEastLat - GeoMath.BaiduLattituteOffset));
            if (string.IsNullOrEmpty(fieldName))
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
            infrastructure.Region.CalculatePerformance(EvaluationSettings.TrafficLoad);
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            List <MeasurePointInfo> infoList
                = infrastructure.Region.GetMeasureMergedList(field, EvaluationSettings.DistanceInMeter);

            return(Json(infoList.Select(x =>
                                        new
            {
                X1 = x.X1 + GeoMath.BaiduLongtituteOffset,
                Y1 = x.Y1 + GeoMath.BaiduLattituteOffset,
                X2 = x.X2 + GeoMath.BaiduLongtituteOffset,
                Y2 = x.Y2 + GeoMath.BaiduLattituteOffset,
                C = x.ColorString
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
        public void TestEvaluationInfrastructure_DefaultConstructor_CalculatePerformance()
        {
            infrastructure = new EvaluationInfrastructure(
                new GeoPoint(113, 23), new GeoPoint(113.003, 23.003), cellList);
            infrastructure.Region.CalculatePerformance(0.1);
            Assert.IsTrue(infrastructure.Region[5].Result.NominalSinr > 2);
            Assert.IsTrue(infrastructure.Region[7].Result.NominalSinr > 12);
            MeasurePoint point16 = infrastructure.MeasurePointList[16];

            Assert.AreEqual(point16.Longtitute, 113.000899, eps);
            Assert.AreEqual(point16.Lattitute, 23.000899, eps);
            Assert.IsTrue(point16.Result.NominalSinr > 15);
            MeasurePoint point24 = infrastructure.MeasurePointList[24];

            Assert.AreEqual(point24.Longtitute, 113.001349, eps);
            Assert.AreEqual(point24.Lattitute, 23.001349, eps);
            Assert.IsTrue(point24.Result.NominalSinr > 21);
            IEnumerable <MeasurePoint> orderedList = infrastructure.MeasurePointList.OrderByDescending(
                x => x.Result.NominalSinr);
            MeasurePoint point = orderedList.ElementAt(0);

            Assert.IsTrue(point.Result.NominalSinr > 28);
            Assert.AreEqual(point.Longtitute, 113.0022483, eps);
            Assert.AreEqual(point.Lattitute, 23, eps);
        }
예제 #4
0
 public JsonResult GetCells(EvaluationInfrastructure infrastructure)
 {
     return(Json(infrastructure.CellList.Select(x =>
                                                new
     {
         CellName = x.CellName,
         CellInfo = x.Info()
     }).ToArray(),
                 JsonRequestBehavior.AllowGet));
 }
예제 #5
0
 public ActionResult PointsCalculate(EvaluationInfrastructure infrastructure)
 {
     infrastructure.InitializeRegion();
     if (infrastructure.Region == null || infrastructure.Region.Length == 0 ||
         infrastructure.CellList.Count == 0)
     {
         TempData["warning"] = "仿真区域设置为空!请先设置仿真区域。";
         return(RedirectToAction("RegionDef"));
     }
     infrastructure.Region.CalculatePerformance(EvaluationSettings.TrafficLoad);
     TempData["success"] = "仿真数据处理成功!可以查看仿真结果。";
     return(RedirectToAction("PointsAnalysis"));
 }
예제 #6
0
        public object BindModel(ControllerContext controllerContext,
                                ModelBindingContext bindingContext)
        {
            EvaluationInfrastructure evaluation
                = (EvaluationInfrastructure)controllerContext.HttpContext.Session[sessionKey];

            if (evaluation == null)
            {
                evaluation = new EvaluationInfrastructure();
                controllerContext.HttpContext.Session[sessionKey] = evaluation;
            }
            // return the cart
            return(evaluation);
        }
 public void TestEvaluationInfrastructure_DefaultConstructor()
 {
     infrastructure = new EvaluationInfrastructure(
         new GeoPoint(113, 23), new GeoPoint(113.003, 23.003), cellList);
     Assert.IsNotNull(infrastructure);
     Assert.IsNotNull(infrastructure.MeasurePointList);
     Assert.IsNotNull(infrastructure.Region);
     Assert.AreEqual(infrastructure.Region.Length, 49, "region length");
     Assert.AreEqual(infrastructure.MeasurePointList.Count(), 49, "points");
     Assert.IsNotNull(infrastructure.Region[5].Result);
     Assert.AreEqual(infrastructure.Region[5].Result.NominalSinr, double.MinValue);
     Assert.AreEqual(infrastructure.Region[5].CellRepository.CellList.Count, 6);
     Assert.AreEqual(infrastructure.Region[5].CellRepository.CellList[0].Cell.Cell.Longtitute, 113.001);
 }
 public void TestEvaluationInfrastructure_CellConstructor()
 {
     infrastructure = new EvaluationInfrastructure();
     infrastructure.ImportCellList(cellList);
     Assert.IsNotNull(infrastructure);
     Assert.IsNotNull(infrastructure.MeasurePointList);
     Assert.IsNotNull(infrastructure.Region);
     Assert.AreEqual(infrastructure.Region.Length, 4956);
     Assert.AreEqual(infrastructure.MeasurePointList.Count(), 4956);
     Assert.IsNotNull(infrastructure.Region[5].Result);
     Assert.AreEqual(infrastructure.Region[5].Result.NominalSinr, double.MinValue);
     Assert.AreEqual(infrastructure.Region[5].CellRepository.CellList.Count, 6);
     Assert.AreEqual(infrastructure.Region[5].CellRepository.CellList[0].Cell.Cell.Longtitute, 113.001);
     Assert.AreEqual(infrastructure.Region.DegreeInterval, 0.00045, eps);
 }
예제 #9
0
        public JsonResult GetPoints(string fieldName,
                                    EvaluationInfrastructure infrastructure,
                                    StatValueFieldRepository repository)
        {
            StatValueField          field = repository.FieldList[(int)fieldName.GetStatValueIndex()];
            List <MeasurePointInfo> infoList
                = infrastructure.Region.GetMeasureMergedList(field, EvaluationSettings.DistanceInMeter);

            return(Json(infoList.Select(x =>
                                        new {
                X1 = x.X1 + GeoMath.BaiduLongtituteOffset,
                Y1 = x.Y1 + GeoMath.BaiduLattituteOffset,
                X2 = x.X2 + GeoMath.BaiduLongtituteOffset,
                Y2 = x.Y2 + GeoMath.BaiduLattituteOffset,
                C = x.ColorString
            }).ToArray(),
                        JsonRequestBehavior.AllowGet));
        }
        public void TestEvaluationInfrastructure_CellConstructor_CalculatePerformance()
        {
            infrastructure = new EvaluationInfrastructure();
            infrastructure.ImportCellList(cellList);
            infrastructure.Region.CalculatePerformance(0.1);
            Assert.IsTrue(infrastructure.Region[5].Result.NominalSinr > 1);
            Assert.IsTrue(infrastructure.Region[7].Result.NominalSinr > 1);
            IEnumerable <MeasurePoint> orderedList = infrastructure.MeasurePointList.OrderByDescending(
                x => x.Result.NominalSinr);
            MeasurePoint point = orderedList.ElementAt(0);

            Assert.IsTrue(point.Result.NominalSinr > 30);
            Assert.IsTrue(point.Result.StrongestCell.ReceivedRsrp > -65);
            Assert.IsTrue(point.Result.StrongestCell.DistanceInMeter < 30);
            Assert.AreEqual(point.CellRepository.CellList.Count, 6);
            Assert.AreEqual(point.CellRepository.CellList[0].ReceivedRsrp, point.Result.StrongestCell.ReceivedRsrp, eps);

            Assert.AreEqual(point.CellRepository.CellList[0].PciModx, 2);
        }
예제 #11
0
        public ActionResult ExportPoints(string fieldName,
                                         EvaluationInfrastructure infrastructure,
                                         StatValueFieldRepository repository)
        {
            if (infrastructure.Region == null || infrastructure.Region.Length == 0 ||
                infrastructure.CellList.Count == 0)
            {
                TempData["warning"] = "仿真区域设置为空!请先设置仿真区域。";
                return(RedirectToAction("RegionDef"));
            }
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            if (field.IntervalList.Count == 0)
            {
                TempData["warning"] = "显示区间设置为空!请先设置区间。";
                return(RedirectToAction("PointsAnalysis"));
            }

            TempData["centerX"] = infrastructure.CellList.Average(x => x.BaiduLongtitute);
            TempData["centerY"] = infrastructure.CellList.Average(x => x.BaiduLattitute);
            return(View(field));
        }
예제 #12
0
        public ActionResult ExportKml(string fieldName,
                                      EvaluationInfrastructure infrastructure,
                                      StatValueFieldRepository repository)
        {
            StatValueField field = repository.FieldList[(int)fieldName.GetStatValueIndex()];

            if (field.IntervalList.Count == 0)
            {
                TempData["warning"] = "显示区间设置为空!请先设置区间。";
                return(RedirectToAction("PointsAnalysis"));
            }

            GoogleKml kml = new GoogleKml("framework.xml");
            string    absoluFilePath
                = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "uploads\\",
                               "Kmlresults-" + field.FieldName + DateTime.Today.ToString("yyyyMMdd"));

            kml.GenerateKmlFile(absoluFilePath,
                                infrastructure.Region.GetMeasureInfoList(field, EvaluationSettings.DistanceInMeter), field);
            return(File(new FileStream(absoluFilePath, FileMode.Open),
                        "application/octet-stream", Server.UrlEncode(
                            "Kmlresults-" + field.FieldName + DateTime.Today.ToString("yyyyMMdd") + ".kml")));
        }
예제 #13
0
        public ActionResult RegionDef(ENodebQueryViewModel viewModel,
                                      EvaluationInfrastructure infrastructure)
        {
            eNodebList = eNodebRepository.GetAllWithNames(townRepository,
                                                          viewModel, viewModel.ENodebName, viewModel.Address);

            EvaluationViewModel model = new EvaluationViewModel
            {
                ENodebs    = eNodebList.Take(PageSize).ToList(),
                PagingInfo = new PagingInfo
                {
                    CurrentPage  = 1,
                    ItemsPerPage = PageSize,
                    TotalItems   = eNodebList.Count()
                },
                TrafficLoad     = EvaluationSettings.TrafficLoad * 100,
                CellCoverage    = (int)EvaluationSettings.DegreeSpan.GetDistanceInMeter(),
                DistanceInMeter = EvaluationSettings.DistanceInMeter
            };

            model.InitializeTownList(townRepository);
            ViewBag.RegionList = infrastructure.Region;
            return(View(model));
        }
예제 #14
0
 public JsonResult RemoveOneCell(EvaluationInfrastructure infrastructure,
                                 string cellName)
 {
     infrastructure.RemoveCell(cellName);
     return(Json(null, JsonRequestBehavior.AllowGet));
 }
예제 #15
0
        public JsonResult GetSectors(EvaluationInfrastructure infrastructure)
        {
            List <SectorTriangle> sectors = infrastructure.CellList.GetSectors();

            return(Json(sectors, JsonRequestBehavior.AllowGet));
        }
예제 #16
0
 public void SetUp()
 {
     infrastructure = new EvaluationInfrastructure();
 }