STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
ui.interactive_pipeline Namespace Reference

Classes

class  ThrustSolveError

Functions

PintleEngineRunner load_runner ()
None print_header (str title)
str format_value (float value, str unit, int precision=2)
None summarize_results (Dict[str, Any] results)
None forward_mode (PintleEngineRunner runner)
float _thrust_difference (float scale, PintleEngineRunner runner, Tuple[float, float] base_pressures, float target_thrust_kN)
Tuple[Tuple[float, float], Dict[str, Any], Dict[str, Any]] solve_for_thrust_and_MR (PintleEngineRunner runner, float target_thrust_kN, float target_MR, Optional[Tuple[float, float]] initial_guess_psi=None, int max_iterations=50, float tolerance=0.01)
Tuple[Tuple[float, float], Dict[str, Any], Dict[str, Any]] solve_for_thrust (PintleEngineRunner runner, float target_thrust_kN, Tuple[float, float] base_pressures_psi, Tuple[float, float] scale_bounds=(0.2, 5.0), int num_samples=60)
None inverse_mode (PintleEngineRunner runner)
 interactive_loop ()

Variables

float PSI_TO_PA = 6894.76
float PA_TO_PSI = 1.0 / PSI_TO_PA
str CONFIG_PATH = Path(__file__).parent.parent / "configs" / "default.yaml"

Detailed Description

Interactive CLI for the pintle engine pipeline.

Features:
- Forward mode: user provides tank pressures (psi) and receives performance outputs
- Inverse mode: user provides target thrust (kN) and pipeline solves required tank pressures

This script uses the existing PintleEngineRunner to evaluate the pipeline.

Function Documentation

◆ _thrust_difference()

float ui.interactive_pipeline._thrust_difference ( float scale,
PintleEngineRunner runner,
Tuple[float, float] base_pressures,
float target_thrust_kN )
protected
Return thrust difference at given scale factor.

Definition at line 142 of file interactive_pipeline.py.

◆ format_value()

str ui.interactive_pipeline.format_value ( float value,
str unit,
int precision = 2 )

Definition at line 55 of file interactive_pipeline.py.

◆ forward_mode()

None ui.interactive_pipeline.forward_mode ( PintleEngineRunner runner)

Definition at line 111 of file interactive_pipeline.py.

References print_header(), and summarize_results().

Referenced by interactive_loop().

◆ interactive_loop()

ui.interactive_pipeline.interactive_loop ( )

◆ inverse_mode()

None ui.interactive_pipeline.inverse_mode ( PintleEngineRunner runner)

Definition at line 497 of file interactive_pipeline.py.

References print_header(), solve_for_thrust(), and summarize_results().

Referenced by interactive_loop().

◆ load_runner()

PintleEngineRunner ui.interactive_pipeline.load_runner ( )
Load configuration and create a runner instance.

Definition at line 43 of file interactive_pipeline.py.

Referenced by interactive_loop().

◆ print_header()

None ui.interactive_pipeline.print_header ( str title)

Definition at line 49 of file interactive_pipeline.py.

Referenced by forward_mode(), interactive_loop(), and inverse_mode().

◆ solve_for_thrust()

Tuple[Tuple[float, float], Dict[str, Any], Dict[str, Any]] ui.interactive_pipeline.solve_for_thrust ( PintleEngineRunner runner,
float target_thrust_kN,
Tuple[float, float] base_pressures_psi,
Tuple[float, float] scale_bounds = (0.2, 5.0),
int num_samples = 60 )
Solve for tank pressures that achieve the target thrust.

The solution scales the baseline tank pressures by a factor 'scale'.
The function also returns diagnostic information useful for UIs.

Definition at line 349 of file interactive_pipeline.py.

Referenced by inverse_mode().

◆ solve_for_thrust_and_MR()

Tuple[Tuple[float, float], Dict[str, Any], Dict[str, Any]] ui.interactive_pipeline.solve_for_thrust_and_MR ( PintleEngineRunner runner,
float target_thrust_kN,
float target_MR,
Optional[Tuple[float, float]] initial_guess_psi = None,
int max_iterations = 50,
float tolerance = 0.01 )
Solve for tank pressures that achieve both target thrust AND target O/F ratio.

This uses a 2D Newton-Raphson iteration to find (P_tank_O, P_tank_F) such that:
- Thrust(P_O, P_F) = target_thrust_kN
- MR(P_O, P_F) = target_MR

Parameters:
-----------
runner : PintleEngineRunner
    Engine pipeline runner
target_thrust_kN : float
    Desired thrust [kN]
target_MR : float
    Desired mixture ratio (O/F)
initial_guess_psi : tuple, optional
    Starting guess for (P_tank_O, P_tank_F) in psi
    If None, uses (1305, 974) as default
max_iterations : int
    Maximum Newton iterations
tolerance : float
    Convergence tolerance (relative error)

Returns:
--------
(P_tank_O_psi, P_tank_F_psi) : tuple
    Solution tank pressures [psi]
results : dict
    Full pipeline results at solution
diagnostics : dict
    Iteration history and convergence info

Definition at line 160 of file interactive_pipeline.py.

◆ summarize_results()

None ui.interactive_pipeline.summarize_results ( Dict[str, Any] results)
Pretty-print the main outputs from a pipeline evaluation.

Definition at line 59 of file interactive_pipeline.py.

Referenced by forward_mode(), and inverse_mode().

Variable Documentation

◆ CONFIG_PATH

str ui.interactive_pipeline.CONFIG_PATH = Path(__file__).parent.parent / "configs" / "default.yaml"

Definition at line 32 of file interactive_pipeline.py.

◆ PA_TO_PSI

float ui.interactive_pipeline.PA_TO_PSI = 1.0 / PSI_TO_PA

Definition at line 30 of file interactive_pipeline.py.

◆ PSI_TO_PA

float ui.interactive_pipeline.PSI_TO_PA = 6894.76

Definition at line 29 of file interactive_pipeline.py.