Main Content

pidTuner

Open PID Tuner for PID tuning

Syntax

pidTuner(sys,type)
pidTuner(sys,Cbase)
pidTuner(sys)
pidTuner

Description

pidTuner(sys,type)launches thePID Tunerapp and designs a controller of typetypefor plantsys.

pidTuner(sys,Cbase)launches PID Tuner with a baseline controllerCbaseso that you can compare performance between the designed controller and the baseline controller. IfCbaseis apid,pidstd,pid2orpidstd2controller object, PID Tuner designs a controller of the same form, type, and discrete integrator formulas asCbase.

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

pidTunerlaunches PID Tuner with default plant of 1 and proportional (P) controller of 1.

Input Arguments

sys

Plant model for controller design.syscan be:

  • Any SISO LTI system (such asss,tf,zpk, orfrd).

  • Any System Identification Toolbox™ SISO linear model (idtf(System Identification Toolbox),idfrd(System Identification Toolbox),idgrey(System Identification Toolbox),idpoly(System Identification Toolbox),idproc(System Identification Toolbox), oridss(System Identification Toolbox)).

  • 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, andsysis either:

  • Afrdmodel

  • Assmodel 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 opening PID Tuner, in thePlantmenu, selectImport. In the Import Linear System dialog box, reimportsys, specifying the number of unstable poles where prompted.

type

Controller type of the controller to design, specified as a character vector. The termcontroller type是指哪些术语controlle存在r action. For example, a PI controller has only a proportional and an integral term, while a PIDF controller contains proportional, integrator, and filtered derivative terms.typecan take the values summarized below. For more detailed information about these controller types, seePID Controller Types for Tuning

1-DOF Controllers

  • 'P'— Proportional only

  • '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

2-DOF Controllers

  • 'PI2'— 2-DOF proportional and integral

  • 'PD2'— 2-DOF proportional and derivative

  • 'PDF2'— 2-DOF proportional and derivative with first-order filter on derivative term

  • 'PID2'— 2-DOF proportional, integral, and derivative

  • 'PIDF2'— 2-DOF proportional, integral, and derivative with first-order filter on derivative term

For more information about 2-DOF PID controllers generally, seeTwo-Degree-of-Freedom PID Controllers.

2-DOF Controllers with Fixed Setpoint Weights

  • 'I-PD'— 2-DOF PID withb= 0,c= 0

  • 'I-PDF'— 2-DOF PIDF withb= 0,c= 0

  • 'ID-P'— 2-DOF PID withb= 0,c= 1

  • 'IDF-P'— 2-DOF PIDF withb= 0,c= 1

  • 'PI-D'— 2-DOF PID withb= 1,c= 0

  • 'PI-DF'— 2-DOF PIDF withb= 1,c= 0

For more detailed information about fixed-setpoint-weight 2-DOF PID controllers, seePID Controller Types for Tuning.

Controller Form

When you use thetypeinput, PID Tuner designs a controller in parallel form. If you want to design a controller in standard form, Use the inputCbaseinstead oftype, or selectStandardfrom theFormmenu. For more information about parallel and standard forms, see thepidandpidstdreference pages.

Ifsysis a discrete-time model with sample timeTs, PID Tuner designs a discrete-timepidcontroller using theForwardEulerdiscrete integrator formula. To design a controller having a different discrete integrator formula:

  • Use the input argumentCbaseinstead oftype. PID Tuner reads controller type, form, and discrete integrator formulas from the baseline controllerCbase.

  • In PID Tuner, clickOptionsto open the Controller Options dialog box. Select discrete integrator formulas from theIntegral FormulaandDerivative Formulamenus.

For more information about discrete integrator formulas, see thepidandpidstdreference pages.

Cbase

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

IfCbaseis apidorpidstdobject, 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 byCbase.

  • Is a parallel-form controller, ifCbaseis apidcontroller object.

  • Is a standard-form controller, ifCbaseis apidstdcontroller object.

  • Is a parallel-form 2-DOF controller, ifCbaseis apid2controller object.

  • Is a standard-form 2-DOF controller, ifCbaseis apidstd2controller object.

  • Has the sameIformulaandDformulavalues asCbase. For more information aboutIformulaandDformula, see thepidandpidstdreference pages .

IfCbaseis any other dynamic system, PID Tuner designs a parallel-form PI controller. You can change the controller form and type using theFormandTypemenus after launching PID Tuner.

Examples

Interactive PID Tuning of Parallel-Form Controller

Launch 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 pidTuner(Gd,'pidf') % Launch PID Tuner

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

Design a standard-form PIDF controller usingBackwardEulerdiscrete 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') pidTuner(Gd,Cbase) % Launch PID Tuner

PID Tuner designs a controller forGdhaving the same form, type, and discrete integrator formulas asCbase. For comparison, you can display the response plots ofCbasewith the response plots of the designed controller by clicking theShow baselinecheckbox in PID Tuner.

Tips

  • IftypeorCbasespecifies a one-degree-of-freedom (1-DOF) PID controller, thenpidTuner设计单位反馈回路的控制器illustrated:

  • IftypeorCbasespecifies a two-degree-of-freedom (2-DOF) PID controller, thenpidTunerdesigns a 2-DOF controller as in the feedback loop of this illustration:

  • 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 theResponse timeorBandwidthandPhase Marginsliders to tune the controller's performance to your requirements. Increasing performance typically decreases robustness, and vice versa.

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

  • If you provideCbase, checkShow baselineto display the response of the baseline controller.

  • For more detailed information about using PID Tuner, seeDesigning PID Controllers with PID Tuner.

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

Algorithms

For information about the MathWorks®PID tuning algorithm, seePID Tuning Algorithm.

Alternatives

You can open PID Tuner from the MATLAB desktop, in theAppstab. When you do so, use thePlantmenu in PID Tuner to specify your plant model.

For PID tuning at the command line, usepidtune. Thepidtunecommand can design a controller for multiple plants at once.

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

References

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

Introduced in R2014b