lds::System

lds::System #

Linear Dynamical System Type.
#include <lds_sys.h>

Inherited by lds::gaussian::System, lds::poisson::System

Public Functions #

Name
System() =default
Constructs a new System.
System(size_t n_u, size_t n_x, size_t n_y, data_t dt, data_t p0 =kDefaultP0, data_t q0 =kDefaultQ0)
constructs a new System
virtual ~System()
void Filter(const Vector & u_tm1, const Vector & z)
Filter data to produce causal state estimates.
virtual const Vector & Simulate(const Vector & u_tm1) =0
simulates system (single time step)
void f(const Vector & u, bool do_add_noise =false)
system dynamics function
virtual void h() =0
system output function
size_t n_u() const
Get number of inputs.
size_t n_x() const
Get number of states.
size_t n_y() const
Get number of outputs.
data_t dt() const
Get sample period.
const Vector & x() const
Get current state.
const Matrix & P() const
Get covariance of state estimate.
const Vector & m() const
Get current process disturbance/bias.
const Matrix & P_m() const
Get covariance of process disturbance estimate.
const Vector & cx() const
Get C*x.
const Vector & y() const
Get output.
const Vector & x0() const
Get initial state.
const Vector & m0() const
Get initial disturbance.
const Matrix & A() const
Get state matrix.
const Matrix & B() const
Get input matrix.
const Vector & g() const
Get input gain/conversion factor.
const Matrix & C() const
Get output matrix.
const Vector & d() const
Get output bias.
const Matrix & Ke() const
Get estimator gain.
const Matrix & Ke_m() const
Get estimator gain for process disturbance (m)
const Matrix & Q()
Get process noise covariance.
const Matrix & Q_m()
Get process noise covariance of disturbance evoluation.
const Matrix & P0()
Get covariance of initial state.
const Matrix & P0_m()
Get covariance of initial process disturbance.
void set_A(const Matrix & A)
Set state matrix.
void set_B(const Matrix & B)
Set input matrix.
void set_m(const Vector & m, bool do_force_assign =false)
Set process disturbance.
void set_g(const Vector & g)
Set input gain.
void set_Q(const Matrix & Q)
Set process noise covariance.
void set_Q_m(const Matrix & Q_m)
Set process noise covariance of disturbance evoluation.
void set_x0(const Vector & x0)
Set initial state.
void set_P0(const Matrix & P0)
Set covariance of initial state.
void set_P0_m(const Matrix & P0_m)
Set covariance of initial process disturbance.
void set_C(const Matrix & C)
Set output matrix.
void set_d(const Vector & d)
Set output bias.
void set_x(const Vector & x)
Set state of system.
void Reset()
Reset system variables.
void Print()
Print system variables to stdout.

Protected Functions #

Name
virtual void RecurseKe() =0
Recursively recalculate estimator gain (Ke)
void InitVars(data_t p0 =kDefaultP0, data_t q0 =kDefaultQ0)

Public Attributes #

Name
bool do_adapt_m
whether to adaptively estimate disturbance m

Protected Attributes #

Name
std::size_t n_x_
number of states
std::size_t n_u_
number of inputs
std::size_t n_y_
number of outputs
data_t dt_
sample period
Vector x_
state
Matrix P_
covariance of state estimate
Vector m_
process disturbance
Matrix P_m_
covariance of disturbance estimate
Vector cx_
C*x.
Vector y_
output
Vector z_
measurement
Vector x0_
initial state
Matrix P0_
covariance of initial state estimate
Vector m0_
initial process disturbance
Matrix P0_m_
covariance of initial disturbance est.
Matrix A_
state matrix
Matrix B_
input matrix
Vector g_
input gain
Matrix Q_
covariance of process noise
Matrix Q_m_
covariance of disturbance random walk
Matrix C_
output matrix
Vector d_
output bias
Matrix Ke_
estimator gain
Matrix Ke_m_
estimator gain for process disturbance


Public Function Details #

System #

System() =default

System #

System(
    size_t n_u,
    size_t n_x,
    size_t n_y,
    data_t dt,
    data_t p0 =kDefaultP0,
    data_t q0 =kDefaultQ0
)

