Alpha

#!/usr/bin/env python3
"""
Argo Alpha-AUXMOD Performance Calculator

Models the docked Alpha capsule and Auxiliary Module in orbit.

Calculates:
- Combined operating and dry mass
- Shared AUXMOD propellant budget
- Ideal delta-v available for maneuvering and docking
- Theoretical peak solar-array output
- Comparison with the specified 7 kW electrical output

Assumptions:
- Alpha mass remains constant at 5200 kg.
- AUXMOD RCS and retro-fire systems share one propellant supply.
- All AUXMOD operating mass above dry mass is treated as propellant.
- Hypergolic specific impulse is 314 seconds.
- Solar-array output uses 35% cell efficiency and standard
  solar irradiance at Earth's orbital distance.
"""

import math

# --------------------------------------------------
# Physical constants
# --------------------------------------------------

G0 = 9.80665                  # Standard gravity (m/s^2)
SOLAR_IRRADIANCE = 1361.0     # Solar irradiance (W/m^2)

# --------------------------------------------------
# Alpha capsule
# --------------------------------------------------

ALPHA_MASS = 5200.0           # Constant operating mass (kg)
ALPHA_DIAMETER = 3.6           # Diameter (m)
ALPHA_HEIGHT = 2.0             # Overall height (m)

# --------------------------------------------------
# Auxiliary Module
# --------------------------------------------------

AUXMOD_WET_MASS = 2850.0      # Operating mass (kg)
AUXMOD_DRY_MASS = 1640.0      # Dry mass (kg)
AUXMOD_ISP = 314.0            # Hypergolic specific impulse (s)

# Shared RCS and retro-fire propellant budget
AUXMOD_PROPELLANT = (
    AUXMOD_WET_MASS - AUXMOD_DRY_MASS
)

# --------------------------------------------------
# Solar arrays
# --------------------------------------------------

SOLAR_ARRAY_AREA = 18.0       # Total deployed area (m^2)
SOLAR_CELL_EFFICIENCY = 0.35  # 35 percent
RATED_ELECTRICAL_OUTPUT = 7000.0  # Previously specified output (W)

# --------------------------------------------------
# Calculations
# --------------------------------------------------

def ideal_delta_v(initial_mass, final_mass, isp):
    """Calculate ideal delta-v using the Tsiolkovsky rocket equation."""
    if initial_mass <= final_mass:
        return 0.0

    return isp * G0 * math.log(initial_mass / final_mass)


def solar_peak_power(area, efficiency, irradiance):
    """Calculate ideal solar-array electrical output in watts."""
    return area * efficiency * irradiance


def main():
    stack_wet_mass = ALPHA_MASS + AUXMOD_WET_MASS
    stack_dry_mass = ALPHA_MASS + AUXMOD_DRY_MASS

    print("=" * 54)
    print(" ARGO ALPHA-AUXMOD PERFORMANCE")
    print("=" * 54)

    print("\nSPACECRAFT MASS")
    print(f"Alpha capsule:             {ALPHA_MASS:10,.1f} kg")
    print(f"AUXMOD operating mass:     {AUXMOD_WET_MASS:10,.1f} kg")
    print(f"AUXMOD dry mass:           {AUXMOD_DRY_MASS:10,.1f} kg")
    print(f"AUXMOD propellant budget:  {AUXMOD_PROPELLANT:10,.1f} kg")
    print(f"Combined operating mass:   {stack_wet_mass:10,.1f} kg")
    print(f"Combined dry mass:         {stack_dry_mass:10,.1f} kg")

    print("\nPROPULSION AND MANEUVERING")

    print(f"Hypergolic Isp:            {AUXMOD_ISP:10.1f} s")

    print(
        "\nHow much propellant (kg) must be reserved for "
        "retro-fire operations?"
    )
    print(
        f"Enter a value from 0 to {AUXMOD_PROPELLANT:.1f}. "
        "Press Enter for 0 kg (optimistic upper bound)."
    )

    entry = input("Retro-fire reserve (kg): ").strip()

    if entry == "":
        retro_reserve = 0.0
    else:
        try:
            retro_reserve = float(entry)
        except ValueError:
            print("Invalid input. Please enter a numeric mass.")
            return

    if not 0.0 <= retro_reserve <= AUXMOD_PROPELLANT:
        print(
            f"Reserve must be between 0 and "
            f"{AUXMOD_PROPELLANT:.1f} kg."
        )
        return

    docking_propellant = AUXMOD_PROPELLANT - retro_reserve

    # Propellant reserved for retro-fire remains aboard.
    final_mass = stack_wet_mass - docking_propellant

    docking_delta_v = ideal_delta_v(
        stack_wet_mass,
        final_mass,
        AUXMOD_ISP
    )

    maximum_delta_v = ideal_delta_v(
        stack_wet_mass,
        stack_dry_mass,
        AUXMOD_ISP
    )

    print(f"\nRetro-fire reserve:       {retro_reserve:10,.1f} kg")
    print(f"Propellant for maneuvering:{docking_propellant:9,.1f} kg")
    print(f"Mass before maneuver:     {stack_wet_mass:10,.1f} kg")
    print(f"Mass after maneuver:      {final_mass:10,.1f} kg")
    print(f"Ideal docking Δv budget:  {docking_delta_v:10,.1f} m/s")
    print(f"Absolute ideal Δv maximum:{maximum_delta_v:10,.1f} m/s")

