STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.core.runner.PintleEngineRunner Class Reference

Public Member Functions

 __init__ (self, PintleEngineConfig config)
Dict[str, Any] evaluate (self, float P_tank_O, float P_tank_F, Optional[float] Pc_guess=None, Optional[float] P_ambient=None, bool debug=False, bool silent=False, bool rich_stability=False, Optional[Dict[str, float]] stability_overrides=None)
Dict[str, np.ndarray] evaluate_arrays (self, Union[np.ndarray, list] P_tank_O, Union[np.ndarray, list] P_tank_F, Optional[float] P_ambient=None)
Dict[str, np.ndarray] evaluate_arrays_with_time (self, Union[np.ndarray, list] times, Union[np.ndarray, list] P_tank_O, Union[np.ndarray, list] P_tank_F, Optional[bool] track_ablative_geometry=None, bool use_coupled_solver=True, Optional[float] P_ambient=None, bool strict_erosion=False, bool chug_eroded_geometry=False)

Public Attributes

 config = apply_measurements(config)
 cea_cache = CEACache(config.combustion.cea)
 solver = ChamberSolver(config, self.cea_cache)
 last_time_varying_solver = None

Protected Member Functions

float _get_ambient_pressure (self, Optional[float] P_ambient=None)
float _get_elevation (self)
Dict[str, Any] _evaluate_internal (self, float P_tank_O, float P_tank_F, Optional[float] Pc_guess=None, Optional[float] P_ambient=None, bool debug=False, bool silent=False, bool rich_stability=False, Optional[Dict[str, float]] stability_overrides=None)

Detailed Description

Main pipeline runner - orchestrates full tank pressure to thrust calculation

Definition at line 44 of file runner.py.

Constructor & Destructor Documentation

◆ __init__()

engine.core.runner.PintleEngineRunner.__init__ ( self,
PintleEngineConfig config )
Initialize pipeline runner.

Parameters:
-----------
config : PintleEngineConfig
    Engine configuration (should be a deep copy if isolation is needed)

Definition at line 47 of file runner.py.

Member Function Documentation

◆ _evaluate_internal()

◆ _get_ambient_pressure()

◆ _get_elevation()

◆ evaluate()

Dict[str, Any] engine.core.runner.PintleEngineRunner.evaluate ( self,
float P_tank_O,
float P_tank_F,
Optional[float] Pc_guess = None,
Optional[float] P_ambient = None,
bool debug = False,
bool silent = False,
bool rich_stability = False,
Optional[Dict[str, float]] stability_overrides = None )
Evaluate engine performance at given tank pressures.

Parameters:
-----------
P_tank_O : float
    Oxidizer tank pressure [Pa]
P_tank_F : float
    Fuel tank pressure [Pa]
Pc_guess : float, optional
    Initial guess for chamber pressure [Pa]
P_ambient : float, optional
    Ambient pressure [Pa]. If None, computed from config environment
    elevation using standard atmosphere model.
debug : bool, optional
    If True, enables debug logging to output/logs/evaluate.log and prints
    detailed execution traces. Defaults to False.

Returns:
--------
results : dict
    Dictionary containing all performance metrics:
    - Pc: Chamber pressure [Pa]
    - mdot_O: Oxidizer mass flow [kg/s]
    - mdot_F: Fuel mass flow [kg/s]
    - MR: Mixture ratio (O/F)
    - F: Thrust [N]
    - Isp: Specific impulse [s]
    - cstar_actual: Actual characteristic velocity [m/s]
    - P_ambient: Ambient pressure used [Pa]
    - elevation: Elevation from config [m]
    - diagnostics: Detailed diagnostics dict

Raises:
-------
ValueError
    If any physics validation fails (invalid values, out of range, etc.)
KeyError
    If required data is missing from results
RuntimeError
    If solver fails to converge or calculation fails

Definition at line 102 of file runner.py.

References _evaluate_internal().

Referenced by evaluate_arrays().

◆ evaluate_arrays()

Dict[str, np.ndarray] engine.core.runner.PintleEngineRunner.evaluate_arrays ( self,
Union[np.ndarray, list] P_tank_O,
Union[np.ndarray, list] P_tank_F,
Optional[float] P_ambient = None )
Evaluate engine performance for arrays of tank pressures (time series).

Parameters:
-----------
P_tank_O : array-like
    Array of oxidizer tank pressures [Pa]
P_tank_F : array-like
    Array of fuel tank pressures [Pa]
P_ambient : float, optional
    Ambient pressure [Pa]. If None, defaults to sea level (101325 Pa).
    This is used for thrust calculation and should match the target exit pressure
    for accurate performance evaluation.

Returns:
--------
results : dict
    Dictionary with arrays of all performance metrics

Definition at line 623 of file runner.py.

References controller_lut.engine_lut.EngineLUT.evaluate(), evaluate(), feedtwin.engine.card.CardChamber.evaluate(), feedtwin.engine.chamber.Chamber.evaluate(), fsw::calibration::PolynomialCalibration.evaluate(), fsw::calibration::PolynomialCalibration.evaluate(), and fsw::control::ControllerLUT.evaluate().

◆ evaluate_arrays_with_time()

