Exemplo n.º 1
0
 public RLMPlan(DateTime start, DateTime end, int plan, double srlvSeconds, Approach approach)
 {
     SRLVSeconds = srlvSeconds;
     startTime   = start;
     endTime     = end;
     planNumber  = plan;
     Approach    = approach;
 }
Exemplo n.º 2
0
        protected override List <BinsContainer> GetBinsContainersByApproach(Approach approach, bool getprotectedPhase)
        {
            var approachSplitFailAggregationContainer = new SplitFailAggregationByApproach(approach, this,
                                                                                           StartDate, EndDate,
                                                                                           getprotectedPhase, SelectedAggregatedDataType);

            return(approachSplitFailAggregationContainer.BinsContainers);
        }
        public ApproachDetailsDto BuildDetailsDto(Approach approach)
        {
            if (approach == null)
            {
                throw new ArgumentNullException("approach");
            }

            return(new ApproachDetailsDto(approach.Id, approach.Name.Value, approach.Criteria.Value));
        }
Exemplo n.º 4
0
        public void CreateEsa(EsaSummaryDto dto)
        {
            Esa      model    = this.factory.CreateEsa(dto.Id, dto.Altitude, dto.Radius, dto.CenterLatitude, dto.CenterLongitude);
            Approach approach = this.GetSingleApproach(model.ApproachId);

            approach.AddEsa(model);
            this.CreateApproach(approach);
            this.CreateEsa(model);
        }
Exemplo n.º 5
0
        public ApproachDetailsDto GetApproach(Guid id)
        {
            Approach approach = this.GetSingleApproach(id);

            return(new ApproachDetailsDto(
                       approach.Id,
                       approach.Name.Value,
                       approach.Criteria.Value));
        }
Exemplo n.º 6
0
        public ActionResult AddApproach(string id)
        {
            var      signal   = signalsRepository.GetSignalBySignalID(id);
            Approach approach = GetNewApproach(signal);

            approachRepository.AddOrUpdate(approach);
            AddSelectListsToViewBag(signal);
            return(PartialView(approach));
        }
Exemplo n.º 7
0
        public void Delete(Approach approach)
        {
            if (approach == null)
            {
                throw new ArgumentNullException(nameof(approach));
            }

            _stockTraderContext.Approaches.Remove(approach);
        }
Exemplo n.º 8
0
 /// <summary>
 ///     Contrutor Used for RouteManagement
 /// </summary>
 /// <param name="detid"></param>
 /// <param name="signalid"></param>
 /// <param name="channelid"></param>
 /// <param name="laneid"></param>
 /// <param name="approachdirection"></param>
 /// <param name="phasenumber"></param>
 /// <param name="routeorder"></param>
 public Detector(string detid, string signalid, int channelid, Approach approach, string phasenumber,
                 int routeorder)
 {
     DetID    = detid;
     Channel  = channelid;
     Approach = approach;
     Phase    = phasenumber;
     Order    = routeorder;
 }
Exemplo n.º 9
0
        private void SetChartTitle(Chart chart, Approach approach, Dictionary <string, string> statistics)
        {
            var    detectorsForMetric = approach.GetDetectorsForMetricType(this.MetricTypeID);
            string message            = "\n Advanced detector located " + detectorsForMetric.FirstOrDefault().DistanceFromStopBar.ToString() + " ft. upstream of stop bar";

            chart.Titles.Add(ChartTitleFactory.GetChartName(this.MetricTypeID));
            chart.Titles.Add(ChartTitleFactory.GetSignalLocationAndDateRangeAndMessage(approach.SignalID, this.StartDate, this.EndDate, message));
            chart.Titles.Add(ChartTitleFactory.GetPhaseAndPhaseDescriptions(approach.ProtectedPhaseNumber, approach.DirectionType.Description));
            chart.Titles.Add(ChartTitleFactory.GetStatistics(statistics));
        }
Exemplo n.º 10
0
    public bool DoorsClosed()
    {
        Vector3 _DOOR_POS = door_LEFT.localPosition;
        bool    arrived   = Approach.Apply(ref _DOOR_POS.x, ref door_SPEED, left_CLOSED_X, DOOR_ACCELERATION,
                                           DOOR_ARRIVAL_THRESHOLD, DOOR_FRICTION);

        door_LEFT.localPosition  = _DOOR_POS;
        door_RIGHT.localPosition = new Vector3(-_DOOR_POS.x, _DOOR_POS.y, _DOOR_POS.z);
        return(arrived);
    }
