This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

PID Controller Design for Fast Reference Tracking

This example shows how to use PID Tuner to design a controller for the plant:

sys=1(s+1)3.

The design requirements are for the closed loop system to track a reference input with a rise time less than 1.5 s, and settling time less than 6 s.

In this example, you represent the plant as an LTI model. For information about using PID Tuner to tune a PID Controller block in a Simulink® model, see Tune PID Controller to Favor Reference Tracking or Disturbance Rejection (Simulink Control Design).

  1. Create the plant model and open PID Tuner to design a PI controller for a first pass design.

    sys = zpk([],[-1 -1 -1],1); 
    pidTuner(sys,'pi')

    When you open PID Tuner, it automatically designs a controller of the type you specify (here, PI). The controller is designed for a balance between performance (response time) and robustness (stability margins). PID Tuner displays the closed-loop step response of the system with the designed controller.

    Tip

    You can also open PID Tuner from the MATLAB® desktop, in the Apps tab. When you do so, use the Plant menu in PID Tuner to specify your plant model.

  2. Examine the reference tracking rise time and settling time.

    Right-click on the plot and select Characteristics > Rise Time to mark the rise time as a blue dot on the plot. Select Characteristics > Settling Time to mark the settling time. To see tool-tips with numerical values, click each of the blue dots.

    The initial PI controller design provides a rise time of 2.35 s and settling time of 10.7 s. Both results are slower than the design requirements.

    Note

    To display the performance metrics in a table instead of in tool-tips on the plot, click Show parameters. This action opens a display containing performance and robustness metrics and the tuned controller gains.

  3. Slide the Response time slider to the right to try to improve the loop performance. The response plot automatically updates with the new design.

    Moving the Response time slider far enough to meet the rise time requirement of less than 1.5 s results in more oscillation. Additionally, the parameters display shows that the new response has an unacceptably long settling time.

    To achieve the faster response speed, the algorithm must sacrifice stability.

  4. Change the controller type to improve the response.

    Adding derivative action to the controller gives PID Tuner more freedom to achieve adequate phase margin with the desired response speed.

    In the Type menu, select PIDF. PID Tuner designs a new PIDF controller. (See PID Controller Type for more information about available controller types.)

    The rise time and settling time now meet the design requirements. You can use the Response time slider to make further adjustments to the response. To revert to the default automated tuning result, click Reset Design.

    Note

    To adjust the closed-loop bandwidth instead of the response time, select Frequency domain from the Design mode menu . The bandwidth is inversely proportional to the response time.

  5. Analyze other system responses, if appropriate.

    To analyze other system responses, click Add Plot. Select the system response you want to analyze.

    For example, to observe the closed-loop step response to disturbance at the plant input, in the Step section of the Add Plot menu, select Input disturbance rejection. The disturbance rejection response appears in a new figure.

    See Analyze Design in PID Tuner for more information about available response plots.

    Tip

    Use the options in the View tab to change how PID Tuner displays multiple plots.

  6. Export your controller design to the MATLAB workspace.

    To export your final controller design to the MATLAB workspace, click Export. PID Tuner exports the controller as a

    • pid controller object, if the Form is Parallel

    • pidstd controller object, if the Form is Standard

    Alternatively, you can export a model using the right-click menu in the Data Browser. To do so, click the Data Browser tab.

    Then, right-click the model and select Export.

Related Topics