Main Content

Tune PID控制器

Tune PID控制器For LTI plant in the Live Editor

description

Tune PID控制器Live Editor task lets you interactively tune a PID controller for a plant. The task automatically generates MATLAB®实时脚本的代码。有关实时编辑任务的更多信息,请参见Add Interactive Tasks to a Live Script

Tune PID控制器自动为SISO工厂自动调整PID控制器的收益,以在性能和稳健性之间达到平衡。您可以指定使用或不带有导数过滤器的控制器类型,例如PI,PD或PID。默认,Tune PID控制器assumes the following standard unit-feedback control configuration.

You can also useTune PID控制器to design a 2-DOF PID controller for the feedback configuration of this illustration:

Tune PID控制器generates analysis plots that let you examine controller performance in the time and frequency domains. You can interactively refine the performance of the controller to adjust response time, loop bandwidth, or phase margin, or to favor setpoint tracking or disturbance rejection.

to get started with theTune PID控制器任务,选择工厂模型并指定要设计的控制器的类型。尝试滑块,并观察它们对闭环系统响应的影响。例如,请参阅PID Controller Design in the Live Editor

Related Functionality

打开任务

to add theTune PID控制器MATLAB编辑器中实时脚本的任务:

  • On theLive Editortab, selecttask>Tune PID控制器

  • 在脚本中的代码块中,键入相关关键字,例如tuneorPID。SelectTune PID控制器From the suggested command completions.

参数

Plant and Controller Settings

Choose a plant for which to design a controller. The list contains continuous-time or discrete-time SISO LTI models present in the MATLAB workspace, such as:

  • 州空间(ss),,,,transfer function (tf)和零极生(zpk) 楷模。

  • 对于频率响应数据(FRD) 楷模。For such plants, only frequency-domain design goals and response plots are available.

  • 广义状态空间(Genss)or uncertain state-space (你ss) 楷模。对于这样的模型,Tune PID控制器s你ses the current, nominal value of the tunable and uncertain components.

  • 我dentified models, such asIDSSandIDTFmodels.

Specify the controller form. The two forms differ in the parameters used to express the proportional, integral, and derivative actions and the filter on the derivative term. For information about parallel and standard forms, see:

默认,Tune PID控制器设计一个一级自由度(1-DOF)控制器。这样的控制器最多具有四个系数(请参阅Proportional-Integral-Derivative (PID) Controllers)。

You can instead design a two-degree-of-freedom (2-DOF) PID controller. Such controllers include setpoint weighting on the proportional and derivative terms. A 2-DOF PID controller is capable of fast disturbance rejection without significant increase of overshoot in setpoint tracking. You can also use 2-DOF PID controllers to mitigate the influence of changes in the reference signal on the control signal. For more information, seetwo-Degree-of-Freedom PID Controllers

控制器类型指定PID控制器中存在哪些术语。例如,PI控制器具有比例和积分术语。PDF控制器具有比例项和过滤的导数项。有关可用控制器类型的详细信息,请参见调音的PID控制器类型

System Performance Goals

选择任务显示目标性能参数的域。

  • t一世me-使用sliders to set performance goals in terms of response time and transient behavior. Time-domain tuning is not available for frequency-response data plants such asFRDplants.

  • Frequency-使用sliders to set performance goals in terms of loop bandwidth and phase margin.

域的选择不会影响基础控制器设计或结果。您可以使用更方便的方法或更适合您的应用程序。例如,如果您的设计目标包括目标上升时间,您可能会发现在时间域中工作很方便。如果您具有目标循环带宽,则可能更喜欢在频域中工作。在两个领域中,参考跟踪和干扰拒绝性能之间都有一个权衡。

