ESPHome  2021.11.3
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::pid::PIDController Struct Reference

#include <pid_controller.h>

Public Member Functions

float update (float setpoint, float process_value)
 
void reset_accumulated_integral ()
 

Data Fields

float kp = 0
 Proportional gain K_p. More...
 
float ki = 0
 Integral gain K_i. More...
 
float kd = 0
 Differential gain K_d. More...
 
float min_integral = NAN
 
float max_integral = NAN
 
float error
 
float proportional_term
 
float integral_term
 
float derivative_term
 

Protected Member Functions

float calculate_relative_time_ ()
 

Protected Attributes

float previous_error_ = 0
 Error from previous update used for derivative term. More...
 
float accumulated_integral_ = 0
 Accumulated integral value. More...
 
uint32_t last_time_ = 0
 

Detailed Description

Definition at line 8 of file pid_controller.h.

Member Function Documentation

◆ calculate_relative_time_()

float esphome::pid::PIDController::calculate_relative_time_ ( )
inlineprotected

Definition at line 62 of file pid_controller.h.

◆ reset_accumulated_integral()

void esphome::pid::PIDController::reset_accumulated_integral ( )
inline

Definition at line 43 of file pid_controller.h.

◆ update()

float esphome::pid::PIDController::update ( float  setpoint,
float  process_value 
)
inline

Definition at line 9 of file pid_controller.h.

Field Documentation

◆ accumulated_integral_

float esphome::pid::PIDController::accumulated_integral_ = 0
protected

Accumulated integral value.

Definition at line 76 of file pid_controller.h.

◆ derivative_term

float esphome::pid::PIDController::derivative_term

Definition at line 59 of file pid_controller.h.

◆ error

float esphome::pid::PIDController::error

Definition at line 56 of file pid_controller.h.

◆ integral_term

float esphome::pid::PIDController::integral_term

Definition at line 58 of file pid_controller.h.

◆ kd

float esphome::pid::PIDController::kd = 0

Differential gain K_d.

Definition at line 50 of file pid_controller.h.

◆ ki

float esphome::pid::PIDController::ki = 0

Integral gain K_i.

Definition at line 48 of file pid_controller.h.

◆ kp

float esphome::pid::PIDController::kp = 0

Proportional gain K_p.

Definition at line 46 of file pid_controller.h.

◆ last_time_

uint32_t esphome::pid::PIDController::last_time_ = 0
protected

Definition at line 77 of file pid_controller.h.

◆ max_integral

float esphome::pid::PIDController::max_integral = NAN

Definition at line 53 of file pid_controller.h.

◆ min_integral

float esphome::pid::PIDController::min_integral = NAN

Definition at line 52 of file pid_controller.h.

◆ previous_error_

float esphome::pid::PIDController::previous_error_ = 0
protected

Error from previous update used for derivative term.

Definition at line 74 of file pid_controller.h.

◆ proportional_term

float esphome::pid::PIDController::proportional_term

Definition at line 57 of file pid_controller.h.


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