public void CreateTimeXDetectorSeries() { DetectorVolumeAggregationOptions options = new DetectorVolumeAggregationOptions(); options.SeriesWidth = 3; options.StartDate = Convert.ToDateTime("10/17/2017"); options.EndDate = Convert.ToDateTime("10/18/2017"); options.SelectedXAxisType = XAxisType.Time; options.SelectedSeries = SeriesType.Detector; options.SelectedAggregatedDataType = new AggregatedDataType { Id = 0, DataName = "Volume" }; options.TimeOptions = new BinFactoryOptions( Convert.ToDateTime("10/17/2017"), Convert.ToDateTime("10/18/2017"), null, null, null, null, null, BinFactoryOptions.BinSize.FifteenMinute, BinFactoryOptions.TimeOptions.StartToEnd); SetFilterSignal(options); options.SelectedChartType = SeriesChartType.StackedColumn; options.SelectedAggregationType = AggregationType.Sum; options.CreateMetric(); options.SelectedAggregationType = AggregationType.Average; options.CreateMetric(); Assert.IsTrue(options.ReturnList.Count == 2); }
public ActionResult GetAggregateDataTypes(int id) { List <AggregatedDataType> AggregatedDataTypes; switch (id) { case 16: AggregatedDataTypes = new DetectorVolumeAggregationOptions().AggregatedDataTypes; break; case 25: AggregatedDataTypes = new ApproachSpeedAggregationOptions().AggregatedDataTypes; break; case 18: AggregatedDataTypes = new ApproachPcdAggregationOptions().AggregatedDataTypes; break; case 19: AggregatedDataTypes = new ApproachCycleAggregationOptions().AggregatedDataTypes; break; case 20: AggregatedDataTypes = new ApproachSplitFailAggregationOptions().AggregatedDataTypes; break; case 26: AggregatedDataTypes = new ApproachYellowRedActivationsAggregationOptions().AggregatedDataTypes; break; case 22: AggregatedDataTypes = new SignalPreemptionAggregationOptions().AggregatedDataTypes; break; case 24: AggregatedDataTypes = new SignalPriorityAggregationOptions().AggregatedDataTypes; break; case 27: AggregatedDataTypes = new SignalEventCountAggregationOptions().AggregatedDataTypes; break; case 28: AggregatedDataTypes = new ApproachEventCountAggregationOptions().AggregatedDataTypes; break; case 29: AggregatedDataTypes = new PhaseTerminationAggregationOptions().AggregatedDataTypes; break; case 30: AggregatedDataTypes = new PhasePedAggregationOptions().AggregatedDataTypes; break; default: throw new Exception("Invalid Metric Type"); break; } return(PartialView(AggregatedDataTypes)); }
public DetectorAggregationBySignal(DetectorVolumeAggregationOptions options, Models.Signal signal) : base( options, signal) { ApproachDetectorVolumes = new List <DetectorAggregationByApproach>(); GetApproachDetectorVolumeAggregationContainersForAllApporaches(options, signal); LoadBins(null, null); }
public void CreateTimeMetricYearBinTimePeriodTest() { DetectorVolumeAggregationOptions options = new DetectorVolumeAggregationOptions(); options.SeriesWidth = 3; options.StartDate = Convert.ToDateTime("1/1/2016"); options.EndDate = Convert.ToDateTime("1/1/2018"); options.SelectedXAxisType = XAxisType.Time; options.SelectedSeries = SeriesType.Detector; options.SelectedAggregatedDataType = new AggregatedDataType { Id = 0, DataName = "Volume" }; options.TimeOptions = new BinFactoryOptions( Convert.ToDateTime("1/1/2016"), Convert.ToDateTime("1/1/2018"), 6, 0, 10, 0, new List <DayOfWeek> { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday }, BinFactoryOptions.BinSize.Year, BinFactoryOptions.TimeOptions.TimePeriod); SetFilterSignal(options); options.SelectedChartType = SeriesChartType.StackedColumn; options.SelectedAggregationType = AggregationType.Sum; options.CreateMetric(); options.SelectedAggregationType = AggregationType.Average; options.CreateMetric(); Assert.IsTrue(options.ReturnList.Count == 2); }
public DetectorAggregationByApproach(Approach approach, DetectorVolumeAggregationOptions options, bool getProtectedPhase) : base(approach, options, options.StartDate, options.EndDate, getProtectedPhase, options.SelectedAggregatedDataType) { GetApproachDetectorVolumeAggregationContainersForAllDetectors(options, approach); LoadBins(approach, options, getProtectedPhase, options.SelectedAggregatedDataType); }
private void GetApproachDetectorVolumeAggregationContainersForAllDetectors( DetectorVolumeAggregationOptions options, Approach approach) { foreach (var detector in approach.Detectors) { detectorAggregationByDetectors.Add(new DetectorAggregationByDetector(detector, options)); } }
private void SetFilterSignal(DetectorVolumeAggregationOptions options) { List <FilterSignal> filterSignals = new List <FilterSignal>(); var signal = Db.Signals.FirstOrDefault(); var filterSignal = new FilterSignal { SignalId = signal.SignalID, Exclude = false }; foreach (var approach in signal.Approaches) { var filterApproach = new FilterApproach { ApproachId = approach.ApproachID, Description = String.Empty, Exclude = false }; filterSignal.FilterApproaches.Add(filterApproach); foreach (var detector in approach.Detectors) { filterApproach.FilterDetectors.Add(new FilterDetector { Id = detector.ID, Description = String.Empty, Exclude = false }); } } options.FilterSignals.Add(filterSignal); options.FilterDirections = new List <FilterDirection>(); options.FilterDirections.Add(new FilterDirection { Description = "", DirectionTypeId = 0, Include = true }); options.FilterDirections.Add(new FilterDirection { Description = "", DirectionTypeId = 1, Include = true }); options.FilterDirections.Add(new FilterDirection { Description = "", DirectionTypeId = 2, Include = true }); options.FilterDirections.Add(new FilterDirection { Description = "", DirectionTypeId = 3, Include = true }); options.FilterMovements = new List <FilterMovement>(); options.FilterMovements.Add(new FilterMovement { Description = "", MovementTypeId = 0, Include = true }); options.FilterMovements.Add(new FilterMovement { Description = "", MovementTypeId = 1, Include = true }); options.FilterMovements.Add(new FilterMovement { Description = "", MovementTypeId = 2, Include = true }); options.FilterMovements.Add(new FilterMovement { Description = "", MovementTypeId = 3, Include = true }); }
private void GetApproachDetectorVolumeAggregationContainersForAllApporaches( DetectorVolumeAggregationOptions options, Models.Signal signal) { foreach (var approach in signal.Approaches) { ApproachDetectorVolumes.Add( new DetectorAggregationByApproach(approach, options, true)); if (approach.PermissivePhaseNumber != null) { ApproachDetectorVolumes.Add( new DetectorAggregationByApproach(approach, options, false)); } } }
public void SetAggregateData() { switch (SelectedMetricTypeId) { case 16: AggregatedDataTypes = new DetectorVolumeAggregationOptions().AggregatedDataTypes; break; case 18: AggregatedDataTypes = new ApproachPcdAggregationOptions().AggregatedDataTypes; break; case 19: AggregatedDataTypes = new ApproachCycleAggregationOptions().AggregatedDataTypes; break; case 20: AggregatedDataTypes = new ApproachSplitFailAggregationOptions().AggregatedDataTypes; break; case 22: AggregatedDataTypes = new SignalPreemptionAggregationOptions().AggregatedDataTypes; break; case 24: AggregatedDataTypes = new SignalPriorityAggregationOptions().AggregatedDataTypes; break; case 25: AggregatedDataTypes = new ApproachSpeedAggregationOptions().AggregatedDataTypes; break; case 26: AggregatedDataTypes = new ApproachYellowRedActivationsAggregationOptions().AggregatedDataTypes; break; case 27: AggregatedDataTypes = new SignalEventCountAggregationOptions().AggregatedDataTypes; break; case 28: AggregatedDataTypes = new ApproachEventCountAggregationOptions().AggregatedDataTypes; break; default: throw new Exception("Invalid Metric Type"); break; } }
public DetectorAggregationBySignal(DetectorVolumeAggregationOptions options, Models.Signal signal, int phaseNumber) : base(options, signal) { ApproachDetectorVolumes = new List <DetectorAggregationByApproach>(); foreach (var approach in signal.Approaches) { if (approach.ProtectedPhaseNumber == phaseNumber) { ApproachDetectorVolumes.Add( new DetectorAggregationByApproach(approach, options, true)); if (approach.PermissivePhaseNumber != null && approach.PermissivePhaseNumber == phaseNumber) { ApproachDetectorVolumes.Add(new DetectorAggregationByApproach(approach, options, false)); } } } LoadBins(null, null); }
public DetectorAggregationBySignal(DetectorVolumeAggregationOptions options, Models.Signal signal, DirectionType direction) : base(options, signal) { ApproachDetectorVolumes = new List <DetectorAggregationByApproach>(); foreach (var approach in signal.Approaches) { if (approach.DirectionType.DirectionTypeID == direction.DirectionTypeID) { ApproachDetectorVolumes.Add( new DetectorAggregationByApproach(approach, options, true)); if (approach.PermissivePhaseNumber != null) { ApproachDetectorVolumes.Add( new DetectorAggregationByApproach(approach, options, false)); } } } LoadBins(null, null); }
private ActionResult GetLaneByLaneChart(AggDataExportViewModel aggDataExportViewModel) { DetectorVolumeAggregationOptions options = new DetectorVolumeAggregationOptions(); return(GetChart(aggDataExportViewModel, options)); }
public DetectorAggregationByDetector(Models.Detector detector, DetectorVolumeAggregationOptions options) : base( detector, options) { }