![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
Model Predictive Controller (MPC) to determine the optimal airbrake angle. More...


Go to the source code of this file.
Functions | |
| double | optimalAngle (double sim_time_step, double altitude, double temperature, double velocity, double pressure, double current_delta, double tilt_angle, double target_apogee, double tolerance, const double mach_states[5], const double deployment_states[6], const double cd_table[30]) |
| Calculates the optimal constant airbrake angle to reach a target apogee. | |
Model Predictive Controller (MPC) to determine the optimal airbrake angle.
This header file declares the optimalAngle function, which is the core of the rocket's Model Predictive Control (MPC) system for apogee control. Its primary goal is to calculate the single, constant airbrake deployment angle that, if applied from the current moment, will result in the rocket reaching a specified target apogee.
The function uses a combination of two main algorithms:
This function was generated from a MATLAB model provided by the MSA subteam.
Definition in file optimalAngle.h.
| double optimalAngle | ( | double | sim_time_step, |
| double | altitude, | ||
| double | temperature, | ||
| double | velocity, | ||
| double | pressure, | ||
| double | current_delta, | ||
| double | tilt_angle, | ||
| double | target_apogee, | ||
| double | tolerance, | ||
| const double | mach_states[5], | ||
| const double | deployment_states[6], | ||
| const double | cd_table[30] | ||
| ) |
Calculates the optimal constant airbrake angle to reach a target apogee.
| [in] | sim_time_step | The duration of a single time step used inside the internal trajectory simulation, in seconds (s). |
| [in] | altitude | The rocket's current altitude above ground level in meters (m). |
| [in] | temperature | Current ambient air temperature in Kelvin (K). |
| [in] | velocity | The rocket's current total speed (magnitude of velocity vector) in m/s. |
| [in] | pressure | Current ambient air pressure in Pascals (Pa). |
| [in] | current_delta | The current, real-world deployment angle of the airbrakes in degrees. (Note: May not be used in this version). |
| [in] | tilt_angle | The angle of the rocket's velocity vector with respect to the vertical axis in radians. |
| [in] | target_apogee | The desired final apogee for the rocket in meters (m). |
| [in] | tolerance | The desired precision for the binary search, in degrees. The search stops when dep_max - dep_min <= tolerance. |
| [in] | mach_states | An array of 5 discrete Mach numbers that form the x-axis of the Cd lookup table. |
| [in] | deployment_states | An array of 6 discrete airbrake deployment angles that form the y-axis of the Cd lookup table. |
| [in] | cd_table | A 1D array of 30 Coefficient of Drag (Cd) values, representing the 6x5 lookup grid (row-major). |
Definition at line 86 of file optimalAngle.c.
References altitude, cd_table, cdEvaluation(), current_delta, deployment_states, mach_states, rt_powd_snf(), rtIsNaN(), rtNaN, sim_time_step, target_apogee, tilt_angle, tolerance, and velocity.
Referenced by StartMPC_Task().

