You can use PID Tuner to tune PID gains automatically in a Simulink® model containing a PID Controller or PID Controller (2DOF) block. PID Tuner allows you to achieve a good balance between performance and robustness for either one- or two-degree-of-freedom PID controllers.
Automatically computes a linear model of the plant in your model. PID Tuner considers the plant to be the combination of all blocks between the PID controller output and input. Thus, the plant includes all blocks in the control loop, other than the controller itself. See What Plant Does PID Tuner See?.
Automatically computes an initial PID design with a balance between performance and robustness. PID Tuner bases the initial design upon the open-loop frequency response of the linearized plant. See PID Tuning Algorithm.
Provides tools to help you interactively refine the performance of the PID controller to meet your design requirements. See Open PID Tuner.
You can use PID Tuner to design one- or two-degree-of-freedom PID controllers. You can often achieve both good setpoint tracking and good disturbance rejection using a one-degree-of-freedom PID controller. However, depending upon the dynamics in your model, using a one-degree-of-freedom PID controller can require a trade-off between setpoint tracking and disturbance rejection. In such cases, if you need both good setpoint tracking and good disturbance rejection, use a two-degree-of-freedom PID Controller.
For examples of tuning one- and two-degree-of-freedom PID compensators, see: