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

A PI (Proportional Integral) controller with varying sample-times. More...

#include <controlpp/TimeVariantControl.hpp>

Public Member Functions

 PIControl (const T &kp, const T &ki)
 
 PIControl (const PIControl &)=default
 
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, PIControl &c)
 

Detailed Description

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

A PI (Proportional Integral) controller with varying sample-times.

With the transfer function:

\[ \text{PI} = k_p + \frac{k_i}{s} \]

and the discretisation using the tustin transformation:

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

resulting in the controlers time series:

\[ y_k = \left( \frac{k_i T}{2} + k_p \right) u_k + \left( \frac{k_i T}{2} - k_p \right) u_{k-1} + y_{k-1} \]

with:

  • \(T_s\) the sample-time in seconds
  • \(u_{k}\) and \(u_{k-1}\) are current and previous control inputs
  • \(y_{k}\) and \(y_{k-1}\) are current and previous control outputs

The purely proportional component can amplify high-frequency noise.  * While this does not improve control performance, it may lead to increased power consumption due to rapid steering actions.  * To mitigate this, the proportional gain (P) can be replaced with a first-order low-pass filter (PT1), effectively transforming the PI controller into a PT1I controller.

See also
controlpp::vartime::PT1I
Template Parameters
TValue type of the filter like float or double

Constructor & Destructor Documentation

◆ PIControl() [1/2]

template<class T >
controlpp::timevar::PIControl< T >::PIControl ( const T &  kp,
const T &  ki 
)
inline
Parameters
kiThe integral gain
kpThe proportional gain

◆ PIControl() [2/2]

template<class T >
controlpp::timevar::PIControl< T >::PIControl ( const PIControl< T > &  )
default

Member Function Documentation

◆ input()

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

◆ operator()()

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

◆ reset()

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

Friends And Related Symbol Documentation

◆ operator>>

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

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