Controlpp
Loading...
Searching...
No Matches
controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs > Class Template Reference

Matrix (A, B, C, D) representation of a linear time invariant system. More...

#include <controlpp/DiscreteStateSpace.hpp>

Public Types

using value_type = ValueType
 
using state_space_type = StateSpace< ValueType, internal_states, inputs, outputs >
 
using A_matrix_type = typename state_space_type::A_matrix_type
 
using B_matrix_type = typename state_space_type::B_matrix_type
 
using C_matrix_type = typename state_space_type::C_matrix_type
 
using D_matrix_type = typename state_space_type::D_matrix_type
 

Public Member Functions

 DiscreteStateSpace ()=default
 
 DiscreteStateSpace (const DiscreteStateSpace &)=default
 
DiscreteStateSpaceoperator= (const DiscreteStateSpace &)=default
 
 DiscreteStateSpace (const Eigen::Matrix< ValueType, internal_states, internal_states > &A, const Eigen::Matrix< ValueType, internal_states, inputs > &B, const Eigen::Matrix< ValueType, outputs, internal_states > &C, const Eigen::Matrix< ValueType, outputs, inputs > &D)
 
 DiscreteStateSpace (const state_space_type &state_space)
 
const state_space_typestate_space () const
 
state_space_typestate_space ()
 
std::tuple< Eigen::Vector< ValueType, internal_states >, Eigen::Vector< ValueType, outputs > > eval (const Eigen::Vector< ValueType, internal_states > &x, const Eigen::Vector< ValueType, inputs > &u) const
 calculates the next states and calculates the output from the previous states and new inputs
 
template<std::convertible_to< ValueType > U>
requires (inputs == 1 && outputs != 1)
std::tuple< Eigen::Vector< U, internal_states >, Eigen::Vector< U, outputs > > eval (const Eigen::Vector< U, internal_states > &x, const U &u_scalar) const
 calculates the next states and calculates the output from the previous states and new inputs
 
template<std::convertible_to< ValueType > U>
requires (inputs == 1 && outputs == 1)
std::tuple< Eigen::Vector< U, internal_states >, U > eval (const Eigen::Vector< U, internal_states > &x, const U &u_scalar) const
 calculates the next states and calculates the output from the previous states and new inputs
 
A_matrix_typeA ()
 
B_matrix_typeB ()
 
C_matrix_typeC ()
 
D_matrix_typeD ()
 
const A_matrix_typeA () const
 
const B_matrix_typeB () const
 
const C_matrix_typeC () const
 
const D_matrix_typeD () const
 

Static Public Attributes

static constexpr int number_of_states = internal_states
 
static constexpr int number_of_inputs = inputs
 
static constexpr int number_of_outputs = outputs
 

Friends

std::ostream & operator<< (std::ostream &stream, const DiscreteStateSpace &dss)
 

Detailed Description

template<class ValueType, int internal_states, int inputs, int outputs>
class controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >

Matrix (A, B, C, D) representation of a linear time invariant system.

\[ \hat{x} = \mathbf{A} x + \mathbf{B} u \]

\[ y = \mathbf{C} x + \mathbf{D} u \]

  • u is the input
  • x are the internal states
  • y is the output

This is only a representation using the A, B, C, D matrices. This does not contain an internal state. You may use the .eval() method, but have to provide the state manually.

If you want a system with internal state have a look at: DssFilter.

This is a type wrapper around controlpp::StateSpace

See also
controlpp::StateSpace
controlpp::DiscreteTransferFunction
controlpp::DssFilter
Template Parameters
ValueTypeThe value type of the matrix elements and arithmetic calculations (usually double or float)
internal_statesThe number of internal states, this influences the size of the A, B and C matrices
inputsThe number of input to the system, this influences the size of the B and D matrix
outputsThe number of outputs of the system, this influences the size of the C and D matrix

Member Typedef Documentation

◆ A_matrix_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::A_matrix_type = typename state_space_type::A_matrix_type

◆ B_matrix_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::B_matrix_type = typename state_space_type::B_matrix_type

◆ C_matrix_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::C_matrix_type = typename state_space_type::C_matrix_type

◆ D_matrix_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::D_matrix_type = typename state_space_type::D_matrix_type

◆ state_space_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::state_space_type = StateSpace<ValueType, internal_states, inputs, outputs>

◆ value_type

template<class ValueType , int internal_states, int inputs, int outputs>
using controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::value_type = ValueType

Constructor & Destructor Documentation

◆ DiscreteStateSpace() [1/4]

template<class ValueType , int internal_states, int inputs, int outputs>
controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::DiscreteStateSpace ( )
default

◆ DiscreteStateSpace() [2/4]

