$K_p=1.2\,\tau/(K\cdot L),\quad T_i=2L,\quad T_d=0.5L$
Adjust Kp, integral time Ti, and derivative time Td to see closed-loop step response in real time. Compare P-only, PI, and PID control — and discover how each gain affects overshoot, settling time, and IAE.
The core of PID control is the control law, which calculates the command signal $u(t)$ sent to the actuator (like a valve or motor) based on the error $e(t) = SP - PV$, where SP is the Setpoint and PV is the Process Variable.
$$u(t)=K_p\!\left[e(t)+\frac{1}{T_i}\!\int_0^t\!e\,d\tau+T_d\frac{de}{dt}\right]$$$K_p$: Proportional Gain. Scales the current error.
$T_i$: Integral Time (seconds). A smaller Ti means stronger integral action.
$T_d$: Derivative Time (seconds). A larger Td means stronger damping.
The combination of these three terms allows the controller to correct present, past, and future trends of the error.
One classic method for initial tuning is the Ziegler-Nichols step response method. It uses the process's open-loop response, characterized by a delay $L$ and a time constant $\tau$, to suggest starting parameters.
$$K_p=1.2\,\frac{\tau}{K \cdot L},\quad T_i=2L,\quad T_d=0.5L$$These are just starting points. In practice, you use them as a baseline and then fine-tune using a simulator like this one—or carefully on the real system—to achieve the desired balance of speed, overshoot, and stability.
Chemical Process Control: In a distillation column, temperature must be held precisely to separate chemicals. A PID controller adjusts steam flow to a heater. The integral term (Ti) is crucial here to eliminate any steady-state error, ensuring the final product purity is exactly on spec.
Automotive Cruise Control: Your car's cruise control uses PID to maintain speed on hills. The proportional term (Kp) adjusts throttle based on speed error, the integral term compensates for the hill's grade, and the derivative term (Td) smooths out the response when you suddenly set a new target speed.
CNC Machine & 3D Printer Positioning: The motor controlling the toolhead must move to an exact position quickly and without oscillation. PID tuning is critical here; too much integral can cause overshoot and ruin a part, while derivative helps dampen vibrations for a clean stop.
Drone Flight Stabilization: Drones use PID loops for attitude control (pitch, roll, yaw). The gyroscope provides feedback. The derivative term is especially important to prevent "jerky" movements and provide smooth, stable flight against wind gusts.
First, there is a misconception that "shorter integral time (Ti) is always better." While reducing Ti (strengthening the integral gain) does eliminate steady-state error faster, setting it excessively short can destabilize the system, causing sustained oscillations (including the risk of integral windup). For example, setting Ti to an extremely low value like 0.1 seconds should cause the graph to oscillate back and forth around the setpoint without settling. In practice, the key is to first tune the proportional gain (Kp) to establish the basic response, then adjust Ti within a range that does not induce oscillations.
Next, understand that the derivative action (D) is not a "universal predictive function." While derivative does predict the rate of change, it is extremely sensitive to noise. Real sensor signals always contain noise, and differentiating this noise can amplify it into huge control signals. Therefore, in actual hardware, it's common to set the derivative gain modestly or to use a low-pass filter in conjunction with the derivative action. Note that simulators use ideal signals, making it difficult to appreciate this risk in practice.
Finally, remember that the Ziegler-Nichols method is a "starting point," not an "optimal solution." The parameters obtained from this method tend to be somewhat aggressive (with significant overshoot) and do not necessarily ensure high robustness (strength against disturbances). For instance, after running a simulation with ZN-tuned parameters, fine-tuning—such as slightly lowering Kp and raising Ti to reduce overshoot—is essential. The practical approach is not "set once and forget," but rather to observe the actual response and make adjustments, considering the trade-offs (response speed vs. stability).