|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Classes | |
| class | ProfileParams |
| class | GenerateProfileRequest |
| class | GenerateProfileResponse |
| class | PressureSegment |
| class | SegmentsRequest |
| class | SegmentsResponse |
| class | PreviewSegmentsRequest |
| class | PreviewResponse |
Functions | |
| convert_numpy (obj) | |
| compute_timeseries_results (runner, np.ndarray times, np.ndarray P_tank_O_psi, np.ndarray P_tank_F_psi, bool run_copv=True, Optional[np.ndarray] lox_mass_kg=None, Optional[np.ndarray] fuel_mass_kg=None) | |
| Optional[float] | _loaded_mass (config, str tank_attr) |
| Optional[dict] | _compute_correlation_matrix (dict result_data) |
| Optional[dict] | _run_copv_analysis (config, np.ndarray times, list mdot_O_kg_s, list mdot_F_kg_s, np.ndarray P_tank_O_psi, np.ndarray P_tank_F_psi) |
| generate_timeseries (GenerateProfileRequest request, UserSession session=Depends(get_session)) | |
| GenerateProfileResponse | _generate_timeseries (GenerateProfileRequest request, UserSession session) |
| List[dict] | segments_to_dict_list (List[PressureSegment] segments) |
| generate_from_segments (SegmentsRequest request, UserSession session=Depends(get_session)) | |
| SegmentsResponse | _generate_from_segments (SegmentsRequest request, UserSession session) |
| preview_curve (PreviewSegmentsRequest request) | |
| generate_from_csv (Request request, UploadFile file=File(...), UserSession session=Depends(get_session)) | |
| _curves_from_config (PintleEngineConfig config) | |
| GenerateProfileResponse | _generate_from_csv_bytes (bytes contents, UserSession session) |
Variables | |
| _PROJECT_ROOT = Path(__file__).parent.parent.parent | |
| N2_Z_LOOKUP_CSV = str(_PROJECT_ROOT / "copv" / "n2_Z_lookup.csv") | |
| router = APIRouter(prefix="/api/timeseries", tags=["timeseries"]) | |
| float | PSI_TO_PA = 6894.76 |
| float | PA_TO_PSI = 1.0 / PSI_TO_PA |
Time-series evaluation endpoints.
|
protected |
Compute correlation matrix for key time-series variables. Returns dict with 'matrix' (2D list) and 'labels' (list of variable names).
Definition at line 605 of file timeseries.py.
Referenced by compute_timeseries_results().
|
protected |
(times, LOX psi, fuel psi) from a config's Layer 2 ``pressure_curves`` section.
Definition at line 1219 of file timeseries.py.
Referenced by generate_from_csv().
|
protected |
A CSV of tank pressures run on the session's design (in the thread pool, under the lock).
Definition at line 1242 of file timeseries.py.
References compute_timeseries_results(), and convert_numpy().
|
protected |
Definition at line 941 of file timeseries.py.
References compute_timeseries_results(), convert_numpy(), and segments_to_dict_list().
|
protected |
Definition at line 789 of file timeseries.py.
References compute_timeseries_results(), and convert_numpy().
|
protected |
The configured propellant load of ``lox_tank`` / ``fuel_tank`` [kg], or None if unset.
Definition at line 594 of file timeseries.py.
Referenced by compute_timeseries_results().
|
protected |
Run COPV blowdown analysis using the polytropic N2 solver. Uses hardcoded defaults per requirements: - n = 1.2 (polytropic exponent) - T0_K = 300 (initial COPV temp) - R = 296.8 (gas constant for N2) - Oxidizer gas temp: 250K - Fuel gas temp: 293K - use_real_gas = True (use Z lookup table) Returns dict with copv_pressure_psi trace and summary metrics, or None if unavailable.
Definition at line 654 of file timeseries.py.
Referenced by compute_timeseries_results().
| backend.routers.timeseries.compute_timeseries_results | ( | runner, | |
| np.ndarray | times, | ||
| np.ndarray | P_tank_O_psi, | ||
| np.ndarray | P_tank_F_psi, | ||
| bool | run_copv = True, | ||
| Optional[np.ndarray] | lox_mass_kg = None, | ||
| Optional[np.ndarray] | fuel_mass_kg = None ) |
Compute time-series results from pressure profiles. This is a standalone version that doesn't depend on Streamlit.
Definition at line 58 of file timeseries.py.
References _compute_correlation_matrix(), _loaded_mass(), and _run_copv_analysis().
Referenced by _generate_from_csv_bytes(), _generate_from_segments(), _generate_timeseries(), and generate_from_csv().
| backend.routers.timeseries.convert_numpy | ( | obj | ) |
Recursively convert numpy types to Python native types.
Definition at line 32 of file timeseries.py.
References convert_numpy().
Referenced by _generate_from_csv_bytes(), _generate_from_segments(), _generate_timeseries(), convert_numpy(), and generate_from_csv().
| backend.routers.timeseries.generate_from_csv | ( | Request | request, |
| UploadFile | file = File(...), | ||
| UserSession | session = Depends(get_session) ) |
Generate time-series results from uploaded CSV file or YAML config file. CSV files must contain columns: - T (or time): time in seconds - P_O (or P_tank_O): LOX tank pressure in psi - P_F (or P_tank_F): Fuel tank pressure in psi YAML config files: - Must be a valid PintleEngineConfig with a 'pressure_curves' section; one without is refused (400) and changes nothing - Replace the session config wholesale, as /api/config/upload does: behind the design checkout, off the event loop, with a new load_token (returned) - If time column is missing in CSV, it will be generated with uniform spacing. The run itself goes through ``run_compute`` like /generate: on the event loop it froze every other request for its length, and outside the compute lock it shared the session's runner with whatever else was solving.
Definition at line 1144 of file timeseries.py.
References _curves_from_config(), compute_timeseries_results(), and convert_numpy().
| backend.routers.timeseries.generate_from_segments | ( | SegmentsRequest | request, |
| UserSession | session = Depends(get_session) ) |
Generate time-series results from segment-based pressure curves. Two modes: 1. Regulated mode (default): Uses segments to define pressure curves, COPV analysis enabled 2. Blowdown mode: Simulates pure tank blowdown from initial conditions, ignores segments Each segment specifies: - length_ratio: fraction of total time (0-1) - type: 'blowdown' or 'linear' - start_pressure_psi: start pressure (auto-chained from previous segment) - end_pressure_psi: end pressure - k: blowdown decay constant (0.1-3.0) The blowdown formula: P(t) = P_end + (P_start - P_end) * exp(-k * t_norm) Off the event loop, like /generate: a design whose Time-Series tab is set to segments runs this on open.
Definition at line 919 of file timeseries.py.
| backend.routers.timeseries.generate_timeseries | ( | GenerateProfileRequest | request, |
| UserSession | session = Depends(get_session) ) |
Generate time-series results from simple pressure profiles. Supports linear, exponential, and power profile types. The run goes to the thread pool (``run_compute``): the Time-Series tab runs every design it opens, ~10 s here and ~23 s on a CI runner, and on the event loop that froze /api/health and every other request for as long.
Definition at line 777 of file timeseries.py.
| backend.routers.timeseries.preview_curve | ( | PreviewSegmentsRequest | request | ) |
Preview a pressure curve from segments without running full evaluation. Useful for real-time curve visualization in the UI.
Definition at line 1118 of file timeseries.py.
References segments_to_dict_list().
| List[dict] backend.routers.timeseries.segments_to_dict_list | ( | List[PressureSegment] | segments | ) |
Convert Pydantic segments to dict list for curve generation.
Definition at line 890 of file timeseries.py.
Referenced by _generate_from_segments(), and preview_curve().
|
protected |
Definition at line 21 of file timeseries.py.
| backend.routers.timeseries.N2_Z_LOOKUP_CSV = str(_PROJECT_ROOT / "copv" / "n2_Z_lookup.csv") |
Definition at line 22 of file timeseries.py.
| float backend.routers.timeseries.PA_TO_PSI = 1.0 / PSI_TO_PA |
Definition at line 29 of file timeseries.py.
| float backend.routers.timeseries.PSI_TO_PA = 6894.76 |
Definition at line 28 of file timeseries.py.
| backend.routers.timeseries.router = APIRouter(prefix="/api/timeseries", tags=["timeseries"]) |
Definition at line 24 of file timeseries.py.