STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.pipeline.cea_cache.CEACache Class Reference

Public Member Functions

 __init__ (self, CEAConfig config)
dict eval (self, float MR, float Pc, float Pa=101325.0, Optional[float] eps=None)
float eval_cf_vac (self, float MR, float Pc, Optional[float] eps=None)
"CEAAuxTables" aux (self)

Public Attributes

 config = config
 cache_file = config.cache_file
 use_3d = config.eps_range is not None
 Pc_min
 Pc_max = config.Pc_range
 MR_min
 MR_max = config.MR_range
 n_points = config.n_points
 Pc_grid = np.linspace(self.Pc_min, self.Pc_max, self.n_points)
 MR_grid = np.linspace(self.MR_min, self.MR_max, self.n_points)
 eps_min
 eps_max = config.eps_range
 eps_grid = np.linspace(self.eps_min, self.eps_max, self.n_points)
 cstar_table = None
 Cf_table = None
 Tc_table = None
 gamma_table = None
 R_table = None
float M_table = None
str Cf_vac_table = None

Protected Member Functions

 _load_cache (self)
 _build_cache (self)
 _build_cache_sequential (self, int total_points)
 _build_cache_parallel (self, int n_workers, int total_points)
 _save_cache (self)
float _bilinear_interpolate (self, float Pc, float MR, np.ndarray table)
float _trilinear_interpolate (self, float Pc, float MR, float eps, np.ndarray table)

Detailed Description

CEA cache with bilinear interpolation

Definition at line 326 of file cea_cache.py.

Constructor & Destructor Documentation

◆ __init__()

engine.pipeline.cea_cache.CEACache.__init__ ( self,
CEAConfig config )

Definition at line 329 of file cea_cache.py.

Member Function Documentation

◆ _bilinear_interpolate()

float engine.pipeline.cea_cache.CEACache._bilinear_interpolate ( self,
float Pc,
float MR,
np.ndarray table )
protected
Bilinear interpolation in (Pc, MR) space with robust error handling.

Uses improved boundary handling and NaN management for numerical stability.

Definition at line 803 of file cea_cache.py.

References min, MR_grid, and Pc_grid.

Referenced by eval(), and eval_cf_vac().

◆ _build_cache()

◆ _build_cache_parallel()

◆ _build_cache_sequential()

◆ _load_cache()

engine.pipeline.cea_cache.CEACache._load_cache ( self)
protected
Load CEA data from cache file

Definition at line 387 of file cea_cache.py.

References _build_cache(), engine.pipeline.cea_cache._load_npz_tables(), cache_file, Cf_table, Cf_vac_table, backend.routers.documents.CreatePayload.config, backend.routers.documents.ReleasePayload.config, backend.state.AppState.config, board_simulator.SimulatedBoard.config, calibration_robustness.AnomalyDetector.config, calibration_robustness.BackupManager.config, calibration_robustness.CalibrationValidator.config, calibration_robustness.HealthMonitor.config, calibration_robustness.RobustnessManager.config, combined_fsw_gui.ConfigManager.config, combined_gui.ConfigManager.config, emmc_log_t.config, engine.control.robust_ddp.engine_wrapper.EngineWrapper.config, engine.core.chamber_solver.ChamberSolver.config, engine.core.runner.PintleEngineRunner.config, engine.layerx.card.EngineSampler.config, config, idle_t.config, self_test_t.config, solenoid_characterization_gui.ConfigManager.config, StarOTA::Server.config, cstar_table, eps_grid, eps_max, eps_min, gamma_table, M_table, max, min, MR_grid, engine.control.robust_ddp.data_models.ControllerConfig.MR_max, MR_max, fsw::control::RobustDDPController::Config.MR_max, engine.control.robust_ddp.data_models.ControllerConfig.MR_min, MR_min, fsw::control::RobustDDPController::Config.MR_min, backend.routers.timeseries.PreviewSegmentsRequest.n_points, backend.routers.timeseries.SegmentsRequest.n_points, n_points, Pc_grid, Pc_max, Pc_min, engine.pipeline.cea_cache.print, R_table, Tc_table, and use_3d.