When you setdomaintot一世me,,,,你se these sliders to adjust the responsiveness and robustness of the controller.

  • 使用Response Time滑块以使控制系统的闭环响应更快或较慢。要更改滑块的限制,请将滑块拖到左侧或右端。要将响应时间减少或增加10倍,请单击or

  • 使用transient Behaviorslider to make the controller more aggressive at disturbance rejection (smaller values) or more robust against plant uncertainty (larger values).

t一世me-domain tuning is not available for frequency-response data plants such asFRDplants.

When you setdomaintoFrequency,,,,你se these sliders to adjust the bandwidth and phase margin of the control system.

  • 使用Bandwidthslider to make the closed-loop response of the control system faster or slower (the response time is 2/wC,,,,wherewC一世sthe bandwidth). To change the limits of the slider, drag the slider to the left or right end. To decrease or increase the bandwidth by a factor of 10, clickor

    For discrete-time controllers,Tune PID控制器limits the maximum bandwidth topi/ts,,,,wherets一世sthe sample time of the selected plant.

  • 使用相位边缘slider to make the controller more aggressive at disturbance rejection (smaller values) or more robust against plant uncertainty (larger values).

Optional Parameters

For a given target phase margin,Tune PID控制器选择一个控制器设计,该设计可以平衡两种绩效指标,参考跟踪和干扰拒绝。当您更改design focus选项,调整算法试图调整PID增益,以偏爱参考跟踪或干扰拒绝,同时达到相同的目标相位边缘。

design focus选项如下:

  • 均衡-For a given robustness, tune the controller to balance reference tracking and disturbance rejection.

  • Reference tracking-t你ne the controller to favor reference tracking, if possible.

  • 我nput disturbance rejection-t你ne the controller to favor disturbance rejection, if possible.

这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.

在所有情况下,您可以如何微调系统的性能很大程度上取决于植物的特性。对于某些植物,改变设计重点option might have little or no effect.

For discrete-time PID controllers, there are different ways to implement the integrator and filter terms. For instance, for a parallel-form discrete-time PID controller, the controller transfer function is

