The class initializes a proportional gain constant, Kp, an integral gain Ki and a desired setpoint for a system.
More...
|
| | __init__ (self, Kp, Ki, setPoint) |
| | This function initializes the proportional and integral gain constants and desired setpoint.
|
| |
| | run (self, actualVal) |
| | This function handles control by comparing the current system value to the desired set point, and then computing the error.
|
| |
| | set_setpoint (self, setPt) |
| | This function sets the desired setpoint.
|
| |
| | set_Kp (self, Kp) |
| | This function sets the proportional gain.
|
| |
| | set_Ki (self, Ki) |
| | This function sets the intergral gain.
|
| |
The class initializes a proportional gain constant, Kp, an integral gain Ki and a desired setpoint for a system.
When feedback is applied through the run() method, the error in the system is calculated, and the proportional and integral gain is applied. Rapidly and repeatedly calling run() enables one to create a closed loop proportional controller.
◆ __init__()
| src.controller.PIController.__init__ |
( |
| self, |
|
|
| Kp, |
|
|
| Ki, |
|
|
| setPoint ) |
This function initializes the proportional and integral gain constants and desired setpoint.
- Parameters
-
| Kp | User specified proportional gain constant. |
| Ki | User specified integral gain constant |
| setPoint | Desired setpoint for the system to be driven to. |
◆ run()
| src.controller.PIController.run |
( |
| self, |
|
|
| actualVal ) |
This function handles control by comparing the current system value to the desired set point, and then computing the error.
The error is then multiplied by the gain Kp to obtain proportional control. The total error is integrated by summing it, and then Ki is applied to obtain integral control. Together, this creates a PI controller.
- Parameters
-
| actualVal | The measured current value of the system. |
- Returns
- The output to be sent to the system driver as a float. (For a motor system, this is the PWM duty cycle percentage to be sent to the motor)
◆ set_Ki()
| src.controller.PIController.set_Ki |
( |
| self, |
|
|
| Ki ) |
This function sets the intergral gain.
- Parameters
-
| Ki | The new integral gain value. |
◆ set_Kp()
| src.controller.PIController.set_Kp |
( |
| self, |
|
|
| Kp ) |
This function sets the proportional gain.
- Parameters
-
| Kp | The new proportional gain value. |
◆ set_setpoint()
| src.controller.PIController.set_setpoint |
( |
| self, |
|
|
| setPt ) |
This function sets the desired setpoint.
- Parameters
-
| setPt | The new desired setpoint of the system. |
The documentation for this class was generated from the following file: