Ejemplo n.º 1
0
        private void LoadSolarSystem()
        {
            _sun = new Sun(DVector2.Zero, DVector2.Zero);

            var mercury = new Mercury();
            var venus   = new Venus();
            var earth   = new Earth();
            var moon    = new Moon(earth.Position, earth.Velocity);
            var mars    = new Mars();
            var jupiter = new Jupiter();
            var europa  = new Europa(jupiter.Position + new DVector2(6.64862e8, 0), jupiter.Velocity + new DVector2(0, -13740));
            var saturn  = new Saturn();

            _massiveBodies = new List <IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            //_spaceCrafts = SpacecraftFactory.BuildFalconHeavy(earth, ProfileDirectory);
            //_spaceCrafts = SpacecraftFactory.BuildDragonV2Abort(earth, ProfileDirectory);
            _spaceCrafts = SpacecraftFactory.BuildDragonV2Entry(earth, ProfileDirectory);
            //_spaceCrafts = SpacecraftFactory.BuildF9(earth, ProfileDirectory);
            //_spaceCrafts = SpacecraftFactory.BuildF9Dragon(earth, ProfileDirectory);

            // Initialize the spacecraft controllers
            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                spaceCraft.InitializeController(ProfileDirectory, _eventManager);
            }

            // Start at nearly -Math.Pi / 2
            _strongback = new Strongback(-1.5707947, _spaceCrafts[0].TotalHeight * 0.05, earth);

            // Start downrange at ~300km
            var asds = new ASDS(-1.62026, 20, earth);

            _gravitationalBodies = new List <IGravitationalBody>
            {
                _sun, mercury, venus, earth
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            _structures = new List <StructureBase>
            {
                _strongback, //asds
            };

            _gravitationalBodies.Add(moon);
            _gravitationalBodies.Add(mars);
            _gravitationalBodies.Add(jupiter);
            _gravitationalBodies.Add(europa);
            _gravitationalBodies.Add(saturn);

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());
        }
Ejemplo n.º 2
0
        private void LoadSolarSystem()
        {
            _sun = new Sun(DVector2.Zero, DVector2.Zero);

            var mercury = new Mercury();
            var venus   = new Venus();
            var earth   = new Earth();

            _strongback = new Strongback(new DVector2(10, -earth.SurfaceRadius + 38), earth);

            var moon    = new Moon(earth.Position, earth.Velocity);
            var mars    = new Mars();
            var jupiter = new Jupiter();
            var europa  = new Europa(jupiter.Position + new DVector2(6.64862e8, 0), jupiter.Velocity + new DVector2(0, -13740));
            var saturn  = new Saturn();

            _massiveBodies = new List <IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            _structures = new List <StructureBase>
            {
                _strongback
            };

            _spaceCrafts = SpacecraftFactory.BuildFalconHeavy(earth, ProfileDirectory);

            _gravitationalBodies = new List <IGravitationalBody>
            {
                _sun, mercury, venus, earth
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            _gravitationalBodies.Add(moon);
            _gravitationalBodies.Add(mars);
            _gravitationalBodies.Add(jupiter);
            _gravitationalBodies.Add(europa);
            _gravitationalBodies.Add(saturn);

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());
        }
Ejemplo n.º 3
0
        private void LoadSolarSystem()
        {
            _sun = new Sun();

            var mercury = new Mercury();
            var venus   = new Venus();
            var earth   = new Earth();
            var moon    = new Moon(earth.Position, earth.Velocity);
            var mars    = new Mars();
            var jupiter = new Jupiter();
            var europa  = new Europa(jupiter.Position, jupiter.Velocity);
            var saturn  = new Saturn();

            _massiveBodies = new List <IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            ResolveMassiveBodyParents();

            _spaceCrafts = new List <ISpaceCraft>();
            _structures  = new List <StructureBase>();

            MissionConfig primaryMission = MissionConfig.Load(ProfilePaths[0]);

            _originTime = primaryMission.GetLaunchDate();

            OrbitHelper.SimulateToTime(_massiveBodies, _originTime, 300);

            // Load missions
            for (int i = 0; i < ProfilePaths.Count; i++)
            {
                MissionConfig missionConfig = MissionConfig.Load(ProfilePaths[i]);

                IMassiveBody targetPlanet = LocatePlanet(missionConfig.ParentPlanet);

                double launchAngle = targetPlanet.GetSurfaceAngle(_originTime, _sun);

                _spaceCrafts.AddRange(SpacecraftFactory.BuildSpaceCraft(targetPlanet, launchAngle, missionConfig, ProfilePaths[i]));

                _structures.AddRange(StructureFactory.Load(targetPlanet, launchAngle, ProfilePaths[i]));
            }

            // Initialize the spacecraft controllers
            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                spaceCraft.InitializeController(_eventManager);
            }

            _gravitationalBodies = new List <IGravitationalBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());

            ResolveSpaceCraftParents();
        }