template<class ValueType , int internal_states, int inputs, int outputs>
controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::DiscreteStateSpace ( const DiscreteStateSpace< ValueType, internal_states, inputs, outputs > &  )
default

◆ DiscreteStateSpace() [3/4]

template<class ValueType , int internal_states, int inputs, int outputs>
controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::DiscreteStateSpace ( const Eigen::Matrix< ValueType, internal_states, internal_states > &  A,
const Eigen::Matrix< ValueType, internal_states, inputs > &  B,
const Eigen::Matrix< ValueType, outputs, internal_states > &  C,
const Eigen::Matrix< ValueType, outputs, inputs > &  D 
)
inline

◆ DiscreteStateSpace() [4/4]

template<class ValueType , int internal_states, int inputs, int outputs>
controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::DiscreteStateSpace ( const state_space_type state_space)
inline

Member Function Documentation

◆ A() [1/2]

template<class ValueType , int internal_states, int inputs, int outputs>
A_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::A ( )
inline

◆ A() [2/2]

template<class ValueType , int internal_states, int inputs, int outputs>
const A_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::A ( ) const
inline

◆ B() [1/2]

template<class ValueType , int internal_states, int inputs, int outputs>
B_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::B ( )
inline

◆ B() [2/2]

template<class ValueType , int internal_states, int inputs, int outputs>
const B_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::B ( ) const
inline

◆ C() [1/2]

template<class ValueType , int internal_states, int inputs, int outputs>
C_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::C ( )
inline

◆ C() [2/2]

template<class ValueType , int internal_states, int inputs, int outputs>
const C_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::C ( ) const
inline

◆ D() [1/2]

template<class ValueType , int internal_states, int inputs, int outputs>
D_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::D ( )
inline

◆ D() [2/2]

template<class ValueType , int internal_states, int inputs, int outputs>
const D_matrix_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::D ( ) const
inline

◆ eval() [1/3]

template<class ValueType , int internal_states, int inputs, int outputs>
template<std::convertible_to< ValueType > U>
requires (inputs == 1 && outputs != 1)
std::tuple< Eigen::Vector< U, internal_states >, Eigen::Vector< U, outputs > > controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::eval ( const Eigen::Vector< U, internal_states > &  x,
const U &  u_scalar 
) const
inline

calculates the next states and calculates the output from the previous states and new inputs

Returns
a tuple of [nest_states, output]

◆ eval() [2/3]

template<class ValueType , int internal_states, int inputs, int outputs>
template<std::convertible_to< ValueType > U>
requires (inputs == 1 && outputs == 1)
std::tuple< Eigen::Vector< U, internal_states >, U > controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::eval ( const Eigen::Vector< U, internal_states > &  x,
const U &  u_scalar 
) const
inline

calculates the next states and calculates the output from the previous states and new inputs

Returns
a tuple of [nest_states, output]

◆ eval() [3/3]

template<class ValueType , int internal_states, int inputs, int outputs>
std::tuple< Eigen::Vector< ValueType, internal_states >, Eigen::Vector< ValueType, outputs > > controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::eval ( const Eigen::Vector< ValueType, internal_states > &  x,
const Eigen::Vector< ValueType, inputs > &  u 
) const
inline

calculates the next states and calculates the output from the previous states and new inputs

Returns
a tuple of [nest_states, output]

◆ operator=()

template<class ValueType , int internal_states, int inputs, int outputs>
DiscreteStateSpace & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::operator= ( const DiscreteStateSpace< ValueType, internal_states, inputs, outputs > &  )
default

◆ state_space() [1/2]

template<class ValueType , int internal_states, int inputs, int outputs>
state_space_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::state_space ( )
inline

◆ state_space() [2/2]

template<class ValueType , int internal_states, int inputs, int outputs>
const state_space_type & controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::state_space ( ) const
inline

Friends And Related Symbol Documentation

◆ operator<<

template<class ValueType , int internal_states, int inputs, int outputs>
std::ostream & operator<< ( std::ostream &  stream,
const DiscreteStateSpace< ValueType, internal_states, inputs, outputs > &  dss 
)
friend

Member Data Documentation

◆ number_of_inputs

template<class ValueType , int internal_states, int inputs, int outputs>
constexpr int controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::number_of_inputs = inputs
staticconstexpr

◆ number_of_outputs

template<class ValueType , int internal_states, int inputs, int outputs>
constexpr int controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::number_of_outputs = outputs
staticconstexpr

◆ number_of_states

template<class ValueType , int internal_states, int inputs, int outputs>
constexpr int controlpp::DiscreteStateSpace< ValueType, internal_states, inputs, outputs >::number_of_states = internal_states
staticconstexpr

The documentation for this class was generated from the following file: