public override void OnUpdate()
        {
            base.OnUpdate();

            vesselAltitudeInKm = vessel.altitude * 0.001;
            inStarOrbit        = KopernicusHelper.IsStar(vessel.mainBody);
        }
Exemple #2
0
        public static double getBeltMagneticFieldAzimuthal(this CelestialBody body, CelestialBody homeworld, double altitude, double lat)
        {
            double mlat = lat / 180 * Math.PI + Math.PI / 2;

            double relmp = body.Mass / homeworld.Mass;
            double relrp = body.Radius / homeworld.Radius;
            double relrt = body.rotationPeriod / homeworld.rotationPeriod;

            double altituded = altitude + body.Radius;
            double Bmag      = -relmp * VanAllen.B0 / relrt * Math.Pow((body.Radius / altituded), 3) * Math.Sin(mlat) * body.specialMagneticFieldScaling();

            if (KopernicusHelper.IsStar(body))
            {
                Bmag /= 1000;
            }

            if (body.atmosphere)
            {
                Bmag *= body.atmosphereDepth / 70000;
            }
            else
            {
                Bmag *= 0.01;
            }

            return(Bmag);
        }
Exemple #3
0
        public static double GetProtonRadiationLevel(this CelestialBody body, CelestialBody homeworld, double altitude, double lat)
        {
            lat = lat / 180 * Math.PI;

            double atmosphere    = FlightGlobals.getStaticPressure(altitude, body) / 101.325;
            double relrp         = body.Radius / homeworld.Radius;
            double relrt         = body.rotationPeriod / homeworld.rotationPeriod;
            double peakbelt      = body.GetPeakProtonBeltAltitude(homeworld, altitude, lat);
            double altituded     = altitude;
            double a             = peakbelt / sqrt2;
            double beltparticles = sqrt2divPi * Math.Pow(altituded, 2) * Math.Exp(-Math.Pow(altituded, 2) / (2 * Math.Pow(a, 2))) / (Math.Pow(a, 3));

            beltparticles = beltparticles * relrp / relrt * 50;

            if (KopernicusHelper.IsStar(body))
            {
                beltparticles /= 1000;
            }

            if (body.atmosphere)
            {
                beltparticles *= body.atmosphereDepth / 70000;
            }
            else
            {
                beltparticles *= 0.01;
            }

            beltparticles = beltparticles * Math.Abs(Math.Cos(lat)) * body.specialMagneticFieldScaling() * Math.Exp(-atmosphere);

            return(beltparticles);
        }
Exemple #4
0
        public static double GetElectronRadiationLevel(this CelestialBody body, CelestialBody homeworld, double altitude, double lat)
        {
            lat = lat / 180 * Math.PI;
            double atmosphere         = FlightGlobals.getStaticPressure(altitude, body) / GameConstants.EarthAtmospherePressureAtSeaLevel;
            double atmosphere_height  = PluginHelper.GetMaxAtmosphericAltitude(body);
            double atmosphere_scaling = Math.Exp(-atmosphere);

            double relrp = body.Radius / homeworld.Radius;
            double relrt = body.rotationPeriod / homeworld.rotationPeriod;

            double peakbelt2     = body.GetPeakElectronBeltAltitude(homeworld, altitude, lat);
            double altituded     = altitude;
            double b             = peakbelt2 / sqrt2;
            double beltparticles = 0.9 * sqrt2divPi * Math.Pow(altituded, 2) * Math.Exp(-Math.Pow(altituded, 2) / (2 * Math.Pow(b, 2))) / (Math.Pow(b, 3));

            beltparticles = beltparticles * relrp / relrt * 50;

            if (KopernicusHelper.IsStar(body))
            {
                beltparticles /= 1000;
            }

            if (body.atmosphere)
            {
                beltparticles *= body.atmosphereDepth / 70000;
            }
            else
            {
                beltparticles *= 0.01;
            }

            beltparticles = beltparticles * Math.Abs(Math.Cos(lat)) * body.specialMagneticFieldScaling() * atmosphere_scaling;

            return(beltparticles);
        }