PI Controller Example
Overview
This example demonstrates the use of the Digital Control Library (DCL) Proportional-Integral (PI) controller. The PI controller is one of the most widely used feedback controllers in industrial control systems for:
Motor speed control
Temperature regulation
Voltage/current regulation
Position control systems
Process control applications
What the Example Does
The example:
Initializes a Series PI controller with predefined gain parameters
Processes control loop iterations with reference and feedback inputs
Computes control output (uk) based on error between reference (rk) and feedback (yk)
Compares computed outputs against expected reference values
Measures and reports execution performance in CPU cycles
Validates correctness by comparing results with an error tolerance
Expected Output
The example prints:
Total execution cycles for all iterations
Average execution cycles per iteration
Number of errors detected (should be 0 for PASS)
Individual failure messages if any output differs from expected value
Usage Notes
Customization
You can modify the example by:
Adjusting controller gains (Kp, Ki) in dcl_pi_example.h
Changing output limits (Umax, Umin) or integrator limits (Imax, Imin)
Modifying
NUM_ELEMENTSto process more or fewer samplesReplacing test data files in the
data/directorySwitching to different PI controller variants
External Connections
None required. This is a software-only computational example.