Main Content

PID Tuning with Actuator Constraints

This example shows how to use Simulink® Design Optimization™ to tune the gains of the PID controller (Kp, Ki, and Kd) and optimize the step response of the plant. To view the results, use the following steps.

Open thepidtune_demomodel using the command below and run the simulation. The simulation produces an unoptimized step response and the initial data for optimization.

open_system('pidtune_demo')

Double-click theScopeblock to view the unoptimized step response.

Double-click theOutput Constraintblock to view constraints on the plant response, including rise time, settling time and maximum overshoot.

Double-click theActuator Constraintblock to view constraints on the actuator signal of the controller.

You can launch theResponse Optimizerusing theAppsmenu in the Simulink toolstrip, or thesdotoolcommand in MATLAB®. You can launch a pre-configured optimization task in theResponse Optimizerby first opening the model and by double-clicking on the orange block at the bottom of the model. From theResponse Optimizer,按下Plot Model Responsebutton to simulate the model and show how well the initial design satisfies the design requirements.

We start the optimization by pressing theOptimizebutton from theResponse Optimizer. The plots are updated to indicate that the design requirements are now satisfied.

Close the model.

bdclose('pidtune_demo')