lds::Controller #
Inherited by lds::gaussian::Controller, lds::poisson::Controller, lds::SwitchedController< System >
Public Functions #
Name | |
---|---|
Controller() =default Constructs a new Controller. |
|
Controller(const System & sys, data_t u_lb, data_t u_ub, size_t control_type =0) Constructs a new Controller. |
|
Controller(System && sys, data_t u_lb, data_t u_ub, size_t control_type =0) Constructs a new Controller by moving the system object. |
|
const Vector & | Control(const Vector & z, bool do_control =true, bool do_lock_control =false, data_t sigma_soft_start =0, data_t sigma_u_noise =0, bool do_reset_at_control_onset =true) updates control signal (single-step) |
const Vector & | ControlOutputReference(const Vector & z, bool do_control =true, bool do_estimation =true, bool do_lock_control =false, data_t sigma_soft_start =0, data_t sigma_u_noise =0, bool do_reset_at_control_onset =true) updates control signal, given previously-set (single-step) |
const System & | sys() const |
const Matrix & | Kc() const Get state feedback controller gain. |
const Matrix & | Kc_inty() const Get integral controller gain. |
const Matrix & | Kc_u() const Get input feedback controller gain. |
const Vector & | g_design() const Get input gain used in controller design. |
const Vector & | u_ref() const Get reference input. |
const Vector & | x_ref() const Get reference state. |
const Vector & | y_ref() const Get reference output. |
size_t | control_type() const Get controller type. |
data_t | tau_awu() const Get time constant of anti-integral-windup. |
data_t | u_lb() const Get control lower bound. |
data_t | u_ub() const Get control upper bound. |
void | set_sys(const System & sys) Set system. |
void | set_g_design(const Vector & g_design) Set input gain used in controller design (g_design) |
void | set_u_ref(const Vector & u_ref) Set reference input (u_ref) |
void | set_x_ref(const Vector & x_ref) Set reference state (x_ref) |
virtual void | set_y_ref(const Vector & y_ref) Set reference output (y_ref) |
void | set_Kc(const Matrix & Kc) Set state controller gain. |
void | set_Kc_inty(const Matrix & Kc_inty) Set integral controller gain. |
void | set_Kc_u(const Matrix & Kc_u) Set input controller gain. |
void | set_tau_awu(data_t tau) Set time constant of anti-integral-windup. |
void | set_control_type(size_t control_type) Sets the control type. |
void | set_u_lb(data_t u_lb) sets control lower bound |
void | set_u_ub(data_t u_ub) Sets control upper bound. |
void | Reset() reset system and control variables. |
void | Print() prints variables to stdout |
Protected Attributes #
Name | |
---|---|
System | sys_ underlying LDS |
Vector | u_ control signal |
Vector | u_return_ control signal that is returned to user |
Vector | g_design_ input gain of the system used for controller design |
Vector | u_ref_ reference input |
Vector | u_ref_prev_ reference input at previous time step |
Vector | x_ref_ reference state |
Vector | y_ref_ reference output |
Vector | cx_ref_ |
Matrix | Kc_ state controller gain |
Matrix | Kc_u_ input controller gain (optional when control updates ) |
Matrix | Kc_inty_ integral controller gain |
Vector | du_ref_ |
Vector | dv_ref_ |
Vector | v_ref_ |
Vector | dv_ |
Vector | v_ Control after g inversion (e.g., control in physical units) |
Vector | int_e_ integrated error |
Vector | int_e_awu_adjust_ anti-windup adjustment to intE |
Vector | u_sat_ control signal after saturation (for antiWindup) |
bool | do_control_prev_ |
bool | do_lock_control_prev_ |
bool | u_saturated_ whether control signal has reached saturation limits |
data_t | u_lb_ lower bound on control |
data_t | u_ub_ upper bound on control |
data_t | tau_awu_ antiwindup time constant |
data_t | k_awu_ |
data_t | t_since_control_onset_ time since control epoch onset |
size_t | control_type_ controller type |
Detailed Description #
template <typename System >
class lds::Controller;
Public Function Details #
Controller #
Controller() =default
Controller #
inline Controller(
const System & sys,
data_t u_lb,
data_t u_ub,
size_t control_type =0
)
Parameters:
- sys System (derived from lds::System)
- u_lb lower bound on control (u)
- u_ub upper bound on control (u)
- control_type [optional] control type bit mask
Template Parameters:
- System type derived from lds::System
Controller #
inline Controller(
System && sys,
data_t u_lb,
data_t u_ub,
size_t control_type =0
)
Parameters:
- sys System (derived from lds::System)
- u_lb lower bound on control (u)
- u_ub upper bound on control (u)
- control_type [optional] control type bit mask
Template Parameters:
- System type derived from lds::System
Control #
inline const Vector & Control(
const Vector & z,
bool do_control =true,
bool do_lock_control =false,
data_t sigma_soft_start =0,
data_t sigma_u_noise =0,
bool do_reset_at_control_onset =true
)
Parameters:
- z measurement
- do_control [optional] whether to update control (true) or simply feed through u_ref (false)
- do_lock_control [optional] whether to lock control at its current value
- sigma_soft_start [optional] standard deviation (sigma) of a Gaussian soft-start to control (do_control from false to true)
- sigma_u_noise [optional] standard deviation (sigma) of Gaussian noise added on top of control signal
- do_reset_at_control_onset [optional] whether to reset controller at control epoch onset (i.e., do_control from false to true)
Return: updated control signal
Updates the control signal (single-step). This is the most flexible option, but requires user to have set the controller’s y_ref, x_ref, and u_ref variables.
ControlOutputReference #
inline const Vector & ControlOutputReference(
const Vector & z,
bool do_control =true,
bool do_estimation =true,
bool do_lock_control =false,
data_t sigma_soft_start =0,
data_t sigma_u_noise =0,
bool do_reset_at_control_onset =true
)
Parameters:
- z measurement
- do_control [optional] whether to update control (true) or simply feed through u_ref (false)
- do_estimation [optional] whether to update state estimate (if false, effectively open-loop control)
- do_lock_control [optional] whether to lock control at its current value
- sigma_soft_start [optional] standard deviation (sigma) of a Gaussian soft-start to control (do_control from false to true)
- sigma_u_noise [optional] standard deviation (sigma) of Gaussian noise added on top of control signal
- do_reset_at_control_onset [optional] whether to reset controller at control epoch onset (i.e., do_control from false to true)
Return: updated control signal
Updates the control signal (single-step), given previously-set y_ref. This method calculates the rest of the set point (u_ref, x_ref) that is required to for the system to be at y_ref at steady state. This is accomplished by linearly-constrained least-squares. For a single-output system, the solution should be exact within control saturation limits. For a multi-output system, it provides the least-squares comprimise across the outputs.
sys #
inline const System & sys() const
Kc #
inline const Matrix & Kc() const
Kc_inty #
inline const Matrix & Kc_inty() const
Kc_u #
inline const Matrix & Kc_u() const
g_design #
inline const Vector & g_design() const
u_ref #
inline const Vector & u_ref() const
x_ref #
inline const Vector & x_ref() const
y_ref #
inline const Vector & y_ref() const
control_type #
inline size_t control_type() const
tau_awu #
inline data_t tau_awu() const
u_lb #
inline data_t u_lb() const
u_ub #
inline data_t u_ub() const
set_sys #
inline void set_sys(
const System & sys
)
set_g_design #
inline void set_g_design(
const Vector & g_design
)
set_u_ref #
inline void set_u_ref(
const Vector & u_ref
)
set_x_ref #
inline void set_x_ref(
const Vector & x_ref
)
set_y_ref #
inline virtual void set_y_ref(
const Vector & y_ref
)
Reimplemented by: lds::poisson::SwitchedController::set_y_ref, lds::gaussian::SwitchedController::set_y_ref, lds::poisson::Controller::set_y_ref, lds::gaussian::Controller::set_y_ref
set_Kc #
inline void set_Kc(
const Matrix & Kc
)
set_Kc_inty #
inline void set_Kc_inty(
const Matrix & Kc_inty
)
set_Kc_u #
inline void set_Kc_u(
const Matrix & Kc_u
)
set_tau_awu #
inline void set_tau_awu(
data_t tau
)
set_control_type #
inline void set_control_type(
size_t control_type
)
Parameters:
- control_type control type bit mask
Template Parameters:
- System type derived from lds::System
set_u_lb #
inline void set_u_lb(
data_t u_lb
)
Parameters:
- u_lb control lower bound
set_u_ub #
inline void set_u_ub(
data_t u_ub
)
Parameters:
- u_ub control upper bound
Reset #
inline void Reset()
Print #
inline void Print()
Protected Attribute Details #
**sys_** #
System sys_;
**u_** #
Vector u_;
**u_return_** #
Vector u_return_;
**g_design_** #
Vector g_design_;
**u_ref_** #
Vector u_ref_;
**u_ref_prev_** #
Vector u_ref_prev_;
**x_ref_** #
Vector x_ref_;
**y_ref_** #
Vector y_ref_;
**cx_ref_** #
Vector cx_ref_;
**Kc_** #
Matrix Kc_;
**Kc_u_** #
Matrix Kc_u_;
**Kc_inty_** #
Matrix Kc_inty_;
**du_ref_** #
Vector du_ref_;
**dv_ref_** #
Vector dv_ref_;
**v_ref_** #
Vector v_ref_;
**dv_** #
Vector dv_;
**v_** #
Vector v_;
**int_e_** #
Vector int_e_;
**int_e_awu_adjust_** #
Vector int_e_awu_adjust_;
**u_sat_** #
Vector u_sat_;
**do_control_prev_** #
bool do_control_prev_ = false;
**do_lock_control_prev_** #
bool do_lock_control_prev_ = false;
**u_saturated_** #
bool u_saturated_ =
false;
**u_lb_** #
data_t u_lb_ {};
**u_ub_** #
data_t u_ub_ {};
**tau_awu_** #
data_t tau_awu_ {};
**k_awu_** #
data_t k_awu_ = 0;
**t_since_control_onset_** #
data_t t_since_control_onset_ = 0;
**control_type_** #
size_t control_type_ {};
Updated on 19 May 2022 at 17:16:03 Eastern Daylight Time