|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Functions | |
| bool | is_safe (np.ndarray x, EngineEstimate eng_est, ControllerConfig cfg) |
| Dict[str, float] | constraint_values (np.ndarray x, EngineEstimate eng_est, ControllerConfig cfg) |
| Dict[str, Any] | get_constraint_summary (Dict[str, float] constraints) |
Constraint checking for robust DDP controller. Provides hard constraint violations and soft constraint margins.
| Dict[str, float] engine.control.robust_ddp.constraints.constraint_values | ( | np.ndarray | x, |
| EngineEstimate | eng_est, | ||
| ControllerConfig | cfg ) |
Compute constraint violation margins and soft constraint distances.
Positive values indicate constraint violations (unsafe).
Negative values indicate constraint satisfaction with margin.
Parameters:
-----------
x : np.ndarray, shape (N_STATE,)
State vector: [P_copv, P_reg, P_u_F, P_u_O, P_d_F, P_d_O, V_u_F, V_u_O]
eng_est : EngineEstimate
Engine performance estimate
cfg : ControllerConfig
Controller configuration
Returns:
--------
constraints : dict
Dictionary with constraint values:
Hard constraints (positive = violation):
- "copv_min": P_copv_min - P_copv [Pa]
- "ullage_max_F": P_u_F - P_u_max [Pa]
- "ullage_max_O": P_u_O - P_u_max [Pa]
- "MR_min": MR_min - MR [dimensionless]
- "MR_max": MR - MR_max [dimensionless]
- "injector_stiffness_F": eps_i * P_ch - (P_d_F - P_ch) [Pa]
- "injector_stiffness_O": eps_i * P_ch - (P_d_O - P_ch) [Pa]
Soft constraints (margins, negative = safe with margin):
- "copv_margin": P_copv - P_copv_min [Pa] (distance above minimum)
- "ullage_margin_F": P_u_max - P_u_F [Pa] (distance below maximum)
- "ullage_margin_O": P_u_max - P_u_O [Pa] (distance below maximum)
- "MR_margin_low": MR - MR_min [dimensionless] (distance above minimum)
- "MR_margin_high": MR_max - MR [dimensionless] (distance below maximum)
- "injector_stiffness_margin_F": (P_d_F - P_ch) - eps_i * P_ch [Pa]
- "injector_stiffness_margin_O": (P_d_O - P_ch) - eps_i * P_ch [Pa]
Headroom flags (boolean-like, 1.0 = insufficient, 0.0 = sufficient):
- "headroom_insufficient_F": 1.0 if (P_reg - P_u_F) < dp_min, else 0.0
- "headroom_insufficient_O": 1.0 if (P_reg - P_u_O) < dp_min, else 0.0
- "headroom_margin_F": (P_reg - P_u_F) - dp_min [Pa]
- "headroom_margin_O": (P_reg - P_u_O) - dp_min [Pa]
Definition at line 65 of file constraints.py.
Referenced by is_safe().
| Dict[str, Any] engine.control.robust_ddp.constraints.get_constraint_summary | ( | Dict[str, float] | constraints | ) |
Get human-readable summary of constraint status.
Parameters:
-----------
constraints : dict
Output from constraint_values()
Returns:
--------
summary : dict
Summary with:
- "safe": bool (all constraints satisfied)
- "violations": list of violated constraint names
- "margins": dict of constraint margins
- "headroom_flags": dict of headroom insufficiency flags
Definition at line 219 of file constraints.py.
| bool engine.control.robust_ddp.constraints.is_safe | ( | np.ndarray | x, |
| EngineEstimate | eng_est, | ||
| ControllerConfig | cfg ) |
Check if state satisfies all hard constraints.
Parameters:
-----------
x : np.ndarray, shape (N_STATE,)
State vector: [P_copv, P_reg, P_u_F, P_u_O, P_d_F, P_d_O, V_u_F, V_u_O]
eng_est : EngineEstimate
Engine performance estimate
cfg : ControllerConfig
Controller configuration
Returns:
--------
safe : bool
True if all constraints are satisfied, False otherwise
Definition at line 23 of file constraints.py.
References constraint_values().