Exemplo n.º 11
0
        public ActionResult AddApproach(string versionId)
        {
            int      id       = Convert.ToInt32(versionId);
            var      signal   = _signalsRepository.GetSignalVersionByVersionId(id);
            Approach approach = GetNewApproach(signal);

            _approachRepository.AddOrUpdate(approach);
            AddSelectListsToViewBag(signal);
            return(PartialView(approach));
        }
Exemplo n.º 12
0
        public void CreateApproach(ApproachDetailsDto dto)
        {
            Contract.Assert(dto != null, "Approach details DTO may not be null to create an approach.");

            Name     name     = new Name(dto.Name);
            Criteria criteria = new Criteria(dto.Criteria);
            Approach approach = new Approach(dto.Id, name, criteria);

            this.CreateApproach(approach);
        }
Exemplo n.º 13
0
        public ActionResult Create(string id)
        {
            Approach approach = new Approach();

            approach.SignalID        = id;
            approach.DirectionTypeID = 1;
            approach.ApproachID      = 0;
            ViewBag.DirectionType    = new SelectList(directionRepository.GetAllDirections(), "DirectionTypeID", "Abbreviation");
            return(PartialView(approach));
        }
Exemplo n.º 14
0
        public async Task <IHttpActionResult> GetApproach(int id)
        {
            Approach approach = await db.Approaches.FindAsync(id);

            if (approach == null)
            {
                return(NotFound());
            }

            return(Ok(approach));
        }
 /// <summary>Initializes a new instance of the <see cref="AdaptiveGaussKronrodIntegrator"/> class.
 /// </summary>
 /// <param name="integrationRule">The integration rule.</param>
 /// <param name="exitCondition">The exit condition.</param>
 public AdaptiveGaussKronrodIntegrator(Approach integrationRule, StoppingCriteria exitCondition)
     : base(BoundDescriptor.Closed, BoundDescriptor.Closed)
 {
     if (exitCondition == null)
     {
         throw new ArgumentNullException("exitCondition");
     }
     ExitCondition   = exitCondition;
     IntegrationRule = integrationRule;
     m_Name          = new IdentifierString(String.Format("Adaptive Gauss-Kronrod {0} Integrator", integrationRule.ToFormatString()));
 }
Exemplo n.º 16
0
 public ActionResult Create([Bind(Include = "SignalID,DirectionTypeID,Description,MPH,DecisionPoint,MovementDelay")] Approach approach)
 {
     ViewBag.DirectionType = new SelectList(directionRepository.GetAllDirections(), "DirectionTypeID", "Abbreviation");
     if (ModelState.IsValid)
     {
         approachRepository.AddOrUpdate(approach);
         approach.Signal = signalRepository.GetLatestVersionOfSignalBySignalID(approach.SignalID);
         return(PartialView("~/Views/Signals/EditorTemplates/Approach.cshtml", approach));
     }
     return(PartialView(approach));
 }
Exemplo n.º 17
0
        public ActionResult Copy(int approachID)
        {
            ViewBag.DirectionType = new SelectList(directionRepository.GetAllDirections(), "DirectionTypeID", "Abbreviation");
            MOE.Common.Models.Repositories.IApproachRepository approachRepository =
                MOE.Common.Models.Repositories.ApproachRepositoryFactory.Create();
            MOE.Common.Models.Approach approachToCopy = approachRepository.GetApproachByApproachID(approachID);

            Approach newApproach = MOE.Common.Models.Approach.CopyApproach(approachID);

            return(PartialView("Create", newApproach));
        }
Exemplo n.º 18
0
    public override void Init()
    {
        var d = (DataAttackJump)data;

        mgJump.jumpSpeed = d.jumpSpeed.value;
        mgJump.jumpTime  = d.jumpTime.value;
        mgJump.fallSpeed = -d.fallSpeed.value;
        mgMovement.SetSpeed(d.moveSpeed.value);
        approachToPlayer = (Approach)Enum.Parse(typeof(Approach), d.approachToPlayer.value);
        SetState(State.JUMPSTART);
    }
Exemplo n.º 19
0
        private Approach GetNewApproach(Signal signal)
        {
            Approach approach = new Approach();

            approach.Detectors       = new List <Detector>();
            approach.ApproachID      = 0;
            approach.SignalID        = signal.SignalID;
            approach.Description     = "New Phase/Direction";
            approach.Index           = GetApproachIndex(signal);
            approach.DirectionTypeID = 1;
            return(approach);
        }
