Documentation Center

  • Trial Software
  • Product Updates

pidtool

Open PID Tuner for PID tuning

Syntax

pidtool(sys,type)
pidtool(sys,Cbase)
pidtool(sys)
pidtool

Description

pidtool(sys,type) launches the PID Tuner GUI and designs a controller of type type for plant sys.

pidtool(sys,Cbase) launches the GUI with a baseline controller Cbase so that you can compare performance between the designed controller and the baseline controller. If Cbase is a pid or pidstd controller object, the PID Tuner designs a controller of the same form, type, and discrete integrator formulas as Cbase.

pidtool(sys) designs a parallel-form PI controller.

pidtool launches the GUI with default plant of 1 and proportional (P) controller of 1.

Input Arguments

sys

Plant model for controller design. sys can be:

  • Any SISO LTI system (such as ss, tf, zpk, or frd).

  • Any System Identification Toolbox™ SISO linear model (idarx, idfrd, idgrey, idpoly, idproc, or idss).

  • A continuous- or discrete-time model.

  • Stable, unstable, or integrating. However, you might not be able to stabilize a plant with unstable poles under PID control.

  • A model that includes any type of time delay. A plant with long time delays, however, might not achieve adequate performance under PID control.

If the plant has unstable poles, and sys is either:

  • A frd model

  • A ss model with internal time delays that cannot be converted to I/O delays

then you must specify the number of unstable poles in the plant. To do this, After launching the PID Tuner GUI, click the button to open the Import Linear System dialog box. In that dialog box, you can reimport sys, specifying the number of unstable poles where prompted.

type

Controller type (actions) of the controller you are designing, specified as one of the following strings:

StringTypeContinuous-Time Controller Formula (parallel form)Discrete-Time Controller Formula (parallel form, ForwardEuler integration method)
'p'proportional onlyKpKp
'i'integral only

'pi'proportional and integral

'pd'proportional and derivative

'pdf'proportional and derivative with first-order filter on derivative term

'pid'proportional, integral, and derivative

'pidf'proportional, integral, and derivative with first-order filter on derivative term

When you use the type input, the PID Tuner designs a controller in parallel form. If you want to design a controller in standard form, Use the input Cbase instead of type, or select Standard from the Form menu. For more information about parallel and standard forms, see the pid and pidstd reference pages.

If sys is a discrete-time model with sampling time Ts, the PID Tuner designs a discrete-time pid controller using the ForwardEuler discrete integrator formula. If you want to design a controller having a different discrete integrator formula, use the input Cbase instead of type or the Preferences dialog box. For more information about discrete integrator formulas, see the pid and pidstd reference pages.

Cbase

A dynamic system representing a baseline controller, permitting comparison of the performance of the designed controller to the performance of Cbase.

If Cbase is a pid or pidstd object, the PID Tuner also uses it to configure the type, form, and discrete integrator formulas of the designed controller. The designed controller:

  • Is the type represented by Cbase.

  • Is a parallel-form controller, if Cbase is a pid controller object.

  • Is a standard-form controller, if Cbase is a pidstd controller object.

  • Has the same Iformula and Dformula values as Cbase. For more information about Iformula and Dformula, see the pid and pidstd reference pages .

If Cbase is any other dynamic system, the PID Tuner designs a parallel-form PI controller. You can change the controller form and type using the Form and Type menus after launching the PID Tuner.

Examples

Interactive PID Tuning of Parallel-Form Controller

Launch the PID Tuner to design a parallel-form PIDF controller for a discrete-time plant:

Gc = zpk([],[-1 -1 -1],1);
Gd = c2d(Gc,0.1);           % Create discrete-time plant

pidtool(Gd,'pidf')          % Launch PID Tuner
 

Interactive PID Tuning of Standard-Form Controller Using Integrator Discretization Method

Design a standard-form PIDF controller using BackwardEuler discrete integrator formula:

Gc = zpk([],[-1 -1 -1],1);
Gd = c2d(Gc,0.1);           % Create discrete-time plant


% Create baseline controller. 
Cbase = pidstd(1,2,3,4,'Ts',0.1,...
      'IFormula','BackwardEuler','DFormula','BackwardEuler')

pidtool(Gd,Cbase)          % Launch PID Tuner

The PID Tuner designs a controller for Gd having the same form, type, and discrete integrator formulas as Cbase. For comparison, you can display the response plots of Cbase with the response plots of the designed controller by clicking the Show baseline checkbox on the PID Tuner GUI.

Alternatives

For PID tuning at the command line, use pidtune. pidtune can design controllers for multiple plants at once.

More About

expand all

Tips

  • The PID Tuner designs a controller in the feedforward path of a single control loop with unit feedback:

  • The PID Tuner has a default target phase margin of 60 degrees and automatically tunes the PID gains to balance performance (response time) and robustness (stability margins). Use the Response time or Bandwidth and Phase Margin sliders to tune the controller's performance to your requirements. Increasing performance typically decreases robustness, and vice versa.

  • Select response plots from the Response menu to analyze the controller's performance.

  • If you provide Cbase, check Show baseline to display the response of the baseline controller.

  • For more detailed information about using the PID Tuner, see Designing PID Controllers with the PID Tuner.

Algorithms

Typical PID tuning objectives include:

  • Closed-loop stability — The closed-loop system output remains bounded for bounded input.

  • Adequate performance — The closed-loop system tracks reference changes and suppresses disturbances as rapidly as possible. The larger the loop bandwidth (the first frequency at which the open-loop gain is unity), the faster the controller responds to changes in the reference or disturbances in the loop.

  • Adequate robustness — The loop design has enough phase margin and gain margin to allow for modeling errors or variations in system dynamics.

The MathWorks algorithm for tuning PID controllers helps you meet these objectives by automatically tuning the PID gains to balance performance (response time) and robustness (stability margins).

By default, the algorithm chooses a crossover frequency (loop bandwidth) based upon the plant dynamics, and designs for a target phase margin of 60°. If you change the bandwidth or phase margin using the sliders in the PID Tuner GUI, the algorithm computes PID gains that best meet those targets.

References

Åström, K. J. and Hägglund, T. Advanced PID Control, Research Triangle Park, NC: Instrumentation, Systems, and Automation Society, 2006.

See Also

| |

Tutorials

Was this topic helpful?