6 ms·
When your espresso machine has some thermal mass (eg E61 group head), then a simple bang-bang controller performs just as well as a PID. After tweaking PID cont
by wildekek 3y ago
When your espresso machine has some thermal mass (eg E61 group head), then a simple bang-bang controller performs just as well as a PID. After tweaking PID controllers in drones, HVAC systems and my espresso machine, my experience is that PID's do more harm than good in systems with a lot of inertia and slow response.
- redox99 3y ago> PID's do more harm than good In what way?
- wildekek 3y agoPID controllers require more tuning, which becomes harder with more latency in the system. They are more susceptible to integral windup: https://en.wikipedia.org/wiki/Integral_windup https://en.wikipedia.org/wiki/Integral_windup They require an MCU, whereas a bang-bang controller can be done mechanically (or with analog components), keeping them simpler.
- amluto 3y agoSince when does a PID controller need an MCU? You can build one out of op-amps, resistors, and capacitors. Whether you should is a different story. (I’ve never been convinced that a PID controller really makes sense for a heater where there may not be much natural cooling going on, but that’s a different story.)
- wildekek 3y agoYes, you're correct. I think you never see them in practice since MCU's are cheaper, but it is totally doable.
- cjbgkagh 3y agoThere might be other reasons for wanting a MCU but PID controller chips are cheaper and so are the diy PID circuits. Drone PIDs are hard, and a lot of that to do with the quickly moving targets which is not the case in many (most?) scenarios PIDs are used.
- the__alchemist 3y ago> Drone PIDs are hard, and a lot of that to do with the quickly moving targets which is not the case in many (most?) scenarios PIDs are used. You can write a flyable PID in a few lines, and a full PID in a few more. Set the error term to the range-mapped input - angular rate measurement, for each axis. (Assuming you have the control inputs, gyro/acc inputs, and motor output IO setup)
- cjbgkagh 3y agoI'm talking industrial PID and other consumer goods. Drones are just one place PIDs are used, though probably the most frequent place for interaction for software engineers on HN. As for them being hard for drones... PIDs are built into the software which is easy enough to write but the drone characteristic is specific to both the configuration of the drone and the flight preference of the pilot. It can be hard to find an optimal PID setting for both, which is where it seems that most people are finding PID settings to be difficult.
- nihzm 3y agoIndeed, most modern approaces to controlling drones use other more advanced techniques that (ab)use the computational power of modern MCUs, PIDs are used only near the actuators to keep the motor torque within an optimal range or things like that. For the flight trajectory fancy drones use things like model predictive control combined with convex optimization algorithms to avoid obstacles very reliably (see for ex. [1]). [1]: https://youtu.be/mHDQcckqdg4 https://youtu.be/mHDQcckqdg4
- the__alchemist 3y ago
- pierat 3y agoI would concur, especially with control devices that can turn on to heat. Although, a lot of more basic controllers only handle binary states for input. I'd argue that a calibrated (bang-bang with thermistor/thermocouple) on an analog control would be much easier to tune and easier to implement. That way, the hysteresis could be dynamically tuned out of the system with a constant input to stabilize losses. I did something similar to that with I experimented with a peltier heated 3d printing bed. I fried the first batch of peltiers since I wasn't aware they *HATED* binary states, and would die in a crack of the ceramic matrix. My next round was to implement "Using PWM to Generate an Analog Output" ( https://ww1.microchip.com/downloads/en/Appnotes/90003250A.pdf https://ww1.microchip.com/downloads/en/Appnotes/90003250A.pd... )
- syntaxing 3y agoChances are, you’re probably tuning it incorrectly. Tuning is not an easy thing to do, but you should get much closer if you draw out the block diagram. At a minimum, even fuzzy logic would be better than bang on/off.
- wildekek 3y agoI'm familiar with algorithmic and manual tuning, and the more latency the system has, the more time consuming and harder it is to get right. Genuinely curious how a block diagram would help?
- syntaxing 3y agoPID is the controller for a block diagram [1]. When you have the block diagram, you can predict the response graphs extremely reliably [2]. You should be extremely close to the desired coefficients and requires a little tuning. Especially for stuff like thermal and conduction that’s very well understood. You just need to draw the thermal circuit and know the spec of your hardware. Most of the time people use PID, they use it as a black box which causes a lot of pain. [1] https://www.tutorialspoint.com/control_systems/control_systems_block_diagrams.htm https://www.tutorialspoint.com/control_systems/control_syste... [2] https://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpeed§ion=ControlPID https://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpe...
- wildekek 3y agoThanks! I wish I learnt more control theory in my education, this is helpfull.
- syntaxing 3y agoControl system was probably one of the hardest class I took for undergraduate. Unfortunately, it really requires a college course (mine had a lab too so you can some “real life” experience) to understand the beauty of PID controllers. Highly recommend sitting in a college course if you like this stuff!
- icegreentea2 3y agoHigh inertia/slow response is challenging to control systems in general, especially to linear systems like pure PIDs (especially if your 'slow response' is well modeled as transport delay, rather than just... slow response). Bang-bang controllers with deadzones/hysteresis are really the simplest form of non-linear controllers, and so can do okay at something like an HVAC system, especially when precise tracking of target isn't needed. But you can strap all sorts of non-linear things (gain scheduling, hysteresis, etc) onto the form of PID to try to get decent macro scale behavior, while still having reasonable fine tracking performance. Though obviously, it becomes much much more complicated to tune.
- marcosdumay 3y agoA PID allows you to reduce the thermal mass, what makes your machine turn on faster and wastes less energy on power cycling. But yes, adding one to a non-controlled machine that is already working well will probably harm its performance.
- ranting-moth 3y agoThey key phrase in your comment is "that is already working well". After many years of fixing things that aren't broken, I've come to appreciate the phrase "If it ain't broken, don't fix it!".
- throwaway9870 3y agoIf you know characteristics of the system, like thermal mass, inertia etc., then coupling feed-forward control along with the PID can help. The idea is that if you know the thermal mass (and you do for a coffee maker's internal elements), then you have a reasonable estimate of how many watts are needed to change the temp of those parts. So, don't make the PID put those watts in, instead just add them separately based on your simple physics model. The PID runs in parallel and corrects all the short-comings of your model.
- wildekek 3y agoThanks, I never really understood feed-forward well, but modeling the thermal mass makes a lot of sense for keeping the terms in check. (As I understood it in Betaflight, it overrides the PID controller and mixes setpoints directly into the output.)
- carlmr 3y agoI found it funny that if you did robotics this is the first thing they teach you, and in control systems they went onto other more "fancy" controllers, but never explained how to make PID work well for a range of systems.