addoutputspec

Add output specification to operating point specification

Description

example

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 of a Simulink block.

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

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)
 Operating point specification for the Model scdspeed.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
	 spec:  dx = 0,  initial guess: 0.543
(2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s
	 spec:  dx = 0,  initial guess: 209

Inputs: 
----------
(1.) scdspeed/Throttle  perturbation
	 initial guess: 0            

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
 Operating point specification for the Model scdspeed.
 (Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) scdspeed/Throttle & Manifold/Intake Manifold/p0 = 0.543 bar
	 spec:  dx = 0,  initial guess: 0.543
(2.) scdspeed/Vehicle Dynamics/w = T//J w0 = 209 rad//s
	 spec:  dx = 0,  initial guess: 209

Inputs: 
----------
(1.) scdspeed/Throttle  perturbation
	 initial guess: 0            

Outputs: 
----------
(1.) scdspeed/rad//s to rpm
	 spec:  y = 2e+03        


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])
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:

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

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

To create an operating point specification object for your model, use the operspec command.

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 operspec object or an array of operspec 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.

Introduced before R2006a