findop - Find operating points from specifications or simulation

Syntax

[op_point,op_report]=findop('model',op_spec)
[op_point,op_report]=findop('model',op_spec,options)
op_point=findop('model',times)

Graphical Interface

As an alternative to the findop function, create operating points from specifications or simulation within the Operating Points node of the Simulink Control Design GUI. For more information on creating operating points, see Creating Operating Points from Specifications and Creating Operating Points from Simulation in the Simulink Control Design getting started documentation.

Remarks

Finding operating points from specifications using the findop function is the same as trimming, or performing trim analysis. Use the findop function instead of the Simulink trim function when you work with Simulink Control Design operating point objects and specification objects.

Description

[op_point,op_report]=findop('model',op_spec) finds an operating point, op_point, of the model, 'model', from specifications given in op_spec.

[op_point,op_report]=findop('model',op_spec,options) finds an operating point, op_point, of the model, 'model', from specifications given in op_spec. Several options for the optimization are specified in the options object, which you can create with the function linoptions.

The input to findop, op_spec, is an operating point specification object. Create this object with the function operspec. Specifications on the operating points, such as minimum and maximum values, initial guesses, and known values, are specified by editing op_spec directly or by using get and set. To find equilibrium, or steady-state, operating points, set the SteadyState property of the states and inputs in op_spec to 1. The findop function uses optimization to find operating points that closely meet the specifications in op_spec. By default, findop uses the optimizer graddescent_elim. To use a different optimizer, change the value of OptimizerType in options using the linoptions function.

A report object, op_report, gives information on how closely findop meets the specifications. The function findop displays the report automatically, even if the output is suppressed with a semicolon. To turn off the display of the report, set DisplayReport to 'off' in options using the function linoptions.

op_point=findop('model',times) runs a simulation of the model, 'model', and extracts operating points from the simulation at the snapshot times given in the vector, times. An operating point object, op_point, is returned.

The output of findop is always an operating point object. Use this object with the function linearize to create linearized models of Simulink models. The operating point object has the following properties:

Model

Model specifies the name of the Simulink model to which this operating point object refers.

States

States describes the operating points of states in the Simulink model. The States property is a vector of state objects that contains the operating point values of the states. There is one state object per block that has a state in the Simulink model. The States object has the following properties:

Nx

Number of states in the block. This property is read-only.

Block

Block with which the states are associated.

x

Vector containing the values of states in the block.

Ts

Vector containing the sample time and offset for the state.

SampleType

Set this value to CSTATE, for a continuous state, or DSTATE, for a discrete state.

inReferencedModel

Set this value to 1, when the state is inside a referenced model, or 0, when it is not.

Description

Text string describing the block.

Inputs

Inputs is a vector of input objects that contains the input levels at the operating point. There is one input object per root-level inport block in the Simulink model. The Inputs object has the following properties:

Block

Inport block with which the input vector is associated

PortWidth

Width of the corresponding inport

u

Vector containing the input level at the operating point

Description

Text string describing the input

Time

Time specifies the time at which any time-varying functions in the model are evaluated.

The operating point report object, returned when finding operating points from specifications, has the following properties:

Of these properties, Model, Inputs, Outputs, States, and Time contain the same information as the operating point specification object, with the addition of dx values for the States and yspec values, or desired y values, for the Outputs. The TerminationString contains the message that findop displays after terminating the optimization. The OptimizationOutput property contains the same properties returned in the output variable of the Optimization Toolbox functions fmincon, fminsearch, and lsqnonlin. See the Optimization Toolbox documentation for more information. If you do not have Optimization Toolbox software, you can access the documentation at:

http://www.mathworks.com/access/helpdesk/help/toolbox/optim/optim.html

Examples

Example 1

Create an operating point specification object for the model magball with the operspec function.

op_spec=operspec('magball');

Edit the operating point specification object to reflect any specifications on the operating points such as minimum and maximum values, initial guesses, and known values. This example uses the default specifications in which SteadyState is set to 1 for all states, specifying that an equilibrium operating point is desired.

Find the equilibrium operating points with the findop function.

op_point=findop('magball',op_spec)

This function returns an operating point object, op_point.

 Operating Point for the Model magball.
(Time-Varying Components Evaluated at time t=0)

States: 
----------
(1.) magball/Controller/Controller
      x: 0            
      x: -2.56e-006   
(2.) magball/Magnetic Ball Plant/Current
      x: 7            
(3.) magball/Magnetic Ball Plant/dhdt
      x: 0            
(4.) magball/Magnetic Ball Plant/height
      x: 0.05         
 
Inputs: None 

The MATLAB window displays the name of the model, the time at which any time-varying functions in the model are evaluated, the names of blocks containing states, and the operating point values of the states. In this example, there are four blocks that contain states in the model and four entries in the States object. The first entry contains two states. MATLAB also displays the Inputs field although there are no inputs in this model. To view the properties of op_point in more detail, use the get function.

MATLAB also displays the operating point report object.

 Operating Point Search Report for the Model magball.
(Time-Varying Components Evaluated at time t=0)

Operating condition specifications were successully met.

States: 
----------
(1.) magball/Controller/Controller
      x:             0      dx:             0 (0)
      x:    -2.56e-006      dx:             0 (0)
(2.) magball/Magnetic Ball Plant/Current
      x:             7      dx:             0 (0)
(3.) magball/Magnetic Ball Plant/dhdt
      x:             0      dx:    -1.78e-015 (0)
(4.) magball/Magnetic Ball Plant/height
      x:          0.05      dx:             0 (0)
 
Inputs: None
 
Outputs: None

In addition to the operating point values, the report shows how closely the specifications were met. In the preceding report, the dx values are all small and close to the desired dx values of 0 indicating that an equilibrium or steady-state value was found.

Example 2

To extract an operating point from a simulation at the times 10 and 20 using findop, enter the following:

op_point=findop('magball',[10,20])

This function returns the message:

There is more than one operating point.  Select an element 
in the vector of operating points to display.

To display the first operating point, enter the command

op_point(1)

This command should display:

 Operating Point for the Model magball.
(Time-Varying Components Evaluated at time t=10)

States: 
----------
(1.) magball/Controller/Controller
      x: -4.82e-010   
      x: -2.56e-006   
(2.) magball/Magnetic Ball Plant/Current
      x: 7            
(3.) magball/Magnetic Ball Plant/dhdt
      x: 2.6e-006     
(4.) magball/Magnetic Ball Plant/height
      x: 0.05         
 
Inputs: None

To display the second operating point, enter:

op_point(2)

This function returns:

 Operating Point for the Model magball.
(Time-Varying Components Evaluated at time t=20)

States: 
----------
(1.) magball/Controller/Controller
      x: -5.5e-010    
      x: -2.56e-006   
(2.) magball/Magnetic Ball Plant/Current
      x: 7            
(3.) magball/Magnetic Ball Plant/dhdt
      x: 2.54e-006    
(4.) magball/Magnetic Ball Plant/height
      x: 0.05         
 
Inputs: None

See Also

operspec, linearize

  


 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS