|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Public Member Functions | |
| __init__ (self, ControllerConfig cfg, float forgetting_factor=0.99) | |
| None | update_params (self, ControllerState state, Measurement meas, ControllerConfig cfg, np.ndarray x_current, np.ndarray u_current, float dt, Optional[float] mdot_F=None, Optional[float] mdot_O=None) |
| dict | get_params (self) |
| None | update_config (self, ControllerConfig cfg) |
Public Attributes | |
| cfg = cfg | |
| lambda_rls = forgetting_factor | |
| alpha_F = cfg.alpha_F | |
| alpha_O = cfg.alpha_O | |
| tau_line_F = cfg.tau_line_F | |
| tau_line_O = cfg.tau_line_O | |
| copv_cF = cfg.copv_cF | |
| copv_cO = cfg.copv_cO | |
| int | P_alpha_F = 1e6 |
| theta_alpha_F = cfg.alpha_F | |
| int | P_alpha_O = 1e6 |
| theta_alpha_O = cfg.alpha_O | |
| int | P_tau_F = 1e6 |
| float | theta_tau_F = 1.0 / cfg.tau_line_F |
| int | P_tau_O = 1e6 |
| float | theta_tau_O = 1.0 / cfg.tau_line_O |
| int | P_copv = 1e6 * np.eye(2) |
| theta_copv = np.array([cfg.copv_cF, cfg.copv_cO]) | |
| Optional[np.ndarray] | x_prev = None |
| Optional[np.ndarray] | u_prev = None |
| Optional[float] | t_prev = None |
| alpha_min | |
| float | alpha_max = 0.1, 100.0 |
| tau_min | |
| float | tau_max = 0.001, 1.0 |
| copv_c_min | |
| int | copv_c_max = 1e3, 1e7 |
Protected Member Functions | |
| None | _update_alpha_F (self, float dP_u_dt, np.ndarray x, np.ndarray u, float dt, Optional[float] mdot_F) |
| None | _update_alpha_O (self, float dP_u_dt, np.ndarray x, np.ndarray u, float dt, Optional[float] mdot_O) |
| None | _update_tau_line_F (self, float dP_d_dt, np.ndarray x, float dt) |
| None | _update_tau_line_O (self, float dP_d_dt, np.ndarray x, float dt) |
| None | _update_copv_coefficients (self, float dP_copv_dt, np.ndarray u, float dt) |
Online parameter identifier using RLS with forgetting factor.
Definition at line 29 of file identify.py.
| engine.control.robust_ddp.identify.ParameterIdentifier.__init__ | ( | self, | |
| ControllerConfig | cfg, | ||
| float | forgetting_factor = 0.99 ) |
Initialize parameter identifier.
Parameters:
-----------
cfg : ControllerConfig
Controller configuration (contains initial parameter values)
forgetting_factor : float
RLS forgetting factor (0 < lambda < 1, closer to 1 = slower forgetting)
Definition at line 32 of file identify.py.
|
protected |
Update alpha_F using RLS.
Definition at line 155 of file identify.py.
References engine.control.robust_ddp.data_models.ControllerConfig.alpha_F, alpha_F, fsw::control::RobustDDPController::Config.alpha_F, alpha_max, alpha_min, engine.control.robust_ddp.controller.RobustDDPController.cfg, cfg, lambda_rls, P_alpha_F, and theta_alpha_F.
Referenced by update_params().
|
protected |
Update alpha_O using RLS.
Definition at line 200 of file identify.py.
References alpha_max, alpha_min, engine.control.robust_ddp.data_models.ControllerConfig.alpha_O, alpha_O, fsw::control::RobustDDPController::Config.alpha_O, engine.control.robust_ddp.controller.RobustDDPController.cfg, cfg, lambda_rls, P_alpha_O, and theta_alpha_O.
Referenced by update_params().
|
protected |
Update COPV consumption coefficients using RLS.
Definition at line 297 of file identify.py.
References engine.control.robust_ddp.controller.RobustDDPController.cfg, cfg, copv_c_max, copv_c_min, engine.control.robust_ddp.data_models.ControllerConfig.copv_cF, copv_cF, fsw::control::RobustDDPController::Config.copv_cF, engine.control.robust_ddp.data_models.ControllerConfig.copv_cO, copv_cO, fsw::control::RobustDDPController::Config.copv_cO, lambda_rls, backend.routers.control.MeasurementRequest.P_copv, engine.control.robust_ddp.data_models.Measurement.P_copv, P_copv, fsw::control::RobustDDPController::Measurement.P_copv, and theta_copv.
Referenced by update_params().
|
protected |
Update tau_line_F using RLS.
Definition at line 242 of file identify.py.
References lambda_rls, max, P_tau_F, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_F, tau_line_F, fsw::control::RobustDDPController::Config.tau_line_F, tau_max, tau_min, fsw::calibration::NoiseCoefficients.tau_min, and theta_tau_F.
Referenced by update_params().
|
protected |
Update tau_line_O using RLS.
Definition at line 271 of file identify.py.
References lambda_rls, max, P_tau_O, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_O, tau_line_O, fsw::control::RobustDDPController::Config.tau_line_O, tau_max, tau_min, fsw::calibration::NoiseCoefficients.tau_min, and theta_tau_O.
Referenced by update_params().
| dict engine.control.robust_ddp.identify.ParameterIdentifier.get_params | ( | self | ) |
Get current parameter estimates.
Definition at line 335 of file identify.py.
References engine.control.robust_ddp.data_models.ControllerConfig.alpha_F, alpha_F, fsw::control::RobustDDPController::Config.alpha_F, engine.control.robust_ddp.data_models.ControllerConfig.alpha_O, alpha_O, fsw::control::RobustDDPController::Config.alpha_O, engine.control.robust_ddp.data_models.ControllerConfig.copv_cF, copv_cF, fsw::control::RobustDDPController::Config.copv_cF, engine.control.robust_ddp.data_models.ControllerConfig.copv_cO, copv_cO, fsw::control::RobustDDPController::Config.copv_cO, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_F, tau_line_F, fsw::control::RobustDDPController::Config.tau_line_F, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_O, tau_line_O, and fsw::control::RobustDDPController::Config.tau_line_O.
| None engine.control.robust_ddp.identify.ParameterIdentifier.update_config | ( | self, | |
| ControllerConfig | cfg ) |
Update config with identified parameters (slow update).
Definition at line 346 of file identify.py.
References engine.control.robust_ddp.data_models.ControllerConfig.alpha_F, alpha_F, fsw::control::RobustDDPController::Config.alpha_F, engine.control.robust_ddp.data_models.ControllerConfig.alpha_O, alpha_O, fsw::control::RobustDDPController::Config.alpha_O, engine.control.robust_ddp.data_models.ControllerConfig.copv_cF, copv_cF, fsw::control::RobustDDPController::Config.copv_cF, engine.control.robust_ddp.data_models.ControllerConfig.copv_cO, copv_cO, fsw::control::RobustDDPController::Config.copv_cO, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_F, tau_line_F, fsw::control::RobustDDPController::Config.tau_line_F, engine.control.robust_ddp.data_models.ControllerConfig.tau_line_O, tau_line_O, and fsw::control::RobustDDPController::Config.tau_line_O.
| None engine.control.robust_ddp.identify.ParameterIdentifier.update_params | ( | self, | |
| ControllerState | state, | ||
| Measurement | meas, | ||
| ControllerConfig | cfg, | ||
| np.ndarray | x_current, | ||
| np.ndarray | u_current, | ||
| float | dt, | ||
| Optional[float] | mdot_F = None, | ||
| Optional[float] | mdot_O = None ) |
Update identified parameters from measurements.
Parameters:
-----------
state : ControllerState
Controller state (not used, but kept for API consistency)
meas : Measurement
Current measurements
cfg : ControllerConfig
Controller configuration
x_current : np.ndarray
Current state vector
u_current : np.ndarray
Current control input
dt : float
Time step [s]
mdot_F : float, optional
Fuel mass flow [kg/s]
mdot_O : float, optional
Oxidizer mass flow [kg/s]
Definition at line 84 of file identify.py.
References _update_alpha_F(), _update_alpha_O(), _update_copv_coefficients(), _update_tau_line_F(), _update_tau_line_O(), t_prev, engine.control.robust_ddp.data_models.ControllerState.u_prev, u_prev, engine.control.robust_ddp.controller.RobustDDPController.x_prev, and x_prev.
| engine.control.robust_ddp.identify.ParameterIdentifier.alpha_F = cfg.alpha_F |
Definition at line 47 of file identify.py.
Referenced by _update_alpha_F(), get_params(), and update_config().
| float engine.control.robust_ddp.identify.ParameterIdentifier.alpha_max = 0.1, 100.0 |
Definition at line 80 of file identify.py.
Referenced by _update_alpha_F(), and _update_alpha_O().
| engine.control.robust_ddp.identify.ParameterIdentifier.alpha_min |
Definition at line 80 of file identify.py.
Referenced by _update_alpha_F(), and _update_alpha_O().
| engine.control.robust_ddp.identify.ParameterIdentifier.alpha_O = cfg.alpha_O |
Definition at line 48 of file identify.py.
Referenced by _update_alpha_O(), get_params(), and update_config().
| engine.control.robust_ddp.identify.ParameterIdentifier.cfg = cfg |
Definition at line 43 of file identify.py.
Referenced by test_robust_ddp_controller_integration.TestControllerIntegration._simulate_dynamics(), _update_alpha_F(), _update_alpha_O(), _update_copv_coefficients(), payload.cold_gas_thruster.ColdGasThruster.compute(), payload.cold_gas_thruster.ColdGasThruster.generate_nozzle_contour(), test_combustion_stability_audit.TestIntegration.test_acoustic_report_only_by_default(), test_robust_ddp_reference.TestReferenceGeneration.test_altitude_command(), test_robust_ddp_reference.TestReferenceGeneration.test_altitude_command_below_goal(), test_robust_ddp_actuation.TestActuation.test_binary_actuation_sigma_delta(), test_robust_ddp_actuation.TestActuation.test_binary_actuation_threshold(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_altitude_mode(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_slew_rate(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_thrust_mode(), test_combustion_stability_audit.TestIntegration.test_chug_gate_is_the_gain_margin_band_minimum(), test_robust_ddp_safety_filter.TestSafetyFilter.test_compute_action_cost(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_binary(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_clamping(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_dwell_enforcement(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_dwell_satisfied(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_pwm(), test_robust_ddp_controller_integration.TestControllerIntegration.test_controller_integration(), test_robust_ddp_reference.TestReferenceGeneration.test_estimate_thrust_bounds(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_clamping(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_ullage(), test_robust_ddp_safety_filter.TestSafetyFilter.test_find_best_safe_action(), test_robust_ddp_ddp_solver.TestDDPSolver.test_forward_rollout(), test_robust_ddp_safety_filter.TestSafetyFilter.test_generate_action_candidates(), test_robust_ddp_identify.TestParameterIdentification.test_get_params(), test_robust_ddp_identify.TestParameterIdentification.test_identify_alpha_F(), test_robust_ddp_identify.TestParameterIdentification.test_identify_alpha_O(), test_robust_ddp_identify.TestParameterIdentification.test_identify_copv_coefficients(), test_robust_ddp_identify.TestParameterIdentification.test_identify_tau_line_F(), test_robust_ddp_identify.TestParameterIdentification.test_identify_tau_line_O(), test_combustion_stability_audit.TestIntegration.test_missing_injector_drop_is_recorded_and_zero_is_zero(), test_combustion_stability_audit.TestIntegration.test_model_error_fails_closed(), test_robust_ddp_identify.TestParameterIdentification.test_parameter_bounds(), test_robust_ddp_reference.TestReferenceGeneration.test_project_thrust_bounds(), test_robust_ddp_reference.TestReferenceGeneration.test_project_thrust_slew_rate(), test_robust_ddp_ddp_solver.TestDDPSolver.test_running_cost(), test_robust_ddp_ddp_solver.TestDDPSolver.test_running_cost_with_errors(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_copv_min(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_ullage_max(), and test_robust_ddp_identify.TestParameterIdentification.test_update_config().
| int engine.control.robust_ddp.identify.ParameterIdentifier.copv_c_max = 1e3, 1e7 |
Definition at line 82 of file identify.py.
Referenced by _update_copv_coefficients().
| engine.control.robust_ddp.identify.ParameterIdentifier.copv_c_min |
Definition at line 82 of file identify.py.
Referenced by _update_copv_coefficients().
| engine.control.robust_ddp.identify.ParameterIdentifier.copv_cF = cfg.copv_cF |
Definition at line 51 of file identify.py.
Referenced by _update_copv_coefficients(), get_params(), and update_config().
| engine.control.robust_ddp.identify.ParameterIdentifier.copv_cO = cfg.copv_cO |
Definition at line 52 of file identify.py.
Referenced by _update_copv_coefficients(), get_params(), and update_config().
| engine.control.robust_ddp.identify.ParameterIdentifier.lambda_rls = forgetting_factor |
Definition at line 44 of file identify.py.
Referenced by _update_alpha_F(), _update_alpha_O(), _update_copv_coefficients(), _update_tau_line_F(), and _update_tau_line_O().
| int engine.control.robust_ddp.identify.ParameterIdentifier.P_alpha_F = 1e6 |
Definition at line 55 of file identify.py.
Referenced by _update_alpha_F().
| int engine.control.robust_ddp.identify.ParameterIdentifier.P_alpha_O = 1e6 |
Definition at line 59 of file identify.py.
Referenced by _update_alpha_O().
| int engine.control.robust_ddp.identify.ParameterIdentifier.P_copv = 1e6 * np.eye(2) |
Definition at line 71 of file identify.py.
Referenced by _update_copv_coefficients().
| int engine.control.robust_ddp.identify.ParameterIdentifier.P_tau_F = 1e6 |
Definition at line 63 of file identify.py.
Referenced by _update_tau_line_F().
| int engine.control.robust_ddp.identify.ParameterIdentifier.P_tau_O = 1e6 |
Definition at line 67 of file identify.py.
Referenced by _update_tau_line_O().
| Optional[float] engine.control.robust_ddp.identify.ParameterIdentifier.t_prev = None |
Definition at line 77 of file identify.py.
Referenced by update_params().
| engine.control.robust_ddp.identify.ParameterIdentifier.tau_line_F = cfg.tau_line_F |
Definition at line 49 of file identify.py.
Referenced by _update_tau_line_F(), get_params(), and update_config().
| engine.control.robust_ddp.identify.ParameterIdentifier.tau_line_O = cfg.tau_line_O |
Definition at line 50 of file identify.py.
Referenced by _update_tau_line_O(), get_params(), and update_config().
| float engine.control.robust_ddp.identify.ParameterIdentifier.tau_max = 0.001, 1.0 |
Definition at line 81 of file identify.py.
Referenced by _update_tau_line_F(), and _update_tau_line_O().
| engine.control.robust_ddp.identify.ParameterIdentifier.tau_min |
Definition at line 81 of file identify.py.
Referenced by _update_tau_line_F(), and _update_tau_line_O().
| engine.control.robust_ddp.identify.ParameterIdentifier.theta_alpha_F = cfg.alpha_F |
Definition at line 56 of file identify.py.
Referenced by _update_alpha_F().
| engine.control.robust_ddp.identify.ParameterIdentifier.theta_alpha_O = cfg.alpha_O |
Definition at line 60 of file identify.py.
Referenced by _update_alpha_O().
| engine.control.robust_ddp.identify.ParameterIdentifier.theta_copv = np.array([cfg.copv_cF, cfg.copv_cO]) |
Definition at line 72 of file identify.py.
Referenced by _update_copv_coefficients().
| float engine.control.robust_ddp.identify.ParameterIdentifier.theta_tau_F = 1.0 / cfg.tau_line_F |
Definition at line 64 of file identify.py.
Referenced by _update_tau_line_F().
| float engine.control.robust_ddp.identify.ParameterIdentifier.theta_tau_O = 1.0 / cfg.tau_line_O |
Definition at line 68 of file identify.py.
Referenced by _update_tau_line_O().
| Optional[np.ndarray] engine.control.robust_ddp.identify.ParameterIdentifier.u_prev = None |
Definition at line 76 of file identify.py.
Referenced by test_robust_ddp_robustness.TestRobustness.test_multiple_updates_convergence(), 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_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 update_params().
| Optional[np.ndarray] engine.control.robust_ddp.identify.ParameterIdentifier.x_prev = None |
Definition at line 75 of file identify.py.
Referenced by test_robust_ddp_robustness.TestRobustness.test_multiple_updates_convergence(), 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_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 update_params().