Exemplo n.º 20
0
        public async Task <IHttpActionResult> PostApproach(Approach approach)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Approaches.Add(approach);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = approach.Id }, approach));
        }
Exemplo n.º 21
0
 public SignalPhase(DateTime startDate, DateTime endDate, Approach approach,
                    bool showVolume, int binSize, int metricTypeId, bool getPermissivePhase)
 {
     _showVolume        = showVolume;
     _binSize           = binSize;
     _metricTypeId      = metricTypeId;
     StartDate          = startDate;
     EndDate            = endDate;
     Approach           = approach;
     GetPermissivePhase = getPermissivePhase;
     GetSignalPhaseData();
 }
Exemplo n.º 22
0
        public RLMPlan(DateTime start, DateTime end, int planNumber,
                       List <Controller_Event_Log> cycleEvents,
                       double srlvSeconds, Approach approach)
        {
            Approach        = approach;
            startTime       = start;
            endTime         = end;
            this.planNumber = planNumber;
            var usePermissivePhase = false;
            var db = new SPM();
            var l  = new List <int> {
                1, 8, 9, 10, 11
            };
            List <Controller_Event_Log> permEvents = null;

            if (Approach.PermissivePhaseNumber != null)
            {
                usePermissivePhase = true;
                var cveRepository =
                    ControllerEventLogRepositoryFactory.Create();
                permEvents = cveRepository.GetEventsByEventCodesParam(Approach.SignalID,
                                                                      start, end, l, Approach.ProtectedPhaseNumber);
                foreach (var row in cycleEvents)
                {
                    if (row.Timestamp >= start && row.Timestamp <= end &&
                        GetEventType(row.EventCode) == RLMCycle.EventType.BeginYellowClearance)
                    {
                        foreach (var permRow in permEvents)
                        {
                            if (GetEventType(permRow.EventCode) == RLMCycle.EventType.BeginYellowClearance)
                            {
                                if (row.Timestamp == permRow.Timestamp)
                                {
                                    usePermissivePhase = false;
                                }
                            }
                        }
                    }
                }
            }
            SRLVSeconds = srlvSeconds;
            startTime   = start;
            endTime     = end;
            if (usePermissivePhase)
            {
                GetRedCycle(start, end, permEvents);
            }
            else
            {
                GetRedCycle(start, end, cycleEvents);
            }
        }
Exemplo n.º 23
0
        public static void LoadApproaches(string xmlFileName, InMemoryMOEDatabase db)
        {
            string localFilePath = filePath + "\\Approaches\\" + xmlFileName;
            var    doc           = XElement.Load(localFilePath);
            var    incoming      = new List <Approach>();

            foreach (var x in doc.Elements("Approach"))
            {
                var appr = new Approach();
                appr.ApproachID      = Convert.ToInt32(x.Element("ApproachID").Value);
                appr.SignalID        = x.Element("SignalID").Value;
                appr.DirectionTypeID = Convert.ToInt32(x.Element("DirectionTypeID").Value);
                appr.Description     = x.Element("Description").Value;
                if (x.Element("MPH") != null)
                {
                    appr.MPH = Convert.ToInt32(x.Element("MPH").Value);
                }
                else
                {
                    appr.MPH = 0;
                }
                appr.ProtectedPhaseNumber    = Convert.ToInt32(x.Element("ProtectedPhaseNumber").Value);
                appr.IsProtectedPhaseOverlap = (x.Element("IsProtectedPhaseOverlap").Value).Equals("1");
                if (x.Element("PermissivePhaseNumber") != null)
                {
                    appr.PermissivePhaseNumber = Convert.ToInt32(x.Element("PermissivePhaseNumber").Value);
                }
                else
                {
                    appr.PermissivePhaseNumber = 0;
                }
                appr.VersionID = Convert.ToInt32(x.Element("VersionID").Value);
                appr.IsPermissivePhaseOverlap = (x.Element("IsPermissivePhaseOverlap").Value).Equals("1");
                incoming.Add(appr);
            }
            foreach (var e in incoming)
            {
                var signal = db.Signals.Where(s => s.SignalID == e.SignalID).FirstOrDefault();
                if (signal != null)
                {
                    signal.Approaches = new List <Approach>();
                    signal.Approaches.Add(e);
                    e.Signal = signal;
                }
                var direction = db.DirectionTypes.Where(d => d.DirectionTypeID == e.DirectionTypeID).FirstOrDefault();
                if (direction != null)
                {
                    e.DirectionType = direction;
                }
                db.Approaches.Add(e);
            }
        }
