|
Vulcan
Aerospace Engineering Utilities Built on Janus
|
Transfer function utilities for linear systems and nonlinear elements. More...
Classes | |
| struct | FirstOrderCoeffs |
| First-order discrete-time system coefficients. More... | |
| struct | SecondOrderCoeffs |
| Second-order discrete-time system coefficients. More... | |
Functions | |
| template<int N> | |
| Eigen::Matrix< double, N, N > | matrix_exp_pade (const Eigen::Matrix< double, N, N > &A) |
| Compute matrix exponential using Padé(13,13) approximation. | |
| template<int N> | |
| void | discretize_zoh (const Eigen::Matrix< double, N, N > &A_c, const Eigen::Matrix< double, N, 1 > &B_c, double dt, Eigen::Matrix< double, N, N > &A_d, Eigen::Matrix< double, N, 1 > &B_d) |
| Zero-order hold (ZOH) discretization. | |
| template<int N> | |
| void | discretize_tustin (const Eigen::Matrix< double, N, N > &A_c, const Eigen::Matrix< double, N, 1 > &B_c, double dt, Eigen::Matrix< double, N, N > &A_d, Eigen::Matrix< double, N, 1 > &B_d) |
| Tustin (bilinear) discretization. | |
| template<int N> | |
| void | discretize_euler (const Eigen::Matrix< double, N, N > &A_c, const Eigen::Matrix< double, N, 1 > &B_c, double dt, Eigen::Matrix< double, N, N > &A_d, Eigen::Matrix< double, N, 1 > &B_d) |
| Forward Euler discretization. | |
| template<int N> | |
| void | discretize_backward_euler (const Eigen::Matrix< double, N, N > &A_c, const Eigen::Matrix< double, N, 1 > &B_c, double dt, Eigen::Matrix< double, N, N > &A_d, Eigen::Matrix< double, N, 1 > &B_d) |
| Backward Euler discretization. | |
| template<typename Scalar> | |
| FirstOrderCoeffs< Scalar > | first_order (double tau, double K, double dt) |
| Compute first-order discrete-time system coefficients. | |
| template<typename Scalar> | |
| Scalar | first_order_step (const FirstOrderCoeffs< Scalar > &coeffs, const Scalar &state, const Scalar &input) |
| Compute next state for first-order system (stateless). | |
| template<typename Scalar> | |
| Scalar | first_order_response (double tau, double K, const Scalar &t) |
| Compute analytical step response at time t. | |
| template<typename Scalar> | |
| Scalar | rate_limit (const Scalar ¤t, const Scalar &commanded, double rate_max, double dt) |
| Apply rate limiting to a value change (stateless). | |
| template<typename Scalar> | |
| Scalar | saturate (const Scalar &value, const Scalar &min, const Scalar &max) |
| Apply saturation/clamping (stateless). | |
| template<typename Scalar> | |
| Scalar | deadband (const Scalar &input, double deadband_width) |
| Apply deadband (stateless). | |
| template<typename Scalar> | |
| Scalar | hysteresis (const Scalar &input, const Scalar &last_output, double hysteresis_width) |
| Apply hysteresis (stateless computation). | |
| template<typename Scalar> | |
| SecondOrderCoeffs< Scalar > | second_order (double omega_n, double zeta, double K, double dt) |
| Compute second-order discrete-time system coefficients. | |
| template<typename Scalar> | |
| Eigen::Matrix< Scalar, 2, 1 > | second_order_step (const SecondOrderCoeffs< Scalar > &coeffs, const Eigen::Matrix< Scalar, 2, 1 > &state, const Scalar &input) |
| Compute next state for second-order system (stateless). | |
| template<typename Scalar> | |
| Scalar | second_order_output (const SecondOrderCoeffs< Scalar > &coeffs, const Eigen::Matrix< Scalar, 2, 1 > &state, const Scalar &input) |
| Extract output from state (stateless). | |
| std::tuple< double, double, double > | second_order_characteristics (double omega_n, double zeta) |
| Compute theoretical system characteristics. | |
Transfer function utilities for linear systems and nonlinear elements.
Provides symbolic-compatible, stateless functions for:
All functions are pure and stateless. State management is the responsibility of the calling simulation framework (e.g., Icarus).
| Scalar vulcan::tf::deadband | ( | const Scalar & | input, |
| double | deadband_width ) |
Apply deadband (stateless).
Returns zero for inputs within deadband, otherwise input minus deadband.
| Scalar | Variable type |
| input | Input value |
| deadband_width | Deadband half-width (symmetric around zero) |
| void vulcan::tf::discretize_backward_euler | ( | const Eigen::Matrix< double, N, N > & | A_c, |
| const Eigen::Matrix< double, N, 1 > & | B_c, | ||
| double | dt, | ||
| Eigen::Matrix< double, N, N > & | A_d, | ||
| Eigen::Matrix< double, N, 1 > & | B_d ) |
Backward Euler discretization.
| N | State dimension |
| void vulcan::tf::discretize_euler | ( | const Eigen::Matrix< double, N, N > & | A_c, |
| const Eigen::Matrix< double, N, 1 > & | B_c, | ||
| double | dt, | ||
| Eigen::Matrix< double, N, N > & | A_d, | ||
| Eigen::Matrix< double, N, 1 > & | B_d ) |
Forward Euler discretization.
| N | State dimension |
| void vulcan::tf::discretize_tustin | ( | const Eigen::Matrix< double, N, N > & | A_c, |
| const Eigen::Matrix< double, N, 1 > & | B_c, | ||
| double | dt, | ||
| Eigen::Matrix< double, N, N > & | A_d, | ||
| Eigen::Matrix< double, N, 1 > & | B_d ) |
Tustin (bilinear) discretization.
| N | State dimension |
| void vulcan::tf::discretize_zoh | ( | const Eigen::Matrix< double, N, N > & | A_c, |
| const Eigen::Matrix< double, N, 1 > & | B_c, | ||
| double | dt, | ||
| Eigen::Matrix< double, N, N > & | A_d, | ||
| Eigen::Matrix< double, N, 1 > & | B_d ) |
Zero-order hold (ZOH) discretization.
| N | State dimension |
| A_c | Continuous state matrix |
| B_c | Continuous input matrix |
| dt | Sample time [s] |
| A_d | Output discrete state matrix |
| B_d | Output discrete input matrix |
| FirstOrderCoeffs< Scalar > vulcan::tf::first_order | ( | double | tau, |
| double | K, | ||
| double | dt ) |
Compute first-order discrete-time system coefficients.
| Scalar | Variable type |
| tau | Time constant [s] (must be positive) |
| K | DC gain (default: 1.0) |
| dt | Sample time [s] (must be positive) |
| Scalar vulcan::tf::first_order_response | ( | double | tau, |
| double | K, | ||
| const Scalar & | t ) |
Compute analytical step response at time t.
y(t) = K * (1 - exp(-t/tau))
| Scalar | Variable type |
| tau | Time constant [s] |
| K | DC gain |
| t | Time [s] |
| Scalar vulcan::tf::first_order_step | ( | const FirstOrderCoeffs< Scalar > & | coeffs, |
| const Scalar & | state, | ||
| const Scalar & | input ) |
Compute next state for first-order system (stateless).
Computes: y[k+1] = a*y[k] + b*u[k]
| Scalar | Variable type |
| coeffs | The first-order coefficients |
| state | Current state y[k] |
| input | Current input u[k] |
| Scalar vulcan::tf::hysteresis | ( | const Scalar & | input, |
| const Scalar & | last_output, | ||
| double | hysteresis_width ) |
Apply hysteresis (stateless computation).
Given input and last output, computes new output with hysteresis.
| Scalar | Variable type |
| input | Current input command |
| last_output | Previous output |
| hysteresis_width | Hysteresis half-width |
| Eigen::Matrix< double, N, N > vulcan::tf::matrix_exp_pade | ( | const Eigen::Matrix< double, N, N > & | A | ) |
Compute matrix exponential using Padé(13,13) approximation.
| N | Matrix dimension |
| A | Input matrix |
| Scalar vulcan::tf::rate_limit | ( | const Scalar & | current, |
| const Scalar & | commanded, | ||
| double | rate_max, | ||
| double | dt ) |
Apply rate limiting to a value change (stateless).
Limits the delta from current to commanded value.
| Scalar | Variable type |
| current | Current value |
| commanded | Commanded value |
| rate_max | Maximum rate magnitude [units/s] |
| dt | Time step [s] |
| Scalar vulcan::tf::saturate | ( | const Scalar & | value, |
| const Scalar & | min, | ||
| const Scalar & | max ) |
Apply saturation/clamping (stateless).
| Scalar | Variable type |
| value | Value to saturate |
| min | Minimum allowed value |
| max | Maximum allowed value |
| SecondOrderCoeffs< Scalar > vulcan::tf::second_order | ( | double | omega_n, |
| double | zeta, | ||
| double | K, | ||
| double | dt ) |
Compute second-order discrete-time system coefficients.
Uses ZOH discretization via closed-form solution.
| Scalar | Variable type |
| omega_n | Natural frequency [rad/s] (must be positive) |
| zeta | Damping ratio (0 < zeta for stability) |
| K | DC gain |
| dt | Sample time [s] (must be positive) |
|
inline |
Compute theoretical system characteristics.
| omega_n | Natural frequency [rad/s] |
| zeta | Damping ratio |
| Scalar vulcan::tf::second_order_output | ( | const SecondOrderCoeffs< Scalar > & | coeffs, |
| const Eigen::Matrix< Scalar, 2, 1 > & | state, | ||
| const Scalar & | input ) |
Extract output from state (stateless).
Computes: y = C*x + D*u
| Scalar | Variable type |
| coeffs | The second-order coefficients |
| state | Current state [y, ẏ]ᵀ |
| input | Current input u[k] |
| Eigen::Matrix< Scalar, 2, 1 > vulcan::tf::second_order_step | ( | const SecondOrderCoeffs< Scalar > & | coeffs, |
| const Eigen::Matrix< Scalar, 2, 1 > & | state, | ||
| const Scalar & | input ) |
Compute next state for second-order system (stateless).
Computes: x[k+1] = A*x[k] + B*u[k]
| Scalar | Variable type |
| coeffs | The second-order coefficients |
| state | Current state [y, ẏ]ᵀ |
| input | Current input u[k] |