主要内容

trim

查找动态系统的修剪点

Syntax

[x,u,y,dx] = trim('sys')
[x,u,y,dx] = trim('sys',x0,u0,y0)
[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy)
[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx)
[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,iy,dx0,idx,选项)
[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options,t)

描述

Note

trim仅提供基本的修剪功能。对于完整的修剪功能,请使用金宝app®Control Design™software. For more information, seeCompute Steady-State Operating Points(Simulink Control Design).

修剪点,也称为平衡点,是动态系统的参数空间中的一个点,该系统处于稳态状态。例如,飞机的修剪点是其控制装置的设置,该设置会导致飞机直飞直飞和水平。从数学上讲,修剪点是系统的状态衍生物等于零的点。trim从初始点开始,然后使用顺序二次编程算法进行搜索,直到找到最近的装饰点为止。您必须隐式或显式地提供初始点。如果trimcannot find a trim point, it returns the point encountered in its search where the state derivatives are closest to zero in a min-max sense; that is, it returns the point that minimizes the maximum deviation from zero of the derivatives.trim可以找到符合特定输入,输出或状态条件的修剪点,并且可以找到以指定方式更改系统更改的点,即系统的状态衍生物等于特定的非零值。

[x,u,y,dx] = trim('sys')找到模型的平衡点'sys',最接近系统的初始状态,x0. Specifically,trimfinds the equilibrium point that minimizes the maximum absolute value of[x-x0,u,y]. Iftrim找不到系统初始状态附近的平衡点,它返回系统最接近平衡的点。具体而言,它返回了最小化的观点abs(dx)wheredxrepresents the derivative of the system. You can obtainx0using this command.

[sizes,x0,xstr] = sys([],[],[],0)

[x,u,y,dx] = trim('sys',x0,u0,y0)找到最接近的装饰点x0,u0,y0,也就是说,将最大值的最大值

abs([x-x0; u-u0; y-y0])

[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy)找到最接近的装饰点x0,u0,y0that satisfies a specified set of state, input, and/or output conditions. The integer vectorsix,IU, 和iy选择值x0,u0, 和y0那必须满足。如果trimcannot find an equilibrium point that satisfies the specified set of conditions exactly, it returns the nearest point that satisfies the conditions, namely,

abs([x(ix)-x0(ix); u(iu)-u0(iu); y(iy)-y0(iy)])

[x,u,y,dx] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx)找到特定的非平衡点,即系统衍生物具有一些指定的非零值的点。这里,dx0specifies the state derivative values at the search's starting point andidx选择值dx0搜索必须完全满足。

[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,iy,dx0,idx,选项)specifies an array of optimization parameters thattrimpasses to the optimization function that it uses to find trim points. The optimization function, in turn, uses this array to control the optimization process and to return information about the process.trimreturns theoptions搜索过程结束时的数组。通过以这种方式公开基础优化过程trimallows you to monitor and fine-tune the search for trim points.

下表描述了每个元素如何影响对修剪点的搜索。阵列元素1、2、3、4和10对于查找修剪点特别有用。

No. 默认 描述
1 0 指定显示选项。0指定没有显示;1指定表输出;-1抑制警告消息。
2 10–4 Precision the computed trim point must attain to terminate the search.
3 10–4 Precision the trim search goal function must attain to terminate the search.
4 10–6 Precision the state derivatives must attain to terminate the search.
5 N/A 不曾用过。
6 N/A 不曾用过。
7 N/A Used internally.
8 N/A 返回修剪搜索目标功能的值(目标达到目标)。
9 N/A 不曾用过。
10 N/A Returns the number of iterations used to find a trim point.
11 N/A 返回功能梯度评估的数量。
12 0 不曾用过。
13 0 平等约束的数量。
14 100*(变量数) Maximum number of function evaluations to use to find a trim point.
15 N/A 不曾用过。
16 10–8 Used internally.
17 0.1 Used internally.
18 N/A Returns the step length.

[x,u,y,dx,options] = trim('sys',x0,u0,y0,ix,iu,iy,dx0,idx,options,t)设定时间tif the system is dependent on time.

Note

如果修复了任何状态,输入或输出值,trim使用未指定的自由变量来得出满足这些约束的解决方案。

例子

寻找稳态点

Simu金宝applinktrim功能使用模型来确定满足您指定的输入,输出和状态条件的动态系统的稳态点。例如,考虑此模型称为ex_lmod.

You can use thetrim函数以找到输入的值以及将两个输出设置为1的状态。首先,对状态变量进行初始猜测(x) and input values (u), then set the desired value for the output (y)。

x = [0; 0; 0]; u = 0; y = [1; 1];

使用索引变量指示固定哪些变量且哪些变量可以变化。

ix = [];%不要修复任何状态iu = [];%不要修复输入iy = [1; 2];%修复输出1和输出2

Invokingtrim返回解决方案。您的结果可能因圆形错误而有所不同。

[x,u,y,dx] = trim('lmod',x,u,y,ix,iu,iy)x = 0.0000 1.0000 1.0000 u = 2 y = 2 y = 1.0000 1.0000 1.0000 dx = 1.0e -015 * -0.2220-0.0227 0.3331

Note that there might be no solution to equilibrium point problems. If that is the case,trimreturns a solution that minimizes the maximum deviation from the desired result after first trying to set the derivatives to zero. For a description of thetrim语法,请参阅trim.

寻找平衡点

Consider a linear state-space system modeled using a State-Space block

x ˙ = A x + B u y = C x + D u

TheA,B,C, 和Dmatrices to enter at the command line or in the block parameters dialog are:.

a = [-0.09 -0.01;1 0];b = [0 -7;0 -2];C = [0 2;1 -5];d = [-3 0;1 0];
示例1

To find an equilibrium point in this model calledsys使用:

[x,u,y,dx,options] = trim('sys') x = 0 0 u = 0 0 y = 0 0 dx = 0 0

进行的迭代次数是:

options(10) ans = 7
示例2

To find an equilibrium point nearx = [1;1], u = [1;1], enter

x0 = [1;1]; u0 = [1;1]; [x,u,y,dx,options] = trim('sys', x0, u0); x = 1.0e-13 * -0.5160 -0.5169 u = 0.3333 0.0000 y = -1.0000 0.3333 dx = 1.0e-12 * 0.1979 0.0035

The number of iterations taken is

options(10) ans = 25
示例3

要找到一个固定到输出的平衡点1使用:

y = [1; 1];iy = [1; 2];[x,u,y,dx] = trim('sys', [], [], y, [], [], iy) x = 0.0009 -0.3075 u = -0.5383 0.0004 y = 1.0000 1.0000 dx = 1.0e-15 * -0.0170 0.1483
示例4

要找到一个固定为1的输出,衍生物设置为0和1的平衡点,请使用

y = [1; 1];iy = [1; 2];dx = [0; 1];idx = [1; 2];[x,u,y,dx,options] = trim('sys',[],[],[],y,[],[],iy,dx,idx)x = 0.9752 -0.0827 u = -0.3884 -0.0124 y y= 1.0000 1.0000 dx = 0.0000 1.0000

The number of iterations taken is

options(10) ans = 13

限制

trimstarting from any given initial point is only a local value. Other, more suitable trim points may exist. Thus, if you want to find the most suitable trim point for a particular application, it is important to try a number of initial guesses forx,u, 和y.

算法

trimuses a sequential quadratic programming algorithm to find trim points. See顺序二次编程(SQP)(优化工具箱)for a description of this algorithm.

版本历史

在R2006a之前引入

See Also

(Simulink Control Design)

Topics