|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | EnvironmentConfig |
| class | FinsConfig |
| class | RocketConfig |
| class | TankConfig |
| class | FlightSimRequest |
| class | FlightTrajectory |
| class | TruncationInfo |
| class | MassCapInfo |
| class | PropellantDiagnostics |
| class | FlightSimResponse |
| class | FlightOptimizeRequest |
| class | FlightOptimizeResponse |
Functions | |
| tuple | _propellant_densities (config) |
| float | calculate_tank_capacity (float height, float radius, float density, float fill_factor=0.95) |
| convert_numpy (obj) | |
| Optional[str] | generate_rocket_diagram (flight_obj) |
| extract_flight_series (flight_obj, float elevation=0.0) | |
| build_flight_config (base_config, FlightSimRequest request) | |
| tuple[dict, dict, float|None, float|None, float] | _apply_propellant_mass_caps (dict config_dict, base_config) |
| float | _integrate_series (np.ndarray times, np.ndarray values) |
| MassCapInfo | _build_mass_cap_info (str branch, float requested_kg, float effective_kg, float tank_volume_m3, float max_fill_kg, float fill_factor) |
| PropellantDiagnostics | _compute_propellant_diagnostics (*, np.ndarray times, np.ndarray thrust_array, np.ndarray mdot_O_array, np.ndarray mdot_F_array, float lox_requested, float fuel_requested, float lox_effective, float fuel_effective, Optional[float] lox_tank_max, Optional[float] fuel_tank_max, Optional[TruncationInfo] truncation, dict mass_caps, Optional[float] target_apogee_m, Optional[float] propellant_tank_fill_factor=None) |
| float | _thrust_reference_pressure (base_config, FlightSimRequest request) |
| Optional[float] | ceiling_agl_m (design_requirements, float elevation_m) |
| Optional[dict] | _ceiling_check (flight_config, pressure_curves, float burn_time, float nominal_apogee_agl) |
| FlightSimResponse | _execute_flight_simulation (base_config, FlightSimRequest request, *, Optional[np.ndarray] time_array=None, Optional[np.ndarray] thrust_array=None, Optional[np.ndarray] mdot_O_array=None, Optional[np.ndarray] mdot_F_array=None, Optional[float] lox_mass_kg=None, Optional[float] fuel_mass_kg=None, bool check_ceiling=True) |
| simulate_flight (FlightSimRequest request, UserSession session=Depends(get_session)) | |
| FlightSimResponse | _simulate_flight (FlightSimRequest request, config) |
| optimize_flight_altitude (FlightOptimizeRequest request, UserSession session=Depends(get_session)) | |
| FlightOptimizeResponse | _optimize_flight_altitude (FlightOptimizeRequest request, config) |
| check_rocketpy () | |
Variables | |
| router = APIRouter(prefix="/api/flight", tags=["flight"]) | |
| float | PSI_TO_PA = 6894.76 |
| float | PA_TO_PSI = 1.0 / PSI_TO_PA |
| float | LOX_DENSITY_FALLBACK = 1141.0 |
| float | FUEL_DENSITY_FALLBACK = 800.0 |
Flight simulation endpoints.
|
protected |
Cap LOX/fuel masses to tank capacity. Returns (mass_adjustments, lox_max, fuel_max, fill_factor).
Definition at line 433 of file flight.py.
References _propellant_densities(), and min.
Referenced by _execute_flight_simulation().
|
protected |
Definition at line 505 of file flight.py.
Referenced by _compute_propellant_diagnostics().
|
protected |
Apogee against the ceiling at its high-apogee corner. The corner is the most vertical, lowest-drag flight the config admits: the rail at 90 deg, the windless ISA, and -- when drag is the build-up -- a hydraulically smooth skin (roughness 0), the floor of turbulent friction. A user's drag table has no band and is flown as given.
Definition at line 672 of file flight.py.
References ceiling_agl_m().
Referenced by _execute_flight_simulation().
|
protected |
Definition at line 523 of file flight.py.
References _build_mass_cap_info(), and _integrate_series().
Referenced by _execute_flight_simulation().
|
protected |
Run one flight simulation (shared by /simulate and /optimize-altitude).
Definition at line 719 of file flight.py.
References _apply_propellant_mass_caps(), _ceiling_check(), _compute_propellant_diagnostics(), _thrust_reference_pressure(), build_flight_config(), convert_numpy(), extract_flight_series(), and generate_rocket_diagram().
Referenced by _optimize_flight_altitude(), and _simulate_flight().
|
protected |
Definition at line 497 of file flight.py.
Referenced by _compute_propellant_diagnostics().
|
protected |
Definition at line 961 of file flight.py.
References _execute_flight_simulation(), and ceiling_agl_m().
|
protected |
(oxidizer, fuel) liquid densities [kg/m³] from the loaded config's fluids, so propellant mass-capping follows the selected propellant rather than a hardcoded fuel. Falls back to generic densities only if the config doesn't carry them.
Definition at line 28 of file flight.py.
Referenced by _apply_propellant_mass_caps().
|
protected |
Definition at line 922 of file flight.py.
References _execute_flight_simulation().
|
protected |
The ambient pressure the thrust curve was computed at [Pa]. The time series ran on the SESSION config, so its elevation (not an elevation the Flight tab overrides afterwards) sets the reference; the request can state it outright.
Definition at line 641 of file flight.py.
Referenced by _execute_flight_simulation().
| backend.routers.flight.build_flight_config | ( | base_config, | |
| FlightSimRequest | request ) |
Build a flight-ready config by merging base config with request overrides.
Definition at line 339 of file flight.py.
Referenced by _execute_flight_simulation().
| float backend.routers.flight.calculate_tank_capacity | ( | float | height, |
| float | radius, | ||
| float | density, | ||
| float | fill_factor = 0.95 ) |
| Optional[float] backend.routers.flight.ceiling_agl_m | ( | design_requirements, | |
| float | elevation_m ) |
design_requirements.max_apogee_m as metres above the pad, or None when no ceiling is set.
Definition at line 659 of file flight.py.
Referenced by _ceiling_check(), and _optimize_flight_altitude().
| backend.routers.flight.check_rocketpy | ( | ) |
| backend.routers.flight.convert_numpy | ( | obj | ) |
Recursively convert numpy types to Python native types.
Definition at line 60 of file flight.py.
References convert_numpy().
Referenced by _execute_flight_simulation(), and convert_numpy().
| backend.routers.flight.extract_flight_series | ( | flight_obj, | |
| float | elevation = 0.0 ) |
Extract flight time series from RocketPy flight object.
Returns:
Tuple of (time_array, altitude_agl_array, velocity_array)
Definition at line 311 of file flight.py.
Referenced by _execute_flight_simulation().
| Optional[str] backend.routers.flight.generate_rocket_diagram | ( | flight_obj | ) |
Generate rocket diagram as base64-encoded PNG.
Returns:
Base64-encoded PNG string, or None if generation fails.
Definition at line 270 of file flight.py.
References decode().
Referenced by _execute_flight_simulation().
| backend.routers.flight.optimize_flight_altitude | ( | FlightOptimizeRequest | request, |
| UserSession | session = Depends(get_session) ) |
Find minimum-fuel burn time to reach a target apogee for the loaded time-series curve. In the thread pool: the search flies a dozen RocketPy flights (~7 s on the LE4 stand), and inline on the event loop /api/health went unanswered for all of it. Every flight of the search uses the one config read here.
| backend.routers.flight.simulate_flight | ( | FlightSimRequest | request, |
| UserSession | session = Depends(get_session) ) |
Run flight simulation using time-series data. Uses provided thrust/mdot arrays from time-series analysis. Returns apogee, max velocity, and flight trajectory. In the thread pool: a RocketPy flight is about a second of CPU, and inline on the event loop it froze every other request (/api/health included) for as long. The config is read once.