public void Constructor_OrbitSatCorrectly()
        {
            var res = new SatPosition(orbit, sat);

            Assert.AreEqual(orbit, res.OrbitNumber);
            Assert.AreEqual(sat, res.SatNumber);
        }
        public Satellite(string localAddress, Coordinate coordinate, SatPosition satPosition, SatPosition logical, ref List <List <Satellite> > constellation, ref SimulationConfiguration conf, StatisticsCollector results)
        {
            LocalAddress    = localAddress;
            Location        = coordinate;
            SatPosition     = satPosition;
            _conf           = conf;
            LogicalPosition = logical;
            _statistics     = results;

            _logger = new Logger(_conf.OutputPath + "/" + LocalAddress + ".log", conf);
            _logger.WriteLine(LocalAddress + " starting up...");

            _network = new Network.Network(ref constellation, ref conf, this, _logger, _statistics);
        }
Example #3
0
        public Constellation(SimulationConfiguration conf, StatisticsCollector results)
        {
            //Create all locations for satellites
            //First orbit is at 0 longitude
            //Create list of all positions in order, and pass to satellite (longitude stays the same)

            _configuration = conf;
            _constellation = new List <List <Satellite> >(conf.NumberOfOrbits);

            for (var i = 0; i < conf.NumberOfOrbits; i++) //For each orbit (longitude, from 0-180 degrees)
            {
                var orbit = new List <Satellite>(conf.NumberOfSatellitesPerOrbit);

                //Create a list of latitudes (Argument of perigee in STK)
                for (var j = 0; j < conf.NumberOfSatellitesPerOrbit; j++) //Add a satellite to the orbit
                {
                    var perigee   = j * conf.AngleBetweenSatellites;
                    var latitude  = perigee;
                    var longitude = i * conf.AngleBetweenOrbits;

                    if (latitude > 270) //Change from of east/west hemisphere
                    {
                        latitude = -90 + (latitude - 270);
                    }
                    else if (latitude > 90) //Change from of east/west hemisphere
                    {
                        latitude  = 90 - (latitude - 90);
                        longitude = -180 + (i * conf.AngleBetweenOrbits);
                    }

                    var coordinate = new Coordinate(latitude, longitude, conf.SatelliteAltitude);
                    var position   = new SatPosition(i, j);
                    var name       = "R" + i + "S" + j;

                    //Create satellite with new position
                    var sat = new Satellite(name, coordinate, position, position, ref _constellation, ref conf, results); //Initially, satposition and logical position are identical, however, only logical is incremented on each tick
                    orbit.Add(sat);
                }

                _constellation.Add(orbit);
            }
        }