I am taking my first shot at creating and tuning a PID for my software application. The PID I am creating is used to control the temperature of a "thing". The thing is heated by focusing a laser on it and changing the laser's output power in the range of ~0.1W to 1.0W. The temperature is then calculated and is in the range of ~100C to 1000C.

An example sentence/problem to refer to. I desire the temperature of my thing to be 600C, to start I set the laser's power to 0.5W, then measure a temperature of 500C, the PID is iterated and calculates a output signal of 0.6W (Assuming the PID parameters are tuned correctly).

// Is this the correct terminology?
???            = Laser power of 0.5W
Setpoint       = Desired temperature of 600C
Measured value = Measured temperature of 500C
Output         = Output signal of 0.6W

To test my PID implementation and parameters I have been allowing the PID to iterate and calculate an ouput signal, but I have NOT been allowing this signal to command the system ( In the example I have been calculating the output signal of 0.6W but not setting the laser power to 0.6W; it stays at a constant 0.5W ). This has somewhat worked to hone in on appropriate PID parameters but I think I need to put the PID "online".

Obviously my PID parameters, and maybe implementation, are not going to be correct until they are refined and tuned so I do not want to allow it to control the system for various types of concerns and safety issues it could cause. Is this ok to do? Does it make sense?

I think this is a flawed way to see if the output signal is correct because the Error and Integral from past iterations are going to reflect past commanded signals. The error/integral could continue to grow even though they shouldn't be?

EDIT: Rephrased. Will a PID always produce a sane output whether it is online or not?

  • $\begingroup$ Without putting the PID controller online, you won't really be able to see its performance. However, you should be able to do lots to sanity check it without putting it online: does it send the control signal in the right direction (hotter when it needs to be hotter, cooler when it needs to be cooler)? Does the error signal correct? If you "manually" set the laser to what the PID is telling you, does it do the right thing? $\endgroup$ – Peter K. Jun 7 '16 at 16:52
  • $\begingroup$ Yes that is how I have been using it so far, and it seems to be working for the most part. But I guess I am concerned what happens after the PID iterates many times without being online. Is the error and integral so far off that the output signal cannot be trusted? Or should the PID always create a sane output signal no matter if it controls the system or not? $\endgroup$ – KDecker Jun 7 '16 at 16:54
  • $\begingroup$ Well, if the PID control output doesn't get responded too, the error will continue to grow. That's the problem with running it open loop. You may be able to "manually" change the laser's control input by using the value the PID tells you to see that things are a bit closer. Often, "hard limits" are used on safety-critical controllers to ensure they don't go ballistic... but that will depend on your application. $\endgroup$ – Peter K. Jun 7 '16 at 17:18

The PID can be tested in an open-loop setup, however any integral gain <> 0 will cause the PID output to run away, so you are likely to hit clamping (like control voltage maxima) with your test rig.

What really matters and needs to be tuned is the closed-loop behaviour. This includes your plants behaviour. Stability is prime goal, maximum overshoot and settle time (to set-point change or disturbance) can be tuned.

If you cannot tune in the live system, modeling and simulation is the way to go (look for Simulink Control Design). You would typically start with an empirical plant model, tune your PID for it, then run the actual device with this PID but a set-point well below Tmax. Instrumentation will give you data to improve your plant model. Repeat this development cycle a few times until you are confident to increase to the actual set-point.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.