Ejemplo n.º 1
0
        public ArbiterWaypoint GetNext(Coordinates loc, List <WaypointType> wts, List <ArbiterWaypoint> ignorable)
        {
            SLComponentType closest = this.ClosestComponent(loc);

            if (closest == SLComponentType.Initial)
            {
                return(this.GetNext(this.Initial.GetClosestPartition(loc).Final, wts, ignorable));
            }
            else if (closest == SLComponentType.Final)
            {
                return(this.GetNext(this.Final.GetClosestPartition(loc).Final, wts, ignorable));
            }
            else
            {
                return(this.GetNext(this.Final.GetClosestPartition(this.Interconnect.FinalGeneric.Position).Final, wts, ignorable));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the next waypoint of a certain type
        /// </summary>
        /// <param name="loc">Location to start looking from</param>
        /// <param name="wt">Waypoint type to look for</param>
        /// <param name="ignorable">ignorable waypoints</param>
        /// <returns></returns>
        public ArbiterWaypoint GetNext(Coordinates loc, WaypointType wt, List <ArbiterWaypoint> ignorable)
        {
            List <WaypointType> wts = new List <WaypointType>();

            wts.Add(wt);

            SLComponentType closest = this.ClosestComponent(loc);

            if (closest == SLComponentType.Initial)
            {
                return(this.GetNext(this.Initial.GetClosestPartition(loc).Final, wts, ignorable));
            }
            else if (closest == SLComponentType.Final)
            {
                return(this.GetNext(this.Final.GetClosestPartition(loc).Final, wts, ignorable));
            }
            else
            {
                return(this.GetNext(this.Final.GetClosestPartition(loc).Final, wts, ignorable));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the maximum speed depending upon where we are
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        public double CurrentMaximumSpeed(Coordinates position)
        {
            SLComponentType slct = this.ClosestComponent(position);

            if (slct == SLComponentType.Initial)
            {
                double maxInit  = this.Initial.Way.Segment.SpeedLimits.MaximumSpeed;
                double maxInter = this.RequiredSpeed((ArbiterWaypoint)this.Interconnect.InitialGeneric, this.Interconnect.MaximumDefaultSpeed, maxInit, this, position);
                //double maxFinal = this.RequiredSpeed((ArbiterWaypoint)this.Interconnect.FinalGeneric, this.Final.Way.Segment.SpeedLimits.MaximumSpeed, this.Final.Way.Segment.SpeedLimits.MaximumSpeed, this, position);
                double max = Math.Min(maxInter, maxInit);                //Math.Min(maxInit, Math.Min(maxInter, maxFinal));
                return(max);
            }
            else if (slct == SLComponentType.Interconnect)
            {
                double maxInter = this.Interconnect.MaximumDefaultSpeed;
                double maxFinal = this.RequiredSpeed((ArbiterWaypoint)this.Interconnect.FinalGeneric, this.Final.Way.Segment.SpeedLimits.MaximumSpeed, this.Final.Way.Segment.SpeedLimits.MaximumSpeed, this, position);
                double max      = Math.Min(maxInter, maxFinal);
                return(max);
            }
            else
            {
                return(this.Final.Way.Segment.SpeedLimits.MaximumSpeed);
            }
        }