Main Content

pidtuneOptions

Define options for pidtune function

Description

Use a pidtuneOptions object to specify properties for tuning a PID controller using the pidtune function.

Creation

Description

example

opt = pidTuneOptions creates a pistuneOptions object with default properties.

opt = pidtuneOptions(Name=Value) specifies one or more properties of the options object using name-value arguments. For example, opt = pidtuneOptions(PhaseMargin=55) creates an options object with a phase margin of 55 degrees.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes. For example, opt = pidtuneOptions("PhaseMargin",55)creates an options object with a phase margin of 55 degrees.

Properties

expand all

Target phase margin in degrees, specified as a positive scalar. pidtune attempts to design a controller such that the phase margin is at least the value specified for PhaseMargin. The selected crossover frequency could restrict the achievable phase margin. Typically, higher phase margin improves stability and overshoot, but limits bandwidth and response speed.

Closed-loop performance objective to favor in the design, specified as one of the following:

  • 'balanced' (default) — For a given robustness, tune the controller to balance reference tracking and disturbance rejection.

  • 'reference-tracking' — Tune the controller to favor reference tracking, if possible.

  • 'disturbance-rejection' — Tune the controller to favor disturbance rejection, if possible.

For a given target phase margin, pidtune chooses a controller design that balances the two measures of performance, reference tracking and disturbance rejection. When you change the DesignFocus option, the tuning algorithm attempts to adjust the PID gains to favor either reference tracking or disturbance rejection while achieving the same target phase margin. In the control architecture assumed by pidtune, shown in the following diagram, reference tracking is the response at y to signals at r, and disturbance rejection is the suppression at y of signals at d.

The more tunable parameters there are in the system, the more likely it is that the PID algorithm can achieve the desired design focus without sacrificing robustness. For example, setting the design focus is more likely to be effective for PID controllers than for P or PI controllers. In all cases, how much you can fine-tune the performance of the system depends strongly on the properties of your plant.

For an example illustrating the effect of this option, see Tune PID Controller to Favor Reference Tracking or Disturbance Rejection (Command Line).

Number of unstable poles in the plant, specified as a nonnegative integer.

When your plant is a frd model or a state-space model with internal delays, you must specify the number of open-loop unstable poles (if any). Incorrect values might result in PID controllers that fail to stabilize the real plant. (pidtune ignores this option for other model types.)

Unstable poles are poles located at:

  • Re(s) > 0, for continuous-time plants

  • |z| > 1, for discrete-time plants

A pure integrator in the plant (s = 0) or (|z| > 1) does not count as an unstable pole for NumUnstablePoles. If your plant is a frd model of a plant with a pure integrator, for best results, ensure that your frequency response data covers a low enough frequency to capture the integrator slope.

Object Functions

pidtunePID tuning algorithm for linear plant model

Examples

collapse all

Tune a PIDF controller with a target phase margin of 45 degrees, favoring the disturbance-rejection measure of performance.

sys = tf(1,[1 3 3 1]);
opts = pidtuneOptions('PhaseMargin',45,'DesignFocus','disturbance-rejection');
[C,info] = pidtune(sys,'pid',opts);

Tips

  • When using the pidtune command to design a PID controller for a plant with unstable poles, if your plant model is one of the following:

    • frd model

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

    then use pidtuneOptions to specify the number of unstable poles in the plant.

Version History

Introduced in R2010b