Main Content

operpoint

Create operating point for金宝appmodel

Description

example

op= operpoint(mdl)returns the operating point of Simulink®modelmdl. You can compute a linear model of your system at this operating point using thelinearizefunction.

Examples

collapse all

Open Simulink model.

open_system('magball')

Create operating point for the model.

op = operpoint('magball')
op = Operating point for the Model magball. (Time-Varying Components Evaluated at time t=0) States: ---------- x _______ (1.) magball/Controller/PID Controller/Filter/Cont. Filter/Filter 0 (2.) magball/Controller/PID Controller/Integrator/Continuous/Integrator 14.0071 (3.) magball/Magnetic Ball Plant/Current 7.0036 (4.) magball/Magnetic Ball Plant/dhdt 0 (5.) magball/Magnetic Ball Plant/height 0.05 Inputs: None ----------

oplists each block in the model that has states. There are no root-level inports in this model, thereforeopdoes not contain inputs.

You can create new operating-point variables in three ways:

  • Using theoperpointfunction

  • Using assignment with the equals (=) operator

  • Using thecopyfunction

Using the=operator results in linked variables that both point to the same underlying data. Using thecopyfunction results in an independent operating-point object. In this example, create operating-point objects both ways, and examine their behavior.

mdl ='watertank'; open_system(mdl) op1 = operpoint(mdl)
op1 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 0 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------

创建一个新的操作点object using assignment with the=operator.

op2 = op1;

op2is an operating-point object that points to the same underlying data asop1. Because of this link, you cannot independently change properties of the two operating-point objects. To see this, change a property ofop2. For instance, change the value for the first state from 0 to 2. The change shows in theStatessection of the display.

op2.States(1).x = 2
op2 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 2 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------

Examine the display ofop1to see that the corresponding property value ofop1also changes from 0 to 2.

op1
op1 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 2 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------

To create an independent copy of an operating-point object, use thecopyfunction.

op3 = copy(op1);

Now, when you change a property ofop3,op1does not change. For instance, change the value for the first state from 2 to 4.

op3.States(1).x = 4
op3 = Operating point for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- x _ (1.) watertank/PID Controller/Integrator/Continuous/Integrator 4 (2.) watertank/Water-Tank System/H 1 Inputs: None ----------

Inop1, the corresponding value remains 2.

op1.States(1).x
ans = 2

This copy behavior occurs because the operating-point object is ahandle object. For more information about handle objects, seeHandle Object Behavior.

Input Arguments

collapse all

Simulink model name, specified as a character vector or string. The model must be in the current working folder or on the MATLAB®path.

Output Arguments

collapse all

Operating point, returned as anOperatingPointobject with the following properties.

Property Description
Model Simulink model name, returned as a character vector.
States

State operating point, returned as a vector of state objects. Each entry inStatesrepresents the supported states of one Simulink block.

For a list of supported states for operating point objects, seeSimulink Model States Included in Operating Point Object.

Note

If the block has multiple named continuous states,Statescontains one structure for each named state.

Each state object has the following fields:

Field Description
Nx(read only)

Number of states in the block

Block

Block path, returned as a character vector.

StateName

State name

x

Values of all supported block states, returned as a vector of lengthNx.

Ts

Sample time and offset of each supported block state, returned as a vector. For continuous-time systems,Tsis zero.

SampleType

State time rate, returned as one of the following:

  • 'CSTATE'— Continuous-time state

  • 'DSTATE'— Discrete-time state

inReferencedModel

Flag indicating whether the block is inside a reference model, returned as one of the following:

  • 1— Block is inside a reference model.

  • 0— Block is in the current model file.

Description

Block state description, returned as a character vector.

Inputs

Input level at the operating point, returned as a vector of input objects. Each entry inInputsrepresents the input levels of one root-level inport block in the model.

Each input object has the following fields:

Field Description
Nu(read only)

Number of inport block signals

Block

Inport block name

PortDimensions

Dimension of signals accepted by the inport

u

Inport block input levels at the operating point, returned as a vector of lengthNu.

Description

Inport block input description, returned as a character vector.

Time

Times at which any time-varying functions in the model are evaluated, returned as a vector.

Version

Object version number

Tips

  • You can create new operating points of in three ways:

    • Construct a new object using theoperpointfunction.

    • Create a new variable by assignment with the equals (=) operator.

    • Copy an operating point object using thecopycommand.

    Usingoperpointorcopycreates a new, independent object. When you use assignment, there is a link between the old and new variable. For an example, seeCopy an Operating Point.

Alternative Functionality

Theoperpointfunction returns an operating point with the initial state and input values of the model. To create an operating point that meets your application specifications, use thefindopfunction. For more information, seeCompute Steady-State Operating Points.

Version History

Introduced before R2006a

expand all

Not recommended starting in R2021b