Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Repeat Cycle computations #488

Open
vishwa2710 opened this issue Jan 9, 2025 · 0 comments
Open

[feat] Repeat Cycle computations #488

vishwa2710 opened this issue Jan 9, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@vishwa2710
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Describe the solution you'd like
Repeat cycle computations for sun-synchronous orbits

Additional context
Add any other context or screenshots about the feature request here. Any relevant information related to your specific use case should be added!

Example python code:

def calculate_daily_orbital_frequency(n):
    """
    Calculate the daily orbital frequency in round trips per day.

    Args:
        n (float): Mean motion [rad/s].

    Returns:
        float: Daily orbital frequency [round trips/day].
    """

    return n * J_M / (2.0 * math.pi)
def calculate_nodal_precession_rate_round_trips_per_year(
    omega_dot,
):
    """
    Calculate the nodal precession rate in round trips per year.

    Args:
        omega_dot (float): Nodal precession rate [rad/s].

    Returns:
        float: Nodal precession rate [round trips/day].
    """

    return J_M / (2 * math.pi) * N_sid * omega_dot
def calculate_daily_recurrence_frequency(
    n,
    omega_dot,
):
    """
    Calculate the daily recurrence frequency (κ).

    Args:
        n (float): Mean motion [rad/s].
        omega_dot (float): Nodal precession rate [rad/s].

    Returns:
        float: Daily recurrence frequency [-].
    """

    return n / (omega_dot_T - omega_dot)
def calculate_nodal_precession_rate(
    a,
    i,
):
    """
    Calculate nodal precession rate omega_dot, based on (a,i) and J2 approximation for circular orbits.

    Args:
        a (float): Semi major axis [m].
        i (float): Inclination [rad].

    Returns:
        float: nodal precession rate [rad/s].
    """

    K0 = (3 / 2) * J2 * np.sqrt(mu / R_e**3)
    omega_dot = -K0 * (R_e / a) ** (7 / 2) * np.cos(i)

    return omega_dot
def calculate_apsidal_precession_rate(
    a,
    i,
):
    """
    Calculate nodal precession rate omega_dot, based on (a,i) and J2 approximation for circular orbits.

    Args:
        a (float): Semi major axis [m].
        i (float): Inclination [rad].

    Returns:
        float: nodal precession rate [rad/s].
    """

    K0 = (3 / 2) * J2 * np.sqrt(mu / R_e**3)
    omega_dot = (
        1 / 2 * K0 * (R_e / a) ** (7 / 2) * (5 * np.cos(i) ** 2 - 1)
    )  # formula 4.10

    return omega_dot
def calculate_integer_recurrence_cycle(
    N_T_0,
    kappa,
):
    return N_T_0 / kappa
def calculate_dracronitic_period(
    C_T_0,
    N_T_0,
    P,
):
    """
    Calculate draconitic period.

    Args:
        C_T_0 (int): Integer recurrence cycle [-].
        N_T_0 (int): Number of round trips [-].
        P (float): Nodal precession rate [round trips/year].

    Returns:
        float: Draconitic period [min].
    """

    return 1440 * C_T_0 / N_T_0 * (1 + (1 - P) / N_sid)
def compute_a_from_a0(a_0):
    """
    Calculate the semi-major axis (taking J2 into account) from an initial guess.

    Args:
        a_0 (float): initial guess of the semi major axis [m].

    Returns:
        float: nodal precession rate [rad/s].
    """

    # Initialization
    a_i = a_0
    i_i = sso_a2i(a_i)
    delta_a = 1001

    # Pre-procs
    omega_dot_i = calculate_apsidal_precession_rate(a_i, i_i)
    n_i = calculate_mean_motion(a_i)

    # Corrections
    delta_n = (
        3 / 4 * J2 * (R_e / a_i) ** 2 * (3 * np.cos(i_i) ** 2 - 1)
    ) * n_i  # formula 4.3
    delta_a = 2 / 3 * (omega_dot_i + delta_n) / n_i * a_i  # formula 4.15

    # Return corrected values
    a_i = a_i + delta_a
    i_i = sso_a2i(a_i)

    return a_i, i_i
def calculate_semi_major_axis(
    T_d,
):
    """
    Calculate semi-major axis from orbital period.

    Args:
        T_d (float): Orbital period [min].

    Returns:
        float: Semi-major axis [m].
    """

    # Convert period to seconds
    T = T_d * 60  # [s]

    return ((mu * T**2) / (4 * math.pi**2)) ** (1 / 3)
def compute_recurrence_triple_sso(
    nu_0,
    D_T_0,
    C_T_0,
):
    nu = nu_0 + D_T_0 / C_T_0  # Eq. 7.14
    kappa = nu  # SSO (§ 7.2.1)
    P = 1  # SSO (§ 7.1.1)
    N_T_0 = kappa * C_T_0  # Eq. 7.10
    T_d = calculate_dracronitic_period(C_T_0, N_T_0, P)  # Eq. 7.13
    a = calculate_semi_major_axis(T_d)

    return (nu_0, D_T_0, C_T_0, nu * C_T_0, T_d, a, nu)
def compute_repeat_cycle_sso(
    min_nu_0,
    max_nu_0,
    min_CT_0,
    max_CT_0,
):
    data = []
    for nu_0 in np.linspace(
        min_nu_0,
        max_nu_0,
        max_nu_0 - min_nu_0 + 1,
    ):
        for C_T_0 in np.linspace(
            min_CT_0,
            max_CT_0,
            max_CT_0 - min_CT_0 + 1,
        ):
            for D_T_0 in np.linspace(0, math.floor(C_T_0 / 2), math.floor(C_T_0 / 2) + 1):
                if are_coprime(D_T_0, C_T_0):
                    data.append(compute_recurrence_triple_sso(nu_0, D_T_0, C_T_0))
                    data.append(compute_recurrence_triple_sso(nu_0, -D_T_0, C_T_0))
    return data
@vishwa2710 vishwa2710 added the enhancement New feature or request label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant