PID Control Simulator
This is a simulation of a PID control algorithm. The physics in this simulation are roughly modelled on a falling object with a "thruster", like a drone, with the goal of keeping it at a certain height, however the simulation can loosely represent a number of other control applications, for example a thermostat controlling a heater (greatly sped up of course). Before you get started with the PID control, use the Manual On/Off button to try to maintain the setpoint yourself. Add some noise for a real challnge. The basic idea of a PID controller is to be "smarter" than a simple "P" controller (where we turn ON when below the setpoint and OFF when above the setpoint). You can simulate this simple on/off controller by setting the kP value (to anything) and leaving kI and kD at zero. The circle in the corner of the grid indicates when the "thruster" is on or off. Notice how this control scheme doesn't maintain very tight control, especially with a larger timestep (sample rate). PID control makes use of two other properties, the rate of change (D) and the accumulated error (I) to acheive tighter control. Play around with the various parameters and see how they affect the control. The "Autocalculate" button sets the parameters based on my simple tuning algorithm (and the timestep setting), but I bet you can do better! Notice how it becomes harder to maintain tight control with a larger timestep, however sometimes this is unavoidable in real world applications due to sample aquisition/processing time or to extend the lifespan of switching components, so a good control agorithm is critical. The "Environment Noise" setting applies some random fluctuations to the signal, for example wind affecting a hovering drone. Naturally, it becomes harder to control. One other point is that this simulation is for a striclty on or off system. A real world example might have the ability to ramp up/down the power output, which can also give you better control.