Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

addoutputspec

在工作点设定中添加输出设定

说明

示例

newOpspec = addoutputspec(opspec,block,port) 在现有工作点设定或工作点设定数组中添加 Simulink® 模型的输出设定。为源自模块 block 的指定输出端口 port 的信号添加输出设定。

为了找到指定端口的宽度,addoutputspec 命令会重新编译模型。

示例

全部折叠

打开 Simulink 模型。

sys = 'scdspeed';
open_system(sys)

为模型创建一个默认工作点设定对象。

opspec = operspec(sys)
opspec = 


 Operating point specification for the Model 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.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s
  209.48       false       true        -Inf         Inf        -Inf         Inf    

Inputs: 
----------
  u   Known  Min   Max 
_____ _____ _____ _____
                       
(1.) scdspeed/Throttle  perturbation
  0   false -Inf   Inf 

Outputs: None 
----------

默认工作点设定对象没有输出设定,因为模型中没有根级输出端口。

在 rad/s to rpm 模块的输出端口添加一个输出设定。

newspec = addoutputspec(opspec,'scdspeed/rad//s to rpm',1);

为输出设定指定已知值 2000 rpm。

newspec.Outputs(1).Known = 1;
newspec.Outputs(1).y = 2000;

查看更新后的工作点设定。

newspec
newspec = 


 Operating point specification for the Model 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.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s
  209.48       false       true        -Inf         Inf        -Inf         Inf    

Inputs: 
----------
  u   Known  Min   Max 
_____ _____ _____ _____
                       
(1.) scdspeed/Throttle  perturbation
  0   false -Inf   Inf 

Outputs: 
----------
  y   Known  Min   Max 
_____ _____ _____ _____
                       
(1.) scdspeed/rad//s to rpm
2000  true  -Inf   Inf 

打开 Simulink 模型。

sys = 'scdspeed';
open_system(sys)

为模型创建一个由默认工作点设定对象组成的 3×1 数组。

opspec = operspec(sys,[3,1])
opspec = 

Array of operating point specifications for the model scdspeed. To display an 
 operating point specification, select an element from the array.

在 rad/s to rpm 模块的输出端口添加一个输出设定。

newspec = addoutputspec(opspec,'scdspeed/rad//s to rpm',1);

此输出设定将添加到 opspec 中的所有工作点设定对象中。

您可以在 opspec 中为每个设定指定不同的输出约束。例如,为每个设定指定不同的已知值。

newspec(1,1).Outputs(1).Known = 1;
newspec(1,1).Outputs(1).y = 1900;

newspec(2,1).Outputs(1).Known = 1;
newspec(2,1).Outputs(1).y = 2000;

newspec(3,1).Outputs(1).Known = 1;
newspec(3,1).Outputs(1).y = 2100;

输入参数

全部折叠

Simulink 模型的工作点设定,指定为以下项之一:

  • OperatingSpec 对象 - 在单个 OperatingSpec 对象中添加输出设定。

  • OperatingSpec 对象数组 - 在数组中的所有 OperatingSpec 对象中添加相同的输出设定。所有设定对象必须具有相同的 Model 属性。

要为您的模型创建 OperatingSpec 对象,请使用 operspec 函数。

要向其添加输出设定的 Simulink 模块,指定为包含其模块路径的字符向量或字符串。block 必须位于在 opspec.Model 中指定的 Simulink 模型中。

要向其添加输出设定的输出端口,指定为范围 [1,N] 内的正整数,其中 N 是指定的 block 上的输出端口数量。

输出参数

全部折叠

更新后的工作点设定,以 OperatingSpec 对象或与 opspec 具有相同维度的 OperatingSpec 对象数组形式返回。newOpspecopspec 相同,不同之处是它在其 Outputs 数组中包含新的输出设定。

您可以使用圆点表示法修改新输出设定的约束和设定。

替代功能

稳态管理器

使用稳态管理器配平模型时,您可以通过交互方式添加输出设定。有关详细信息,请参阅Compute Operating Points from Specifications Using Steady State Manager

Simulink 模型

您可以直接在 Simulink 模型中添加输出设定。要这样做,请右键点击要向其添加设定的信号,然后选择线性分析点 > 配平输出约束

版本历史记录

在 R2006a 之前推出

另请参阅

| |