- 3.0.2 core module.
ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR > Class Template Reference

interface class for a general linear system or linearized system More...

#include <SensitivityApproximation.h>

Inheritance diagram for ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >:
ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR > ct::core::DiscreteLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR > ct::core::DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > ct::core::DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALAR >

Public Types

typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALARstate_control_matrix_t
 input Jacobian type More...
 
- Public Types inherited from ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >
typedef std::shared_ptr< ControlVectorArray< CONTROL_DIM, SCALAR > > ControlVectorArrayPtr
 
- Public Types inherited from ct::core::DiscreteLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >
typedef Base::time_t time_t
 
typedef Base::state_vector_t state_vector_t
 
typedef Base::control_vector_t control_vector_t
 
typedef StateMatrix< STATE_DIM, SCALARstate_matrix_t
 state Jacobian type More...
 
typedef StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALARstate_control_matrix_t
 input Jacobian type More...
 
- Public Types inherited from ct::core::DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
typedef DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALARBase
 
typedef Base::state_vector_t state_vector_t
 
typedef Base::control_vector_t control_vector_t
 
typedef Base::time_t time_t
 
- Public Types inherited from ct::core::DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALAR >
typedef int time_t
 the type of the time variable More...
 
typedef StateVector< STATE_DIM, SCALARstate_vector_t
 
typedef ControlVector< CONTROL_DIM, SCALARcontrol_vector_t
 

Public Member Functions

 SensitivityApproximation (const SCALAR &dt, const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &linearSystem=nullptr, const SensitivityApproximationSettings::APPROXIMATION &approx=SensitivityApproximationSettings::APPROXIMATION::FORWARD_EULER)
 constructor More...
 
 SensitivityApproximation (const SensitivityApproximationSettings &settings, const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &linearSystem=nullptr)
 constructor More...
 
 SensitivityApproximation (const SensitivityApproximation &other)
 copy constructor More...
 
virtual ~SensitivityApproximation ()
 destructor More...
 
virtual SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR > * clone () const override
 deep cloning More...
 
virtual void setApproximation (const SensitivityApproximationSettings::APPROXIMATION &approx) override
 update the approximation type for the discrete-time system More...
 
SensitivityApproximationSettings::APPROXIMATION getApproximation () const
 retrieve the approximation type for the discrete-time system More...
 
virtual void setLinearSystem (const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &linearSystem) override
 update the linear system More...
 
virtual void setTimeDiscretization (const SCALAR &dt) override
 update the time discretization More...
 
void updateSettings (const SensitivityApproximationSettings &settings)
 update the settings More...
 
virtual void getAandB (const StateVector< STATE_DIM, SCALAR > &x, const ControlVector< CONTROL_DIM, SCALAR > &u, const StateVector< STATE_DIM, SCALAR > &x_next, const int n, const size_t numSteps, state_matrix_t &A, state_control_matrix_t &B) override
 get A and B matrix for linear time invariant system More...
 
- Public Member Functions inherited from ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >
 Sensitivity ()
 
virtual ~Sensitivity ()
 
void setSubstepTrajectoryReference (std::vector< StateVectorArrayPtr, Eigen::aligned_allocator< StateVectorArrayPtr >> *xSubstep, std::vector< ControlVectorArrayPtr, Eigen::aligned_allocator< ControlVectorArrayPtr >> *uSubstep)
 
virtual void getAandB (const StateVector< STATE_DIM, SCALAR > &x, const ControlVector< CONTROL_DIM, SCALAR > &u, const StateVector< STATE_DIM, SCALAR > &x_next, const int n, size_t numSteps, StateMatrix< STATE_DIM, SCALAR > &A, StateControlMatrix< STATE_DIM, CONTROL_DIM, SCALAR > &B) override=0
 
- Public Member Functions inherited from ct::core::DiscreteLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >
 DiscreteLinearSystem (const ct::core::SYSTEM_TYPE &type=ct::core::SYSTEM_TYPE::GENERAL)
 default constructor More...
 
virtual ~DiscreteLinearSystem ()
 destructor More...
 
virtual void propagateControlledDynamics (const state_vector_t &state, const time_t n, const control_vector_t &control, state_vector_t &stateNext) override
 compute the system dynamics More...
 
virtual void getAandB (const state_vector_t &x, const control_vector_t &u, const state_vector_t &x_next, const int n, size_t subSteps, state_matrix_t &A, state_control_matrix_t &B)=0
 retrieve discrete-time linear system matrices A and B. More...
 
void getAandB (const state_vector_t &x, const control_vector_t &u, const int n, state_matrix_t &A, state_control_matrix_t &B)
 
- Public Member Functions inherited from ct::core::DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
 DiscreteControlledSystem (const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL)
 default constructor More...
 
 DiscreteControlledSystem (std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> controller, const SYSTEM_TYPE &type=SYSTEM_TYPE::GENERAL)
 constructor More...
 
 DiscreteControlledSystem (const ControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > &arg)
 copy constructor More...
 
virtual ~DiscreteControlledSystem ()=default
 destructor More...
 
void setController (const std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> &controller)
 set a new controller More...
 
void getController (std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR >> &controller) const
 get the controller instance More...
 
std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR > > getController ()
 get the controller instace More...
 
virtual void propagateDynamics (const state_vector_t &state, const time_t n, state_vector_t &stateNext) override
 propagates the system dynamics forward by one step More...
 
- Public Member Functions inherited from ct::core::DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALAR >
 DiscreteSystem (const SYSTEM_TYPE &type=GENERAL)
 constructor More...
 
virtual ~DiscreteSystem ()
 desctructor More...
 
virtual void propagateDynamics (const StateVector< STATE_DIM, SCALAR > &state, const time_t n, StateVector< STATE_DIM, SCALAR > &stateNext)=0
 propagates the system dynamics forward by one step More...
 