◆ _save_cache()

◆ _trilinear_interpolate()

float engine.pipeline.cea_cache.CEACache._trilinear_interpolate ( self,
float Pc,
float MR,
float eps,
np.ndarray table )
protected
Trilinear interpolation in (Pc, MR, eps) space

Definition at line 914 of file cea_cache.py.

References eps_grid, max, min, MR_grid, and Pc_grid.

Referenced by eval(), and eval_cf_vac().

◆ aux()

◆ eval()

dict engine.pipeline.cea_cache.CEACache.eval ( self,
float MR,
float Pc,
float Pa = 101325.0,
Optional[float] eps = None )
Evaluate CEA properties at given conditions.

Parameters:
-----------
MR : float
    Mixture ratio (O/F)
Pc : float
    Chamber pressure [Pa]
Pa : float
    Ambient pressure [Pa] (default: sea level)
eps : float, optional
    Expansion ratio (uses config default if None)

Returns:
--------
dict with keys:
    cstar_ideal : float [m/s]
    Cf_ideal : float, ambient thrust coefficient at THIS Pa: Cf_vac - Pa*eps/Pc
    Cf_sl : float, the stored table (CEA get_PambCf at its default 14.7 psia)
    Cf_vac : float
    Tc : float [K]
    gamma : float
    R : float [J/(kg*K)]
    M : float [kg/kmol] (molecular weight)
    extrapolated : bool, True when Pc, MR or eps lay outside the table and were clamped
    clamped : tuple of the clamped axis names ("Pc", "MR", "eps")

Definition at line 968 of file cea_cache.py.

References _bilinear_interpolate(), engine.pipeline.cea_cache._isentropic_cf_vac(), engine.pipeline.cea_cache._scalar_clamp(), _trilinear_interpolate(), Cf_table, Cf_vac_table, backend.routers.documents.CreatePayload.config, backend.routers.documents.ReleasePayload.config, backend.state.AppState.config, board_simulator.SimulatedBoard.config, calibration_robustness.AnomalyDetector.config, calibration_robustness.BackupManager.config, calibration_robustness.CalibrationValidator.config, calibration_robustness.HealthMonitor.config, calibration_robustness.RobustnessManager.config, combined_fsw_gui.ConfigManager.config, combined_gui.ConfigManager.config, emmc_log_t.config, engine.control.robust_ddp.engine_wrapper.EngineWrapper.config, engine.core.chamber_solver.ChamberSolver.config, engine.core.runner.PintleEngineRunner.config, engine.layerx.card.EngineSampler.config, config, idle_t.config, self_test_t.config, solenoid_characterization_gui.ConfigManager.config, StarOTA::Server.config, cstar_table, eps_max, eps_min, gamma_table, M_table, engine.control.robust_ddp.data_models.ControllerConfig.MR_max, MR_max, fsw::control::RobustDDPController::Config.MR_max, engine.control.robust_ddp.data_models.ControllerConfig.MR_min, MR_min, fsw::control::RobustDDPController::Config.MR_min, Pc_max, Pc_min, engine.pipeline.cea_cache.print, R_table, Tc_table, and use_3d.

◆ eval_cf_vac()

float engine.pipeline.cea_cache.CEACache.eval_cf_vac ( self,
float MR,
float Pc,
Optional[float] eps = None )
Fast single-value vacuum thrust coefficient lookup (one interpolation).

Hot path for the native Layer-1 inner loop: avoids the full ``eval`` dict
build + sanity prints. Same value ``eval(...)["Cf_vac"]`` returns.

Definition at line 1082 of file cea_cache.py.