def aligned_number(value, decimals=1, width=10, comma=True):
    formatted = f"{value:,.{decimals}f}" if comma else f"{value:.{decimals}f}"
    integer, fraction = formatted.split(".")
    return f"{integer:>{width - decimals - 1}}.{fraction}"

    print("\nSOLAR POWER")

    theoretical_power = solar_peak_power(
        SOLAR_ARRAY_AREA,
        SOLAR_CELL_EFFICIENCY,
        SOLAR_IRRADIANCE
    )


    print(f"Deployed array area:      {aligned_number(SOLAR_ARRAY_AREA)} m^2")
    print(f"Cell efficiency:          {aligned_number(SOLAR_CELL_EFFICIENCY * 100)}%")
    print(f"Solar irradiance:         {aligned_number(SOLAR_IRRADIANCE)} W/m^2")
    print(f"Theoretical peak output:  {aligned_number(theoretical_power / 1000, 2)} kW")
    print(f"Specified system output:  {aligned_number(RATED_ELECTRICAL_OUTPUT / 1000, 2)} kW")

    derating = 1.0 - RATED_ELECTRICAL_OUTPUT / theoretical_power

    print(f"Implied power derating:   {aligned_number(derating * 100)}%")


    print("\nNOTES")
    print(
        "- Delta-v is ideal: gravity, attitude-control, and other "
        "operational losses are not included."
    )
    print(
        "- The maneuvering result assumes all unreserved mass "
        "allowance is usable propellant."
    )
    print(
        "- Actual electrical output depends on array temperature, "
        "illumination angle, degradation, and power-system losses."
    )
    print("=" * 54)


if __name__ == "__main__":
    main()
======================================================
 ARGO ALPHA-AUXMOD PERFORMANCE
======================================================

SPACECRAFT MASS
Alpha capsule:                5,200.0 kg
AUXMOD operating mass:        2,850.0 kg
AUXMOD dry mass:              1,640.0 kg
AUXMOD propellant budget:     1,210.0 kg
Combined operating mass:      8,050.0 kg
Combined dry mass:            6,840.0 kg

PROPULSION AND MANEUVERING
Hypergolic Isp:                 314.0 s

How much propellant (kg) must be reserved for retro-fire operations?
Enter a value from 0 to 1210.0. Press Enter for 0 kg (optimistic upper bound).
Retro-fire reserve (kg): 300

Retro-fire reserve:            300.0 kg
Propellant for maneuvering:    910.0 kg
Mass before maneuver:        8,050.0 kg
Mass after maneuver:         7,140.0 kg
Ideal docking Δv budget:       369.4 m/s
Absolute ideal Δv maximum:     501.6 m/s
Unknown's avatar

About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply