![]() |
Controlpp
|
The main namespace for the Control++ library. More...
Namespaces | |
| namespace | polynom |
| namespace | tf |
| namespace | timevar |
| Namespace that contains sample-time variant controllers | |
Classes | |
| class | Bode |
| Frequency response data. More... | |
| class | ComplexTimeSeries |
| struct | ContinuousGeneralisedPlant |
| A continuous generalised plant model. More... | |
| class | ContinuousStateSpace |
| class | ContinuousTransferFunction |
| Continuous transfer functions in the s lapace plain. More... | |
| class | DiscreteStateSpace |
| Matrix (A, B, C, D) representation of a linear time invariant system. More... | |
| class | DiscreteTransferFunction |
| Continuous transfer functions in the s lapace plain. More... | |
| class | DssFilter |
| Controller from a discrete state space. More... | |
| class | DtfEstimator |
| Estimates a discrete transfer function from online data points. More... | |
| class | DtfFilter |
| Controller from a discrete transfer function. More... | |
| struct | ExpmPadeParams |
| Pade for the scaled pade matrix exponential. More... | |
| class | FixedPolynom |
| Describes a mathematical polynomial of fixed size. More... | |
| class | FixedRationalPolynom |
| Fixed sized polynomial. More... | |
| class | KalmanFilter |
| Kalman filter. More... | |
| class | Polynom |
| Describes a mathematical polynomial. More... | |
| class | ReccursiveLeastSquares |
| Calculates the recursive least square for online parameter estimation. More... | |
| class | ReccursiveLeastSquares< T, NParams, 1 > |
| Calculates the recursive least square for online parameter estimation. More... | |
| class | SineGenerator |
| A lite weight incremental sine generator. More... | |
| class | StateSpace |
| Base class for the state space representation of a linear time invariant system. More... | |
| class | TimeSeries |
| Contiains time and values pairs. More... | |
| class | TransferFunction |
Enumerations | |
| enum class | EBodeCsvReadError { CouldNotFindFrequencyVector , CouldNotFindAmplitudeVectors } |
| Error cases for reading/parsing bode data from CSV formated data. More... | |
| enum class | EFrequencyInterpretation { AutoHz , AutoRad , ForceHz , ForceRad } |
| Enum that determines how frequency data will be interpreted when reading CSV data. More... | |
| enum class | EMagnitudeInterpretation { Auto , ForceAbs , ForceDB } |
| Enum that determines how frequency data will be interpreted when reading CSV data. More... | |
| enum class | EPhaseInterpretation { AutoRad , AutoDeg , ForceRad , ForceDeg } |
| Enum that determines how phase data will be interpreted when reading CSV data. More... | |
| enum class | dft_estimate_error { data_ranges_different_lenth , data_range_too_small } |
| enum class | EDiscretisation { zero_order_hold , tustin } |
Functions | |
| std::ostream & | operator<< (std::ostream &stream, EBodeCsvReadError val) |
| tl::expected< Bode< double >, std::variant< EBodeCsvReadError, csvd::ReadError > > | read_bode_from_csv (std::istream &stream, const csvd::Settings &csv_settings=csvd::Settings(), EFrequencyInterpretation freq_interp=EFrequencyInterpretation::AutoHz, EMagnitudeInterpretation mag_interp=EMagnitudeInterpretation::Auto, EPhaseInterpretation phase_interp=EPhaseInterpretation::AutoDeg) |
| Loads bode data from csv data. | |
| template<class Itr , class T > | |
| std::optional< std::pair< Itr, Itr > > | find_enclosing (Itr first, Itr last, const T &v) |
| Finds elements in a range that enclose v. | |
| template<class T , int Size = Eigen::Dynamic> | |
| std::optional< std::pair< const T *, const T * > > | find_enclosing (const Eigen::Vector< T, Size > &range, const T &v) |
| Finds elements in a range that enclose v. | |
| template<class Iterator , class T > | |
| void | shift_up (Iterator first, Iterator last, const T &v0=T(0)) |
| Shifts the values in a range up by one position and inserts a new value (copy operation) at the beginning of the range. | |
| template<class Iterator , class T > | |
| void | shift_up (Iterator first, Iterator last, T &&v0=T(0)) |
| Shifts the values in a range up by one position and inserts a new value (move operation) at the beginning of the range. | |
| template<class T , int NStates> | |
| TimeSeries< T > | step (const DiscreteStateSpace< T, NStates, 1, 1 > &dss, double Ts, double simulation_time) |
| calculates the step response of a system | |
| template<class T , int NumOrder, int DenOrder> | |
| std::tuple< T, T > | slowest_fastest_frequencies (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, T alternative=static_cast< T >(1)) |
| Calculates the slowest (lowest) and fastest (highest) frequencies of a continuous transfer function. | |
| template<class T , int NumOrder, int DenOrder> | |
| TimeSeries< T > | step (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const T &sample_time, const T &simulation_time) |
| template<class T , int NumOrder, int DenOrder> | |
| TimeSeries< T > | step (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf) |
| template<class T > | |
| Bode< T > | prewarp_tustin (const Bode< T > &bode, const T &Ts) |
| Prewarps the frequency axis of a bode plot for tustin discretisation. | |
| template<class T > | |
| Bode< T > | unwarp_tustin (const Bode< T > &bode, const T &Ts) |
| Unwarps the frequency axis of a bode plot for tustin discretisation. | |
| template<class T > | |
| const Eigen::Vector< T, Eigen::Dynamic > & | frequencies (const Bode< T > &bode) |
| Converts and returns the frequency vector in rad. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | frequencies_hz (const Bode< T > &bode) |
| Converts and returns the frequency vector in Hz. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | real (const Bode< T > &bode) |
| Converts and returns the frequency vector in rad/s. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | imag (const Bode< T > &bode) |
| Converts and returns the frequency vector in rad/s. | |
| template<class T > | |
| const Eigen::Vector< T, Eigen::Dynamic > & | values (const Bode< T > &bode) |
| Returns the complex values of the bode data. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | magnitudes (const Bode< T > &bode) |
| Creates a vector containing the absolute magnitudes. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | magnitudes_dB (const Bode< T > &bode) |
| Creates a vector of magnitudes in dB. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | phases (const Bode< T > &bode) |
| Creates a vector of phases in rad. | |
| template<class T > | |
| Eigen::Vector< T, Eigen::Dynamic > | phases_deg (const Bode< T > &bode) |
| Creates a vector of phases in degree. | |
| template<class T > | |
| TimeSeries< T > | impulse (const Bode< T > &bode, const T &time_step, const T &simulation_time) |
| Calculates the impulse-response of frequency data. | |
| template<class T > | |
| TimeSeries< T > | impulse (const Bode< T > &bode) |
| Calculates the time-series of a frequency response. | |
| template<class T > | |
| void | integrate (TimeSeries< T > &out, const TimeSeries< T > &in, const T &v0=T(0)) |
| Integrates the time series and writes it to out. | |
| template<class T > | |
| TimeSeries< T > | integrate (const TimeSeries< T > &in, const T &v0=T(0)) |
| Integrates the time series and writes it to out. | |
| template<class T > | |
| TimeSeries< T > | step (const Bode< T > &bode) |
| Calculates the step response time-value pairs from frequency-value data. | |
| template<class T > | |
| TimeSeries< T > | step (const Bode< T > &bode, const T &time_step, const T &simulation_time) |
| Calculates the step response time-value pairs from frequency-value data. | |
| template<class T > | |
| Bode< T > | operator+ (const Bode< T > &l, const Bode< T > &r) |
| Adds two bode plots together. | |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator+ (const Bode< T > &l, const T2 &r) |
| Adds a bode plot and a scalar value together. | |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator+ (const T2 &l, const Bode< T > &r) |
| Adds a scalar value and a bode plot together. | |
| template<class T > | |
| Bode< T > | operator+ (const Bode< T > &b) |
| Negates the bode plot values. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator+ (const Bode< T > &l, const ContinuousTransferFunction< T, NumOrder, DenOrder > &r) |
| Adds a bode plot and a continuous transfer function together. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator+ (const ContinuousTransferFunction< T, NumOrder, DenOrder > &l, const Bode< T > &r) |
| Adds a continuous transfer function and a bode plot together. | |
| template<class T > | |
| Bode< T > | operator- (const Bode< T > &l, const Bode< T > &r) |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator- (const Bode< T > &l, const T2 &r) |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator- (const T2 &l, const Bode< T > &r) |
| template<class T > | |
| Bode< T > | operator- (const Bode< T > &b) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator- (const Bode< T > &l, const ContinuousTransferFunction< T, NumOrder, DenOrder > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator- (const ContinuousTransferFunction< T, NumOrder, DenOrder > &l, const Bode< T > &r) |
| template<class T > | |
| Bode< T > | operator* (const Bode< T > &l, const Bode< T > &r) |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator* (const Bode< T > &l, const T2 &r) |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator* (const T2 &l, const Bode< T > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator* (const Bode< T > &l, const ContinuousTransferFunction< T, NumOrder, DenOrder > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator* (const ContinuousTransferFunction< T, NumOrder, DenOrder > &l, const Bode< T > &r) |
| template<class T > | |
| Bode< T > | operator/ (const Bode< T > &l, const Bode< T > &r) |
| TODO: make it also work for bode that have different frequency vectors. | |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator/ (const Bode< T > &l, const T2 &r) |
| template<class T , std::convertible_to< T > T2> | |
| Bode< T > | operator/ (const T2 &l, const Bode< T > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator/ (const Bode< T > &l, const ContinuousTransferFunction< T, NumOrder, DenOrder > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | operator/ (const ContinuousTransferFunction< T, NumOrder, DenOrder > &l, const Bode< T > &r) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const Eigen::Vector< T, Eigen::Dynamic > &freqs) |
| Calculates the bode response for a pre defined frequency (rad/s) vector. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, Eigen::Vector< T, Eigen::Dynamic > &&freqs) |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode_hz (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const Eigen::Vector< T, Eigen::Dynamic > &freqs_Hz) |
| Calculates the bode response for a pre defined frequency (Hz) vector. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode_hz (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, Eigen::Vector< T, Eigen::Dynamic > &&freqs_Hz) |
| template<class T , int NumOrder, int DenOrder, std::convertible_to< T > T1, std::convertible_to< T > T2> | |
| Bode< T > | bode_hz (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const T1 &slowest_freq_Hz, const T2 &fastest_freq_Hz, const int samples_per_decade=100) |
| Calculates the bode response of a transfer function. | |
| template<class T , int NumOrder, int DenOrder, std::convertible_to< T > T1, std::convertible_to< T > T2> | |
| Bode< T > | bode (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const T1 &slowest_freq_rad, const T2 &fastest_freq_rad, const int samples_per_decade=100) |
| Calculates the bode response of a transfer function. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode_hz (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const int samples_per_decade=100) |
| Calculates the bode response of a transfer function. | |
| template<class T , int NumOrder, int DenOrder> | |
| Bode< T > | bode (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf, const int samples_per_decade=100) |
| Calculates the bode response of a transfer function. | |
| template<class T > | |
| void | write_csv (std::ostream &stream, const Bode< T > &bode) |
Prints a bode plot to an output stream as a .csv file. | |
| template<class T , int NumOrder, int DenOrder> | |
| ContinuousStateSpace< T, DenOrder, 1, 1 > | to_continuous_state_space (const TransferFunction< T, NumOrder, DenOrder > &rp) |
| constructs a continuous state space function from a rational polynom | |
| template<class T , int NumOrder, int DenOrder> | |
| ContinuousStateSpace< T, DenOrder, 1, 1 > | to_continuous_state_space (const ContinuousTransferFunction< T, NumOrder, DenOrder > &ctf) |
| constructs a continuous state space function from a continuous transfer function | |
| template<class T , int NumOrder, int DenOrder> | |
| ContinuousStateSpace< T, DenOrder, 1, 1 > | to_state_space (const ContinuousTransferFunction< T, NumOrder, DenOrder > &ctf) |
| constructs a continuous state space function from a continuous transfer function | |
| template<class T , int states> | |
| ContinuousTransferFunction< T, states+1, states+1 > | to_transfer_function (const ContinuousStateSpace< T, states, 1, 1 > &dss) |
| Transforms a discrete state space system to a discrete transfer function. | |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| auto | operator+ (const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class Tpoly , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator+ (const Tscalar &lhs, const ContinuousTransferFunction< Tpoly, NumOrder, DenOrder > &rhs) |
| template<class Tpoly , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator+ (const ContinuousTransferFunction< Tpoly, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder, int DenOrder> | |
| ContinuousTransferFunction< T, NumOrder, DenOrder > | operator- (const ContinuousTransferFunction< T, NumOrder, DenOrder > &a) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| auto | operator- (const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator- (const Tscalar &lhs, const ContinuousTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator- (const ContinuousTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| auto | operator* (const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator* (const Tscalar &lhs, const ContinuousTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator* (const ContinuousTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| auto | operator/ (const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator/ (const Tscalar &lhs, const ContinuousTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , class Tscalar , int NumOrder, int DenOrder> | |
| auto | operator/ (const ContinuousTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder, int DenOrder> | |
| Eigen::Vector< std::complex< T >, NumOrder > | zeros (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf) |
| template<class T , int NumOrder, int DenOrder> | |
| Eigen::Vector< std::complex< T >, DenOrder > | poles (const ContinuousTransferFunction< T, NumOrder, DenOrder > &tf) |
| template<class T > | |
| T | to_hz (const T &radps) |
| Converts a number from radiants per second to herz. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | to_hz (const Eigen::Vector< T, N > &radps) |
| template<class T > | |
| T | to_radps (const T &hz) |
| Converts a number from herz to radiants per second. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | to_radps (const Eigen::Vector< T, N > &hz) |
| template<class T > | |
| T | to_deg (const T &rad) |
| template<class T , int N> | |
| Eigen::Vector< T, N > | to_deg (const Eigen::Vector< T, N > &rad) |
| template<class T > | |
| T | to_rad (const T °) |
| template<class T , int N> | |
| Eigen::Vector< T, N > | to_rad (const Eigen::Vector< T, N > °) |
| template<class T > | |
| T | to_dB (const T &value) |
| template<class T > | |
| T | from_dB (const T &value) |
| template<class T > | |
| T | prewarp_tustin (const T &omega, const T &Ts) |
| Prewarps frequencies for the tustin transformation. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | prewarp_tustin (const Eigen::Vector< T, N > &omegas, const T &Ts) |
| template<class T > | |
| T | unwarp_tustin (const T &omega, const T &Ts) |
provides the inverse to prewarp_tustin: | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | unwarp_tustin (const Eigen::Vector< T, N > &omegas, const T &Ts) |
| template<class T , int NumOrder, int DenOrder> requires (NumOrder <= DenOrder) | |
| DiscreteStateSpace< T, DenOrder, 1, 1 > | to_discrete_state_space (const TransferFunction< T, NumOrder, DenOrder > &rp) |
| constructs a discrete state space function from a rational polynom | |
| template<class ValueType , int NumOrder, int DenOrder> | |
| DiscreteStateSpace< ValueType, DenOrder, 1, 1 > | to_discrete_state_space (const DiscreteTransferFunction< ValueType, NumOrder, DenOrder > &dtf) |
| constructs a continuous state space function from a continuous transfer function | |
| template<class ValueType , int NumOrder, int DenOrder> | |
| DiscreteStateSpace< ValueType, DenOrder, 1, 1 > | to_state_space (const DiscreteTransferFunction< ValueType, NumOrder, DenOrder > &dtf) |
| constructs a continuous state space function from a continuous transfer function | |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr auto | operator+ (const DiscreteTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const DiscreteTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator+ (const Tscalar &lhs, const DiscreteTransferFunction< Tpoly, NumOrder, DenOrder > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator+ (const DiscreteTransferFunction< Tpoly, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr auto | operator- (const DiscreteTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const DiscreteTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator- (const Tscalar &lhs, const DiscreteTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator- (const DiscreteTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr auto | operator* (const DiscreteTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const DiscreteTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator* (const Tscalar &lhs, const DiscreteTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator* (const DiscreteTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr auto | operator/ (const DiscreteTransferFunction< T, NumOrder1, DenOrder1 > &lhs, const DiscreteTransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator/ (const Tscalar &lhs, const DiscreteTransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr auto | operator/ (const DiscreteTransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int XRows, int XCols, int XOpt, int XMaxRows, int XMaxCols> requires ((XRows >= XCols) || (XRows == Eigen::Dynamic) || (XCols == Eigen::Dynamic)) | |
| Eigen::Vector< T, XCols > | least_squares (const Eigen::Matrix< T, XRows, XCols, XOpt, XMaxRows, XMaxCols > &X, const Eigen::Vector< T, XRows > &y) |
| Solves the overdefined system \(y = X p\) for p. | |
| std::string_view | to_string (dft_estimate_error err) |
| std::ostream & | operator<< (std::ostream &stream, dft_estimate_error err) |
| template<class T , int NumOrder, int DenOrder> requires ((NumOrder != Eigen::Dynamic) && (DenOrder != Eigen::Dynamic)) | |
| tl::expected< DiscreteTransferFunction< T, NumOrder, DenOrder >, dft_estimate_error > | dft_estimate (const Eigen::Vector< T, Eigen::Dynamic > &u, const Eigen::Vector< T, Eigen::Dynamic > &y, const T ®ularization=T(0), const DiscreteTransferFunction< T, NumOrder, DenOrder > &hint=DiscreteTransferFunction< T, NumOrder, DenOrder >({T(0)}, {T(1)})) |
| Estimates a discrete time transfer function of a specific order for the input (u) and output (y) data pairs. | |
| template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > | expm_taylor (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &x, int n) |
| Exponential function with a taylor approximation. | |
| template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > | expm_taylor_scaled (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &M, int taylor_order=8, int scaling=10) |
| Calculates the matrix exponent \( \exp{\mathbf{M}} \). | |
| template<class T , int N, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, N, N > | expm_pade (const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > &A, int Order=5) |
| Approximates \(\exp{A}\) using a pade fraction. | |
| template<class T , int N, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, N, N > | expm_pade_scaled (const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > &M, int order, int scaling) |
| Applies scaling and squaring to the pade approximation of the matrix exponential. | |
| template<class T , int N, int Options, int MaxRows, int MaxCols> | |
| ExpmPadeParams | expm_pade_params (const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > &M) |
| Determines the order and scaling factor for the scaled pade approximation of the matrix exponential. | |
| template<class T , int N, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, N, N > | expm_pade_scaled (const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > &M) |
| Matrix exponential using a scaled Pade approximation with automatic order and scaling factor determination. | |
| template<class T , int N, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, N, N > | expm (const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > &M) |
| Calculates the matrix exponent \( \exp{\mathbf{M}} \). | |
| template<class T , int NStates, int NInputs, int NPerfOutputs, int NMeasOutputs, int NDisturbances> | |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > | continous_h2 (const Eigen::Matrix< T, NStates, NStates > &A, const Eigen::Matrix< T, NStates, NDisturbances > &Bw, const Eigen::Matrix< T, NStates, NInputs > &Bu, const Eigen::Matrix< T, NPerfOutputs, NStates > &Cz, const Eigen::Matrix< T, NPerfOutputs, NInputs > &Duz, const Eigen::Matrix< T, NMeasOutputs, NStates > &Cy, const Eigen::Matrix< T, NMeasOutputs, NDisturbances > &Dwy, const Eigen::Matrix< T, NInputs, NInputs > &R, const Eigen::Matrix< T, NMeasOutputs, NMeasOutputs > &S) |
| template<class T , int NStates, int NInputs, int NPerfOutputs, int NMeasOutputs, int NDisturbances> requires (NInputs>1 && NMeasOutputs>1) | |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > | continous_h2 (const Eigen::Matrix< T, NStates, NStates > &A, const Eigen::Matrix< T, NStates, NDisturbances > &Bw, const Eigen::Matrix< T, NStates, NInputs > &Bu, const Eigen::Matrix< T, NPerfOutputs, NStates > &Cz, const Eigen::Matrix< T, NPerfOutputs, NInputs > &Duz, const Eigen::Matrix< T, NMeasOutputs, NStates > &Cy, const Eigen::Matrix< T, NMeasOutputs, NDisturbances > &Dwy, const Eigen::Vector< T, NInputs > r=Eigen::Vector< T, NInputs >::Zero(), const Eigen::Vector< T, NMeasOutputs > s=Eigen::Vector< T, NMeasOutputs >::Zero()) |
| An optimal controller for linear time-invariant (LTI) system. It minimizes the H2 norm of the the disturbance input gain to the output. | |
| template<class T , int NStates, int NInputs, int NPerfOutputs, int NMeasOutputs, int NDisturbances> | |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > | continous_h2 (const Eigen::Matrix< T, NStates, NStates > &A, const Eigen::Matrix< T, NStates, NDisturbances > &Bw, const Eigen::Matrix< T, NStates, NInputs > &Bu, const Eigen::Matrix< T, NPerfOutputs, NStates > &Cz, const Eigen::Matrix< T, NPerfOutputs, NInputs > &Duz, const Eigen::Matrix< T, NMeasOutputs, NStates > &Cy, const Eigen::Matrix< T, NMeasOutputs, NDisturbances > &Dwy, const T &r_scalar=0, const T &s_scalar=0) |
| template<class T , int NStates, int NInputs = 1, int NPerfOutputs = 1, int NMeasOutputs = 1, int NDisturbances = 1> | |
| std::ostream & | operator<< (std::ostream &stream, const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > &G) |
| template<class T , int NStates, int NInputs, int NPerfOutputs, int NMeasOutputs, int NDisturbances> | |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > | continuous_h2 (const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > &Gss, const Eigen::Vector< T, NInputs > &control_penalty=Eigen::Vector< T, NInputs >::Zero(), const Eigen::Vector< T, NMeasOutputs > &measurement_noise=Eigen::Vector< T, NMeasOutputs >::Zero()) |
| Constructs a continuous H2 controller from a continuous state space plant model. | |
| template<class T , int NStates, int NInputs, int NPerfOutputs, int NMeasOutputs, int NDisturbances> | |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > | continuous_h2 (const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > &Gss, const T &control_penalty=static_cast< T >(0), const T &measurement_noise=static_cast< T >(0)) |
| template<class T , int PNumOrder, int PDenOrder, int MNumOrder, int MDenOrder, int WdNumOrder, int WdDenOrder, int WzNumOrder, int WzDenOrder> | |
| ContinuousStateSpace< T, PDenOrder+MDenOrder+WdDenOrder+WzDenOrder, 1, 1 > | continous_h2 (const ContinuousTransferFunction< T, PNumOrder, PDenOrder > &P, const ContinuousTransferFunction< T, MNumOrder, MDenOrder > &M, const ContinuousTransferFunction< T, WdNumOrder, WdDenOrder > &Wd, const ContinuousTransferFunction< T, WzNumOrder, WzDenOrder > &Wz, const T &control_penalty, const T &measurement_noise) |
| Synthesizes an H2 controller from transfer functions. | |
| template<class T , int NStates, int NInputs> | |
| Eigen::Matrix< T, NInputs, NStates > | lqr_continuous (const Eigen::Matrix< T, NStates, NStates > &A, const Eigen::Matrix< T, NStates, NInputs > &B, const Eigen::Matrix< T, NStates, NStates > &Q=Eigen::Matrix< T, NStates, NStates >::Identity(), const Eigen::Matrix< T, NInputs, NInputs > &R=Eigen::Matrix< T, NInputs, NInputs >::Identity()) |
| Synthesizes the continuous LQR gain from plant matrices (A, B) and weights (Q, R) | |
| template<class T , int NStates, int NInputs> | |
| Eigen::Matrix< T, NInputs, NStates > | lqr_discrete (const Eigen::Matrix< T, NStates, NStates > &A, const Eigen::Matrix< T, NStates, NInputs > &B, const Eigen::Matrix< T, NStates, NStates > &Q=Eigen::Matrix< T, NStates, NStates >::Identity(), const Eigen::Matrix< T, NInputs, NInputs > &R=Eigen::Matrix< T, NInputs, NInputs >::Identity()) |
| Synthesizes the continuous LQR gain from plant matrices (A, B) and weights (Q, R) | |
| template<class T , int NStates, int NInputs, int NOutputs> | |
| Eigen::Matrix< T, NInputs, NStates > | lqr (const DiscreteStateSpace< T, NStates, NInputs, NOutputs > Gss, const Eigen::Matrix< T, NStates, NStates > &Q, const Eigen::Matrix< T, NInputs, NInputs > &R) |
| Computes a discrete LQR controller from a discrete state space plant model. | |
| template<class T , int NStates, int NInputs, int NOutputs, std::convertible_to< T > U1 = T, std::convertible_to< T > U2 = T> | |
| Eigen::Matrix< T, NInputs, NStates > | lqr (const DiscreteStateSpace< T, NStates, NInputs, NOutputs > Gss, const U1 &r=static_cast< U1 >(1), const U2 &eps=static_cast< U2 >(0.001)) |
| Construcs a discrete LQR controller with automatic weights Q and R. | |
| template<class T , int NStates, int NInputs, int NOutputs, std::convertible_to< T > U1 = T, std::convertible_to< T > U2 = T> | |
| Eigen::Matrix< T, NInputs, NStates > | lqr_bryson (const DiscreteStateSpace< T, NStates, NInputs, NOutputs > Gss, const Eigen::Vector< T, NOutputs > &x_max, const Eigen::Vector< T, NInputs > &u_max) |
| Construcs a discrete LQR controller with weights trying to limit states and controller outputs. | |
| template<class T , int NStates, int NInputs, int NOutputs> | |
| Eigen::Matrix< T, NInputs, NOutputs > | lqr_feed_forward (const DiscreteStateSpace< T, NStates, NInputs, NOutputs > Gss, Eigen::Matrix< T, NInputs, NStates > LQR) |
| template<class T > | |
| constexpr T | product_over (T from, T to) |
| Calculates the product of all numbers in the closed open range [from, to) | |
| template<class T > | |
| constexpr T | pow (const T &base, const int &exp) |
| Power function for integral exponents. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | unwrap (const Eigen::Vector< T, N > &y, const T &modulo) |
| Unwinds modulo jumps. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | unwrap_rad (const Eigen::Vector< T, N > &phases) |
| Unwinds phase jumps of \(2 \pi\) in radiants. | |
| template<class T , int N> | |
| Eigen::Vector< T, N > | unwrap_deg (const Eigen::Vector< T, N > &phases) |
| Unwinds phase jumps of \(2 \pi\) in degrees. | |
| template<class T = double> | |
| constexpr T | pade_param_reccursice (T P_k, std::int32_t m, std::int32_t n, std::int32_t k) |
| Calculates the next pade parameter recursively. | |
| template<class T = double> | |
| constexpr void | pade_params (T *params, std::size_t size, std::uint32_t m, std::uint32_t n) |
| Calculates all pade parameters up to the given size. | |
| template<class T = double> | |
| constexpr T | pade_num_param (std::int32_t m, std::int32_t n, std::int32_t k) |
| Calculates the numerator parameters of the pade approximation. | |
| template<class T = double> | |
| constexpr T | pade_den_param (unsigned long m, unsigned long n, unsigned long k) |
| Calculates the numerator parameters of the pade approximation. | |
| template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > | identity_like (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &unused) |
| template<class T , int LSize, int RSize> | |
| Eigen::Matrix< T, LSize+RSize, LSize+RSize > | join_to_diagonal (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r) |
| template<class T , int LSize, int RSize> requires (LSize != Eigen::Dynamic && RSize != Eigen::Dynamic) | |
| Eigen::Vector< T, LSize+RSize > | join_to_vector (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r) |
| template<class T , int LSize, int RSize> requires (!(LSize != Eigen::Dynamic && RSize != Eigen::Dynamic)) | |
| Eigen::Vector< T, Eigen::Dynamic > | join_to_vector (const Eigen::Vector< T, LSize > &l, const Eigen::Vector< T, RSize > &r) |
| template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, Rows-1, Cols-1 > | minor (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &A, size_t ex_row, size_t ex_col) |
| returns the minor matrix excluding the provided column and row | |
| template<class T , int Rows, int Cols, int Options, int MaxRows, int MaxCols> | |
| Eigen::Matrix< T, Rows, Cols > | adj (const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > &A) |
| template<class T , int N> | |
| Eigen::Matrix< T, N-1, N-1 > | companion (const Eigen::Vector< T, N > &v) |
| Creates a companion matrix from a vector. | |
| template<class T , int N> requires (N % 2 == 0) | |
| Eigen::Matrix< T, N/2, N/2 > | hamilton_solver (const Eigen::Matrix< T, N, N > H) |
| Solves the hamilton matrix. | |
| template<class T , int N> | |
| Eigen::Matrix< T, N/2, N/2 > | symplectic_solver (const Eigen::Matrix< T, N, N > S) |
| Solves the hamilton matrix. | |
| template<class T , int NStates, int AOpt, int AMaxR, int AMaxC, int QOpt, int QMaxR, int QMaxC> | |
| Eigen::Matrix< T, NStates, NStates > | lyapunov_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q) |
| Solves the continuous time Lyapunov equation. | |
| template<class ValueType , int NStates, int NInputs, int NOutputs> | |
| std::tuple< Eigen::Matrix< ValueType, NStates, NStates >, Eigen::Matrix< ValueType, NStates, NStates > > | energy_scaling_matrix (const Eigen::Matrix< ValueType, NStates, NStates > A, const Eigen::Matrix< ValueType, NStates, NInputs > B, const Eigen::Matrix< ValueType, NOutputs, NStates > C) |
| Calculates the energy (Gramian) scaling via Lyapunov equations. | |
| template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC> | |
| Eigen::Matrix< T, NStates, NStates > | care_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R) |
| Solves the continuous time riccati equation (CARE) | |
| template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC> | |
| Eigen::Matrix< T, NStates, NStates > | dare_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R) |
| Solves the discrete time riccati equation (DARE) | |
| template<class T , int NStates, int NInputs, int AOpt, int AMaxR, int AMaxC, int BOpt, int BMaxR, int BMaxC, int ROpt, int RMaxR, int RMaxC, int QOpt, int QMaxR, int QMaxC, int NOpt, int NMaxR, int NMaxC> | |
| Eigen::Matrix< T, NStates, NStates > | care_solver (const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > &A, const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > &B, const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > &Q, const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > &R, const Eigen::Matrix< T, NStates, NInputs, NOpt, NMaxR, NMaxC > &N) |
| Solves the continuous time riccati equation (CARE) with cross coupling. | |
| template<class T , int NumOrder, int DenOrder = NumOrder> requires (NumOrder <= DenOrder) | |
| ContinuousTransferFunction< T, NumOrder, DenOrder > | pade_delay (T delay) |
| Creates a continuous transfer function approximating a delay using the pade approximation. | |
| template<class T > | |
| Eigen::Vector< std::complex< T >, 0 > | zeros (const Polynom< T, 0 > &polynom) |
| Returns an empty vector resembling the absence of solutions. | |
| template<class T > | |
| Eigen::Vector< std::complex< T >, 1 > | zeros (const Polynom< T, 1 > &polynom) |
| calculates the zeros/roots of a polynomial | |
| template<class T > | |
| Eigen::Vector< std::complex< T >, 2 > | zeros (const Polynom< T, 2 > &polynom) |
| calculates the zeros/roots of a polynomial | |
| template<class T , int N> requires (N > 1) | |
| Eigen::Vector< std::complex< T >, N > | zeros (const Polynom< T, N > &polynom) |
| Calculates the zeros of a polynomial. | |
| template<class T , int N> | |
| bool | operator== (const Polynom< T, N > &lhs, const Polynom< T, N > &rhs) |
| Compares two polynomials for equality. | |
| template<class T , int N> | |
| bool | operator!= (const Polynom< T, N > &lhs, const Polynom< T, N > &rhs) |
| template<class T , int Nl, int Nr> | |
| Polynom< T,(Nl > Nr) ? Nl :Nr > | operator+ (const Polynom< T, Nl > &lhs, const Polynom< T, Nr > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| Polynom< Tpoly, N > | operator+ (const Tscalar &lhs, const Polynom< Tpoly, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| Polynom< Tpoly, N > | operator+ (const Polynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| Polynom< T, N > | operator- (const Polynom< T, N > &poly) |
| template<class T , int Nl, int Nr> | |
| Polynom< T,(Nl > Nr) ? Nl :Nr > | operator- (const Polynom< T, Nl > &lhs, const Polynom< T, Nr > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| Polynom< Tpoly, N > | operator- (const Tscalar &lhs, const Polynom< Tpoly, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| Polynom< Tpoly, N > | operator- (const Polynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class T , int lOrder, int rOrder> | |
| Polynom< T, lOrder+rOrder > | operator* (const Polynom< T, lOrder > &lhs, const Polynom< T, rOrder > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int Order> | |
| Polynom< Tpoly, Order > | operator* (const Polynom< Tpoly, Order > &lhs, const Tscalar &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int Order> | |
| Polynom< Tpoly, Order > | operator* (const Tscalar &lhs, const Polynom< Tpoly, Order > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int Order> | |
| Polynom< Tpoly, Order > | operator/ (const Polynom< Tpoly, Order > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| bool | operator== (const FixedPolynom< T, N > &lhs, const FixedPolynom< T, N > &rhs) |
| Compares two polynomials for equality. | |
| template<class T , int N> | |
| bool | operator!= (const FixedPolynom< T, N > &lhs, const FixedPolynom< T, N > &rhs) |
| template<class T , int N> | |
| FixedPolynom< T, N > | operator+ (const FixedPolynom< T, N > &lhs, const FixedPolynom< T, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> requires (N >= 1) | |
| FixedPolynom< Tpoly, N > | operator+ (const Tscalar &lhs, const FixedPolynom< Tpoly, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> requires (N >= 1) | |
| FixedPolynom< Tpoly, N > | operator+ (const FixedPolynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| FixedPolynom< T, N > | operator- (const FixedPolynom< T, N > &lhs, const FixedPolynom< T, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> requires (N >= 1) | |
| FixedPolynom< Tpoly, N > | operator- (const Tscalar &lhs, const FixedPolynom< Tpoly, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> requires (N >= 1) | |
| FixedPolynom< Tpoly, N > | operator- (const FixedPolynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| FixedPolynom< T, N > | operator- (const FixedPolynom< T, N > &values) |
| template<class T , int N> | |
| FixedPolynom< T, N > | operator* (const FixedPolynom< T, N > &lhs, const FixedPolynom< T, N > &rhs) |
| Non growing multiplication. | |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| FixedPolynom< Tpoly, N > | operator* (const FixedPolynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| FixedPolynom< Tpoly, N > | operator* (const Tscalar &lhs, const FixedPolynom< Tpoly, N > &rhs) |
| template<class Tpoly , std::convertible_to< Tpoly > Tscalar, int N> | |
| FixedPolynom< Tpoly, N > | operator/ (const FixedPolynom< Tpoly, N > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder, int DenOrder> | |
| StateSpace< T, DenOrder, 1, 1 > | to_state_space_controller_norm (const TransferFunction< T, NumOrder, DenOrder > &rp) |
| calculates the control-normed state space representation from a rational polynomial | |
| template<class T , int NumOrder, int DenOrder> | |
| StateSpace< T, DenOrder, 1, 1 > | to_state_space_observer_norm (const TransferFunction< T, NumOrder, DenOrder > &rp) |
| calculates the observer-normed state space representation from a rational polynomial | |
| template<class T , int NumOrder, int DenOrder> | |
| StateSpace< T, DenOrder, 1, 1 > | to_state_space (const TransferFunction< T, NumOrder, DenOrder > &rp) |
| calculates the observer-normed state space representation from a rational polynomial | |
| template<class T , int NRows, int NCols, int Opts, int NMaxRows, int NMaxCols> | |
| StateSpace< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic > | to_state_space (const Eigen::Matrix< TransferFunction< T, Eigen::Dynamic, Eigen::Dynamic >, NRows, NCols, Opts, NMaxRows, NMaxCols > &Mtf) |
| Generates the block diagonal state space representation of the system of transfer functions. | |
| template<class T , int states> | |
| TransferFunction< T, states+1, states+1 > | to_transfer_function (const StateSpace< T, states, 1, 1 > &css) |
| transforms a continuous state space system representation to a transfer function representation | |
| template<class T > | |
| void | write_csv (std::ostream &stream, const TimeSeries< T > ×eries) |
Prints the timeseries as a .csv file. | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &stream, const ComplexTimeSeries< T > ×eries) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr auto | operator== (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder1, DenOrder1 > &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr bool | operator!= (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder1, DenOrder1 > &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr TransferFunction< T, std::max(NumOrder1+DenOrder2, NumOrder2+DenOrder1), DenOrder1+DenOrder2 > | operator+ (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| rational addition of polynomials | |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, std::max(NumOrder, DenOrder), DenOrder > | operator+ (const Tscalar &lhs, const TransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, std::max(NumOrder, DenOrder), DenOrder > | operator+ (const TransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1> | |
| constexpr TransferFunction< T, NumOrder1, DenOrder1 > | operator- (const TransferFunction< T, NumOrder1, DenOrder1 > &poly) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr TransferFunction< T, std::max(NumOrder1+DenOrder2, NumOrder2+DenOrder1), DenOrder1+DenOrder2 > | operator- (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, std::max(NumOrder, DenOrder), DenOrder > | operator- (const Tscalar &lhs, const TransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, std::max(NumOrder, DenOrder), DenOrder > | operator- (const TransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr TransferFunction< T, NumOrder1+NumOrder2, DenOrder1+DenOrder2 > | operator* (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, NumOrder, DenOrder > | operator* (const Tscalar &lhs, const TransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, NumOrder, DenOrder > | operator* (const TransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder1, int DenOrder1, int NumOrder2, int DenOrder2> | |
| constexpr TransferFunction< T, NumOrder1+DenOrder2, DenOrder1+NumOrder2 > | operator/ (const TransferFunction< T, NumOrder1, DenOrder1 > &lhs, const TransferFunction< T, NumOrder2, DenOrder2 > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, DenOrder, NumOrder > | operator/ (const Tscalar &lhs, const TransferFunction< T, NumOrder, DenOrder > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int NumOrder, int DenOrder> | |
| constexpr TransferFunction< T, NumOrder, DenOrder > | operator/ (const TransferFunction< T, NumOrder, DenOrder > &lhs, const Tscalar &rhs) |
| template<class T , int NumOrder, int DenOrder> | |
| Eigen::Vector< std::complex< T >, NumOrder+1 > | zeros (const TransferFunction< T, NumOrder, DenOrder > &tf) |
| template<class T , int NumOrder, int DenOrder> | |
| Eigen::Vector< std::complex< T >, DenOrder+1 > | poles (const TransferFunction< T, NumOrder, DenOrder > &tf) |
| template<class T , int N> | |
| constexpr bool | operator== (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , int N> | |
| constexpr bool | operator!= (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , int N> | |
| constexpr auto | operator+ (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| rational addition of polynomials | |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator+ (const Tscalar &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator+ (const FixedRationalPolynom< T, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| constexpr FixedRationalPolynom< T, N > | operator- (const FixedRationalPolynom< T, N > &poly) |
| template<class T , int N> | |
| constexpr auto | operator- (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator- (const Tscalar &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator- (const FixedRationalPolynom< T, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| constexpr FixedRationalPolynom< T, N > | operator* (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr FixedRationalPolynom< T, N > | operator* (const Tscalar &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr FixedRationalPolynom< T, N > | operator* (const FixedRationalPolynom< T, N > &lhs, const Tscalar &rhs) |
| template<class T , int N> | |
| constexpr auto | operator/ (const FixedRationalPolynom< T, N > &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator/ (const Tscalar &lhs, const FixedRationalPolynom< T, N > &rhs) |
| template<class T , std::convertible_to< T > Tscalar, int N> | |
| constexpr auto | operator/ (const FixedRationalPolynom< T, N > &lhs, const Tscalar &rhs) |
| template<class ValueType , int states> | |
| DiscreteStateSpace< ValueType, states, 1, 1 > | discretise_zoh (const ContinuousStateSpace< ValueType, states, 1, 1 > &sys, ValueType sample_time) |
| transform s-domain into z-domain using zero-order-hold | |
| template<class T , int NStates, int NInputs, int NOutputs> | |
| DiscreteStateSpace< T, NStates, NInputs, NOutputs > | discretise_tustin (const ContinuousStateSpace< T, NStates, NInputs, NOutputs > &sys, const T &sample_time) |
| discretises a continuous state space to a discrete one with the Tustin transformation | |
| template<class T , int NStates> | |
| DiscreteStateSpace< T, NStates, 1, 1 > | discretise (const ContinuousStateSpace< T, NStates, 1, 1 > &sys, const T &sample_time, EDiscretisation method) |
The main namespace for the Control++ library.
This namespace contains all the classes, functions, and utilities provided by the Control++ library for control systems analysis and design.
|
strong |
|
strong |
Error cases for reading/parsing bode data from CSV formated data.
|
strong |
|
strong |
Enum that determines how frequency data will be interpreted when reading CSV data.
|
strong |
Enum that determines how frequency data will be interpreted when reading CSV data.
|
strong |
Enum that determines how phase data will be interpreted when reading CSV data.
| Eigen::Matrix< T, Rows, Cols > controlpp::adj | ( | const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > & | A | ) |
| Bode< T > controlpp::bode | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const Eigen::Vector< T, Eigen::Dynamic > & | freqs | ||
| ) |
Calculates the bode response for a pre defined frequency (rad/s) vector.
| T | The value type of the transfer function |
| NumOrder | The numerator order |
| DenOrder | The denominator order |
| NSize | The number of elements in the frequency vector (may also be Eigen::Dynamic) |
| tf | The continuous transfer function to analyse |
| freqs | The frequency vector at which to evaluate the transfer function in rad/s |
Bode struct | Bode< T > controlpp::bode | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const int | samples_per_decade = 100 |
||
| ) |
Calculates the bode response of a transfer function.
Infers the frequency range of the bode plot from the transfer function.
| tf | The transfer function |
| samples_per_decade | The number of samples per decade of frequencies to be calculated |
| Bode< T > controlpp::bode | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const T1 & | slowest_freq_rad, | ||
| const T2 & | fastest_freq_rad, | ||
| const int | samples_per_decade = 100 |
||
| ) |
Calculates the bode response of a transfer function.
| slowest_freq_rad | The slowest/lowest frequency in rad/s from which to calculate frequency responses |
| fastest_freq_rad | The fastest/highest frequency in rad/s to which to calculate the frequency response |
| samples_per_decade | The number of samples per decade of frequencies to be calculated |
| Bode< T > controlpp::bode | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| Eigen::Vector< T, Eigen::Dynamic > && | freqs | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Bode< T > controlpp::bode_hz | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const Eigen::Vector< T, Eigen::Dynamic > & | freqs_Hz | ||
| ) |
Calculates the bode response for a pre defined frequency (Hz) vector.
| T | The value type of the transfer function |
| NumOrder | The numerator order |
| DenOrder | The denominator order |
| NSize | The number of elements in the frequency vector (may also be Eigen::Dynamic) |
| tf | The continuous transfer function to analyse |
| freqs_Hz | The frequency vector at which to evaluate the transfer function in hz |
Bode struct | Bode< T > controlpp::bode_hz | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const int | samples_per_decade = 100 |
||
| ) |
Calculates the bode response of a transfer function.
Infers the frequency range of the bode plot from the transfer function.
| tf | The transfer function |
| samples_per_decade | The number of samples per decade of frequencies to be calculated |
| Bode< T > controlpp::bode_hz | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const T1 & | slowest_freq_Hz, | ||
| const T2 & | fastest_freq_Hz, | ||
| const int | samples_per_decade = 100 |
||
| ) |
Calculates the bode response of a transfer function.
| slowest_freq_Hz | The slowest/lowest frequency in Hz from which to calculate frequency responses |
| fastest_freq_Hz | The fastest/highest frequency in Hz to which to calculate the frequency response |
| samples_per_decade | The number of samples per decade of frequencies to be calculated |
| Bode< T > controlpp::bode_hz | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| Eigen::Vector< T, Eigen::Dynamic > && | freqs_Hz | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| Eigen::Matrix< T, NStates, NStates > controlpp::care_solver | ( | const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > & | A, |
| const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > & | B, | ||
| const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > & | Q, | ||
| const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > & | R | ||
| ) |
Solves the continuous time riccati equation (CARE)
This function computes the stabilizing symmetric solution of the CARE:
\[ A^\top X + X A - (X B) R^{-1} (B^\top X) + Q = 0 \]
where \(A, B, C, D\) are system matrices:
\[ \dot{x} = A x + B u y = C x + D u \]
with the system states \(x\), inputs \(u\) and outputs \(y\),
as well as \(Q\), \(R\) the state and input weighting matrices.
Soves the Riccatiy equation by:
controlpp::create_hamilton())| A | State matrix ( \(n \times n\)). |
| B | Input matrix ( \(n \times m\)). |
| R | Input weighting matrix ( \(m \times m\), symmetric positive definite). |
| Q | State weighting matrix ( \(n \times n\), symmetric positive semidefinite). |
| T | Scalar type (e.g., double, float). |
| NStates | Number of states. |
| NInputs | Number of control inputs. |
| Eigen::Matrix< T, NStates, NStates > controlpp::care_solver | ( | const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > & | A, |
| const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > & | B, | ||
| const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > & | Q, | ||
| const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > & | R, | ||
| const Eigen::Matrix< T, NStates, NInputs, NOpt, NMaxR, NMaxC > & | N | ||
| ) |
Solves the continuous time riccati equation (CARE) with cross coupling.
This function computes the stabilizing symmetric solution of the CARE:
\[ A^\top X + X A - (X B + N) R^{-1} (B^\top X + N) + Q = 0 \]
where \(A, B, C, D\) are system matrices:
\[ \dot{x} = A x + B u y = C x + D u \]
with the system states \(x\), inputs \(u\) and outputs \(y\),
as well as \(Q\), \(R\) the state and input weighting matrices.
Soves the Riccatiy equation by:
controlpp::create_hamilton())| A | State matrix ( \(n \times n\)). |
| B | Input matrix ( \(n \times m\)). |
| R | Input weighting matrix ( \(m \times m\), symmetric positive definite). |
| Q | State weighting matrix ( \(n \times n\), symmetric positive semidefinite). |
| N | N Cross-term weighting matrix ( \(n × m\)). |
| T | Scalar type (e.g., double, float). |
| NStates | Number of states. |
| NInputs | Number of control inputs. |
| Eigen::Matrix< T, N-1, N-1 > controlpp::companion | ( | const Eigen::Vector< T, N > & | v | ) |
Creates a companion matrix from a vector.
given the vector:
\[ \vec{v} = \left[a_0, a_1, a_2, \cdots , a_n \right] \]
creates the companion matrix:
\[ \mathbf{C} = \begin{bmatrix} 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \ddots & \vdots \\ 0 & 0 & \cdots & 0 & 1 \\ b_0 & b_1 & \cdots & b_{n-2} & b_{n-1} \end{bmatrix} \]
where \(b_i\) is:
\[ b_i = \frac{a_i}{a_n} \]
| ContinuousStateSpace< T, PDenOrder+MDenOrder+WdDenOrder+WzDenOrder, 1, 1 > controlpp::continous_h2 | ( | const ContinuousTransferFunction< T, PNumOrder, PDenOrder > & | P, |
| const ContinuousTransferFunction< T, MNumOrder, MDenOrder > & | M, | ||
| const ContinuousTransferFunction< T, WdNumOrder, WdDenOrder > & | Wd, | ||
| const ContinuousTransferFunction< T, WzNumOrder, WzDenOrder > & | Wz, | ||
| const T & | control_penalty, | ||
| const T & | measurement_noise | ||
| ) |
Synthesizes an H2 controller from transfer functions.
| P | Transfer function of the plan |
| M | Transfer function of the measurement |
| Wd | Transfer function (weight) shaping the disturbance |
| Wn | Transfer function (weight) shaping the measurement noise |
| Wz | Transfer function (weight) shaping the performance output |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > controlpp::continous_h2 | ( | const Eigen::Matrix< T, NStates, NStates > & | A, |
| const Eigen::Matrix< T, NStates, NDisturbances > & | Bw, | ||
| const Eigen::Matrix< T, NStates, NInputs > & | Bu, | ||
| const Eigen::Matrix< T, NPerfOutputs, NStates > & | Cz, | ||
| const Eigen::Matrix< T, NPerfOutputs, NInputs > & | Duz, | ||
| const Eigen::Matrix< T, NMeasOutputs, NStates > & | Cy, | ||
| const Eigen::Matrix< T, NMeasOutputs, NDisturbances > & | Dwy, | ||
| const Eigen::Matrix< T, NInputs, NInputs > & | R, | ||
| const Eigen::Matrix< T, NMeasOutputs, NMeasOutputs > & | S | ||
| ) |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > controlpp::continous_h2 | ( | const Eigen::Matrix< T, NStates, NStates > & | A, |
| const Eigen::Matrix< T, NStates, NDisturbances > & | Bw, | ||
| const Eigen::Matrix< T, NStates, NInputs > & | Bu, | ||
| const Eigen::Matrix< T, NPerfOutputs, NStates > & | Cz, | ||
| const Eigen::Matrix< T, NPerfOutputs, NInputs > & | Duz, | ||
| const Eigen::Matrix< T, NMeasOutputs, NStates > & | Cy, | ||
| const Eigen::Matrix< T, NMeasOutputs, NDisturbances > & | Dwy, | ||
| const Eigen::Vector< T, NInputs > | r = Eigen::Vector<T, NInputs>::Zero(), |
||
| const Eigen::Vector< T, NMeasOutputs > | s = Eigen::Vector<T, NMeasOutputs>::Zero() |
||
| ) |
An optimal controller for linear time-invariant (LTI) system. It minimizes the H2 norm of the the disturbance input gain to the output.
An H2 controller is part of the class of optimal controllers. Where the typical system model is a linear time-invaritan (LTI) system, that looks like:
\[ \dot{x} = A x + B_w w + B_u u \\ z = C_z x + D_{1u} u \\ y = C_y x + D_{2w} w \]
Where:
Note how \(D_{11}\), and \(D_{22}\) are assumed to be zero.
The H2 controller solves a system such that the closed-loop transfer function from the disturbance \(w\) to the performace output \(z\) has a minimized variance.
The dynamic controller of such a system has the form of:
\[ \dot{x_K} = A_K + x_K + B_K y \\ u = C_K x_K + D_K y \]
The optimal solution can be found solveing the Riccati equations for the state-feedback riccati equation:
\[ A^\top X + X A - X B_u R^{-1} B_u^\top X + Q = 0 \]
with
and the estimator riccati equation:
\[ A^\top Y + Y A - Y C_y S^{-1} C_y^\top Y + W = 0 \]
where:
X and Y from the riccati equations are then used to calculate the
optimal state-feedback gain:
\[ F = -R^{-1} \left( B_u^\top X + D_{1u}^\top C_z \right) \]
and the optimal observer gian:
\[ L = - \left( Y C_y^\top + B_w D_{2w}^\top \right) S^{-1} \]
The H2 controller then is:
\[ A_K = A + B_u F + L C_y \\ B_K = -L C_K = F D_K = 0 \]
The default H2 controller minimizes the total energy over all frequencies. To emphasise the control of a certain frequency region one can define a weighting transfer function \(W_z(s)\) that affects the performance output \(z\):
\[ z_w = W_z(s) z \]
I \(W_z\) is large at a certain frequency the optimizer will try to reduce the gain in that band more aggressively than in the band that W is smaller.
| A | System/plant dynamic |
| Bw | disturbance input |
| Bu | control input |
| Cz | state to performance output |
| Cy | state to measurement output |
| Duz | throughput from control input to performance output |
| Dwy | throughput from disturbance to measurement output |
| r | Input weighting. penalizes control effort u.
|
| s | Measurement noise / estimator weighting. penalizes measurement trust:
|
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > controlpp::continous_h2 | ( | const Eigen::Matrix< T, NStates, NStates > & | A, |
| const Eigen::Matrix< T, NStates, NDisturbances > & | Bw, | ||
| const Eigen::Matrix< T, NStates, NInputs > & | Bu, | ||
| const Eigen::Matrix< T, NPerfOutputs, NStates > & | Cz, | ||
| const Eigen::Matrix< T, NPerfOutputs, NInputs > & | Duz, | ||
| const Eigen::Matrix< T, NMeasOutputs, NStates > & | Cy, | ||
| const Eigen::Matrix< T, NMeasOutputs, NDisturbances > & | Dwy, | ||
| const T & | r_scalar = 0, |
||
| const T & | s_scalar = 0 |
||
| ) |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > controlpp::continuous_h2 | ( | const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > & | Gss, |
| const Eigen::Vector< T, NInputs > & | control_penalty = Eigen::Vector<T, NInputs>::Zero(), |
||
| const Eigen::Vector< T, NMeasOutputs > & | measurement_noise = Eigen::Vector<T, NMeasOutputs>::Zero() |
||
| ) |
Constructs a continuous H2 controller from a continuous state space plant model.
| Gss | Generalised plant in state space form |
| T | The value type of the plant and controller. Usually double or float. |
| NPlantOutputs | The number of states of the plant. Also the number of states of the controller if no extra weighting functions are applied. |
| NPlantInputs | The number of inputs of the plant. |
| ContinuousStateSpace< T, NStates, NMeasOutputs, NInputs > controlpp::continuous_h2 | ( | const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > & | Gss, |
| const T & | control_penalty = static_cast<T>(0), |
||
| const T & | measurement_noise = static_cast<T>(0) |
||
| ) |
| Eigen::Matrix< T, NStates, NStates > controlpp::dare_solver | ( | const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > & | A, |
| const Eigen::Matrix< T, NStates, NInputs, BOpt, BMaxR, BMaxC > & | B, | ||
| const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > & | Q, | ||
| const Eigen::Matrix< T, NInputs, NInputs, ROpt, RMaxR, RMaxC > & | R | ||
| ) |
Solves the discrete time riccati equation (DARE)
This function computes the stabilizing symmetric solution of the DARE:
\[ A^\top X A - A^\top X B (R + B^\top X B)^{-1} B^\top X A + Q = 0 \]
where \(A, B, C, D\) are system matrices:
\[ \dot{x} = A x + B u y = C x + D u \]
with the system states \(x\), inputs \(u\) and outputs \(y\),
as well as \(Q\), \(R\) the state and input weighting matrices.
Soves the Riccatiy equation by:
controlpp::create_hamilton())| A | State matrix ( \(n \times n\)). |
| B | Input matrix ( \(n \times m\)). |
| R | Input weighting matrix ( \(m \times m\), symmetric positive definite). |
| Q | State weighting matrix ( \(n \times n\), symmetric positive semidefinite). |
| T | Scalar type (e.g., double, float). |
| NStates | Number of states. |
| NInputs | Number of control inputs. |
| tl::expected< DiscreteTransferFunction< T, NumOrder, DenOrder >, dft_estimate_error > controlpp::dft_estimate | ( | const Eigen::Vector< T, Eigen::Dynamic > & | u, |
| const Eigen::Vector< T, Eigen::Dynamic > & | y, | ||
| const T & | regularization = T(0), |
||
| const DiscreteTransferFunction< T, NumOrder, DenOrder > & | hint = DiscreteTransferFunction<T, NumOrder, DenOrder>({T(0)}, {T(1)}) |
||
| ) |
Estimates a discrete time transfer function of a specific order for the input (u) and output (y) data pairs.
Finds the optimal parameters that minimize the cost function:
\[ \left( y - U p \right)^2 \]
where
| T | The data type |
| NumOrder | The numerator order for the resulting transfer function |
| DenOrder | The denominator order for the resulting transfer function |
| N | The size of the data |
| y | The output data of the system |
| u | The input data of the system |
| regularization | adds an extra ( \(\lambda\)) therm \( \lambda p^2 \) to the cost function that penalises large parameters (p). |
| hint | adds an extra penalty to the cost function if parameters deviate from the hint \( \lambda (p - p_\text{hint})^2 \). Note that regularisation needs to be non-zero for the hint to take effect. |
y = Tf * u | DiscreteStateSpace< T, NStates, 1, 1 > controlpp::discretise | ( | const ContinuousStateSpace< T, NStates, 1, 1 > & | sys, |
| const T & | sample_time, | ||
| EDiscretisation | method | ||
| ) |
| DiscreteStateSpace< T, NStates, NInputs, NOutputs > controlpp::discretise_tustin | ( | const ContinuousStateSpace< T, NStates, NInputs, NOutputs > & | sys, |
| const T & | sample_time | ||
| ) |
discretises a continuous state space to a discrete one with the Tustin transformation
Applies the following transformation:
\[ A_d = \left( I - \frac{Ts}{2} A \right)^{-1} \left( I + \frac{Ts}{2} A \right)\\ B_d = \left( I - \frac{Ts}{2} A \right)^{-1} Ts B C_d = C \left( I - \frac{Ts}{2} A \right)^{-1} D_d = D + C * \left( I - \frac{Ts}{2} A \right)^{-1} * Ts * B / 2 \]
where:
| T | The value type of the matrices/systems. Usually float or double. |
| NStates | The number of states of the systems |
| NInputs | The number of inputs of the systems |
| NOutputs | The number of outputs of the systems |
| sys | The continuous time state space system about to be discretised |
| sample_time | The sample time used for the discretisation |
| DiscreteStateSpace< ValueType, states, 1, 1 > controlpp::discretise_zoh | ( | const ContinuousStateSpace< ValueType, states, 1, 1 > & | sys, |
| ValueType | sample_time | ||
| ) |
transform s-domain into z-domain using zero-order-hold
TODO: Testing
Use this function to discretize a plant.
To correctly design controllers, transform the plant first with zoh into the z-domain and then from the z-domain into the q-domain using the tustin transformation. Perform the actual controller design in q-domain and then transform the controller back into the z-domain.
Note: This method uses exact discretisation - but not quite - it uses an approximated matrix exponent control::exp_taylor_scale(M) to calculate:
\[ \exp{\mathbf{M}} \]
| ValueType | The value type of the matrix entries (e.g.: float) |
| TimePoint | The representation of the time type (e.g.: float) |
| states | The number of internal states of the system |
| sys | A continuous state space sytem |
| sample_time | The sample time in seconds |
sys | std::tuple< Eigen::Matrix< ValueType, NStates, NStates >, Eigen::Matrix< ValueType, NStates, NStates > > controlpp::energy_scaling_matrix | ( | const Eigen::Matrix< ValueType, NStates, NStates > | A, |
| const Eigen::Matrix< ValueType, NStates, NInputs > | B, | ||
| const Eigen::Matrix< ValueType, NOutputs, NStates > | C | ||
| ) |
Calculates the energy (Gramian) scaling via Lyapunov equations.
Calculates the scaling (similarity) matrix T so that the similar system:
\[ A' = T A T^{-1}, \quad B' = T B, \quad C' = C T^{-1}, \quad D' = D \]
has equal state energy.
This is especially useful, if a system has very small and very large entries of very small and large frequency components/dynamics.
| ValueType | The value type of the matrices. (E.g.: double, float) |
| NStates | The number of states |
| NInputs | The number of inputs |
| NOutputs | The number of outputs |
| A | The system state matrix (NStates x NStates) |
| B | The system input matrix (NStates x NInputs) |
| C | The system output matrix (NOutputs x NStates) |
| D | The system passthrough matrix (NOutputs x NInputs) |
| Eigen::Matrix< T, N, N > controlpp::expm | ( | const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > & | M | ) |
Calculates the matrix exponent \( \exp{\mathbf{M}} \).
Uses a scaled pade approximation for the exponential.
The order and scaling factor are automatically determined based on the norm of the matrix.
| T | The value type of the matrix elements |
| Rows | The number of rows of the matrix |
| Cols | The number of columns of the matrix |
| M | The matrix |
| Eigen::Matrix< T, N, N > controlpp::expm_pade | ( | const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > & | A, |
| int | Order = 5 |
||
| ) |
Approximates \(\exp{A}\) using a pade fraction.
| `std::invalid_argument` | if the order is greater than 31 |
| T | The value type of the matrix entries (usually float or double) |
| Rows | The number of rows |
| Cols | The number of columns |
| Options | Matrix options (See: Store Orders) |
| A | The input matrix |
| Order | The order of the numerator and denominator of the pade fraction |
| ExpmPadeParams controlpp::expm_pade_params | ( | const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > & | M | ) |
Determines the order and scaling factor for the scaled pade approximation of the matrix exponential.
Higham, Nicholas J., and Desmond J. Higham. "A new scaling and squaring algorithm for the matrix exponential."
| T | The value type of the matrix entries (usually float or double) |
| MaxRows | The maximum number of rows for the matrix (default is N) |
| MaxCols | The maximum number of columns for the matrix (default is N) |
| Options | The storage order of the matrix (see Eigen documentation) |
| N | The size of the square matrix |
| M | The matrix for which to determine the parameters |
| Eigen::Matrix< T, N, N > controlpp::expm_pade_scaled | ( | const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > & | M | ) |
Matrix exponential using a scaled Pade approximation with automatic order and scaling factor determination.
| T | The value type of the matrix entries (usually float or double) |
| N | The size of the square matrix |
| Options | The storage order of the matrix (see Eigen documentation) |
| MaxRows | The maximum number of rows for the matrix (default is N) |
| MaxCols | The maximum number of columns for the matrix (default is N) |
| M | The matrix to exponentiate |
| Eigen::Matrix< T, N, N > controlpp::expm_pade_scaled | ( | const Eigen::Matrix< T, N, N, Options, MaxRows, MaxCols > & | M, |
| int | order, | ||
| int | scaling | ||
| ) |
Applies scaling and squaring to the pade approximation of the matrix exponential.
| T | The value type of the matrix entries (usually float or double) |
| N | The size of the square matrix |
| Options | The storage order of the matrix (see Eigen documentation) |
| MaxRows | The maximum number of rows for the matrix (default is N) |
| MaxCols | The maximum number of columns for the matrix (default is N) |
| M | Matrix to exponentiate |
| order | Order of the Pade approximation (default is 7) |
| scaling | Scaling factor for the matrix (default is 7) |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > controlpp::expm_taylor | ( | const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > & | x, |
| int | n | ||
| ) |
Exponential function with a taylor approximation.
\[ \exp{x} = I + x + x^2 / 2 + ... + x^n / n! \]
The minimum number of n is 2. If n is set lower than 2, then 2 increments will be calculated regardless
| T | The value type |
| x | The value taken to the exponent |
| n | The order of the taylor approximation (default: 3) |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > controlpp::expm_taylor_scaled | ( | const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > & | M, |
| int | taylor_order = 8, |
||
| int | scaling = 10 |
||
| ) |
Calculates the matrix exponent \( \exp{\mathbf{M}} \).
Uses a scaled taylor approximation for the exponential.
Uses the following relationship:
\[ exp{x} = exp{x/s*s} = \left( exp{x/s} \right) ^ {s} \]
to improve accuracy, by scaling the value first, allowing for smaller taylor orders with increased accuracy.
| T | The value type of the matrix elements |
| Rows | The number of rows of the matrix |
| Cols | The number of columns of the matrix |
| M | The matrix |
| taylor_order | The order of the taylor polynomial used to approximate the exponential function |
| scaling | The scaling factor used to improve the accuracy of the exponential function |
| std::optional< std::pair< const T *, const T * > > controlpp::find_enclosing | ( | const Eigen::Vector< T, Size > & | range, |
| const T & | v | ||
| ) |
Finds elements in a range that enclose v.
| range | The range to search in/iterate through |
| v | The value to search for |
[low, high] iterators that enclose the input value v or std::nullopt if no enclosing sub-range could be found. | std::optional< std::pair< Itr, Itr > > controlpp::find_enclosing | ( | Itr | first, |
| Itr | last, | ||
| const T & | v | ||
| ) |
Finds elements in a range that enclose v.
Searches for two elements in the range given by [first, last) such that *itr <= v && v <= *(itr+1) is true.
| first | the first iterator of the range (points to the first element of the range) |
| last | the last iterator of the range (points past the last element of the range) |
| v | the input value to search for |
[low, high] iterators that enclose the input value v or std::nullopt if no enclosing sub-range could be found. | T controlpp::from_dB | ( | const T & | value | ) |
| Eigen::Matrix< T, N/2, N/2 > controlpp::hamilton_solver | ( | const Eigen::Matrix< T, N, N > | H | ) |
Solves the hamilton matrix.
For example when solveing the CARE (continuous time ricatti equation).
The solution of the hamiltoin matrix is understood as the result of the operations:
| T | The value type of the parameters/matrix elements (ususally float or double) |
| N | The size of the hamilton matrix |
| H | The hamilton matrix |
| Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > controlpp::identity_like | ( | const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > & | unused | ) |
| Eigen::Matrix< T, LSize+RSize, LSize+RSize > controlpp::join_to_diagonal | ( | const Eigen::Vector< T, LSize > & | l, |
| const Eigen::Vector< T, RSize > & | r | ||
| ) |
| Eigen::Vector< T, LSize+RSize > controlpp::join_to_vector | ( | const Eigen::Vector< T, LSize > & | l, |
| const Eigen::Vector< T, RSize > & | r | ||
| ) |
| Eigen::Vector< T, Eigen::Dynamic > controlpp::join_to_vector | ( | const Eigen::Vector< T, LSize > & | l, |
| const Eigen::Vector< T, RSize > & | r | ||
| ) |
| Eigen::Vector< T, XCols > controlpp::least_squares | ( | const Eigen::Matrix< T, XRows, XCols, XOpt, XMaxRows, XMaxCols > & | X, |
| const Eigen::Vector< T, XRows > & | y | ||
| ) |
Solves the overdefined system \(y = X p\) for p.
There have to be more measurements than parameters. Meaning XRows >= XCols has to be true.
| X | the systems matrix that describes how the parameters p can be transformed into the measured output y |
| y | the actual measured system output |
| Eigen::Matrix< T, NInputs, NStates > controlpp::lqr | ( | const DiscreteStateSpace< T, NStates, NInputs, NOutputs > | Gss, |
| const Eigen::Matrix< T, NStates, NStates > & | Q, | ||
| const Eigen::Matrix< T, NInputs, NInputs > & | R | ||
| ) |
Computes a discrete LQR controller from a discrete state space plant model.
[ Q = \text{diag}\left( \frac{1}{x^2_{1,\text{max}}}, \frac{1}{x^2_{2,\text{max}}}, \frac{1}{x^2_{3,\text{max}}}, \cdots \right) ]
[ R = \text{diag}\left( \frac{1}{u^2_{1,\text{max}}}, \frac{1}{u^2_{2,\text{max}}}, \frac{1}{u^2_{3,\text{max}}}, \cdots \right) ]
for states x and control inputs u.
| T | The value types of the parameters |
| NStates | The number of states of the plant |
| NInputs | The number of inputs of the plant |
| NOutputs | Then number of outputs of the plant |
| Q | The state weight matrix (penalizes large states) |
| R | The control weight matrix (penalizes control effort) |
Eigen::Matrix| Eigen::Matrix< T, NInputs, NStates > controlpp::lqr | ( | const DiscreteStateSpace< T, NStates, NInputs, NOutputs > | Gss, |
| const U1 & | r = static_cast<U1>(1), |
||
| const U2 & | eps = static_cast<U2>(0.001) |
||
| ) |
Construcs a discrete LQR controller with automatic weights Q and R.
The weights Q (state penalty) and R (control penalty) are chosen automatically.
How Q is chosen:
\[ Q_1 = C^\top C; Q = Q_1 + I \| Q_1 \| \text{eps}^2; \]
How R is chosen:
\[ R = I * r \]
| T | The value type of the parameters |
| NStates | The number of states of the plant |
| NInputs | The number of inputs of the plant |
| NOutputs | The number of outputs of the plant |
| Gss | The state space description of the plant |
| r | The control penalty (See r in the equations) |
| eps | Makes sure to also penalises states that do not contribute to the output (see eps in the equations) |
Eigen::Matrix| Eigen::Matrix< T, NInputs, NStates > controlpp::lqr_bryson | ( | const DiscreteStateSpace< T, NStates, NInputs, NOutputs > | Gss, |
| const Eigen::Vector< T, NOutputs > & | x_max, | ||
| const Eigen::Vector< T, NInputs > & | u_max | ||
| ) |
Construcs a discrete LQR controller with weights trying to limit states and controller outputs.
The weights Q (state penalty) and R (control penalty) are chosen automatically to respect the limits $x_\text{max}$ (state limits) and $u_\text{max}$ (control output limits)
It is important to understand that those are not hard limits. The controller and the plant may overshoot the bounds - even by orders of magnitudes. It is just that a Q and R will be chosen where it is likely that the states and control signals stay within the bounds.
Chooses $Q$ as the diagonal matrix of $\frac{1}{x_\text{max}^2}$ and $R$ as $\frac{1}{u_\text{max}^2}$
| T | The value type of the parameters |
| NStates | The number of states of the plant |
| NInputs | The number of inputs of the plant |
| NOutputs | The number of outputs of the plant |
| Gss | The state space description of the plant |
| x_max | |
| u_max |
Eigen::Matrix| Eigen::Matrix< T, NInputs, NStates > controlpp::lqr_continuous | ( | const Eigen::Matrix< T, NStates, NStates > & | A, |
| const Eigen::Matrix< T, NStates, NInputs > & | B, | ||
| const Eigen::Matrix< T, NStates, NStates > & | Q = Eigen::Matrix<T, NStates, NStates>::Identity(), |
||
| const Eigen::Matrix< T, NInputs, NInputs > & | R = Eigen::Matrix<T, NInputs, NInputs>::Identity() |
||
| ) |
Synthesizes the continuous LQR gain from plant matrices (A, B) and weights (Q, R)
| T | The valuetype of the parameters (usually float or double) |
| NStates | The number of states in the plant |
| NInputs | The number of inputs of the plant |
| A | Plant state transition matrix |
| B | Plant input matrix |
| R | Control wight matrix (Penalises control effort). Expected to be symetric positive definite |
| Q | State weight matrix (Penalises large plant states) |
| Eigen::Matrix< T, NInputs, NStates > controlpp::lqr_discrete | ( | const Eigen::Matrix< T, NStates, NStates > & | A, |
| const Eigen::Matrix< T, NStates, NInputs > & | B, | ||
| const Eigen::Matrix< T, NStates, NStates > & | Q = Eigen::Matrix<T, NStates, NStates>::Identity(), |
||
| const Eigen::Matrix< T, NInputs, NInputs > & | R = Eigen::Matrix<T, NInputs, NInputs>::Identity() |
||
| ) |
Synthesizes the continuous LQR gain from plant matrices (A, B) and weights (Q, R)
| T | The valuetype of the parameters (usually float or double) |
| NStates | The number of states in the plant |
| NInputs | The number of inputs of the plant |
| A | Plant state transition matrix |
| B | Plant input matrix |
| Q | State weight matrix (Penalises large plant states) |
| R | Control wight matrix (Penalises control effort). Expected to be symetric positive definite |
| Eigen::Matrix< T, NInputs, NOutputs > controlpp::lqr_feed_forward | ( | const DiscreteStateSpace< T, NStates, NInputs, NOutputs > | Gss, |
| Eigen::Matrix< T, NInputs, NStates > | LQR | ||
| ) |
| Eigen::Matrix< T, NStates, NStates > controlpp::lyapunov_solver | ( | const Eigen::Matrix< T, NStates, NStates, AOpt, AMaxR, AMaxC > & | A, |
| const Eigen::Matrix< T, NStates, NStates, QOpt, QMaxR, QMaxC > & | Q | ||
| ) |
Solves the continuous time Lyapunov equation.
This function computes the stabilizing symmetric solution of the lyapunov equation:
\[ A^\top X + X A + Q = 0 \]
where A and Q are parameter and X is the matrix being solved for.
Soves the Lyapunov equation by:
| A | State matrix ( \(n \times n\)). |
| Q | State weighting matrix ( \(n \times n\), symmetric positive semidefinite). |
| T | Scalar type (e.g., double, float). |
| NStates | Dimension of the matrices |
NStates x NStates.| Eigen::Matrix< T, Rows-1, Cols-1 > controlpp::minor | ( | const Eigen::Matrix< T, Rows, Cols, Options, MaxRows, MaxCols > & | A, |
| size_t | ex_row, | ||
| size_t | ex_col | ||
| ) |
returns the minor matrix excluding the provided column and row
| A | The source matrix |
| ex_row | The row to be excluded |
| ex_col | The column to be excluded |
| bool controlpp::operator!= | ( | const FixedPolynom< T, N > & | lhs, |
| const FixedPolynom< T, N > & | rhs | ||
| ) |
|
constexpr |
| bool controlpp::operator!= | ( | const Polynom< T, N > & | lhs, |
| const Polynom< T, N > & | rhs | ||
| ) |
|
constexpr |
| Bode< T > controlpp::operator* | ( | const Bode< T > & | l, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | r | ||
| ) |
| Bode< T > controlpp::operator* | ( | const Bode< T > & | l, |
| const T2 & | r | ||
| ) |
| Bode< T > controlpp::operator* | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | l, |
| const Bode< T > & | r | ||
| ) |
| auto controlpp::operator* | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| auto controlpp::operator* | ( | const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > & | lhs, |
| const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| FixedPolynom< T, N > controlpp::operator* | ( | const FixedPolynom< T, N > & | lhs, |
| const FixedPolynom< T, N > & | rhs | ||
| ) |
Non growing multiplication.
Note that this multiplication does not grow the result to fit all posible values. The correct size has to be allocated beforehand by the user.
| FixedPolynom< Tpoly, N > controlpp::operator* | ( | const FixedPolynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| Polynom< T, lOrder+rOrder > controlpp::operator* | ( | const Polynom< T, lOrder > & | lhs, |
| const Polynom< T, rOrder > & | rhs | ||
| ) |
| Polynom< Tpoly, Order > controlpp::operator* | ( | const Polynom< Tpoly, Order > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| Bode< T > controlpp::operator* | ( | const T2 & | l, |
| const Bode< T > & | r | ||
| ) |
|
constexpr |
|
constexpr |
| auto controlpp::operator* | ( | const Tscalar & | lhs, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | rhs | ||
| ) |
|
constexpr |
| FixedPolynom< Tpoly, N > controlpp::operator* | ( | const Tscalar & | lhs, |
| const FixedPolynom< Tpoly, N > & | rhs | ||
| ) |
|
constexpr |
| Polynom< Tpoly, Order > controlpp::operator* | ( | const Tscalar & | lhs, |
| const Polynom< Tpoly, Order > & | rhs | ||
| ) |
|
constexpr |
| auto controlpp::operator+ | ( | const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > & | lhs, |
| const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > & | rhs | ||
| ) |
| auto controlpp::operator+ | ( | const ContinuousTransferFunction< Tpoly, NumOrder, DenOrder > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| FixedPolynom< T, N > controlpp::operator+ | ( | const FixedPolynom< T, N > & | lhs, |
| const FixedPolynom< T, N > & | rhs | ||
| ) |
| FixedPolynom< Tpoly, N > controlpp::operator+ | ( | const FixedPolynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
rational addition of polynomials
calculates:
\[ \frac{num_1(x)}{den_1(x)} \frac{num_2(x)}{den_2(x)} \]
| T | The value type of the polynomial parameters |
| NumOrder1 | The size of the numerator of the left-hand-side addition argument |
| DenOrder1 | The size of the denominator of the left-hand-side addition argument |
| NumOrder2 | The size of the numberator of the right-hand-side addition argument |
| DenOrder1 | The size of the denominator of the right-hand-side addition argument |
| lhs | The left-hand-side additino argument as a rational polynom |
| rhs | The right-hand-side addition argument as a rational polynom |
|
constexpr |
| Polynom< T,(Nl > Nr) ? Nl :Nr > controlpp::operator+ | ( | const Polynom< T, Nl > & | lhs, |
| const Polynom< T, Nr > & | rhs | ||
| ) |
| Polynom< Tpoly, N > controlpp::operator+ | ( | const Polynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
rational addition of polynomials
calculates:
\[ \frac{num_1(x)}{den_1(x)} \frac{num_2(x)}{den_2(x)} \]
| T | The value type of the polynomial parameters |
| NumOrder1 | The size of the numerator of the left-hand-side addition argument |
| DenOrder1 | The size of the denominator of the left-hand-side addition argument |
| NumOrder2 | The size of the numberator of the right-hand-side addition argument |
| DenOrder1 | The size of the denominator of the right-hand-side addition argument |
| lhs | The left-hand-side additino argument as a rational polynom |
| rhs | The right-hand-side addition argument as a rational polynom |
| auto controlpp::operator+ | ( | const Tscalar & | lhs, |
| const ContinuousTransferFunction< Tpoly, NumOrder, DenOrder > & | rhs | ||
| ) |
|
constexpr |
| FixedPolynom< Tpoly, N > controlpp::operator+ | ( | const Tscalar & | lhs, |
| const FixedPolynom< Tpoly, N > & | rhs | ||
| ) |
|
constexpr |
| Polynom< Tpoly, N > controlpp::operator+ | ( | const Tscalar & | lhs, |
| const Polynom< Tpoly, N > & | rhs | ||
| ) |
|
constexpr |
| Bode< T > controlpp::operator- | ( | const Bode< T > & | l, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | r | ||
| ) |
| Bode< T > controlpp::operator- | ( | const Bode< T > & | l, |
| const T2 & | r | ||
| ) |
| ContinuousTransferFunction< T, NumOrder, DenOrder > controlpp::operator- | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | a | ) |
| Bode< T > controlpp::operator- | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | l, |
| const Bode< T > & | r | ||
| ) |
| auto controlpp::operator- | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| auto controlpp::operator- | ( | const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > & | lhs, |
| const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| FixedPolynom< T, N > controlpp::operator- | ( | const FixedPolynom< T, N > & | lhs, |
| const FixedPolynom< T, N > & | rhs | ||
| ) |
| FixedPolynom< T, N > controlpp::operator- | ( | const FixedPolynom< T, N > & | values | ) |
| FixedPolynom< Tpoly, N > controlpp::operator- | ( | const FixedPolynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
|
constexpr |
| Polynom< T,(Nl > Nr) ? Nl :Nr > controlpp::operator- | ( | const Polynom< T, Nl > & | lhs, |
| const Polynom< T, Nr > & | rhs | ||
| ) |
| Polynom< Tpoly, N > controlpp::operator- | ( | const Polynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| Bode< T > controlpp::operator- | ( | const T2 & | l, |
| const Bode< T > & | r | ||
| ) |
|
constexpr |
|
constexpr |
|
constexpr |
| auto controlpp::operator- | ( | const Tscalar & | lhs, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | rhs | ||
| ) |
|
constexpr |
| FixedPolynom< Tpoly, N > controlpp::operator- | ( | const Tscalar & | lhs, |
| const FixedPolynom< Tpoly, N > & | rhs | ||
| ) |
|
constexpr |
| Polynom< Tpoly, N > controlpp::operator- | ( | const Tscalar & | lhs, |
| const Polynom< Tpoly, N > & | rhs | ||
| ) |
|
constexpr |
TODO: make it also work for bode that have different frequency vectors.
| T |
| l | |
| r |
| Bode< T > controlpp::operator/ | ( | const Bode< T > & | l, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | r | ||
| ) |
| Bode< T > controlpp::operator/ | ( | const Bode< T > & | l, |
| const T2 & | r | ||
| ) |
| Bode< T > controlpp::operator/ | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | l, |
| const Bode< T > & | r | ||
| ) |
| auto controlpp::operator/ | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| auto controlpp::operator/ | ( | const ContinuousTransferFunction< T, NumOrder1, DenOrder1 > & | lhs, |
| const ContinuousTransferFunction< T, NumOrder2, DenOrder2 > & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| FixedPolynom< Tpoly, N > controlpp::operator/ | ( | const FixedPolynom< Tpoly, N > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
| Polynom< Tpoly, Order > controlpp::operator/ | ( | const Polynom< Tpoly, Order > & | lhs, |
| const Tscalar & | rhs | ||
| ) |
| Bode< T > controlpp::operator/ | ( | const T2 & | l, |
| const Bode< T > & | r | ||
| ) |
|
constexpr |
|
constexpr |
| auto controlpp::operator/ | ( | const Tscalar & | lhs, |
| const ContinuousTransferFunction< T, NumOrder, DenOrder > & | rhs | ||
| ) |
|
constexpr |
|
constexpr |
|
constexpr |
| std::ostream & controlpp::operator<< | ( | std::ostream & | stream, |
| const ComplexTimeSeries< T > & | timeseries | ||
| ) |
| std::ostream & controlpp::operator<< | ( | std::ostream & | stream, |
| const ContinuousGeneralisedPlant< T, NStates, NInputs, NPerfOutputs, NMeasOutputs, NDisturbances > & | G | ||
| ) |
|
inline |
| std::ostream & controlpp::operator<< | ( | std::ostream & | stream, |
| EBodeCsvReadError | val | ||
| ) |
| bool controlpp::operator== | ( | const FixedPolynom< T, N > & | lhs, |
| const FixedPolynom< T, N > & | rhs | ||
| ) |
Compares two polynomials for equality.
| T | The datatype of the polynomials |
| N | The size of the polynomials |
| lhs | the left-hand-side polynomial of the comparison |
| rhs | the right-hand-sode polynomial of the comparison |
|
constexpr |
| bool controlpp::operator== | ( | const Polynom< T, N > & | lhs, |
| const Polynom< T, N > & | rhs | ||
| ) |
Compares two polynomials for equality.
| T | The datatype of the polynomials |
| N | The size of the polynomials |
| lhs | the left-hand-side polynomial of the comparison |
| rhs | the right-hand-sode polynomial of the comparison |
|
constexpr |
| ContinuousTransferFunction< T, NumOrder, DenOrder > controlpp::pade_delay | ( | T | delay | ) |
Creates a continuous transfer function approximating a delay using the pade approximation.
The standard Pade approximation where the order of the numerator is equal to the order of the denominator exhibits a jump at t=0 in its step response. To avoid this the use of pade approximations where the numerator order is one less than that of the denominator is reccomended. This gives a better step response
SOME REMARKS ON PADÉ-APPROXIMATION by M.Vajta
| delay | The delay that should be approximated using a |
| T | The value type of the ContinuousTransferFunction |
| NumOrder | The order of the numerator |
| DenOrder | The order of the denominator |
|
constexpr |
Calculates the numerator parameters of the pade approximation.
Calculates the parameter:
\[ Q_k = \frac{(n + m - k)! n!}{(n + m)! k! (n - k)!} \]
For a Pade approximation like:
\[ A = \frac{\sum_{k = 0}^{m} P_k s^k}{\sum_{k = 0}^{n} Q_k s^k} \]
| m | Is the order of the numerator |
| n | Is the order of the denominator |
| k | Is the order of the parameter |
| T | the result type of the function (used for the final division) |
|
constexpr |
Calculates the numerator parameters of the pade approximation.
Calculates the parameter:
\[ P_k = \frac{(m + n - k)! m!}{(m + n)! k! (m - k)!} \]
For a Pade approximation like:
\[ A = \frac{\sum_{k = 0}^{m} P_k s^k}{\sum_{k = 0}^{n} Q_k s^k} \]
| m | Is the order of the numerator |
| n | Is the order of the denominator |
| k | Is the order of the parameter |
| The | result type of the division |
|
constexpr |
Calculates the next pade parameter recursively.
use 1 as the first parameter to calculate the next parameter
\[ \frac{P_{k+1}}{P_k} = \frac{(m - k)}{(k + 1) (m + n - k)} \]
| P_k | The previous pade parameter |
| m | The order of the numerator |
| n | The order of the denominator |
| k | The order of the parameter |
|
constexpr |
Calculates all pade parameters up to the given size.
| params | A pointer to an array of doubles to store the parameters |
| size | The size of the array |
| m | The order of the numerator |
| n | The order of the denominator |
| T | The type of the parameters (default: double) |
| Eigen::Vector< std::complex< T >, DenOrder > controlpp::poles | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf | ) |
| Eigen::Vector< std::complex< T >, DenOrder+1 > controlpp::poles | ( | const TransferFunction< T, NumOrder, DenOrder > & | tf | ) |
|
constexpr |
Power function for integral exponents.
| Eigen::Vector< T, N > controlpp::prewarp_tustin | ( | const Eigen::Vector< T, N > & | omegas, |
| const T & | Ts | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| T controlpp::prewarp_tustin | ( | const T & | omega, |
| const T & | Ts | ||
| ) |
Prewarps frequencies for the tustin transformation.
The tustin transformation stretches frequencies with the scaling:
\[ \omega_d = \frac{2}{T_s} \text{atan}\left( \frac{\omega_c T_s}{2} \right) \]
where:
So for example if you place a continuous time notch filter at 300 Hz and then discretise it with the tustin transformation at a sample frequency of Fs=1kHz the discretised notch will land at 240.6 Hz.
To have the frequencies after the discretisation exactly at the given frequency we 'pre-warp' them with the inverse function which this function provides:
\[ \omega_\text{pre} = \frac{2}{T_s} \text{tan}\left( \frac{\omega_\text{target} T_s}{2} \right) \]
Note that this function returns rad/s and not rad/sample
| T | The value type |
| omega | The frequency before the pre-warping (in rad/s) |
| Ts | The sample time that is also used for the tustin discretisation |
omega.
|
constexpr |
Calculates the product of all numbers in the closed open range [from, to)
| T | The value type of the range |
| from | The first number in the range |
| to | The last number in the range (exclusive) |
| tl::expected< Bode< double >, std::variant< EBodeCsvReadError, csvd::ReadError > > controlpp::read_bode_from_csv | ( | std::istream & | stream, |
| const csvd::Settings & | csv_settings = csvd::Settings(), |
||
| EFrequencyInterpretation | freq_interp = EFrequencyInterpretation::AutoHz, |
||
| EMagnitudeInterpretation | mag_interp = EMagnitudeInterpretation::Auto, |
||
| EPhaseInterpretation | phase_interp = EPhaseInterpretation::AutoDeg |
||
| ) |
Loads bode data from csv data.
TODO
First: searches for the frequency data range. Then for the real and imaginary data ranges. If real and imaginary data could not be identified magnitudes and phases will be searched for.
All following textual comparisons are case insensitive.
"f" to be the frequency data."hz" the frequency is interpreted as Hertz."rad" the frequency is interpreted as Radiant."re" or "im" to be the real and imaginary amplitudes."mag" or "ph" to be absolute magnitudes and phase"dB" the magnitude data will be interpreted in deci-Bell."deg" the phase data is interpreted in degree."rad" the phase data is interpreted in radiants.| stream | |
| settings |
csvd::ReadError) or an error of assembing a bode from the csv EBodeCsvReadError. | void controlpp::shift_up | ( | Iterator | first, |
| Iterator | last, | ||
| const T & | v0 = T(0) |
||
| ) |
Shifts the values in a range up by one position and inserts a new value (copy operation) at the beginning of the range.
| Iterator | The type of the iterators that define the range to shift |
| T | The type of the value to insert at the beginning of the range |
| first | The first iterator of the range (points to the first element of the range) |
| last | The last iterator of the range (points past the last element of the range) |
| v0 | The value to insert at the beginning of the range (default: T(0)) |
| void controlpp::shift_up | ( | Iterator | first, |
| Iterator | last, | ||
| T && | v0 = T(0) |
||
| ) |
Shifts the values in a range up by one position and inserts a new value (move operation) at the beginning of the range.
| Iterator | The type of the iterators that define the range to shift |
| T | The type of the value to insert at the beginning of the range |
| first | The first iterator of the range (points to the first element of the range) |
| last | The last iterator of the range (points past the last element of the range) |
| v0 | The value to insert at the beginning of the range (default: T(0)) |
| std::tuple< T, T > controlpp::slowest_fastest_frequencies | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| T | alternative = static_cast<T>(1) |
||
| ) |
Calculates the slowest (lowest) and fastest (highest) frequencies of a continuous transfer function.
Example:
| tf | A continuous time transfer function |
| alternative | The value to be returned if the transfer function has no dynamics and frequencies to be evaluated. |
[slowest_frequency, fastest_frequency] containing the fastest and slowest frequencies or the alternative. | TimeSeries< T > controlpp::step | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf | ) |
| TimeSeries< T > controlpp::step | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf, |
| const T & | sample_time, | ||
| const T & | simulation_time | ||
| ) |
| TimeSeries< T > controlpp::step | ( | const DiscreteStateSpace< T, NStates, 1, 1 > & | dss, |
| double | Ts, | ||
| double | simulation_time | ||
| ) |
calculates the step response of a system
| dss | A discrete state space model of the system |
| Ts | The sampling frequency |
| simulation_time | The time to be simulated |
Eigen::Vectors | Eigen::Matrix< T, N/2, N/2 > controlpp::symplectic_solver | ( | const Eigen::Matrix< T, N, N > | S | ) |
Solves the hamilton matrix.
For example when solveing the CARE (continuous time ricatti equation).
The solution of the hamiltoin matrix is understood as the result of the operations:
| T | The value type of the parameters/matrix elements (ususally float or double) |
| N | The size of the hamilton matrix |
| H | The hamilton matrix |
| ContinuousStateSpace< T, DenOrder, 1, 1 > controlpp::to_continuous_state_space | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | ctf | ) |
constructs a continuous state space function from a continuous transfer function
| ContinuousStateSpace< T, DenOrder, 1, 1 > controlpp::to_continuous_state_space | ( | const TransferFunction< T, NumOrder, DenOrder > & | rp | ) |
constructs a continuous state space function from a rational polynom
| T controlpp::to_dB | ( | const T & | value | ) |
| Eigen::Vector< T, N > controlpp::to_deg | ( | const Eigen::Vector< T, N > & | rad | ) |
| T controlpp::to_deg | ( | const T & | rad | ) |
| DiscreteStateSpace< ValueType, DenOrder, 1, 1 > controlpp::to_discrete_state_space | ( | const DiscreteTransferFunction< ValueType, NumOrder, DenOrder > & | dtf | ) |
constructs a continuous state space function from a continuous transfer function
| DiscreteStateSpace< T, DenOrder, 1, 1 > controlpp::to_discrete_state_space | ( | const TransferFunction< T, NumOrder, DenOrder > & | rp | ) |
constructs a discrete state space function from a rational polynom
| Eigen::Vector< T, N > controlpp::to_hz | ( | const Eigen::Vector< T, N > & | radps | ) |
| T controlpp::to_hz | ( | const T & | radps | ) |
Converts a number from radiants per second to herz.
| T | The data type |
| radps | The input value in radiants per second |
| Eigen::Vector< T, N > controlpp::to_rad | ( | const Eigen::Vector< T, N > & | deg | ) |
| T controlpp::to_rad | ( | const T & | deg | ) |
| Eigen::Vector< T, N > controlpp::to_radps | ( | const Eigen::Vector< T, N > & | hz | ) |
| T controlpp::to_radps | ( | const T & | hz | ) |
Converts a number from herz to radiants per second.
| T | The data type |
| radps | The input value in herz |
| ContinuousStateSpace< T, DenOrder, 1, 1 > controlpp::to_state_space | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | ctf | ) |
constructs a continuous state space function from a continuous transfer function
| DiscreteStateSpace< ValueType, DenOrder, 1, 1 > controlpp::to_state_space | ( | const DiscreteTransferFunction< ValueType, NumOrder, DenOrder > & | dtf | ) |
constructs a continuous state space function from a continuous transfer function
| StateSpace< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic > controlpp::to_state_space | ( | const Eigen::Matrix< TransferFunction< T, Eigen::Dynamic, Eigen::Dynamic >, NRows, NCols, Opts, NMaxRows, NMaxCols > & | Mtf | ) |
Generates the block diagonal state space representation of the system of transfer functions.
The matrix of transfer functions represensts a multiple input and multiple output system where:
| T | The data type of the matrix elements and transfer function parameters. (Usually float or double) |
| Mtf | A Matrix of transfer functions |
| StateSpace< T, DenOrder, 1, 1 > controlpp::to_state_space | ( | const TransferFunction< T, NumOrder, DenOrder > & | rp | ) |
calculates the observer-normed state space representation from a rational polynomial
| StateSpace< T, DenOrder, 1, 1 > controlpp::to_state_space_controller_norm | ( | const TransferFunction< T, NumOrder, DenOrder > & | rp | ) |
calculates the control-normed state space representation from a rational polynomial
The transfer function:
\[ Tf(s) = \frac{b_0 + b_1 s + \cdots + b_n s^{n}}{a_0 + a_1 s + \cdots + a_n s^{n}} \]
will be turned into the state space system:
\[ \dot{x} = A x + B u y = C x + D u \]
with:
\[ \hat{a}_j = a_j / a_n \]
\[ \hat{b}_j = b_j / a_n \]
\[ A = \begin{bmatrix} 0 & 1 & 0 & 0 & \cdots & 0 \\ 0 & 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & 0 & \cdots & 1 \\ -\hat{a}_0 & -\hat{a}_1 & -\hat{a}_2 & -\hat{a}_3 & \cdots & -\hat{a}_{n-1} \end{bmatrix} \]
\[ B = \begin{bmatrix} 0 \\ \vdots \\ 1 \end{bmatrix} \]
\[ C = \begin{bmatrix} \hat{b}_0 - \hat{a}_0 \hat{b}_n & b_1 - \hat{a}_1 \hat{b}_n & \cdots & \hat{b}_{n-1} - \hat{a}_{n-1} \hat{b}_n \end{bmatrix} \]
\[ D = \hat{b}_n \]
| StateSpace< T, DenOrder, 1, 1 > controlpp::to_state_space_observer_norm | ( | const TransferFunction< T, NumOrder, DenOrder > & | rp | ) |
calculates the observer-normed state space representation from a rational polynomial
|
inline |
| ContinuousTransferFunction< T, states+1, states+1 > controlpp::to_transfer_function | ( | const ContinuousStateSpace< T, states, 1, 1 > & | dss | ) |
Transforms a discrete state space system to a discrete transfer function.
controlpp::DiscreteTransferFunction | TransferFunction< T, states+1, states+1 > controlpp::to_transfer_function | ( | const StateSpace< T, states, 1, 1 > & | css | ) |
transforms a continuous state space system representation to a transfer function representation
Uses the formular:
\[ G(s) = \mathbf{C} \left( s \mathbf{I} - \mathbf{A} \right)^{-1} \mathbf{B} + D \]
| Eigen::Vector< T, N > controlpp::unwarp_tustin | ( | const Eigen::Vector< T, N > & | omegas, |
| const T & | Ts | ||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| T controlpp::unwarp_tustin | ( | const T & | omega, |
| const T & | Ts | ||
| ) |
provides the inverse to prewarp_tustin:
\[ \omega_d = \frac{2}{T_s} \text{atan}\left( \frac{\omega_c T_s}{2} \right) \]
Calculates where the tustin transformation would actually place the frequency after discretisation.
| T | The value type |
| omega | The input frequency |
| Ts | The sample time |
| Eigen::Vector< T, N > controlpp::unwrap | ( | const Eigen::Vector< T, N > & | y, |
| const T & | modulo | ||
| ) |
Unwinds modulo jumps.
Checks wheather jumps in occur that are larger than the threshold, and if so the modulo is added or subtracted n times so that the step \(y_{k+1} - y_{k}\) is within the bounds [-threshold, +threshold].
| y | The vector to be unwrapped |
| modulo | The modulo to unwrap. Will be added/subtracted n times to minimize variance. |
| Eigen::Vector< T, N > controlpp::unwrap_deg | ( | const Eigen::Vector< T, N > & | phases | ) |
Unwinds phase jumps of \(2 \pi\) in degrees.
| phase | A vector op phases (deg) |
| Eigen::Vector< T, N > controlpp::unwrap_rad | ( | const Eigen::Vector< T, N > & | phases | ) |
Unwinds phase jumps of \(2 \pi\) in radiants.
| phase | A vector op phases (rad) |
| void controlpp::write_csv | ( | std::ostream & | stream, |
| const Bode< T > & | bode | ||
| ) |
Prints a bode plot to an output stream as a .csv file.
| stream | The stream to be printed to |
| bode | The bode container with the frequencies, magnitudes and phases |
| void controlpp::write_csv | ( | std::ostream & | stream, |
| const TimeSeries< T > & | timeseries | ||
| ) |
Prints the timeseries as a .csv file.
| T | The datatype of the timeseries |
| N | The size of the timeseries |
| stream | The output stream/file that should be printed to |
| timeseries | The timeseries holding the data |
operator<< chaining | Eigen::Vector< std::complex< T >, NumOrder > controlpp::zeros | ( | const ContinuousTransferFunction< T, NumOrder, DenOrder > & | tf | ) |
| Eigen::Vector< std::complex< T >, 0 > controlpp::zeros | ( | const Polynom< T, 0 > & | polynom | ) |
Returns an empty vector resembling the absence of solutions.
| Eigen::Vector< std::complex< T >, 1 > controlpp::zeros | ( | const Polynom< T, 1 > & | polynom | ) |
calculates the zeros/roots of a polynomial
Specialisation for polynomials of degree 1.
Solves the following equation:
\[ 0 = a_0 + a_1 x \]
| Eigen::Vector< std::complex< T >, 2 > controlpp::zeros | ( | const Polynom< T, 2 > & | polynom | ) |
calculates the zeros/roots of a polynomial
Specialisation for polynomials of degree 1.
\[ 0 = a_0 + a_1 x + a_2 x^2 \]
| Eigen::Vector< std::complex< T >, N > controlpp::zeros | ( | const Polynom< T, N > & | polynom | ) |
Calculates the zeros of a polynomial.
Uses the companion matrix to solve for the zeros of the polynomial
| Eigen::Vector< std::complex< T >, NumOrder+1 > controlpp::zeros | ( | const TransferFunction< T, NumOrder, DenOrder > & | tf | ) |