线性化金宝app楷模
通常,实际系统是非线性的。要设计非线性系统的MPC控制器,您可以在Simulink中建模该工厂金宝app®。
Although an MPC controller can regulate a nonlinear plant, the model used within the controller must be linear. In other words, the controller employs a linear approximation of the nonlinear plant. The accuracy of this approximation significantly affects controller performance.
要获得这样的线性近似,您线性化the nonlinear plant at a specifiedoperating point。
笔记
以下示例需要金宝appSimulink Control Design™软件。
您可以将Simulink模型线性化:金宝app
从命令行。
使用模型线性化器。
使用MPC设计师。例如,请参阅使用MPC设计器线性金宝app化模型。
使用MATLAB代码线性化
This example shows how to obtain a linear model of a plant using a MATLAB script.
对于此示例,CSTR模型,cstr_openloop
,已线性化。模型输入是冷却液温度(MPC控制器的操纵变量),限制了进料流中的反应物浓度和进料温度。模型状态是产品流中极限反应物的温度和浓度。两种状态均已测量并用于反馈控制。
获得稳态操作点
操作点定义了您对模型线性线性的名义条件。通常是稳态状况。
假设您计划以输出浓度操作CSTR,C_A
, 在
。The nominal feed concentration is
,名义饲料温度为300K。
创建并可视化操作点规范对象以定义稳态条件。
opspec = operspec('cstr_openloop');opspec = addoutputspec(opspec,'CSTR_OpenLoop/CSTR',2);opspec.Outputs(1)。已知= true;opspec.Outputs(1).y = 2;OPSPEC
OPSPEC =模型CSTR_OPENLOOP的操作点规范。(Time-Varying Components Evaluated at time t=0) States: ---------- x Known SteadyState Min Max dxMin dxMax ___________ ___________ ___________ ___________ ___________ ___________ ___________ (1.) CSTR_OpenLoop/CSTR/C_A 8.5695 false true0 INF -INF-INF INF(2.)CSTR_OPENLOOP/CSTR/T_K 311.267 FALSE 0 INF -INF-INF INF输入:---------------- u已知的最大最大_____ _____ _____ _____ _____ _____(1.)cstr_openloop/coolantloop/冷却剂温度0 false -Inf Inf输出:----------- y最小最大_____ _____ _____ ______(1。)cstr_openloop/cstr 2 true -inf inf
搜索满足规格的操作点。
op1 = findop('cstr_openloop',opspec);
操作点搜索报告:-----------------------------------------------------
opReport =模型CSTR_OPENLOOP的操作点搜索报告。(在时间t = 0评估的时变组件)成功满足了工作点规格。States: ---------- Min x Max dxMin dx dxMax ___________ ___________ ___________ ___________ ___________ ___________ (1.) CSTR_OpenLoop/CSTR/C_A 0 2 Inf 0 -4.6683e-12 0 (2.) CSTR_OpenLoop/CSTR/t_k 0 373.1311 INF 0 5.5451E-110输入:---------------------------------------------------------------------------------------------------------------------------------------------------------------最小y max ___ ___ __________________________________________________________________________________________________________________________________________________________
计算的工作点是C_A
=
andT_K
= 373K。请注意,稳态冷却剂温度也为299 K,这是用于控制植物的输入的标称值。
指定:
已知输入的值,使用
输入。已知
and输入
fields ofOPSPEC
对状态值的初始猜测,请使用
state.x
现场OPSPEC
例如,以下代码将冷却液温度指定为305 k,并且初始猜测值C_A
andT_K
计算稳态操作点之前的状态:
opspec = operspec('cstr_openloop');OPSPEC。状态(1).x = 1; opspec.States(2).x = 400; opspec.Inputs(1).Known = true; opspec.Inputs(1).u = 305; op2 = findop('cstr_openloop',opspec)
操作点搜索报告:-----------------------------------------------------
opReport =模型CSTR_OPENLOOP的操作点搜索报告。(在时间t = 0评估的时变组件)成功满足了工作点规格。States: ---------- Min x Max dxMin dx dxMax ___________ ___________ ___________ ___________ ___________ ___________ (1.) CSTR_OpenLoop/CSTR/C_A 0 1.7787 Inf 0 -1.5987e-14 0 (2.) CSTR_OpenLoop/CSTR/t_k 0 376.5371 INF 0 7.1054E-14 0输入:-----------------------------------------------------------------------------------------
OP2 =模型CSTR_OPENLOOP的操作点。(在时间t = 0上评估的时变组件)状态:---------- x ________(1.)cstr_openloop/cstr/c_a 1.7787(2.)cstr_openloop/cstr/cstr/t_k 376.5371输入: --------- u ___(1.)CSTR_OPENLOOOP/冷却液温度305
指定线性化输入和输出
如果模型中已经定义了线性化输入和输出信号,则如在cstr_openloop
,然后使用以下来获得信号集。
io = getlinio('cstr_openloop');
Otherwise, specify the input and output signals as shown here.
io(1)= linio('CSTR_OPENLOOP/冷却液温度',1,'输入');io(2)= linio('CSTR_OPENLOOP/FEED浓度',1,'输入');io(3)= linio('CSTR_OPENLOOP/FEED温度',1,'输入');io(4)= linio('CSTR_OpenLoop/CSTR',1,'输出');io(5) = linio('CSTR_OpenLoop/CSTR',2,'输出');
线性化模型
使用指定的操作点线性化模型,OP1
,和输入/输出信号,io
。
sys =线性化('cstr_openloop',OP1,IO)
SYS = A = C_A T_K C_A -5 -5 -0.3427 T_K 47.68 2.785 B =冷却剂温度饲料浓度浓度浓度C_A C_A 0 1 0 T_K 0.3 0 1 C = C_A T_K C = C_A T_K CSTR/1 0 1 0 1 CSTR/2 CSTR/2 CSTR/2 CSTR/2 CSTR/2 CSTR/2 CCTR/2 0 D =冷却剂温度contem contp contem contp contem contp contem contp cont馈电疗法CSTR/1 0 0 0 CSTR/2 0 0 0连续时间空间模型。
将模型线性化也围绕操作点,OP2
,使用相同的输入/输出信号。
sys =线性化('cstr_openloop',OP2,IO)
sys = a = c_a t_k c_a -5.622 -5.622 -0.3458 t_k 55.1 2.822 b =冷却剂温度饲料浓度浓度浓度compa c_a 0 1 0 t_k 0.3 0 1 c = c_a t_k t_k t_k cstr/1 0 1 0 1 0 1 cstr/2 cstr/2 cstr/2 cstr/2 cstr/d d d d =冷却剂温度contem contp contem contp contem馈电疗法CSTR/1 0 0 0 CSTR/2 0 0 0连续时间空间模型。
使用模型线性化的线性化金宝appControl Design
This example shows how to linearize a Simulink model using the模型线性化器,由金宝appSimulink控制设计软件。
打开金宝app模型
此示例使用CSTR模型,cstr_openloop
。
open_system('cstr_openloop')
指定线性化输入和输出
The linearization inputs and outputs are already specified forcstr_openloop
。输入信号对应于来自饲料浓度
,,,,进料温度
,,,,andCoolant Temperature
块。输出信号是CSTRTemperature
and残留浓度
块。
要将信号指定为线性化输入或输出,首先在simulink中金宝app应用选项卡,单击线性化管理器。然后,在Simulink模金宝app型窗口中,单击信号。最后,在插入分析点画廊,在闭环部分,选择要么输入扰动用于线性化输入或输出测量用于线性化输出。
打开模型线性化器
打开模型线性化器,,,,in the应用选项卡,单击模型线性化器。
将剩余浓度指定为已知的修剪约束
要指定残留浓度为已知的修剪常数,首先在Simulink中金宝app应用选项卡,单击线性化管理器。Then, in the Simulink model window, click theCA
输出信号来自CSTR
堵塞。最后,在插入分析点画廊,在修剪部分,选择修剪Output Constraint。
In the模型线性化器,在线性分析选项卡,选择操作点>修剪模型。
在装饰中,模型对话框在输出标签:
选择已知check box for
Channel - 1
在下面cstr_openloop/CSTR。设置相应的Value至
2
kmol/m3。
Create and Verify Operating Point
在“装饰”模型对话框中,单击Start trimming。
修剪进度查看器窗口打开显示优化进度,以在模型的状态输入空间中找到一个特征在模型的状态输入空间中找到一个点。状态,,,,输入,,,,and输出标签。优化过程终止后,关闭修剪进度窗口以及修剪模型对话框。
操作点OP_TRIM1
显示在线性分析工作区of模型线性化器。SelectOP_TRIM1
在线性分析工作区部分。
双击OP_TRIM1
要查看“编辑”对话框中的结果操作点。
在“编辑对话框”中,选择输入标签。
根据需要,稳态的冷却液温度为299 K。关闭编辑对话框。
线性化模型
在线性分析标签,在操作点下拉列表,确保OP_TRIM1
选择。
In the线性化部分,单击步要线性化模型并显示线性化模型的步骤金宝app响应。
此选项创建线性模型linsys1
in the线性分析工作区并为此模型生成步骤响应。linsys1
usesOP_TRIM1
as its operating point.
The step response from feed concentration to outputCSTR/2
显示一个有趣的反响应。对线性模型的检查表明CSTR/2
是残留的CSTR浓度,C_A
。当饲料浓度增加时,C_A
increases initially because more reactant is entering, which increases the reaction rate. This rate increase results in a higher reactor temperature (outputCSTR/1
),进一步提高了反应速率和C_A
大幅下降。
导出线性化结果
如果有必要,你可以重复的these steps to improve your model performance. Once you are satisfied with your linearization result, in the模型线性化器,将线性模型从线性分析工作区部分模型线性化器到MATLAB工作区在其上方的部分。现在,您可以使用线性模型设计MPC控制器。
也可以看看
线性化
(金宝appSimulink控制设计)|模型线性化器(金宝appSimulink控制设计)