Ejemplo n.º 4
0
        private void LoadSolarSystem()
        {
            _sun = new Sun();

            var mercury = new Mercury();
            var venus   = new Venus();
            var earth   = new Earth();
            var moon    = new Moon(earth.Position, earth.Velocity);
            var mars    = new Mars();
            var jupiter = new Jupiter();
            var europa  = new Europa(jupiter.Position, jupiter.Velocity);
            var saturn  = new Saturn();

            _massiveBodies = new List <IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            ResolveMassiveBodyParents();

            // Simulate the planets out to May 2018 with a 6000 second time step
            OrbitHelper.SimulateToTime(_massiveBodies, new DateTime(2018, 5, 1), 300);

            _spaceCrafts = new List <ISpaceCraft>();

            for (int i = 0; i < ProfileDirectories.Count; i++)
            {
                string profileDirectory = ProfileDirectories[i];

                //List<ISpaceCraft> spaceCraft = SpacecraftFactory.BuildSpaceCraft(mars, profileDirectory, i * 30);
                List <ISpaceCraft> spaceCraft = SpacecraftFactory.BuildSpaceCraft(earth, profileDirectory, i * -60);

                _spaceCrafts.AddRange(spaceCraft);
            }

            // Initialize the spacecraft controllers
            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                spaceCraft.InitializeController(_eventManager);
            }

            // Start at nearly -Math.Pi / 2
            var itsMount   = new ITSMount(-1.570795, -69, earth);
            var strongback = new Strongback(-1.5708048, -32, earth);

            // Start downrange at ~300km
            //var asds = new ASDS(-1.8303485, 26, earth);

            _gravitationalBodies = new List <IGravitationalBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, europa, saturn
            };

            foreach (ISpaceCraft spaceCraft in _spaceCrafts)
            {
                _gravitationalBodies.Add(spaceCraft);
            }

            _structures = new List <StructureBase>
            {
                itsMount,
                strongback,
                //asds
            };

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCrafts.FirstOrDefault());

            ResolveSpaceCraftParents();
        }
Ejemplo n.º 5
0
        private void LoadSolarSystem()
        {
            _sun = new Sun();

            var mercury = new Mercury();
            var venus   = new Venus();

            var earth = new Earth();
            var moon  = new Moon(earth.Position, earth.Velocity);

            var mars = new Mars();

            var jupiter  = new Jupiter();
            var callisto = new Callisto(jupiter.Position, jupiter.Velocity);
            var europa   = new Europa(jupiter.Position, jupiter.Velocity);
            var ganymede = new Ganymede(jupiter.Position, jupiter.Velocity);
            var io       = new Io(jupiter.Position, jupiter.Velocity);

            var saturn = new Saturn();

            _massiveBodies = new List <IMassiveBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, callisto, europa, ganymede, io, saturn
            };

            ResolveMassiveBodyParents();

            _gravitationalBodies = new List <IGravitationalBody>
            {
                _sun, mercury, venus, earth, moon, mars, jupiter, callisto, europa, ganymede, io, saturn
            };

            _spaceCraftManager = new SpaceCraftManager(_gravitationalBodies);
            _structures        = new List <StructureBase>();

            MissionConfig primaryMission = MissionConfig.Load(ProfilePaths[0]);

            _originTime = primaryMission.GetLaunchDate();

            UpdateLoadingPercentage(20);

            OrbitHelper.SimulateToTime(_massiveBodies, _originTime, 300, UpdateLoadingPercentage);

            UpdateLoadingPercentage(80);

            // Load missions
            for (int i = 0; i < ProfilePaths.Count; i++)
            {
                MissionConfig missionConfig = MissionConfig.Load(ProfilePaths[i]);

                if (missionConfig.ClockDelay > _clockDelay)
                {
                    _clockDelay = missionConfig.ClockDelay;
                }

                IMassiveBody targetPlanet = LocatePlanet(missionConfig.ParentPlanet);

                // Get the launch angle relative to the sun for the given time at the origin
                // and offset each vehicle by a certain amount on the surface
                double launchAngle = targetPlanet.GetSurfaceAngle(_originTime, _sun) + i * 0.00002;

                _spaceCraftManager.Add(SpacecraftFactory.BuildSpaceCraft(targetPlanet, launchAngle, missionConfig, ProfilePaths[i]));

                _structures.AddRange(StructureFactory.Load(targetPlanet, launchAngle, ProfilePaths[i]));
            }

            _spaceCraftManager.Initialize(_eventManager, _clockDelay);

            // Target the spacecraft
            _targetIndex = _gravitationalBodies.IndexOf(_spaceCraftManager.First);

            _spaceCraftManager.ResolveGravitionalParents(_massiveBodies);

            UpdateLoadingPercentage(90);
        }