Tune PID controllers - MATLAB (2024)

Tune PID controllers

expand all in page

Description

The PID Tuner app automatically tunes the gains of a PID controller for a SISO plant to achieve a balance between performance and robustness. You can specify the controller type, such as PI, PID with derivative filter, or two-degree-of-freedom (2-DOF) PID controllers. Analysis plots let you examine controller performance in time and frequency domains. You can interactively refine the performance of the controller to adjust loop bandwidth and phase margin, or to favor setpoint tracking or disturbance rejection.

You can use PID Tuner with a plant represented by a numeric LTI model such as a transfer function (tf) or state-space (ss) model. If you have Simulink® Control Design™ software, you can use PID Tuner to tune a PID Controller or PID Controller (2DOF) block in a Simulink model. If you have System Identification Toolbox™ software, you can use the app to estimate a plant from measured or simulated data and design a controller for the estimated plant.

Interactive Tuning in the Live Editor

For interactive PID tuning in the Live Editor, see the Tune PID Controller Live Editor task. This task lets you interactively design a PID controller and automatically generates MATLAB® code for your live script.

Tune PID controllers - MATLAB (2)

Open the PID Tuner App

  • MATLAB Toolstrip: On the Apps tab, under Control System Design and Analysis, click the app icon.

  • MATLAB command prompt: Enter pidTuner.

  • Simulink model: In the PID Controller or PID Controller (2DOF) block dialog box, click Tune.

Examples

  • Tune PID Controller to Favor Reference Tracking or Disturbance Rejection (PID Tuner)
  • PID Controller Tuning in Simulink (Simulink Control Design)
  • Designing PID Controllers with PID Tuner
  • Introduction to Model-Based PID Tuning in Simulink (Simulink Control Design)

Parameters

expand all

The Plant menu displays the name of the current plant that PID Tuner is using for controller design.

Change the current plant using the following menu options:

  • A list of the LTI models present in the PID Tuner Data Browser.

  • Import — Import a new LTI model from the MATLAB workspace.

  • Re-Linearize Closed Loop — Linearize the plant at a different snapshot time. See Tune at a Different Operating Point (Simulink Control Design). This option is available only when tuning a PID Controller or PID Controller (2DOF) block in a Simulink model.

  • Identify New Plant — Use system identification to obtain a plant from measured or simulated system response data (requires System Identification Toolbox software). See:

    • Interactively Estimate Plant Parameters from Response Data, when tuning a PID controller for an LTI model.

    • Interactively Estimate Plant from Measured or Simulated Response Data (Simulink Control Design), when tuning a PID Controller block in a Simulink model.

If you are tuning a PID controller for a plant represented by an LTI model, the default plant is:

  • Plant = 1, if you opened PID Tuner from the Apps tab in the MATLAB Toolstrip, or if you used the pidTuner command without an input argument.

  • The plant you specified as an input argument to pidTuner.

If you are tuning a PID Controller or PID Controller (2DOF) block in a Simulink model, then the default plant is linearized at the operating point specified by the model initial conditions. See What Plant Does PID Tuner See? (Simulink Control Design)

The controller type specifies which terms are present in the PID controller. For instance, a PI controller has a proportional and an integral term. A PDF controller has a proportional term and a filtered derivative term.

  • If you are tuning a controller for a plant represented by an LTI model, use the Type menu to specify controller type. When you change controller type, PID Tuner automatically designs a new controller. Available controller types include 2-DOF PID controllers for more flexibility in the trade-off between disturbance rejection and reference tracking. For details on available controller types, see PID Controller Types for Tuning.

  • If you are tuning a PID Controller or PID Controller (2DOF) block in a Simulink model, the Type field displays the controller type specified in the block dialog box.

This field displays the controller form.

  • If you are tuning a controller for a plant represented by an LTI model, use the Form menu to specify controller form. For information about parallel and standard forms, see the pid and pidstd reference pages.

  • If you are tuning a PID Controller or PID Controller (2DOF) block in a Simulink model, the Form field displays the controller form specified in the block dialog box.

The Domain menu enables you to switch the domain in which PID Tuner displays the target performance parameters.

  • Time — Sliders set the Response Time and Transient Behavior.

  • Frequency — Sliders set the Bandwidth and Phase Margin.

To refine the controller design, you adjust the target performance parameters using the sliders or the corresponding numeric values.

Tune PID controllers - MATLAB (3)

For more information, see:

  • Refine the Design (tuning a controller for an LTI model)

  • Refine the Design (Simulink Control Design) (tuning PID Controller or PID Controller (2DOF) block in Simulink model)

Create time-domain and frequency-domain analysis plots to help analyze the performance of the PID controller. For detailed information about the available response plots, see:

  • Analyze Design in PID Tuner (tuning a controller for an LTI model)

  • Analyze Design in PID Tuner (Simulink Control Design) (tuning PID Controller or PID Controller (2DOF) block in Simulink model)

Programmatic Use

expand all

pidTuner

Tips

  • For PID tuning at the command line, use pidtune. The pidtune command can design a controller for multiple plants at once.

  • For interactive PID tuning in the Live Editor, see the Tune PID Controller Live Editor task. This task lets you interactively design a PID controller and automatically generates MATLAB code for your live script.

Version History

Introduced in R2010b

See Also

Functions

  • pidtune

Live Editor Tasks

  • Tune PID Controller

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Tune PID controllers - MATLAB (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Tune PID controllers - MATLAB (2024)
Top Articles
Latest Posts
Article information

Author: Msgr. Refugio Daniel

Last Updated:

Views: 5471

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.