从命令行中的规格计算操作点
您可以通过指定模型状态,输出和输入的约束以及找到满足这些约束的模型操作条件来计算Simulink®模型的金宝app稳态操作点。有关稳态操作点的更多信息,请参阅About Operating Points和Compute Steady-State Operating Points.
要找到Simulink模型的操作点,您可以使用该模型来修剪模型金宝appFindop
, as shown in this example.
另外,您可以在以下方式中修剪模型
Steady State Manager. For more information, seeCompute Operating Points from Specifications Using Steady State Manager.
模型线性化器. For more information, see使用模型线性化器计算规格中的操作点.
In this example, you compute an operating point to meet output specifications. Using a similar approach, you can define state or input specifications. Also, you can define a combination of state, output, and input specifications; that is, you do not have to use, for example, only state specifications.
有关修剪模型以满足规格的更多信息,请参见从规格计算稳态操作点.
打开的si金宝appmulink模型
打开Simulin金宝appk模型。
mdl ='scdspeed';Open_System(MDL)
Define Operating Point Specifications
为模型创建默认操作点规范。
opspec = operspec(mdl)
OPSPEC =模型SCDSPEED的操作点规范。(Time-Varying Components Evaluated at time t=0) States: ---------- x Known SteadyState Min Max dxMin dxMax ___________ ___________ ___________ ___________ ___________ ___________ ___________ (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar 0.543 false true -inf inf -Inf inf(2.)------- u已知最小最大_____ _____ _____ ______(1.)
Since there are no root-level outputs in the model, the default operating point specification object has no output specifications.
在此示例中,指定已知的稳态发动机速度。为此,请在RAD/S的输出处添加输出规范到RPM块。
opspec = addoutputspec(opspec,'scdspeed/rad // s to rpm',1);
Specify a known value of2000
rpm for the output constraint.
opspec.outputs(1)。已知= 1;opspec.Outputs(1).y = 2000;
查看更新的操作点规范。
opspec
OPSPEC =模型SCDSPEED的操作点规范。(Time-Varying Components Evaluated at time t=0) States: ---------- x Known SteadyState Min Max dxMin dxMax ___________ ___________ ___________ ___________ ___________ ___________ ___________ (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar 0.543 false true -inf inf -Inf inf(2.)------- u已知最小最大_____ _____ ____________________________________________________________________________。。
Trim Model
Find an operating point that meets these specifications.
op1 = findop(mdl,opspec);
Operating point search report: --------------------------------- opreport = Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- Min x Max dxMin dx dxMax ___________ ___________ ___________ ___________ ___________ ___________ (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar -Inf 0.54363 Inf 0 2.6649e-13 0 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s -Inf 209.4395 Inf 0 -8.4758e-12 0 Inputs: ---------- Min u Max _________ _________ _________ (1.) scdspeed/Throttle perturbation -Inf 0.0038183 Inf Outputs: ---------- Min y Max ____ ____ ____ (1.) scdspeed/rad//s to rpm 2000 2000 2000
The operating point search report shows that the specifications were met successfully, and that both states are at steady state as expected (dx
= 0)。
You can also specify bounds for outputs during trimming. For example, suppose that you know that there is a steady-state condition between1900
和2100
rpm. To trim the speed to this range, modify the operating point specifications.
opspec.Outputs(1).min = 1900;opspec.Outputs(1).max = 2100;
In this case, since you do not know the output value, specify the output as unknown. You can also provide an initial guess for the output value.
opspec.Outputs(1).Known = 0; opspec.Outputs(1).y = 2050;
Find an operating point that meets these specifications.
op2 = findop(mdl,opspec);
Operating point search report: --------------------------------- opreport = Operating point search report for the Model scdspeed. (Time-Varying Components Evaluated at time t=0) Operating point specifications were successfully met. States: ---------- Min x Max dxMin dx dxMax ___________ ___________ ___________ ___________ ___________ ___________ (1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar -Inf 0.5436 Inf 0 2.9879e-13 0 (2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s -Inf 209.4799 Inf 0 -9.8968e-13 0 Inputs: ---------- Min u Max _________ _________ _________ (1.) scdspeed/Throttle perturbation -Inf 0.0050021 Inf Outputs: ---------- Min y Max _________ _________ _________ (1.) scdspeed/rad//s to rpm 1900 2000.3853 2100
操作点搜索报告显示,该规范已成功满足。
修剪模型后,您可以:
Linearize your model at the resulting operating point. For more information, seeLinearize at Trimmed Operating Point.
Simulate your model at the resulting operating point. For more information, seeSimulate Simulink Model at Specific Operating Point.