Parameters:

  • n_u number of inputs
  • n_x number of states
  • n_y number of outputs
  • dt sample period
  • p0 diagonal elements for state estimate covariance
  • q0 diagonal elements for process noise covariance

~System #

inline virtual ~System()

Filter #

void Filter(
    const Vector & u_tm1,
    const Vector & z
)

Parameters:

  • u_tm1 input at t-minus-1
  • z_t current measurement

Given current measurement and input, filter data to produce causal state estimates using Kalman filtering, which procedes by predicting the state and subsequently updating.


Simulate #

virtual const Vector & Simulate(
    const Vector & u_tm1
) =0

Parameters:

  • u_tm1 input at time t-1

Return: simulated measurement at time t

Reimplemented by: lds::poisson::System::Simulate, lds::gaussian::System::Simulate


f #

inline void f(
    const Vector & u,
    bool do_add_noise =false
)

Parameters:

  • u input
  • do_add_noise whether to add simulated process noise

h #

virtual void h() =0

Reimplemented by: lds::poisson::System::h, lds::gaussian::System::h


n_u #

inline size_t n_u() const

n_x #

inline size_t n_x() const

n_y #

inline size_t n_y() const

dt #

inline data_t dt() const

x #

inline const Vector & x() const

P #

inline const Matrix & P() const

m #

inline const Vector & m() const

P_m #

inline const Matrix & P_m() const

cx #

inline const Vector & cx() const

y #

inline const Vector & y() const

x0 #

inline const Vector & x0() const

m0 #

inline const Vector & m0() const

A #

inline const Matrix & A() const

B #

inline const Matrix & B() const

g #

inline const Vector & g() const

C #

inline const Matrix & C() const

d #

inline const Vector & d() const

Ke #

inline const Matrix & Ke() const

Ke_m #

inline const Matrix & Ke_m() const

Q #

inline const Matrix & Q()

Q_m #

inline const Matrix & Q_m()

P0 #

inline const Matrix & P0()

P0_m #

inline const Matrix & P0_m()

set_A #

inline void set_A(
    const Matrix & A
)

set_B #

inline void set_B(
    const Matrix & B
)

set_m #

inline void set_m(
    const Vector & m,
    bool do_force_assign =false
)

set_g #

inline void set_g(
    const Vector & g
)

set_Q #

inline void set_Q(
    const Matrix & Q
)

set_Q_m #

inline void set_Q_m(
    const Matrix & Q_m
)

set_x0 #

inline void set_x0(
    const Vector & x0
)

set_P0 #

inline void set_P0(
    const Matrix & P0
)

set_P0_m #

inline void set_P0_m(
    const Matrix & P0_m
)

set_C #

inline void set_C(
    const Matrix & C
)

set_d #

inline void set_d(
    const Vector & d
)

set_x #

inline void set_x(
    const Vector & x
)

Reset #

void Reset()

Print #

void Print()

Protected Function Details #

RecurseKe #

virtual void RecurseKe() =0

Reimplemented by: lds::poisson::System::RecurseKe, lds::gaussian::System::RecurseKe


InitVars #

void InitVars(
    data_t p0 =kDefaultP0,
    data_t q0 =kDefaultQ0
)

Public Attribute Details #

do_adapt_m #

bool do_adapt_m {};

Protected Attribute Details #

**n_x_** #

std::size_t n_x_ {};

**n_u_** #

std::size_t n_u_ {};

**n_y_** #

std::size_t n_y_ {};

**dt_** #

data_t dt_ {};

**x_** #

Vector x_;

**P_** #

Matrix P_;

**m_** #

Vector m_;

**P_m_** #

Matrix P_m_;

**cx_** #

Vector cx_;

**y_** #

Vector y_;

**z_** #

Vector z_;

**x0_** #

Vector x0_;

**P0_** #

Matrix P0_;

**m0_** #

Vector m0_;

**P0_m_** #

Matrix P0_m_;

**A_** #

Matrix A_;

**B_** #

Matrix B_;

**g_** #

Vector g_;

**Q_** #

Matrix Q_;

**Q_m_** #

Matrix Q_m_;

**C_** #

Matrix C_;

**d_** #

Vector d_;

**Ke_** #

Matrix Ke_;

**Ke_m_** #

Matrix Ke_m_;


Updated on 19 May 2022 at 17:16:04 Eastern Daylight Time