Main Content

Simulink中的鲁棒性分析金宝app

此示例显示了如何使用Robust Control Toolb金宝appox™提供的Simulink®块和辅助功能来指定和分析Simulink中的不确定系统,以及如何使用这些工具来执行不确定系统的蒙特卡洛模拟。

Introduction

这Simulink modelusim_modelconsists of an uncertain plant in feedback with a sensor:

open_system('usim_model'

该工厂是具有两个不确定性来源的一阶模型:

  • 真实的杆的位置在-10和-4之间变化

  • Unmodeled dynamics which amount to 25% relative uncertainty at low frequency rising to 100% uncertainty at 130 rad/s.

反馈路径具有廉价的传感器,该传感器由20 rad/s的一阶滤镜建模,不确定的增益在0.1到2之间。指定这些不确定的变量,键入

%一阶植物模型unc_pole= ureal('unc_pole',,,,-5,'范围',[-10 -4]);植物= ss(unc_pole,5,1,1);% Unmodeled plant dynamicsinput_unc = ultidyn('input_unc',[1 1]);wt =压力(0.25,130,2.5);传感器增益%sensor_gain = ureal('sensor_gain',,,,1,'范围',,,,[0.1 2]);

金宝app用于不确定性建模和分析的模拟块

RCTblockslibrary contains blocks to model and analyze uncertainty effects in Simulink. To open the library, type

open('RCTblocks'

状态空间不确定block lets you specify uncertain linear systems (USS objects).usim_modelcontains three such blocks which are highlighted in blue. The dialog for the "Plant" block appears below.

In this dialog box,

  • “不确定系统变量”参数指定不确定的植物模型(具有不确定极的一阶模型unc_pole)。

  • “不确定性值”参数指定块不确定变量的值(unc_pole在这种情况下)。

紫色是一种结构,其字段名称和值是用于仿真的不确定的可变名称和值。您可以设置紫色[]使用名义值来不确定变量或变化紫色分析不确定性如何影响模型响应。

MultiPlot Graphblock is a convenient way to visualize the response spread as you vary the uncertainty. This block superposes the simulation results obtained for each uncertainty value.

蒙特卡洛模拟不确定系统

To easily control the uncertainty value used for simulation,usim_modeluses the same "Uncertainty value"紫色in all three状态空间不确定blocks. Setting紫色[]模拟标称值的闭环响应unc_pole,,,,input_unc,,,,andsensor_gain

uval = [];%使用不确定变量的名义价值sim('usim_model',,,,10);% simulate response

To analyze how uncertainty affects the model responses, you can use theUfindandusamplecommands to generate random values ofunc_pole,,,,input_unc,,,,andsensor_gain。首先使用Ufind找到状态空间不确定blocks inusim_modeland compile a list of all uncertain variables in these blocks:

[uvars,pathinfo] = ufind('usim_model');乌瓦尔% uncertain variables
UVARS =带字段的结构:input_unc:[1x1 ultidyn] sensor_gain:[1x1 ureal] unc_pole:[1x1 ureal]

pathinfo(:,1)% paths to USS blocks
ans = 3x1单元格数组{'usim_model/plant'} {'usim_model/传感器增益'} {'usim_model/unusim_model/toom dodeled植物动力学'}

然后使用usample至generate uncertainty values紫色consistent with the specified uncertainty ranges. For example, you can simulate the closed-loop response for 10 random values ofunc_pole,,,,input_unc,,,,andsensor_gainas follows:

为了i = 1:10;uval = usample(uvars);%生成不确定变量的随机实例sim('usim_model',,,,10);% simulate response结尾

MultiPlot Graphwindow now shows 10 possible responses of the uncertain feedback loop. Note that each紫色实例是包含不确定变量的值的结构input_unc,,,,sensor_gain,,,,andunc_pole

紫色% sample value of uncertain variables
UVAL =带字段的结构:input_unc:[1x1 ss] sensor_gain:0.5893 unc_pole:-4.9557

Randomized Simulations

If needed, you can configure the model to use a different uncertainty value紫色为了each new simulation. To do this, add乌瓦尔到基础或模型工作区,并附加usamplecall to the model InitFcn:

bdclose('usim_model'),open_system('usim_model'%在基本工作区中写下不确定的变量列表评估('base',,,,'uvars = ufind(''usim_model'');'% Modify the model InitFcnset_param('usim_model',,,,'InitFcn',,,,'uval = usample(uvars);');%模拟十次(与按“启动模拟”相同十次)为了i = 1:10;sim('usim_model',,,,10);结尾% Clean upset_param('usim_model',,,,'InitFcn',,,,'');

再次MultiPlot Graphwindow shows 10 possible responses of the uncertain feedback loop.

Linearization of Uncertain Simulink Models

如果您具有Simulin金宝appk Control Design™,则可以使用相同的工作流程来线性化和分析频域中的不确定系统。例如,您可以为模型不确定性的10个随机样本绘制闭环bode响应:

clear系统wmax = 50;% max natural frequency for unmodeled dynamics (input_unc)为了i = 1:10;uval = usample(uvars,1,wmax);sys(::,:,i)=线性化('usim_model');结尾bode(sys) title('Ten linearizations of usim\_model');

If the operating point is independent of the uncertain variables, a faster approach is to compute an uncertain linearization (USS object) in one shot using theulinearize命令:

usys =无线化('usim_model'
忙=不确定连续时间状态空间模型with 1 outputs, 1 inputs, 3 states. The model uncertainty consists of the following blocks: input_unc: Uncertain 1x1 LTI, peak gain = 1, 1 occurrences sensor_gain: Uncertain real, nominal = 1, range = [0.1,2], 1 occurrences unc_pole: Uncertain real, nominal = -5, range = [-10,-4], 1 occurrences Type "usys.NominalValue" to see the nominal value, "get(usys)" to see all properties, and "usys.Uncertainty" to interact with the uncertain elements.

然后,您可以采样不确定的状态空间模型usys生成类似的Bode图:

bode(usample(usys,10,wmax)))标题('Ten linearizations of usim\_model');

也可以看看

Blocks

功能

Related Topics