C++ PID Controller for Qspice (Community Project)

RDunn (@RDunn) and I worked together to create a C++ PID controller and would like to share to Qspice community. Symbol, C++ Code, Schematic example and explanation document can be download from RDunn’s Github in this link - github.com/robdunn4/QSpice

The operation principle, formula to implement integral and derivative and verification of code can be found in User Guide - Qspice C++ Discrete PID Controller Implementation.pdf.

Our purpose is to provide a startup kit for anyone who would like to include a digital PID in your Qspice simulation. You can modify the C++ code based on your application and we are welcome for feedback.

This collaborative effort wouldn’t have been possible without the help of RDunn in converting our idea into C++. This work is also based on a demo code from Qspice author Mike Engelhardt.


Demo of C++ PID controller as a compensator for a buck converter


Wow guys- this is really cool. I love the creativity of the QSPICE community. Thank you!

Let’s be very clear, Jeff: @KSKelvin is the brains here. I just push code around and hope that I don’t embarrass myself.


1 Like

switch mode can’t simulation ac signal successful,that is very important for digital resonant converter design. S-domain mode is OK ! I hope it will come true soon.

.bode is frequency response in time domain regardless of your plant is laplace function or a circuit.