PID Control 1.0
Discrete time implementation of P, PI, PD, PID. Including derivative filter, integral clamping, feed-forward, gain scheduling in standard and parallel form.
Loading...
Searching...
No Matches
control_system::integral::I< T > Class Template Reference

Discrete-time integral controller. More...

#include <i.h>

Public Member Functions

 I ()
 Constructs an integral controller.
get_dt ()
 Gets the controller sampling time.
get_Ki ()
 Gets the integral gain.
get_u_k_1 ()
 Gets the previous controller output.
get_u_max ()
 Gets the maximum controller output.
void init (T dt_, T Ki_, T u_k_1_, T u_max_)
 Initializes the integral controller.
void merge (T u_k_1_)
 Merges an external controller output into the integral state.
void reset ()
 Resets the integral controller state.
void set_dt (T dt_)
 Sets the controller sampling time.
void set_Ki (T Ki_)
 Sets the integral gain.
void set_param (T dt_, T Ki_, T u_k_1_, T u_max_)
 Sets the integral controller parameters.
void set_u_0 (T u_k_1_)
 Sets the previous controller output.
void set_u_max (T u_max_)
 Sets the maximum controller output.
update (T x_0, T x)
 Computes the integral control output.

Private Attributes

dt = 0.0
 Controller sampling time.
Ki = 0.0
 Integral gain.
u_k_1 = 0.0
 Previous controller output.
u_max = 9999999999
 Maximum controller output.

Detailed Description

template<typename T>
class control_system::integral::I< T >

Discrete-time integral controller.

The I class implements a discrete-time integral controller using a configurable integral gain and sampling time.

The controller maintains its previous output as internal state and applies a configurable maximum output limit.

Template Parameters
TNumeric data type used for the controller.
Example
controller.init(
0.001,
Ki,
0.0,
100.0
);
double output = controller.update(reference, measurement);
Discrete-time integral controller.
Definition i.h:74
void init(T dt_, T Ki_, T u_k_1_, T u_max_)
Initializes the integral controller.
Definition i.h:13
T update(T x_0, T x)
Computes the integral control output.
Definition i.h:28
T Ki
Integral gain.
Definition i.h:226

Definition at line 73 of file i.h.

Constructor & Destructor Documentation

◆ I()

template<typename T>
control_system::integral::I< T >::I ( )

Constructs an integral controller.

Constructs the controller with its parameters and internal state initialized to their default values.

Definition at line 5 of file i.h.

Member Function Documentation

◆ get_dt()

template<typename T>
T control_system::integral::I< T >::get_dt ( )

Gets the controller sampling time.

Returns
Sampling time in seconds.

Definition at line 74 of file i.h.

◆ get_Ki()

template<typename T>
T control_system::integral::I< T >::get_Ki ( )

Gets the integral gain.

Returns
Integral gain.

Definition at line 80 of file i.h.

◆ get_u_k_1()

template<typename T>
T control_system::integral::I< T >::get_u_k_1 ( )

Gets the previous controller output.

Returns
Previous controller output.

Definition at line 86 of file i.h.

◆ get_u_max()

template<typename T>
T control_system::integral::I< T >::get_u_max ( )

Gets the maximum controller output.

Returns
Maximum allowed controller output.

Definition at line 92 of file i.h.

◆ init()

template<typename T>
void control_system::integral::I< T >::init ( T dt_,
T Ki_,
T u_k_1_,
T u_max_ )

Initializes the integral controller.

Parameters
[in]dt_Controller sampling time in seconds.
[in]Ki_Integral gain.
[in]u_k_1_Previous controller output.
[in]u_max_Maximum allowed controller output.

Initializes the controller sampling time, integral gain, previous controller output, and output limit.

Definition at line 13 of file i.h.

◆ merge()

template<typename T>
void control_system::integral::I< T >::merge ( T u_k_1_)

Merges an external controller output into the integral state.

Parameters
[in]u_k_1_Previous or externally provided controller output.

Updates the internal previous-output state using the specified controller output.

Definition at line 44 of file i.h.

◆ reset()

template<typename T>
void control_system::integral::I< T >::reset ( )

Resets the integral controller state.

Resets the stored controller output to its initial state.

Definition at line 38 of file i.h.

◆ set_dt()

template<typename T>
void control_system::integral::I< T >::set_dt ( T dt_)

Sets the controller sampling time.

Parameters
[in]dt_Sampling time in seconds.

Definition at line 50 of file i.h.

◆ set_Ki()

template<typename T>
void control_system::integral::I< T >::set_Ki ( T Ki_)

Sets the integral gain.

Parameters
[in]Ki_Integral gain.

Definition at line 56 of file i.h.

◆ set_param()

template<typename T>
void control_system::integral::I< T >::set_param ( T dt_,
T Ki_,
T u_k_1_,
T u_max_ )

Sets the integral controller parameters.

Parameters
[in]dt_Controller sampling time in seconds.
[in]Ki_Integral gain.
[in]u_k_1_Previous controller output.
[in]u_max_Maximum allowed controller output.

Updates the controller sampling time, integral gain, previous controller output, and maximum output limit.

Definition at line 19 of file i.h.

◆ set_u_0()

template<typename T>
void control_system::integral::I< T >::set_u_0 ( T u_k_1_)

Sets the previous controller output.

Parameters
[in]u_k_1_Previous controller output.

Definition at line 62 of file i.h.

◆ set_u_max()

template<typename T>
void control_system::integral::I< T >::set_u_max ( T u_max_)

Sets the maximum controller output.

Parameters
[in]u_max_Maximum allowed controller output.

Definition at line 68 of file i.h.

◆ update()

template<typename T>
T control_system::integral::I< T >::update ( T x_0,
T x )

Computes the integral control output.

Parameters
[in]x_0Reference or desired value.
[in]xCurrent or measured value.
Returns
Integral controller output limited by the configured maximum output.

Calculates the integral contribution using the current control error, sampling time, integral gain, and stored controller state.

Definition at line 28 of file i.h.

Member Data Documentation

◆ dt

template<typename T>
T control_system::integral::I< T >::dt = 0.0
private

Controller sampling time.

Sampling period of the discrete-time integral controller in seconds.

Definition at line 213 of file i.h.

◆ Ki

template<typename T>
T control_system::integral::I< T >::Ki = 0.0
private

Integral gain.

Definition at line 226 of file i.h.

◆ u_k_1

template<typename T>
T control_system::integral::I< T >::u_k_1 = 0.0
private

Previous controller output.

Stores the controller output from the previous iteration.

Definition at line 221 of file i.h.

◆ u_max

template<typename T>
T control_system::integral::I< T >::u_max = 9999999999
private

Maximum controller output.

Defines the maximum allowed magnitude of the controller output.

Definition at line 235 of file i.h.


The documentation for this class was generated from the following files:
  • include/integral/i.h
  • src/integral/i.tpp