예제 #1
0
        public static double CalculateHohmannTransferDeltaV(SimpleOrbit orbit1, SimpleOrbit orbit2)
        {
            SimpleOrbit fastestPeriapsisOrbit, slowestPeriapsisOrbit, transferOrbit;
            double      deltaV = 0.0;

            if (orbit1.ParentBody != orbit2.ParentBody)
            {
                throw new ArgumentException("Input orbits must have same parent body.");
            }

            if (orbit1.PeriapsisSpeed > orbit2.PeriapsisSpeed)
            {
                fastestPeriapsisOrbit = orbit1;
                slowestPeriapsisOrbit = orbit2;
            }
            else
            {
                fastestPeriapsisOrbit = orbit2;
                slowestPeriapsisOrbit = orbit1;
            }

            SimpleOrbitBuilder transferOrbitBuilder = new SimpleOrbitBuilder(orbit1.ParentBody);

            transferOrbitBuilder.SetPeriapsis(fastestPeriapsisOrbit.Periapsis);
            transferOrbitBuilder.SetApoapsis(slowestPeriapsisOrbit.Periapsis);
            transferOrbit = transferOrbitBuilder.Build();

            deltaV += Math.Abs(transferOrbit.PeriapsisSpeed - fastestPeriapsisOrbit.PeriapsisSpeed);
            deltaV += Math.Abs(slowestPeriapsisOrbit.PeriapsisSpeed - transferOrbit.ApoapsisSpeed);

            return(deltaV);
        }
예제 #2
0
        public double CalculateEquatorialLandingDeltaV()
        {
            SimpleOrbit transferOrbit;
            double      deltaV = 0.0;
            double      equatorialRotationSpeed = 2.0 * Math.PI * ParentBody.Radius / ParentBody.rotationPeriod;

            SimpleOrbitBuilder transferOrbitBuilder = new SimpleOrbitBuilder(ParentBody);

            transferOrbitBuilder.SetApoapsis(Apoapsis);
            transferOrbitBuilder.SetPeriapsis(ParentBody.Radius);
            transferOrbit = transferOrbitBuilder.Build();

            deltaV += Math.Abs(ApoapsisSpeed - transferOrbit.ApoapsisSpeed);
            deltaV += Math.Abs(transferOrbit.PeriapsisSpeed - equatorialRotationSpeed);

            return(deltaV);
        }
        /// <summary>
        /// Will create the orbit object from the user's input.
        /// </summary>
        /// <returns>The calculated orbit.</returns>
        private SimpleOrbit CalculateOrbit()
        {
            SimpleOrbitBuilder orbitBuilder = new SimpleOrbitBuilder(celestialBodies[selectedCelestialIndex]);

            if (lockApoapsis)
            {
                if (useAltitideAspides)
                {
                    orbitBuilder.SetApoapsisAltitude(apoapsisText);
                }
                else
                {
                    orbitBuilder.SetApoapsis(apoapsisText);
                }
            }

            if (lockPeriapsis)
            {
                if (useAltitideAspides)
                {
                    orbitBuilder.SetPeriapsisAltitude(periapsisText);
                }
                else
                {
                    orbitBuilder.SetPeriapsis(periapsisText);
                }
            }

            if (lockEccentricity)
            {
                orbitBuilder.SetEccentricity(eccentricityText);
            }
            if (lockSMA)
            {
                orbitBuilder.SetSemiMajorAxis(smaText);
            }
            if (lockPeriod)
            {
                orbitBuilder.SetOrbitalPeriod(periodText);
            }

            return(orbitBuilder.Build());
        }