public IEnumerable <InterferenceMatrixView> QueryViews(DateTime begin, DateTime end, int cellId, byte sectorId) { var statList = _repository.GetAllList(begin, end, cellId, sectorId); var results = from stat in statList group stat by new { stat.ENodebId, stat.SectorId, stat.DestPci, stat.DestENodebId, stat.DestSectorId } into g select new InterferenceMatrixView { DestPci = g.Key.DestPci, DestENodebId = g.Key.DestENodebId, DestSectorId = g.Key.DestSectorId, Mod3Interferences = g.Average(x => x.Mod3Interferences), Mod6Interferences = g.Average(x => x.Mod6Interferences), OverInterferences10Db = g.Average(x => x.OverInterferences10Db), OverInterferences6Db = g.Average(x => x.OverInterferences6Db), InterferenceLevel = g.Average(x => x.InterferenceLevel), NeighborCellName = "未匹配小区" }; var views = results as InterferenceMatrixView[] ?? results.ToArray(); foreach (var result in views.Where(x => x.DestENodebId > 0)) { var eNodeb = _eNodebRepository.GetByENodebId(result.DestENodebId); result.NeighborCellName = eNodeb?.Name + "-" + result.DestSectorId; } return(views); }
public IEnumerable <InterferenceMatrixView> QueryViews(DateTime begin, DateTime end, int cellId, byte sectorId) { var statList = _repository.GetAllList(begin, end, cellId, sectorId); var results = from stat in statList group stat by new { stat.ENodebId, stat.SectorId, stat.NeighborPci, stat.NeighborEarfcn, stat.DestENodebId, stat.DestSectorId, stat.Earfcn } into g select new InterferenceMatrixView { DestPci = g.Key.NeighborPci, DestENodebId = g.Key.DestENodebId, DestSectorId = g.Key.DestSectorId, NeighborEarfcn = g.Key.NeighborEarfcn, Mod3Interferences = g.Key.Earfcn == g.Key.NeighborEarfcn ? g.Average(x => x.Pci % 3 == x.NeighborPci % 3 ? (x.Diff0 + x.Diff3 + x.Diff6) : 0) : 0, Mod6Interferences = g.Key.Earfcn == g.Key.NeighborEarfcn ? g.Average(x => x.Pci % 6 == x.NeighborPci % 6 ? (x.Diff0 + x.Diff3 + x.Diff6) : 0) : 0, OverInterferences10Db = g.Average(x => (x.Diff0 + x.Diff3 + x.Diff6 + x.Diff9)), OverInterferences6Db = g.Average(x => (x.Diff0 + x.Diff3 + x.Diff6)), InterferenceLevel = g.Average( x => (x.Diff0 + x.Diff3 + x.Diff6) * (x?.NeighborRsrpBelow120 ?? x.RsrpBelow120 + x?.NeighborRsrpBetween120110 ?? x.RsrpBetween120110 + x?.NeighborRsrpBetween110105 ?? x.RsrpBetween110105)), NeighborCellName = "未匹配小区" }; var views = results as InterferenceMatrixView[] ?? results.ToArray(); foreach (var result in views.Where(x => x.DestENodebId > 0)) { var eNodeb = _eNodebRepository.FirstOrDefault(x => x.ENodebId == result.DestENodebId); result.NeighborCellName = eNodeb?.Name + "-" + result.DestSectorId; } return(views); }