Exemplo n.º 1
0
        public void FindPath(ISatellite start, IEnumerable <ISatellite> commandStations)
        {
            var paths = new List <NetworkRoute <ISatellite> >();

            foreach (ISatellite root in commandStations.Concat(GroundStations.Values).Where(r => r != start))
            {
                paths.Add(NetworkPathfinder.Solve(start, root, FindNeighbors, RangeModelExtensions.DistanceTo, RangeModelExtensions.DistanceTo));
            }
            mConnectionCache[start] = paths.Where(p => p.Exists).ToList();
            mConnectionCache[start].Sort((a, b) => a.Delay.CompareTo(b.Delay));
            start.OnConnectionRefresh(this[start]);
        }
Exemplo n.º 2
0
        public static double GetSignalDelayToSatellite(Guid a, Guid b)
        {
            var sat_a = RTCore.Instance.Satellites[a];
            var sat_b = RTCore.Instance.Satellites[b];

            if (sat_a == null || sat_b == null)
            {
                return(Double.PositiveInfinity);
            }

            Func <ISatellite, IEnumerable <NetworkLink <ISatellite> > > neighbors = RTCore.Instance.Network.FindNeighbors;
            Func <ISatellite, NetworkLink <ISatellite>, double>         cost      = RangeModelExtensions.DistanceTo;
            Func <ISatellite, ISatellite, double> heuristic = RangeModelExtensions.DistanceTo;

            var path = NetworkPathfinder.Solve(sat_a, sat_b, neighbors, cost, heuristic);

            return(path.Delay);
        }
Exemplo n.º 3
0
        public static double GetSignalDelayToSatellite(Guid a, Guid b)
        {
            var satelliteA = RTCore.Instance.Satellites[a];
            var satelliteB = RTCore.Instance.Satellites[b];

            if (satelliteA == null || satelliteB == null)
            {
                return(Double.PositiveInfinity);
            }

            Func <ISatellite, IEnumerable <NetworkLink <ISatellite> > > neighbors = RTCore.Instance.Network.FindNeighbors;
            Func <ISatellite, NetworkLink <ISatellite>, double>         cost      = RangeModelExtensions.DistanceTo;
            Func <ISatellite, ISatellite, double> heuristic = RangeModelExtensions.DistanceTo;

            var path         = NetworkPathfinder.Solve(satelliteA, satelliteB, neighbors, cost, heuristic);
            var delayBetween = path.Delay;

            RTLog.Verbose("Connection from {0} to {1} Delay: {2}", a, b, delayBetween);
            return(delayBetween);
        }