References _bilinear_interpolate(), engine.pipeline.cea_cache._isentropic_cf_vac(), engine.pipeline.cea_cache._scalar_clamp(), _trilinear_interpolate(), Cf_vac_table, backend.routers.documents.CreatePayload.config, backend.routers.documents.ReleasePayload.config, backend.state.AppState.config, board_simulator.SimulatedBoard.config, calibration_robustness.AnomalyDetector.config, calibration_robustness.BackupManager.config, calibration_robustness.CalibrationValidator.config, calibration_robustness.HealthMonitor.config, calibration_robustness.RobustnessManager.config, combined_fsw_gui.ConfigManager.config, combined_gui.ConfigManager.config, emmc_log_t.config, engine.control.robust_ddp.engine_wrapper.EngineWrapper.config, engine.core.chamber_solver.ChamberSolver.config, engine.core.runner.PintleEngineRunner.config, engine.layerx.card.EngineSampler.config, config, idle_t.config, self_test_t.config, solenoid_characterization_gui.ConfigManager.config, StarOTA::Server.config, eps_max, eps_min, gamma_table, engine.control.robust_ddp.data_models.ControllerConfig.MR_max, MR_max, fsw::control::RobustDDPController::Config.MR_max, engine.control.robust_ddp.data_models.ControllerConfig.MR_min, MR_min, fsw::control::RobustDDPController::Config.MR_min, Pc_max, Pc_min, and use_3d.

Member Data Documentation

◆ cache_file

engine.pipeline.cea_cache.CEACache.cache_file = config.cache_file

Definition at line 335 of file cea_cache.py.

Referenced by _load_cache(), and _save_cache().

◆ Cf_table

engine.pipeline.cea_cache.CEACache.Cf_table = None

◆ Cf_vac_table

engine.pipeline.cea_cache.CEACache.Cf_vac_table = None

◆ config

engine.pipeline.cea_cache.CEACache.config = config

Definition at line 330 of file cea_cache.py.

Referenced by engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._advance_walls(), _build_cache(), _build_cache_parallel(), _build_cache_sequential(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._build_walls(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._geometry(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._graphite_layers(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._insert_backing(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._liner_layers(), _load_cache(), _save_cache(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._station_loads(), engine.pipeline.time_varying_solver.TimeVaryingCoupledSolver._wall_report(), aux(), engine.pipeline.system_diagnostics.SystemDiagnostics.diagnose_all(), eval(), 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().

◆ cstar_table

engine.pipeline.cea_cache.CEACache.cstar_table = None

◆ eps_grid

engine.pipeline.cea_cache.CEACache.eps_grid = np.linspace(self.eps_min, self.eps_max, self.n_points)

◆ eps_max

engine.pipeline.cea_cache.CEACache.eps_max = config.eps_range

Definition at line 363 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ eps_min

engine.pipeline.cea_cache.CEACache.eps_min

Definition at line 363 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ gamma_table

engine.pipeline.cea_cache.CEACache.gamma_table = None

◆ M_table

float engine.pipeline.cea_cache.CEACache.M_table = None

◆ MR_grid

engine.pipeline.cea_cache.CEACache.MR_grid = np.linspace(self.MR_min, self.MR_max, self.n_points)

◆ MR_max

engine.pipeline.cea_cache.CEACache.MR_max = config.MR_range

Definition at line 354 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ MR_min

engine.pipeline.cea_cache.CEACache.MR_min

Definition at line 354 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ n_points

engine.pipeline.cea_cache.CEACache.n_points = config.n_points

◆ Pc_grid

engine.pipeline.cea_cache.CEACache.Pc_grid = np.linspace(self.Pc_min, self.Pc_max, self.n_points)

◆ Pc_max

engine.pipeline.cea_cache.CEACache.Pc_max = config.Pc_range

Definition at line 353 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ Pc_min

engine.pipeline.cea_cache.CEACache.Pc_min

Definition at line 353 of file cea_cache.py.

Referenced by _load_cache(), eval(), and eval_cf_vac().

◆ R_table

engine.pipeline.cea_cache.CEACache.R_table = None

◆ Tc_table

engine.pipeline.cea_cache.CEACache.Tc_table = None

◆ use_3d

engine.pipeline.cea_cache.CEACache.use_3d = config.eps_range is not None

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