设计Controller Using MPC Designer
此示例显示了如何使用连续搅拌坦克反应器(CSTR)设计模型预测控制器MPC设计师。
CSTR模型
连续搅拌的储罐反应器(CSTR)的线性化模型显示在CSTR模型。在里面model, the first two state variables are the concentration of reagent (here referred to asC一种and measured in kmol/m3)和反应器的温度(在此称为t,以k为k测量),而前两个输入是冷却剂温度(tC,用K测量,用于控制植物)和流入饲料试剂浓度C一种在以kmol/m测量3(通常被认为是未得到的干扰)。
在此示例中,冷却液温度的范围有限±10度,其标称值和有限的变化率为每秒±2度。
创建一个state-space model of a CSTR system.
a = [-5 -0.3427;47.68 2.785];b = [0 1 0.3 0];c = flipud(眼(2));d =零(2);cstr = ss(a,b,c,d);
进口Plant and Define MPC Structure
mpcdesigner
On theMPC设计师tab, in theStructuresection, clickMPC Structure。
在定义MPC结构中通过导入对话框,在从MATLAB工作区中选择植物型号或MPC控制器表,选择CSTR
model.
自从CSTR
是一个稳定的连续时间LTI系统,MPC设计师sets the controller sample time to0。1tr, 在哪里tr是平均上升时间CSTR
。对于此示例,在Specify MPC controller sample time字段,输入样本时间0。5
seconds.
默认情况下,所有植物输入均定义为操纵变量,所有工厂产出为测量的输出。在里面分配工厂I/O频道部分,分配输入和输出通道索引:
第一个输入冷却液温度是一个操纵变量。
第二输入饲料浓度是未衡量的干扰。
第一个输出反应器温度是测量的输出。
这second output, reactant concentration, is an unmeasured output.
点击进口。
该应用程序导入CSTR
种植Data Browser。以下内容也添加到Data Browser:
MPC1
- 默认MPC控制器使用CSTR
as its internal model.方案1
- 默认模拟方案。
这app runs the default simulation scenario and updates the输入响应and输出响应情节。闭环系统能够成功跟踪所需的测量输出,而未衡量的输出并非如此。这种行为是可以预期的,因为该植物只有一个操纵变量。
定义MPC结构后,您将无法在当前MPC设计师会议。要使用其他频道配置,请启动应用程序的新会话。
Define Input and Output Channel Attributes
On theMPC设计师选项卡,选择i/o属性。
在里面Input and Output Channel Specifications dialog box, in theNameColumn, specify a meaningful name for each input and output channel.
在里面UnitColumn, optionally specify the units for each channel.
自从the state-space model is defined using deviations from the nominal operating point, keep the面值对于每个输入和输出通道0
。
保持比例因子for each channel at the default value of1
。
点击OK。
这输入响应and输出响应绘图标签更新以反映新的信号名称和单位。
配置仿真方案
On theMPC设计师tab, in theScenariosection, click编辑方案>方案1。
在里面Simulation Scenario dialog box, set the模拟持续时间到20秒。
在里面Reference Signalstable, in the first row, specify a step尺寸of2
and atimeof5
。
在里面信号列,在第二行中,选择一个Constant
引用以在“输入和输出通道规格”对话框中定义的名义值保持浓度设定值(在这种情况下,名义值为零)。
这default scenario is configured to simulate a step change of2
degrees Kelvin in the reference reactor temperature,t, at a time of5
seconds.
点击OK。
响应图更新以反映新的仿真方案配置。的参考值C一种is no longer a step but a constant equal to zero.
在里面方案section in the lower left part ofMPC设计师, 点击方案1
。点击方案1
第二次将场景重命名为stepT
。
Configure Controller Horizons
On the调整tab, in theHorizonssection, specify a预测范围of15
and a控制视野of3
。
这response plots update to reflect the new horizons. The输入响应plot shows that the control actions violate the required constraint on the rate of change for the coolant temperature.
定义输入约束
在里面设计section, clickConstraints。
在里面Constraints dialog box, in the输入和输出约束部分,在输入row, enter the coolant temperature upper and lower bounds in theMinand最大限度列分别。
Specify the rate of change limits in therateminandRateMax列。
点击OK。
这输入响应图显示了受约束的操纵变量控制动作。
Specify Controller Tuning Weights
On the调整tab, in the设计section, click权重。
在里面Input Weights表,增加操纵变量(MV)速率重量to0。3
。增加MV速率重量会惩罚控制器优化成本函数的大型MV变化。
在里面输出权重表,保留默认值重量values. By default, all unmeasured outputs have zero weights.
由于只有一个操纵变量,因此控制器试图将两个输出保持在特定的设定点处,则一个或两个输出将在其响应中显示稳态错误。由于控制器忽略了零重量的输出的设定点,因此将浓度输出权重设置为零,可以通过零稳态误差进行反应器温度设定点跟踪。
点击OK。
这输入响应情节显示了更保守的控制动作,导致较慢输出响应。
消除输出过冲
Suppose the application demands zero overshoot in the output response. On the性能调整tab, drag the闭环性能向左滑动直到输出响应没有过度冲锋。同时将此滑块移动到左侧,增加了控制器的操纵速率重量,并减小了输出可变权重,从而产生了更健壮的控制器。
当您调整控制器调整权重时闭环性能slider,MPC设计师不会更改“权重”对话框中指定的权重。取而代之的是,滑块控制一个调整因子,该调整因子与用户指定的权重一起定义实际控制器的权重。
这个因素是1
当滑块居中时;随着滑块向左移动并随着滑块向右移动而增加并增加。加权因子乘以操纵变量和输出可变权重,并将操纵可变速率权重从权重对话框划分。
要查看实际的控制器权重,请导出控制器到MATLAB®工作空间,查看权重
导出控制器对象的属性。
test Controller Disturbance Rejection
在过程控制应用程序中,干扰拒绝通常比设定点跟踪更重要。模拟控制器对进料浓度的步骤变化的响应未衡量的干扰。
On theMPC设计师tab, in theScenariosection, clickPlot Scenario>新场景。
在里面Simulation Scenario dialog box, set the模拟持续时间到20秒。
在里面Reference Signalstable, in the first row, in the信号下拉列表,选择Step
,然后指定步骤尺寸of2
,atimeof5
。在里面信号Column, in the second row, keep aConstant
引用以其名义值保持浓度设定值。
在里面无法衡量的干扰行,在信号下拉列表,选择Step
。然后指定步骤尺寸of0。2
and atimeof5
。
点击OK。
这app adds new scenario to theData Browserand creates new corresponding输入响应and输出响应情节。
在里面Data Browser, in the方案section, renamenewscenario
to分心
。
正如您可以从输出响应plots, the closed-loop system is still able to reach the desired reactor temperature. In this case, the required control actions, combined with the input disturbance, cause a steady-state decrease in the output concentration,C一种0.1 kmol/m3。
指定浓度输出约束
Previously, you defined the controller tuning weights to achieve the primary control objective of tracking the reactor temperature setpoint with zero steady-state error. Doing so enables the unmeasured reactor concentration to vary freely. Suppose that unwanted reactions occur once the reactor concentration drops below 0.05 kmol/m3with respect to its nominal value. To constrain the reactor concentration, specify an output constraint.
On the调整tab, in the设计section, clickConstraints。
在里面Constraints dialog box, in the输入和输出约束部分,第二行Outputs表,指定一个Min未衡量的输出(UO)值-0.05
。
默认情况下,所有输出约束都是软的,这意味着它们MinECRandmaxecr值大于零。要进一步软化未测量的输出(UO)约束,请增加其maxecrvalue.
点击OK。
在里面输出响应图,反应堆浓度,C一种,稳定在-0.05 kmol/m310秒后。由于只有一个操纵变量,因此控制器在两个竞争控制目标之间做出妥协:温度跟踪和约束满意度。较软的输出约束使控制器能够更多地牺牲约束要求,以改善温度跟踪。
由于输出限制是软的,因此控制器通过允许较小的浓度约束违规来保持一定程度的温度控制。通常,根据您的应用程序要求,您可以尝试使用不同的约束设置,以实现可接受的控制目标妥协。
Export Controller
在里面调整tab, in the分析section, clickExport Controller为了保存调谐控制器,MPC1
,到MATLAB工作区。
删除Plants, Controllers, and Scenarios
to delete a plant, controller, or scenario, in theData Browser,右键单击要删除的项目,然后选择删除。
您无法删除当前控制器。另外,如果植物是唯一的植物或场景,则不能删除工厂或方案。
如果任何控制器或场景都使用工厂,则无法删除工厂。
要删除多个工厂,控制器或场景,请保持转移and click each item that you want to delete.
参考
[1] Seborg,D。E.,T。F. Edgar和D. A. Mellichamp,过程动态和控制,第二版,威利,2004年,第34-36和94-95页。