GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::PIController< T > Class Template Reference

Proportional-integral feedback loop for adjusting a control variable towards a desired setpoint based on a measured process variable in the form of a discrete-time input signal. More...

#include <GREM/core/control.hpp>

Public Member Functions

constexpr PIController ()=default
 Default-construct a PI controller.
constexpr PIController (T integral)
 Construct a PI controller with specific initial values.
constexpr void reset ()
 Reset the PI controller to the default state.
constexpr void reset (T newIntegral)
 Reset the PI controller to a specific value.
template<typename Coefficient>
constexpr auto update (T newSignalError, Coefficient proportionalGain, Coefficient integralGain)
 Update the controller state and get the next control variable value to use in order to steer the process variable towards a given setpoint based on the next discrete input signal sample value.

Detailed Description

template<typename T>
class grem::PIController< T >

Proportional-integral feedback loop for adjusting a control variable towards a desired setpoint based on a measured process variable in the form of a discrete-time input signal.

Template Parameters
Tsignal value type. Must be a type that behaves like a number.

Constructor & Destructor Documentation

◆ PIController() [1/2]

template<typename T>
grem::PIController< T >::PIController ( )
constexprdefault

Default-construct a PI controller.

◆ PIController() [2/2]

template<typename T>
grem::PIController< T >::PIController ( T integral)
inlineconstexpr

Construct a PI controller with specific initial values.

Parameters
integralinitial value to set the accumulated integral value to.

Member Function Documentation

◆ reset() [1/2]

template<typename T>
void grem::PIController< T >::reset ( )
inlineconstexpr

Reset the PI controller to the default state.

◆ reset() [2/2]

template<typename T>
void grem::PIController< T >::reset ( T newIntegral)
inlineconstexpr

Reset the PI controller to a specific value.

Parameters
newIntegralnew value to set the accumulated integral value to.

◆ update()

template<typename T>
template<typename Coefficient>
auto grem::PIController< T >::update ( T newSignalError,
Coefficient proportionalGain,
Coefficient integralGain )
inlinenodiscardconstexpr

Update the controller state and get the next control variable value to use in order to steer the process variable towards a given setpoint based on the next discrete input signal sample value.

Parameters
newSignalErrorerror between the new sample value of the input signal and the desired setpoint to steer towards, calculated as desiredSignalValue - newSignalValue.
proportionalGainhow much the current error should contribute to the output.
integralGainhow much the accumulated error should contribute to the output. Should be proportional to the sample interval duration.

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