Main Content

addoutputspec

Add output specification to operating point specification

Description

newOpspec = addoutputspec(opspec,block,port) adds an output specification for a Simulink® model to an existing operating point specification or array of operating point specifications. The output specification is added for the signal that originates from the specified output port port of block block.

To find the width of the specified port, the addoutputspec command recompiles the model.

example

Examples

collapse all

Open the Simulink model.

sys = 'scdspeed';
open_system(sys)

Create a default operating point specification object for the model.

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 
----------

The default operating point specification object has no output specifications because there are no root-level outports in the model.

Add an output specification to the outport of the rad/s to rpm block.

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

Specify a known value of 2000 rpm for the output specification.

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

View the updated operating point specification.

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 

Open the Simulink model.

sys = 'scdspeed';
open_system(sys)

Create a 3-by-1 array of default operating point specification objects for the model.

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.

Add an output specification to the outport of the rad/s to rpm block.

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

This output specification is added to all of the operating point specification objects in opspec.

You can specify different output constraints for each specification in opspec. For example, specify different known values for each specification.

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;

Input Arguments

collapse all

Operating point specification for a Simulink model, specified as one of the following:

  • OperatingSpec object — Add output specification to a single OperatingSpec object.

  • Array of OperatingSpec objects — Add the same output specification to all OperatingSpec objects in the array. All the specification objects must have the same Model property.

To create an OperatingSpec object for your model, use the operspec function.

Simulink block to which to add the output specification, specified as a character vector or string that contains its block path. The block must be in the Simulink model specified in opspec.Model.

Output port to which to add the output specification, specified as a positive integer in the range [1,N], where N is the number of output ports on the specified block.

Output Arguments

collapse all

Updated operating point specification, returned as an OperatingSpec object or an array of OperatingSpec objects with the same dimensions as opspec. newOpspec is the same as opspec, except that it contains the new output specification in its Outputs array.

You can modify the constraints and specifications for the new output specification using dot notation.

Alternative Functionality

Steady State Manager

You can interactively add output specifications when trimming your model using the Steady State Manager. For more information, see Compute Operating Points from Specifications Using Steady State Manager.

Simulink Model

You can add output specifications directly in your Simulink model. To do so, right-click the signal to which you want to add the specification, and select Linear Analysis Points > Trim Output Constraint.

Version History

Introduced before R2006a