/// <summary>
        /// Initializes a new instance of the <see cref="StellarBody"/> class.
        /// </summary>
        /// <param name="phy">The Science interface to use.</param>
        /// <param name="mass">The mass.</param>
        /// <param name="lum">The lumuminosity.</param>
        /// <param name="age">The age of the Body.</param>
        public StellarBody(IScienceAstrophysics phy, Mass mass, Luminosity lum, Duration age)
        {
            Science = phy;
            Parent  = null;

            if (mass.SolarMasses < 0.2 || mass.SolarMasses > 1.5)
            {
                mass = Mass.FromSolarMasses(Extensions.RandomNumber(0.7, 1.4));
            }

            if (lum.SolarLuminosities == 0.0)
            {
                lum = Science.Astronomy.GetLuminosityFromMass(mass);
            }

            StellarType = StellarType.FromLuminosityAndRadius(lum, Length.FromSolarRadiuses(1.0));

            //EcosphereRadiusAU = Math.Sqrt(lum);
            Life = Duration.FromYears365(1.0E10 * (mass.SolarMasses / lum.SolarLuminosities));

            if (age.Years365 == double.MaxValue)
            {
                Age = Duration.FromYears365(Extensions.RandomNumber(MinSunAge.Years365, Life < MaxSunAge ? Life.Years365 : MaxSunAge.Years365));
            }
            else
            {
                Age = age;
            }

            Mass           = StellarType.Mass;
            Radius         = StellarType.Radius;
            Luminosity     = StellarType.Luminosity;
            Temperature    = StellarType.Temperature;
            EscapeVelocity = Science.Dynamics.GetEscapeVelocity(Mass, Radius);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StellarBody"/> class.
        /// </summary>
        /// <param name="phy">The Science interface to use.</param>
        /// <param name="st">The StellarType of the Body to construct.</param>
        public StellarBody(IScienceAstrophysics phy, StellarType st)
        {
            Science = phy;
            Parent  = null;

            StellarType = st;
            Life        = Duration.FromYears365(1.0E10 * (st.Mass.SolarMasses / st.Luminosity.SolarLuminosities));
            Age         = Duration.FromYears365(Extensions.RandomNumber(MinSunAge.Years365, Life < MaxSunAge ? Life.Years365 : MaxSunAge.Years365));

            Mass           = StellarType.Mass;
            Radius         = StellarType.Radius;
            Luminosity     = StellarType.Luminosity;
            Temperature    = StellarType.Temperature;
            EscapeVelocity = Science.Dynamics.GetEscapeVelocity(Mass, Radius);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="StellarBody"/> class.
 /// </summary>
 /// <param name="phy">The Science interface to use.</param>
 /// <param name="mass">The mass.</param>
 public StellarBody(IScienceAstrophysics phy, Mass mass) : this(phy, mass, Luminosity.Zero, Duration.FromYears365(double.MaxValue))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StellarBody"/> class.
 /// </summary>
 /// <param name="phy">The Science interface to use.</param>
 public StellarBody(IScienceAstrophysics phy) : this(phy, Mass.FromSolarMasses(Extensions.RandomNumber(0.7, 1.4)))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StellarBody"/> class.
 /// </summary>
 /// <param name="phy">The Science interface to use.</param>
 /// <param name="st">The StellarType of the Body to construct.</param>
 /// <param name="name">The name.</param>
 public StellarBody(IScienceAstrophysics phy, StellarType st, string name) : this(phy, st)
 {
     Name = name;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Star"/> class.
 /// </summary>
 /// <param name="phy">The astrophysics interface.</param>
 /// <param name="mass">The mass of the Star to create.</param>
 /// <param name="lum">The luminosity of the Star to create.</param>
 /// <param name="age">The age of the Star to create.</param>
 public Star(IScienceAstrophysics phy, Mass mass, Luminosity lum, Duration age) : base(phy, mass, lum, age)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Star"/> class.
 /// </summary>
 /// <param name="phy">The astrophysics interface.</param>
 /// <param name="st">The StellarType of the Star to create.</param>
 /// <param name="name">The name to give to the Star.</param>
 public Star(IScienceAstrophysics phy, StellarType st, string name) : base(phy, st, name)
 {
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Star"/> class.
 /// </summary>
 /// <param name="phy">The astrophysics interface.</param>
 /// <param name="st">The StellarType of the Star to create.</param>
 public Star(IScienceAstrophysics phy, StellarType st) : base(phy, st)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Star"/> class.
 /// </summary>
 /// <param name="phy">The astrophysics interface.</param>
 /// <param name="mass">The mass of the Star.</param>
 public Star(IScienceAstrophysics phy, Mass mass) : base(phy, mass)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Star"/> class.
 /// </summary>
 /// <param name="phy">The astrophysics interface.</param>
 public Star(IScienceAstrophysics phy) : base(phy)
 {
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Withes the astrophysics.
 /// </summary>
 /// <param name="phy">The astrophysics services to use.</param>
 /// <returns></returns>
 public Provider WithAstrophysics(IScienceAstrophysics phy)
 {
     _services[typeof(IScienceAstrophysics)] = phy;
     return(this);
 }