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

A PT1 (proportional time first order) filter (=low-pass element of order 1), with varying smaple-time. More...

#include <controlpp/TimeVariantControl.hpp>

Public Member Functions

constexpr PT1Control (const T &K, const T &omega)
 Constructs a low-pass filter.
 
constexpr PT1Control (const PT1Control &)=default
 Default copy constructor.
 
constexpr void set_gain (const T &g)
 
constexpr const T & gain () const
 
constexpr void set_omega (const T &w)
 
constexpr const T & omega () const
 
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, PT1Control &c)
 

Detailed Description

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

A PT1 (proportional time first order) filter (=low-pass element of order 1), with varying smaple-time.

With the continuous transfer function:

\[ \text{PT}_{1} = \frac{K}{1 + \frac{s}{\omega}} \]

Discretised with the tustin transformation:

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

to the sample series:

\[ y_k = \frac{a (u_k + u_{k-1}) - b y_{k-1}}{c}; a = K \omega_ * T_s b = \omega * T_s - 2 c = \omega * T_s + 2 \]

with:

  • \(K\) The gain of the low-pass
  • \(T_s\) The sample-time in seconds
  • \(\omega\) The -3dB bandwidth of the low-pass
  • \(u_k\) and \(u_{k-1}\) the current and previous control input
  • \(y_k\) and \(y_{k-1}\) the current and previous control output

Constructor & Destructor Documentation

◆ PT1Control() [1/2]

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

Constructs a low-pass filter.

Parameters
KThe gain of the filter
omegaThe -3dB bandwidth of the lowpass filter

◆ PT1Control() [2/2]

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

Default copy constructor.

Member Function Documentation

◆ gain()

template<class T >
constexpr const T & controlpp::timevar::PT1Control< T >::gain ( ) const
inlineconstexpr

◆ input()

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

◆ omega()

template<class T >
constexpr const T & controlpp::timevar::PT1Control< T >::omega ( ) const
inlineconstexpr

◆ operator()()

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

◆ reset()

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

◆ set_gain()

template<class T >
constexpr void controlpp::timevar::PT1Control< T >::set_gain ( const T &  g)
inlineconstexpr

◆ set_omega()

template<class T >
constexpr void controlpp::timevar::PT1Control< T >::set_omega ( const T &  w)
inlineconstexpr

Friends And Related Symbol Documentation

◆ operator>>

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

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