Dict[str, np.ndarray] engine.core.runner.PintleEngineRunner.evaluate_arrays_with_time ( self,
Union[np.ndarray, list] times,
Union[np.ndarray, list] P_tank_O,
Union[np.ndarray, list] P_tank_F,
Optional[bool] track_ablative_geometry = None,
bool use_coupled_solver = True,
Optional[float] P_ambient = None,
bool strict_erosion = False,
bool chug_eroded_geometry = False )
Evaluate engine performance over time with ablative geometry evolution.

This method tracks cumulative ablative recession and updates chamber
geometry (V_chamber, A_throat, L*) at each time step, providing
accurate performance predictions for ablative engines.

Parameters:
-----------
times : array-like
    Time points [s]
P_tank_O : array-like
    Array of oxidizer tank pressures [Pa]
P_tank_F : array-like
    Array of fuel tank pressures [Pa]
track_ablative_geometry : bool, optional
    Override config setting for geometry tracking
strict_erosion : bool
    With geometry tracking on, never take the legacy constant-geometry loop: a failure of
    the coupled solver is raised instead of warned and fallen back from. Off by default
    (the previous behaviour). Layer X's replay sets it, so an eroding engine can no longer
    replay with zero erosion and report it as a converged burn (Layer X audit 5.3).
chug_eroded_geometry : bool
    Passed to TimeVaryingCoupledSolver: the chug analysis sees each step's eroded geometry
    instead of the design point. Off by default (the previous behaviour).
P_ambient : float, optional
    Ambient pressure [Pa]. If None, defaults to sea level (101325 Pa).
    This is used for thrust calculation and should match the target exit pressure
    for accurate performance evaluation.

Returns:
--------
results : dict
    Dictionary with arrays of all performance metrics plus:
    - Lstar: Time-varying characteristic length [m]
    - V_chamber: Time-varying chamber volume [m³]
    - A_throat: Time-varying throat area [m²]
    - recession_chamber: Cumulative chamber recession [m]
    - recession_throat: Cumulative throat recession [m]

Definition at line 706 of file runner.py.

Member Data Documentation

◆ cea_cache

engine.core.runner.PintleEngineRunner.cea_cache = CEACache(config.combustion.cea)

◆ config

engine.core.runner.PintleEngineRunner.config = apply_measurements(config)

Definition at line 61 of file runner.py.

Referenced by engine.layerx.card.EngineSampler.__call__(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._advance_walls(), engine.pipeline.cea_cache.CEACache._build_cache(), engine.pipeline.cea_cache.CEACache._build_cache_parallel(), engine.pipeline.cea_cache.CEACache._build_cache_sequential(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._build_walls(), _evaluate_internal(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._geometry(), _get_ambient_pressure(), _get_elevation(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._graphite_layers(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._insert_backing(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._liner_layers(), engine.pipeline.cea_cache.CEACache._load_cache(), engine.pipeline.cea_cache.CEACache._save_cache(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._station_loads(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._wall_report(), engine.pipeline.cea_cache.CEACache.aux(), engine.pipeline.system_diagnostics.SystemDiagnostics.diagnose_all(), engine.pipeline.cea_cache.CEACache.eval(), engine.pipeline.cea_cache.CEACache.eval_cf_vac(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver.liner_end(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver.solve_time_step(), test_robust_ddp_constraints.TestConstraints.test_all_constraints_safe(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_cache_stats(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_caching(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_clear_cache(), test_robust_ddp_constraints.TestConstraints.test_constraint_summary(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_convenience_function(), test_robust_ddp_constraints.TestConstraints.test_copv_minimum_constraint(), test_robust_ddp_constraints.TestConstraints.test_edge_cases(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_estimate_error_handling(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_estimate_from_pressures_mock(), test_robust_ddp_engine_wrapper.TestEngineWrapper.test_estimate_without_stability(), test_robust_ddp_constraints.TestConstraints.test_headroom_constraints(), test_robust_ddp_constraints.TestConstraints.test_injector_stiffness_constraints(), test_robust_ddp_constraints.TestConstraints.test_mixture_ratio_constraints(), test_robust_ddp_robustness.TestRobustness.test_multiple_updates_convergence(), test_robust_ddp_constraints.TestConstraints.test_multiple_violations(), test_robust_ddp_constraints.TestConstraints.test_nan_handling(), test_robust_ddp_dynamics.TestDynamics.test_regulator_behavior(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_basic(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_validation(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_widens(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_with_large_w_bar(), test_robust_ddp_constraints.TestConstraints.test_ullage_maximum_constraints(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_basic(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_beta(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_ema_behavior(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_inflation(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_requires_mass_flow(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_residual_spike(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_with_engine_wrapper(), and test_robust_ddp_engine_wrapper.TestEngineWrapper.test_wrapper_initialization().

◆ last_time_varying_solver

engine.core.runner.PintleEngineRunner.last_time_varying_solver = None

Definition at line 769 of file runner.py.

◆ solver

engine.core.runner.PintleEngineRunner.solver = ChamberSolver(config, self.cea_cache)

Definition at line 69 of file runner.py.

Referenced by _evaluate_internal().


The documentation for this class was generated from the following file: