Exemple #1
0
 public void TestCoverageStat()
 {
     record = new LogRecord()
     {
         Pci          = 111,
         Sinr         = 12,
         Rsrp         = -110,
         PdschTbCode0 = 12345,
         PdschTbCode1 = 23456,
         Longtitute   = 112.1,
         Lattitute    = 23.2,
         Time         = DateTime.Parse("11:30:04"),
         ENodebId     = 1,
         SectorId     = 1,
         Earfcn       = 100
     };
     hRecord = new HugelandRecord()
     {
         Pci          = 111,
         Sinr         = 12,
         Rsrp         = -95,
         Longtitute   = 112.3,
         Lattitute    = 23.4,
         PdschTbCode0 = 12345,
         PdschTbCode1 = 23456,
         Time         = DateTime.Parse("2012-11-22 11:30:04"),
         ENodebId     = 1,
         SectorId     = 2,
         Earfcn       = 1825
     };
     stat = new CoverageStat();
     stat.Import(record);
     Assert.AreEqual(stat.Rsrp, -110);
     Assert.AreEqual(stat.Sinr, 12);
     Assert.AreEqual(stat.Longtitute, 112.1);
     Assert.AreEqual(stat.Lattitute, 23.2);
     Assert.AreEqual(stat.ENodebId, 1);
     Assert.AreEqual(stat.SectorId, 1);
     Assert.AreEqual(stat.Earfcn, 100);
     stat.Import(hRecord);
     Assert.AreEqual(stat.Rsrp, -95);
     Assert.AreEqual(stat.Sinr, 12);
     Assert.AreEqual(stat.Longtitute, 112.3);
     Assert.AreEqual(stat.Lattitute, 23.4);
     Assert.AreEqual(stat.ENodebId, 1);
     Assert.AreEqual(stat.SectorId, 2);
     Assert.AreEqual(stat.Earfcn, 1825);
 }
Exemple #2
0
 public void TestCoverageStat()
 {
     record = new LogRecord()
     {
         Pci = 111,
         Sinr = 12,
         Rsrp = -110,
         PdschTbCode0 = 12345,
         PdschTbCode1 = 23456,
         Longtitute = 112.1,
         Lattitute = 23.2,
         Time = DateTime.Parse("11:30:04"),
         ENodebId = 1,
         SectorId = 1,
         Earfcn =100
     };
     hRecord = new HugelandRecord()
     {
         Pci = 111,
         Sinr = 12,
         Rsrp = -95,
         Longtitute = 112.3,
         Lattitute = 23.4,
         PdschTbCode0 = 12345,
         PdschTbCode1 = 23456,
         Time = DateTime.Parse("2012-11-22 11:30:04"),
         ENodebId = 1,
         SectorId = 2,
         Earfcn = 1825
     };
     stat = new CoverageStat();
     stat.Import(record);
     Assert.AreEqual(stat.Rsrp, -110);
     Assert.AreEqual(stat.Sinr, 12);
     Assert.AreEqual(stat.Longtitute, 112.1);
     Assert.AreEqual(stat.Lattitute, 23.2);
     Assert.AreEqual(stat.ENodebId, 1);
     Assert.AreEqual(stat.SectorId, 1);
     Assert.AreEqual(stat.Earfcn, 100);
     stat.Import(hRecord);
     Assert.AreEqual(stat.Rsrp, -95);
     Assert.AreEqual(stat.Sinr, 12);
     Assert.AreEqual(stat.Longtitute, 112.3);
     Assert.AreEqual(stat.Lattitute, 23.4);
     Assert.AreEqual(stat.ENodebId, 1);
     Assert.AreEqual(stat.SectorId, 2);
     Assert.AreEqual(stat.Earfcn, 1825);
 }
 public void TestCoverageStatList_Hugeland()
 {
     HugelandDescriptionInitialize();
     testInput = HugelandRecordExample;
     coverageStatList = CsvContext.ReadString<HugelandRecord>(testInput, fileDescription_namesUs).Select(x =>
     {
         CoverageStat stat = new CoverageStat(); stat.Import(x); return stat;
     }).ToList();
     Assert.AreEqual(coverageStatList.Count, 19);
     Assert.AreEqual(coverageStatList[0].Longtitute, 113.13548);
     Assert.AreEqual(coverageStatList[0].Lattitute, 23.07062);
     Assert.AreEqual(coverageStatList[0].Rsrp, -93);
     Assert.AreEqual(coverageStatList[0].Sinr, 3.4);
     CoverageStatChart chart = new CoverageStatChart();
     chart.Import(coverageStatList);
     Assert.AreEqual(chart.StatList.Count, 9);
     Assert.AreEqual(chart.StatList[0].Longtitute, 113.13548);
     Assert.AreEqual(chart.StatList[0].Lattitute, 23.07062);
     Assert.AreEqual(chart.StatList[0].Rsrp, -93);
     Assert.AreEqual(chart.StatList[1].Rsrp, -93.2, 1E-6);
     Assert.AreEqual(chart.StatList[2].Rsrp, -93.15);
     Assert.AreEqual(chart.StatList[3].Rsrp, -92.6);
     Assert.AreEqual(chart.StatList[4].Rsrp, -94.1);
     Assert.AreEqual(chart.StatList[5].Rsrp, -96.5);
     Assert.AreEqual(chart.StatList[6].Rsrp, -98.5);
     Assert.AreEqual(chart.StatList[7].Rsrp, -98.5);
     Assert.AreEqual(chart.StatList[8].Rsrp, -98.5);
     Assert.AreEqual(chart.StatList[0].Sinr, 3.4);
     Assert.AreEqual(chart.StatList[1].Sinr, 2.8);
     Assert.AreEqual(chart.StatList[2].Sinr, 2.55);
 }
 public void TestCoverageStatList_Dingli()
 {
     DescriptionInitialize();
     testInput = DingliRecordExample;
     coverageStatList = CsvContext.ReadString<LogRecord>(testInput, fileDescription_namesUs).Select(x =>
         {
              CoverageStat stat = new CoverageStat(); stat.Import(x); return stat;
         }).ToList();
     Assert.AreEqual(coverageStatList.Count, 74);
     Assert.AreEqual(coverageStatList[0].Longtitute, -9999);
     Assert.AreEqual(coverageStatList[0].Rsrp, -97.31);
     Assert.AreEqual(coverageStatList[0].Sinr, 14.3);
     CoverageStatChart chart = new CoverageStatChart();
     chart.Import(coverageStatList);
     Assert.AreEqual(chart.StatList.Count, 7);
     Assert.AreEqual(chart.StatList[0].Longtitute, 113.0001);
     Assert.AreEqual(chart.StatList[0].Lattitute, 23.0002);
     Assert.AreEqual(chart.StatList[0].Rsrp, -97.31);
     Assert.AreEqual(chart.StatList[1].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[2].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[3].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[4].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[5].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[6].Rsrp, -97.25);
     Assert.AreEqual(chart.StatList[0].Sinr, 14.3);
     Assert.AreEqual(chart.StatList[1].Sinr, 13.4);
     Assert.AreEqual(chart.StatList[2].Sinr, 13.4);
     Assert.AreEqual(chart.StatList[3].Sinr, 13.4);
     Assert.AreEqual(chart.StatList[4].Sinr, 13.4);
     Assert.AreEqual(chart.StatList[5].Sinr, 13.4);
     Assert.AreEqual(chart.StatList[6].Sinr, 13.4);
 }
        public void TestCoverageStatList_Hugeland()
        {
            HugelandDescriptionInitialize();
            testInput        = HugelandRecordExample;
            coverageStatList = CsvContext.ReadString <HugelandRecord>(testInput, fileDescription_namesUs).Select(x =>
            {
                CoverageStat stat = new CoverageStat(); stat.Import(x); return(stat);
            }).ToList();
            Assert.AreEqual(coverageStatList.Count, 19);
            Assert.AreEqual(coverageStatList[0].Longtitute, 113.13548);
            Assert.AreEqual(coverageStatList[0].Lattitute, 23.07062);
            Assert.AreEqual(coverageStatList[0].Rsrp, -93);
            Assert.AreEqual(coverageStatList[0].Sinr, 3.4);
            CoverageStatChart chart = new CoverageStatChart();

            chart.Import(coverageStatList);
            Assert.AreEqual(chart.StatList.Count, 9);
            Assert.AreEqual(chart.StatList[0].Longtitute, 113.13548);
            Assert.AreEqual(chart.StatList[0].Lattitute, 23.07062);
            Assert.AreEqual(chart.StatList[0].Rsrp, -93);
            Assert.AreEqual(chart.StatList[1].Rsrp, -93.2, 1E-6);
            Assert.AreEqual(chart.StatList[2].Rsrp, -93.15);
            Assert.AreEqual(chart.StatList[3].Rsrp, -92.6);
            Assert.AreEqual(chart.StatList[4].Rsrp, -94.1);
            Assert.AreEqual(chart.StatList[5].Rsrp, -96.5);
            Assert.AreEqual(chart.StatList[6].Rsrp, -98.5);
            Assert.AreEqual(chart.StatList[7].Rsrp, -98.5);
            Assert.AreEqual(chart.StatList[8].Rsrp, -98.5);
            Assert.AreEqual(chart.StatList[0].Sinr, 3.4);
            Assert.AreEqual(chart.StatList[1].Sinr, 2.8);
            Assert.AreEqual(chart.StatList[2].Sinr, 2.55);
        }
        public void TestCoverageStatList_Dingli()
        {
            DescriptionInitialize();
            testInput        = DingliRecordExample;
            coverageStatList = CsvContext.ReadString <LogRecord>(testInput, fileDescription_namesUs).Select(x =>
            {
                CoverageStat stat = new CoverageStat(); stat.Import(x); return(stat);
            }).ToList();
            Assert.AreEqual(coverageStatList.Count, 74);
            Assert.AreEqual(coverageStatList[0].Longtitute, -9999);
            Assert.AreEqual(coverageStatList[0].Rsrp, -97.31);
            Assert.AreEqual(coverageStatList[0].Sinr, 14.3);
            CoverageStatChart chart = new CoverageStatChart();

            chart.Import(coverageStatList);
            Assert.AreEqual(chart.StatList.Count, 7);
            Assert.AreEqual(chart.StatList[0].Longtitute, 113.0001);
            Assert.AreEqual(chart.StatList[0].Lattitute, 23.0002);
            Assert.AreEqual(chart.StatList[0].Rsrp, -97.31);
            Assert.AreEqual(chart.StatList[1].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[2].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[3].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[4].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[5].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[6].Rsrp, -97.25);
            Assert.AreEqual(chart.StatList[0].Sinr, 14.3);
            Assert.AreEqual(chart.StatList[1].Sinr, 13.4);
            Assert.AreEqual(chart.StatList[2].Sinr, 13.4);
            Assert.AreEqual(chart.StatList[3].Sinr, 13.4);
            Assert.AreEqual(chart.StatList[4].Sinr, 13.4);
            Assert.AreEqual(chart.StatList[5].Sinr, 13.4);
            Assert.AreEqual(chart.StatList[6].Sinr, 13.4);
        }
        public ActionResult CoverageAnalyze(HttpPostedFileBase[] fileUpload, CoverageStatChart chart)
        {
            List <CoverageStat> coverageStatList = new List <CoverageStat>();

            if (fileUpload[0] != null)
            {
                foreach (HttpPostedFileBase file in fileUpload)
                {
                    using (HttpFileImporter importer = new HttpFileImporter(file))
                    {
                        if (!importer.Success)
                        {
                            if (TempData["warning"] == null)
                            {
                                TempData["warning"] = "请选择合适的路测数据导入!读取以下文件失败:"
                                                      + importer.FilePath;
                            }
                            else
                            {
                                TempData["warning"] += "; " + importer.FilePath;
                            }
                        }
                        else
                        {
                            string extension = Path.GetExtension(importer.FileName);
                            if (extension != null)
                            {
                                string fileExt = extension.ToLower();
                                coverageStatList.AddRange(
                                    (fileExt == ".txt") ?
                                    CsvContext.Read <LogRecord>(
                                        importer.Reader, CsvFileDescription.TabDescription).Select(x =>
                                {
                                    CoverageStat stat = new CoverageStat(); stat.Import(x); return(stat);
                                }).ToList() :
                                    CsvContext.Read <HugelandRecord>(
                                        importer.Reader, CsvFileDescription.CommaDescription).Select(x =>
                                {
                                    CoverageStat stat = new CoverageStat(); stat.Import(x); return(stat);
                                }));
                            }
                            chart.Import(coverageStatList);
                            if (TempData["warning"] == null)
                            {
                                TempData["success"] = "导入路测数据成功!";
                            }
                        }
                    }
                }
            }

            ViewBag.Title          = "路测覆盖指标分析";
            TempData["StatLength"] = chart.StatList.Count;
            return(View("CoverageImport"));
        }
        public ActionResult CoverageAnalyze(HttpPostedFileBase[] fileUpload, CoverageStatChart chart)
        {
            List<CoverageStat> coverageStatList = new List<CoverageStat>();
            if (fileUpload[0] != null)
            {
                foreach (HttpPostedFileBase file in fileUpload)
                {
                    using (HttpFileImporter importer = new HttpFileImporter(file))
                    {
                        if (!importer.Success)
                        {
                            if (TempData["warning"] == null)
                            {
                                TempData["warning"] = "请选择合适的路测数据导入!读取以下文件失败:"
                                                      + importer.FilePath;
                            }
                            else
                            {
                                TempData["warning"] += "; " + importer.FilePath;
                            }
                        }
                        else
                        {
                            string extension = Path.GetExtension(importer.FileName);
                            if (extension != null)
                            {
                                string fileExt = extension.ToLower();
                                coverageStatList.AddRange(
                                    (fileExt == ".txt") ?
                                        CsvContext.Read<LogRecord>(
                                            importer.Reader, CsvFileDescription.TabDescription).Select(x =>
                                            {
                                                CoverageStat stat = new CoverageStat(); stat.Import(x); return stat;
                                            }).ToList() :
                                        CsvContext.Read<HugelandRecord>(
                                            importer.Reader, CsvFileDescription.CommaDescription).Select(x =>
                                            {
                                                CoverageStat stat = new CoverageStat(); stat.Import(x); return stat;
                                            }));
                            }
                            chart.Import(coverageStatList);
                            if (TempData["warning"] == null)
                            {
                                TempData["success"] = "导入路测数据成功!";
                            }
                        }
                    }
                }
            }

            ViewBag.Title = "路测覆盖指标分析";
            TempData["StatLength"] = chart.StatList.Count;
            return View("CoverageImport");
        }