Welcome! Log In Create A New Profile

Advanced

PID Algorithm simulation

Posted by pietr 
PID Algorithm simulation
October 23, 2011 08:57AM
Hello everybody,

I've created a small open-source Java application for simulating the temperature evolution of a virtual heating element. The temperature of the virtual heater is measured by a virtual thermistor. The power applied to the heating element can be controlled by various controller algorithms, which try to maintain a certain target temperature.



This simulator can be used to compare the performance of different controller algorithms or to tune their parameters.

The algorithms currently included in the simulator are:
  • PID32: a simple PID algorithm based on the Arduino Bare Bones (PID) Coffee Controller, using 32-bit arithmetic
  • CAAPID32: a controllable area aware PID algorithm, which uses a different method for preventing integral windup, which seems to offer better performance
  • CAAPID16: a variant of the CAAPID32 algorithm which uses only 16-bit arithmetic, for illustrating that a 16-bit implementation for microcontrollers is possible as well

You can launch this application directly using Java Web Start by downloading and executing this file:
heater-simulator Web Start

More information and a downloadable JAR-file can found here: heater-simulator on Google code
Re: PID Algorithm simulation
October 23, 2011 02:22PM
Wow.

Now, is there a chance we can put our real firmware into this somehow?


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: PID Algorithm simulation
October 25, 2011 05:39AM
Yes, absolutely. You can download the source code from the google code project page (currently only using git but I might upload a zip-file containing the source code of the 1.0 release) and add some Java code to 'simulate' the behaviour of your firmware. This actually comes down to porting the algorithm used in your firmware to Java, which should be straightforward.

You will also need to make some GUI-adjustments to be able to select your algorithm for execution. I will add some notes to the wiki page on how to do this in the next few days. For one of the next releases of the software, I will try to reduce the effort required to add a new algorithm.
Re: PID Algorithm simulation
October 25, 2011 07:01AM
Well, I thought in terms of debugging existing code. Like hooking up the real controller to the application, or at least incorporating existing C code as-is somehow. I'm aware this isn't exactly tricial.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: PID Algorithm simulation
October 25, 2011 07:11AM
Mmh well it might be interesting to be able to plot values obtained by measuring a real controller side by side with the values of a simulated controller. That would obviously require some communication between this application and the firmware, which is not implemented right now. I'll look in to this in the next couple of days.
Sorry, only registered users may post in this forum.

Click here to login