public void GetPlanCollection(DateTime startDate, DateTime endDate, List <Controller_Event_Log> cycleEvents, SPM db) { var ds = new ControllerEventLogs(Approach.SignalID, startDate, endDate, new List <int> { 131 }, db); var row = new Controller_Event_Log(); row.Timestamp = startDate; row.SignalID = Approach.SignalID; row.EventCode = 131; try { row.EventParam = ControllerEventLogs.GetPreviousPlan(Approach.SignalID, startDate); ds.Events.Insert(0, row); } catch { row.EventParam = 0; ds.Events.Insert(0, row); } // remove duplicate plan entries ds.MergeEvents(ds); for (var i = 0; i < ds.Events.Count(); i++) { //if this is the last plan then we want the end of the plan //to cooincide with the end of the graph if (ds.Events.Count() - 1 == i) { if (ds.Events[i].Timestamp != endDate) { var plan = new RLMPlan(ds.Events[i].Timestamp, endDate, ds.Events[i].EventParam, cycleEvents, SRLVSeconds, Approach); AddItem(plan); } } //else we add the plan with the next plans' time stamp as the end of the plan else { if (ds.Events[i].Timestamp != ds.Events[i + 1].Timestamp) { var plan = new RLMPlan(ds.Events[i].Timestamp, ds.Events[i + 1].Timestamp, ds.Events[i].EventParam, cycleEvents, SRLVSeconds, Approach); AddItem(plan); } } } }
public ControllerEventLogs CombineDetectorDataByApproachAndType(DateTime startDate, DateTime endDate, MOE.Common.Models.Approach approach, bool Has_PCD, bool Has_TMC) { MOE.Common.Models.Repositories.IDetectorRepository gr = MOE.Common.Models.Repositories.DetectorRepositoryFactory.Create(); string signalId = approach.SignalID; if (Has_TMC) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(5))); } if (Has_PCD) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(6))); } List <ControllerEventLogs> eventsList = new List <ControllerEventLogs>(); ControllerEventLogs MergedEvents = new ControllerEventLogs(signalId, startDate, endDate); foreach (Models.Detector detector in ApproachCountDetectors) { List <int> li = new List <int> { 82 }; ControllerEventLogs cs = new ControllerEventLogs(signalId, startDate, endDate, detector.DetChannel, li); eventsList.Add(cs); } foreach (ControllerEventLogs Events in eventsList) { MergedEvents.MergeEvents(Events); } return(MergedEvents); }
public ControllerEventLogs CombineDetectorData(DateTime startDate, DateTime endDate, double offset, string signalId) { ControllerEventLogs detectortable = new ControllerEventLogs(signalId, startDate, endDate); List <ControllerEventLogs> Tables = new List <ControllerEventLogs>(); foreach (MOE.Common.Business.Detector Detector in Items) { ControllerEventLogs TEMPdetectortable = new ControllerEventLogs(signalId, startDate, endDate, new List <int>() { 82 }); Tables.Add(TEMPdetectortable); } foreach (ControllerEventLogs Table in Tables) { detectortable.MergeEvents(Table); } return(detectortable); }
public ControllerEventLogs CombineDetectorData(DateTime startDate, DateTime endDate, double offset, string signalId) { var detectortable = new ControllerEventLogs(signalId, startDate, endDate); var Tables = new List <ControllerEventLogs>(); foreach (var Detector in Items) { var TEMPdetectortable = new ControllerEventLogs(signalId, startDate, endDate, new List <int> { 82 }); Tables.Add(TEMPdetectortable); } foreach (var Table in Tables) { detectortable.MergeEvents(Table); } return(detectortable); }
public ControllerEventLogs CombineDetectorDataByApproachAndType(DateTime startDate, DateTime endDate, Approach approach, bool Has_PCD, bool Has_TMC) { var gr = DetectorRepositoryFactory.Create(); var signalId = approach.SignalID; if (Has_TMC) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(5))); } if (Has_PCD) { ApproachCountDetectors.Clear(); ApproachCountDetectors.AddRange(RemoveExitDetectors(approach.GetDetectorsForMetricType(6))); } var eventsList = new List <ControllerEventLogs>(); var MergedEvents = new ControllerEventLogs(signalId, startDate, endDate); foreach (var detector in ApproachCountDetectors) { var li = new List <int> { 82 }; var cs = new ControllerEventLogs(signalId, startDate, endDate, detector.DetChannel, li); eventsList.Add(cs); } foreach (var Events in eventsList) { MergedEvents.MergeEvents(Events); } return(MergedEvents); }