Exemple #1
0
        public PedPhase(int phaseNumber, string signalID, DateTime startDate, DateTime endDate,
                        PlansBase plansData) : base(signalID, startDate, endDate, phaseNumber, new List <int> {
            21, 22, 45
        })
        {
            _SignalID    = signalID;
            _StartDate   = startDate;
            _EndDate     = endDate;
            _PhaseNumber = phaseNumber;

            for (int i = 0; i < plansData.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 (plansData.Events.Count - 1 == i)
                {
                    PedPlan plan = new PedPlan(signalID, phaseNumber, plansData.Events[i].Timestamp, endDate,
                                               plansData.Events[i].EventParam);
                    _Plans.Add(plan);
                }
                //else we add the plan with the next plans' time stamp as the end of the plan
                else
                {
                    PedPlan plan = new PedPlan(signalID, phaseNumber, plansData.Events[i].Timestamp,
                                               plansData.Events[i + 1].Timestamp, plansData.Events[i].EventParam);

                    _Plans.Add(plan);
                }
            }

            GetCycles();
            AddCyclesToPlans();
            SetHourlyTotals();
        }
Exemple #2
0
        public PedPhase(int phaseNumber, Models.Signal signal, DateTime startDate, DateTime endDate,
                        PlansBase plansData) : base(signal.SignalID, startDate, endDate, phaseNumber, new List <int> {
            21, 22, 45, 90
        })
        {
            SignalID     = signal.SignalID;
            StartDate    = startDate;
            EndDate      = endDate;
            PhaseNumber  = phaseNumber;
            StartDate    = startDate;
            EndDate      = endDate;
            Plans        = new List <PedPlan>();
            Cycles       = new List <PedCycle>();
            HourlyTotals = new List <PedHourlyTotal>();

            for (var i = 0; i < plansData.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 (plansData.Events.Count - 1 == i)
                {
                    var plan = new PedPlan(SignalID, phaseNumber, plansData.Events[i].Timestamp, endDate,
                                           plansData.Events[i].EventParam);
                    Plans.Add(plan);
                }
                //else we add the plan with the next plans' time stamp as the end of the plan
                else
                {
                    var plan = new PedPlan(SignalID, phaseNumber, plansData.Events[i].Timestamp,
                                           plansData.Events[i + 1].Timestamp, plansData.Events[i].EventParam);

                    Plans.Add(plan);
                }
            }

            GetCycles(signal);
            AddCyclesToPlans();
            SetHourlyTotals();
        }