/// <summary>
    /// Simple calculation of time base for the transfer assuming both are in circular orbit
    /// </summary>
    private void ComputeBaseTransferTime()
    {
        double xferOrbit  = 0.5 * (shipRadius + moonRadius) / ge.GetPhysicalScale();
        double planetMass = ge.GetMass(planet);

        timeHohmann = Mathd.PI * Mathd.Sqrt(xferOrbit * xferOrbit * xferOrbit / planetMass);
    }
Esempio n. 2
0
    // IFixedOrbit

    public void PreEvolve(float physicalScale, float massScale)
    {
        CalculateRotation();

        GravityEngine ge = GravityEngine.Instance();

        float a_phy = a_scaled / ge.GetPhysicalScale();

        mu           = (float)GravityEngine.Instance().GetMass(centerNbody);
        orbit_period = Mathf.Sqrt(a_phy * a_phy * a_phy / mu);  // G=1
        // nu to anomoly (vallado algorithm 5, p77) It *really* is sin not sinh inside.
        float sinh_H = Mathf.Sin(phase_nu) * Mathf.Sqrt(ecc * ecc - 1) / (1 + ecc * Mathf.Cos(phase_nu));

        // ArcSinh(x) = ln(x + sqrt(x^2+1) )
        float H = Mathf.Log(sinh_H + Mathf.Sqrt(sinh_H * sinh_H + 1));

        mean_anomoly_phase = ecc * sinh_H - H;

        // Debug.LogFormat("PreEvolve: M0={0} H={1} nu0={1}", mean_anomoly_phase, H, nu);
    }
Esempio n. 3
0
    public float GetPeriod()
    {
        if (centerNbody == null)
        {
            return(0);
        }
        // Use Find to allow Editor to use method.
        if (gravityEngine == null)
        {
            gravityEngine = (GravityEngine)FindObjectOfType(typeof(GravityEngine));
            if (gravityEngine == null)
            {
                Debug.LogError("Need GravityEngine in the scene");
                return(0);
            }
            base.Init();
        }
        a_phy = a_scaled / gravityEngine.GetPhysicalScale();
        float massScale = gravityEngine.massScale;

        orbitPeriod = 2f * Mathf.PI * Mathf.Sqrt(a_phy * a_phy * a_phy / ((float)centerNbody.mass * massScale));   // G=1
        return(orbitPeriod);
    }