hlcc 2.0.0-beta2+pre1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
SimScripts.PID.PID Class Reference

PID Controller. More...

Public Member Functions

def __init__ (self, P=0.2, I=0.0, D=0.0, current_time=None)
 
def clear (self)
 Clears PID computations and coefficients.
 
def update (self, feedback_value, current_time=None)
 Calculates PID value for given reference feedback
 
def setKp (self, proportional_gain)
 Determines how aggressively the PID reacts to the current error with setting Proportional Gain.
 
def setKi (self, integral_gain)
 Determines how aggressively the PID reacts to the current error with setting Integral Gain.
 
def setKd (self, derivative_gain)
 Determines how aggressively the PID reacts to the current error with setting Derivative Gain.
 
def setWindup (self, windup)
 Integral windup, also known as integrator windup or reset windup, refers to the situation in a PID feedback controller where a large change in setpoint occurs (say a positive change) and the integral terms accumulates a significant error during the rise (windup), thus overshooting and continuing to increase as this accumulated error is unwound (offset by errors in the other direction).
 
def setSampleTime (self, sample_time)
 PID that should be updated at a regular interval.
 

Public Attributes

 Kp
 
 Ki
 
 Kd
 
 sample_time
 
 current_time
 
 last_time
 
 SetPoint
 
 PTerm
 
 ITerm
 
 DTerm
 
 last_error
 
 int_error
 
 windup_guard
 
 output
 

Detailed Description

PID Controller.

Constructor & Destructor Documentation

◆ __init__()

def SimScripts.PID.PID.__init__ (   self,
  P = 0.2,
  I = 0.0,
  D = 0.0,
  current_time = None 
)

Member Function Documentation

◆ clear()

def SimScripts.PID.PID.clear (   self)

Clears PID computations and coefficients.

◆ setKd()

def SimScripts.PID.PID.setKd (   self,
  derivative_gain 
)

Determines how aggressively the PID reacts to the current error with setting Derivative Gain.

◆ setKi()

def SimScripts.PID.PID.setKi (   self,
  integral_gain 
)

Determines how aggressively the PID reacts to the current error with setting Integral Gain.

◆ setKp()

def SimScripts.PID.PID.setKp (   self,
  proportional_gain 
)

Determines how aggressively the PID reacts to the current error with setting Proportional Gain.

◆ setSampleTime()

def SimScripts.PID.PID.setSampleTime (   self,
  sample_time 
)

PID that should be updated at a regular interval.

Based on a pre-determined sampe time, the PID decides if it should compute or return immediately.

◆ setWindup()

def SimScripts.PID.PID.setWindup (   self,
  windup 
)

Integral windup, also known as integrator windup or reset windup, refers to the situation in a PID feedback controller where a large change in setpoint occurs (say a positive change) and the integral terms accumulates a significant error during the rise (windup), thus overshooting and continuing to increase as this accumulated error is unwound (offset by errors in the other direction).

The specific problem is the excess overshooting.

◆ update()

def SimScripts.PID.PID.update (   self,
  feedback_value,
  current_time = None 
)

Calculates PID value for given reference feedback

. math:: u(t) = K_p e(t) + K_i \int_{0}^{t} e(t)dt + K_d {de}/{dt} .. figure:: images/pid_1.png :align: center Test PID with Kp=1.2, Ki=1, Kd=0.001 (test_pid.py)

Member Data Documentation

◆ current_time

SimScripts.PID.PID.current_time

◆ DTerm

SimScripts.PID.PID.DTerm

◆ int_error

SimScripts.PID.PID.int_error

◆ ITerm

SimScripts.PID.PID.ITerm

◆ Kd

SimScripts.PID.PID.Kd

◆ Ki

SimScripts.PID.PID.Ki

◆ Kp

SimScripts.PID.PID.Kp

◆ last_error

SimScripts.PID.PID.last_error

◆ last_time

SimScripts.PID.PID.last_time

◆ output

SimScripts.PID.PID.output

◆ PTerm

SimScripts.PID.PID.PTerm

◆ sample_time

SimScripts.PID.PID.sample_time

◆ SetPoint

SimScripts.PID.PID.SetPoint

◆ windup_guard

SimScripts.PID.PID.windup_guard

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