SYSTEM_TYPE getType () const
 get the type of system More...
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef StateMatrix< STATE_DIM, SCALARstate_matrix_t
 state Jacobian type More...
 
- Public Attributes inherited from ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef std::shared_ptr< StateVectorArray< STATE_DIM, SCALAR > > StateVectorArrayPtr
 
- Public Attributes inherited from ct::core::DiscreteLinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALARBase
 
- Public Attributes inherited from ct::core::DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef std::shared_ptr< DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR > > Ptr
 

Additional Inherited Members

- Protected Attributes inherited from ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >
std::vector< StateVectorArrayPtr, Eigen::aligned_allocator< StateVectorArrayPtr > > * xSubstep_
 
std::vector< ControlVectorArrayPtr, Eigen::aligned_allocator< ControlVectorArrayPtr > > * uSubstep_
 
- Protected Attributes inherited from ct::core::DiscreteControlledSystem< STATE_DIM, CONTROL_DIM, SCALAR >
std::shared_ptr< DiscreteController< STATE_DIM, CONTROL_DIM, SCALAR > > controller_
 the controller instance More...
 
- Protected Attributes inherited from ct::core::DiscreteSystem< STATE_DIM, CONTROL_DIM, SCALAR >
SYSTEM_TYPE type_
 type of system More...
 

Detailed Description

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
class ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >

interface class for a general linear system or linearized system

Defines the interface for a linear system

Template Parameters
STATE_DIMsize of state vector
CONTROL_DIMsize of input vector

Member Typedef Documentation

◆ state_control_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
typedef StateControlMatrix<STATE_DIM, CONTROL_DIM, SCALAR> ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::state_control_matrix_t

input Jacobian type

Constructor & Destructor Documentation

◆ SensitivityApproximation() [1/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::SensitivityApproximation ( const SCALAR dt,
const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  linearSystem = nullptr,
const SensitivityApproximationSettings::APPROXIMATION approx = SensitivityApproximationSettings::APPROXIMATION::FORWARD_EULER 
)
inline

constructor

◆ SensitivityApproximation() [2/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::SensitivityApproximation ( const SensitivityApproximationSettings settings,
const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  linearSystem = nullptr 
)
inline

constructor

◆ SensitivityApproximation() [3/3]

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::SensitivityApproximation ( const SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR > &  other)
inline

copy constructor

◆ ~SensitivityApproximation()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::~SensitivityApproximation ( )
inlinevirtual

destructor

Member Function Documentation

◆ clone()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual SensitivityApproximation<STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR>* ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::clone ( ) const
inlineoverridevirtual

◆ setApproximation()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual void ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::setApproximation ( const SensitivityApproximationSettings::APPROXIMATION approx)
inlineoverridevirtual

update the approximation type for the discrete-time system

Reimplemented from ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >.

References ct::core::SensitivityApproximationSettings::approximation_.

◆ getApproximation()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
SensitivityApproximationSettings::APPROXIMATION ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::getApproximation ( ) const
inline

retrieve the approximation type for the discrete-time system

References ct::core::SensitivityApproximationSettings::approximation_.

◆ setLinearSystem()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual void ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::setLinearSystem ( const std::shared_ptr< LinearSystem< STATE_DIM, CONTROL_DIM, SCALAR >> &  linearSystem)
inlineoverridevirtual

update the linear system

Implements ct::core::Sensitivity< STATE_DIM, CONTROL_DIM, SCALAR >.

◆ setTimeDiscretization()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual void ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::setTimeDiscretization ( const SCALAR dt)
inlineoverridevirtual

◆ updateSettings()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
void ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::updateSettings ( const SensitivityApproximationSettings settings)
inline

update the settings

◆ getAandB()

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
virtual void ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::getAandB ( const StateVector< STATE_DIM, SCALAR > &  x,
const ControlVector< CONTROL_DIM, SCALAR > &  u,
const StateVector< STATE_DIM, SCALAR > &  x_next,
const int  n,
const size_t  numSteps,
state_matrix_t A,
state_control_matrix_t B 
)
inlineoverridevirtual

get A and B matrix for linear time invariant system

compute discrete-time linear system matrices A and B

Parameters
xthe state setpoint
uthe control setpoint
nthe time setpoint
numStepsnumber of timesteps of trajectory for which to get the sensitivity for
Athe resulting linear system matrix A
Bthe resulting linear system matrix B

for an LTI system A and B won't change with time n, hence the linearizations result from the following LTV special case.

the Tustin (also known as 'Heun') approximation uses the state and control at the start and at the end of the ZOH interval to generate linear approximations A and B in a trapezoidal fashion.

continuous-time A and B matrices

tustin approximation

References ct::core::SensitivityApproximationSettings::approximation_, ct::core::SensitivityApproximationSettings::BACKWARD_EULER, dt, ct::core::SensitivityApproximationSettings::dt_, ct::core::SensitivityApproximationSettings::FORWARD_EULER, ct::core::SensitivityApproximationSettings::MATRIX_EXPONENTIAL, n, SYMPLECTIC_DISABLED, SYMPLECTIC_ENABLED, ct::core::SensitivityApproximationSettings::SYMPLECTIC_EULER, ct::core::SensitivityApproximationSettings::TUSTIN, u, and x.

Member Data Documentation

◆ state_matrix_t

template<size_t STATE_DIM, size_t CONTROL_DIM, size_t P_DIM = STATE_DIM / 2, size_t V_DIM = STATE_DIM / 2, typename SCALAR = double>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef StateMatrix<STATE_DIM, SCALAR> ct::core::SensitivityApproximation< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR >::state_matrix_t

state Jacobian type


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