C = k p + k 一世 F (( z + k d t F + d F (( z

我F((z)andDF((z)are thed一世sCrete integrator formulas用于集成器和导数滤波器。(看看如何我F((z)andDF((z)affect other controller forms, including standard form and 2-DOF controllers, seed一世sCrete-Time Proportional-Integral-Derivative (PID) Controllers。)

Use整体公式and滤波器公式to select the values of我F((z)andDF((z), 分别。

  • 前锋欧拉-我F((z)orDF((z)= t s z 1

    this formula is best for small sample times, where the Nyquist limit is large compared to the bandwidth of the controller. For larger sample times, the前锋欧拉Formula can result in instability, even when you discretize a system that is stable in continuous time.

  • Backward Euler-我F((z)orDF((z)= t s z z 1

    一个优势Backward EulerFormula is that discretizing a stable continuous-time system using this formula always yields a stable discrete-time result.

  • trapezoidal-我F((z)orDF((z)= t s 2 z + 1 z 1

    一个优势trapezoidalFormula is that discretizing a stable continuous-time system using this method always yields a stable discrete-time result. Of all available discrete integrator formulas,trapezoidaly一世elds the closest match between the frequency-domain properties of the discretized system and the corresponding continuous-time system.

d一世splay

Specify a response plot for observing the effect of the PID controller on system performance. You can specify a time-domain step response plot or a frequency-domain Bode plot for different system responses. The code thatTune PID控制器generates in your live script includes code for generating the plot you select.

Available System Responses

For 1-DOF PID controller types such as PI, PIDF, and PDF, the software computes system responses based upon the following single-loop control architecture, whereG一世syour specified plant andC是PID控制器:

For 2-DOF PID controller types such as PI2, PIDF2, and I-PD, the software computes responses based upon the following architecture:

这system responses are based on the decomposition of the 2-DOF PID controller,C,进入设定点组件Crand a feedback componentCy,,,,as described intwo-Degree-of-Freedom PID Controllers

这Following table summarizes the available responses for analysis plots.((For frequency-response-data plants such asFRDmodels, time-domain response plots are not available.)

Response Plotted System (1-DOF) Plotted System (2-DOF) description
Plant G G Plant response. Use to examine plant dynamics.
开环 GC -GCy 开环controller-plant系统的响应。Use for frequency-domain design.
Use when your design specifications include robustness criteria such as open-loop gain margin and phase margin.
Reference tracking

G C 1 + G C ((Fromrtoy

G C r 1 G C y ((Fromrtoy

Closed-loop system response to a step change in setpoint. Use when your design specifications include setpoint tracking.
Controller effort

C 1 + G C ((Fromrto

C r 1 G C y ((Fromrto

Closed-loop controller output response to a step change in setpoint. Use when your design is limited by practical constraints, such as controller saturation.
我nput disturbance rejection

G 1 + G C ((Fromd1toy

G 1 G C y ((Fromd1toy

Closed-loop system response to load disturbance (a step disturbance at the plant input). Use when your design specifications include input disturbance rejection.
Output disturbance rejection

1 1 + G C ((Fromd2toy

1 1 G C y ((Fromd2toy

闭环系统对植物输出时的步骤干扰的响应。当您想分析对建模错误的敏感性时使用。

Select this option to generate a display of numeric characteristics of the closed-loop or open-loop response.

  • WhenOutput Plot是阴谋的一步,显示包括特征Css你Ch as rise time, settling time, and percent overshoot. These values are always those of the closed-loop step response from the control system inputr输出y,无论您选择的绘图哪个特定步骤响应。Tune PID控制器你sesStepinfo计算步骤响应特征。有关如何解释这些值的详细信息,请参见Stepinforeference page.

  • WhenOutput Plot是Bode图,显示屏包括增益边距和相位边缘等特征。这些值始终是开环系统响应的值GC,,,,regardless of which specific Bode plot you choose.Tune PID控制器你sesallmarginto compute the frequency-response characteristics. For details about how to interpret these values, see theallmarginreference page.

当您想将调谐控制器的性能与MATLAB工作区中的另一个PID控制器进行比较时,请使用此选项。为此,选择Select from workspace。Another menu appears containing PID model objects that are currently in the workspace. The list includes PID model objects of all types (p一世d,,,,p一世dstd,,,,PID2,,,,orp一世dstd2)that are of the same time domain as the currently specified plant. For instance, if the plant is a discrete-time state-space model, then any discrete-time PID model object in the workspace is available as a baseline controller.

When you specify a baseline controller, the response plot updates to include a dotted-line plot of the system response with the baseline controller.

Store Controller for Comparison

You can store a design to use as a baseline while you experiment further with controller types, performance goals, and other settings. To do so, when you find the design that you want to use as a baseline:

  1. 注意任务摘要行中控制器工作区变量的名称(请参阅t一世ps)。For instance, if the name isC,,,,then the current controller is in the MATLAB workspace asC

  2. Change the name of the controller variable in the task summary line. For instance, change it toCnew

  3. SelectBaseline Controllerand specify the stored controllerCas the baseline.

    当您对控制器设计进行进一步实验时,任务存储在工作空间中的控制器更改为Cnew。这plot shows you the baseline response usingCand the tuned response usingCnew

t一世ps

  • After you select a plant, the task creates the controller and stores it in the MATLAB workspace. The stored controller is ap一世d,,,,p一世dstd,,,,PID2,,,,orp一世dstd2model object, as specified by your selections for形式anddegrees of Freedom

    这default variable name for the stored controller isC。You can change the variable name by typing a new name into the task summary line.

  • 这task also provides information about the performance and robustness of the closed-loop system in a structure calledp一世d我nfoby default. For information about this structure, see the信息output argument on thep一世dtunereference page.

Algorithms

Tune PID控制器使用讨论的算法PID调整算法

版本历史记录

在R2019b中引入