Main Content

PID Controller Design for Fast Reference Tracking

This example shows how to usePID Tunerto design a controller for the plant:

s y s = 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 anLTI model. For information about usingPID Tunerto tune aPID Controllerblock in a Simulink®model, seeTune PID Controller to Favor Reference Tracking or Disturbance Rejection(Simulink Control Design).

  1. Create the plant model and openPID Tunerto design a PI controller for a first pass design.

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

    When you openPID 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 Tunerdisplays the closed-loop step response of the system with the designed controller.

    Tip

    You can also openPID Tunerfrom the MATLAB®desktop, in theAppstab. When you do so, use thePlantmenu inPID Tunerto specify your plant model.

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

    Right-click on the plot and selectCharacteristics > Rise Timeto mark the rise time as a blue dot on the plot. SelectCharacteristics > Settling Timeto 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

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

  3. Slide theResponse timeslider to the right to try to improve the loop performance. The response plot automatically updates with the new design.

    Moving theResponse timeslider 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 givesPID Tunermore freedom to achieve adequate phase margin with the desired response speed.

    In theTypemenu, selectPIDF.PID Tunerdesigns a new PIDF controller. (SeePID Controller Typefor more information about available controller types.)

    The rise time and settling time now meet the design requirements. You can use theResponse timeslider to make further adjustments to the response. To revert to the default automated tuning result, clickReset Design.

    Note

    To adjust the closed-loop bandwidth instead of the response time, selectFrequency domainfrom theDesign modemenu . The bandwidth is inversely proportional to the response time.

  5. Analyze other system responses, if appropriate.

    To analyze other system responses, clickAdd 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 theStepsection of theAdd Plotmenu, selectInput disturbance rejection. The disturbance rejection response appears in a new figure.

    SeeAnalyze Design in PID Tunerfor more information about available response plots.

    Tip

    Use the options in theViewtab to change howPID Tunerdisplays multiple plots.

  6. Export your controller design to the MATLAB workspace.

    出口最终MATL控制器设计AB workspace, clickExport.PID Tunerexports the controller as a

    • pidcontroller object, if theFormisParallel

    • pidstdcontroller object, if theFormisStandard

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

    Then, right-click the model and selectExport.

Related Topics