Controlpp
Loading...
Searching...
No Matches
controlpp::timevar::DControl< T > Class Template Reference

A D (differntial) controller, with varying smaple-time. More...

#include <controlpp/TimeVariantControl.hpp>

Public Member Functions

constexpr DControl (const T &kd, const T &omega)
 Construct a D control element.
 
constexpr DControl (const DControl &)=default
 default copy constructor
 
constexpr T input (const T &u, const T &Ts)
 
constexpr T operator() (const T &u, const T &Ts)
 
constexpr void reset ()
 

Friends

constexpr ValueSampletimePair< T > operator>> (const ValueSampletimePair< T > &p, DControl &c)
 

Detailed Description

template<class T>
class controlpp::timevar::DControl< T >

A D (differntial) controller, with varying smaple-time.

An ideal D (differential) control element has the transfer function:

\[ D(s) = k_d * s. \]

However, such a transfer function is:

  1. not realisable
  2. will amplify lots of noise

So a low pass filter is added:

\[ D(s) = \frac{k_d s}{1 + \frac{s}{\omega}} \]

where:

  • \(k_d\) is the differential gain
  • \(omega\) is the low-pass bandwidth in radians per second

Discretised with the tustin transformation:

\[ s = \frac{2}{T_s} \frac{1 - z^{-1}}{1 + z^{-1}} \]

with the sample time \(T_s\) and the delay operator \(z^{-1}\) to:

\[ y_k = \frac{1}{\frac{\omega T_s}{2} + 1} \left[ \omega k_d \left( u_k - u_{k-1} \right) - \left( \frac{\omega T_s}{2} - 1 \right) y_{k-1} \right] \]

Template Parameters
TThe data type of the D controller (inputs/outputs/states). Usually float or double.

Constructor & Destructor Documentation

◆ DControl() [1/2]

template<class T >
constexpr controlpp::timevar::DControl< T >::DControl ( const T &  kd,
const T &  omega 
)
inlineconstexpr

Construct a D control element.

Parameters
kdThe differential gain
omegaThe bandwidth of the low-pass filter in radians per second

◆ DControl() [2/2]

template<class T >
constexpr controlpp::timevar::DControl< T >::DControl ( const DControl< T > &  )
constexprdefault

default copy constructor

Member Function Documentation

◆ input()

template<class T >
constexpr T controlpp::timevar::DControl< T >::input ( const T &  u,
const T &  Ts 
)
inlineconstexpr

◆ operator()()

template<class T >
constexpr T controlpp::timevar::DControl< T >::operator() ( const T &  u,
const T &  Ts 
)
inlineconstexpr

◆ reset()

template<class T >
constexpr void controlpp::timevar::DControl< T >::reset ( )
inlineconstexpr

Friends And Related Symbol Documentation

◆ operator>>

template<class T >
constexpr ValueSampletimePair< T > operator>> ( const ValueSampletimePair< T > &  p,
DControl< T > &  c 
)
friend

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