Exemplo n.º 24
0
        public IHttpActionResult Update([FromBody] Approach approach)
        {
            LogInfoObjectToJson(approach, "Updating 'Approach':");

            return(ExecuteRequest(() =>
            {
                var approachDTO = _mapper.Map <ApproachDTO>(approach);
                var result = _service.Update(approachDTO);

                LogInfoObjectToJson(result, "Updated 'Approach':");
                return Ok <IOperationResult>(result);
            }));
        }
Exemplo n.º 25
0
        private static List <Controller_Event_Log> GetTerminationEvents(bool getPermissivePhase, DateTime startDate,
                                                                        DateTime endDate,
                                                                        Approach approach)
        {
            var celRepository = ControllerEventLogRepositoryFactory.Create();
            var cycleEvents   = celRepository.GetEventsByEventCodesParam(approach.SignalID, startDate,
                                                                         endDate, new List <int> {
                4, 5, 6
            },
                                                                         getPermissivePhase ? approach.PermissivePhaseNumber.Value : approach.ProtectedPhaseNumber);

            return(cycleEvents);
        }
Exemplo n.º 26
0
    public static bool Apply(ref Transform _transform, ref Vector3 _speed, Vector3 _destination, float _acceleration,
                             float _arrivalThreshold, float _friction)
    {
        Vector3 _POS = _transform.position;

        bool arrivedX = Approach.Apply(ref _POS.x, ref _speed.x, _destination.x, _acceleration, _arrivalThreshold, _friction);
        bool arrivedY = Approach.Apply(ref _POS.y, ref _speed.y, _destination.y, _acceleration, _arrivalThreshold, _friction);
        bool arrivedZ = Approach.Apply(ref _POS.z, ref _speed.z, _destination.z, _acceleration, _arrivalThreshold, _friction);

        _transform.position = _POS;

        return(arrivedX && arrivedY && arrivedZ);
    }
Exemplo n.º 27
0
        public void EvaluateApproach(Approach approach)
        {
            this.deviationObserver.RemoveDeviation(DeviationMessageConstants.APPR_ESA_REQUIRED_KEY);
            bool hasEsa = this.approachService.HasEsa(approach.Id);

            if (approach.Criteria.Value == CriteriaType.NATO && !hasEsa)
            {
                Deviation deviation = this.deviationFactory.CreateDeviation(
                    DeviationMessageConstants.APPR_ESA_REQUIRED_FOR_NATO,
                    DeviationMessageConstants.APPR_ESA_REQUIRED_FOR_NATO_SEVERITY);
                deviationObserver.PublishDeviation(DeviationMessageConstants.APPR_ESA_REQUIRED_KEY, deviation);
            }
        }
Exemplo n.º 28
0
 public SplitFailPhase(Approach approach, SplitFailOptions options, bool getPermissivePhase)
 {
     Approach           = approach;
     GetPermissivePhase = getPermissivePhase;
     Cycles             = CycleFactory.GetSplitFailCycles(options, approach, getPermissivePhase);
     SetDetectorActivations(options);
     AddDetectorActivationsToCycles();
     Plans      = PlanFactory.GetSplitFailPlans(Cycles, options, Approach);
     TotalFails = Cycles.Count(c => c.IsSplitFail);
     Statistics = new Dictionary <string, string>();
     Statistics.Add("Total Split Failures", TotalFails.ToString());
     SetBinStatistics(options);
 }
Exemplo n.º 29
0
        public void LinearMovementTrajectoryTest()
        {
            var pointFrom = new PointF(0, 0);
            var pointTo   = new PointF(50, 0);

            var result = Approach.LinearMovement(pointFrom, pointTo);

            Assert.AreEqual(50, result.Count);

            result = Approach.LinearMovement(new PointF(0, 0), new PointF(5, 5));

            Assert.AreEqual(8, result.Count);
        }
Exemplo n.º 30
0
        static string RunWithStopwatch(Approach approach, Matrix testMatrix)
        {
            var timer = new Stopwatch();
            var calc  = new Calculator();

            timer.Start();
            calc.Start(testMatrix, approach);
            timer.Stop();
            TimeSpan timeTaken = timer.Elapsed;
            string   foo       = "Time taken: " + timeTaken.ToString(@"m\:ss\.fff");

            return(foo);
        }