Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PID Controller

This is a simple PID controller library written in C++23. It doesn't have any external dependencies.

It implements "derivative on measurement" to prevent output spikes when the goal point changes.

It is assumed that it will be run on a microcontroller or some other device that can guarantee that the Update function can be called at the set period_time rate. Running a PID control system with irregular refresh rate will cause the PID to be unreliable and needs to stabilise again.

Building and Usage

Prerequisites

  • C++23 compatible compiler (g++ recommended)

Building the PID Controller

# Build the PID controller object file
make pid.o

# Build the heater example application
make heater

The heater executable demonstrates the PID controller in action, simulating a temperature control system.

Running Simulations & Visualization

Run ./heater to run the simulation and generate output of the simulated heater and make plot_heater to see the visualisations. This command executes both linear and nonlinear heater simulations, outputting heater.out and heater_nonlinear.out data files, then automatically generates visualizations using the Python plotting script.

matplotlib is used to plot the graphs and is required as a dependency for visualisation.

About

Simple PID Controller written in C++23

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages