Operating point specifications

Open Simulink model.

```
sys = 'watertank';
open_system(sys)
```

Create the default operating point specification object for the model.

opspec = operspec(sys)

Operating point specification for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) watertank/PID Controller/Integrator/Continuous/Integrator spec: dx = 0, initial guess: 0 (2.) watertank/Water-Tank System/H spec: dx = 0, initial guess: 1 Inputs: None ---------- Outputs: None ----------

`opspec`

contains specifications for the two states in the model. Since the model has no root level inports or outports, `opspec`

does not contain input or output specifications. To add output specifications, use `addoutputspec`

.

Modify the operating point specifications for each state using dot notation. For example, configure the first state to:

Be at steady state.

Have a lower bound of

`0`

.Have an initial value of

`2`

for trimming.

opspec.States(1).SteadyState = 1; opspec.States(1).x = 2; opspec.States(1).Min = 0;

You can create new `operspec`

variables in three ways:

Using the

`operspec`

commandUsing assignment with the equals (

`=`

) operatorUsing the

`copy`

command

Using the `=`

operator results in linked variables that both point to the same underlying data. Using the `copy`

command results in an independent `operspec`

object. In this example, create `operspec`

objects both ways, and examine their behavior.

```
mdl = 'watertank';
open_system(mdl);
opspec1 = operspec(mdl)
```

Operating point specification for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) watertank/PID Controller/Integrator/Continuous/Integrator spec: dx = 0, initial guess: 0 (2.) watertank/Water-Tank System/H spec: dx = 0, initial guess: 1 Inputs: None ---------- Outputs: None ----------

Create a new operating point specification object using assignment with the `=`

operator.

opspec2 = opspec1;

`opspec2`

is an `operspec`

object that points to the same underlying data as `opspec1`

. Because of this link, you cannot independently change properties of the two `operspec`

objects. To see this, change a property of `opspec2`

. For instance, change the initial value for the first state from 0 to 2. The change shows in the `States`

section of the display.

opspec2.States(1).x = 2

Operating point specification for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) watertank/PID Controller/Integrator/Continuous/Integrator spec: dx = 0, initial guess: 2 (2.) watertank/Water-Tank System/H spec: dx = 0, initial guess: 1 Inputs: None ---------- Outputs: None ----------

Examine the display of `opspec1`

to see that the corresponding property value of `opspec1`

also changes from 0 to 2.

opspec1

Operating point specification for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) watertank/PID Controller/Integrator/Continuous/Integrator spec: dx = 0, initial guess: 2 (2.) watertank/Water-Tank System/H spec: dx = 0, initial guess: 1 Inputs: None ---------- Outputs: None ----------

To create an independent copy of an operating point specification, use the `copy`

command.

opspec3 = copy(opspec1);

Now, when you change a property of `opspec3`

, `opspec1`

does not change. For instance, change the initial value for the first state from 2 to 4.

opspec3.States(1).x = 4

Operating point specification for the Model watertank. (Time-Varying Components Evaluated at time t=0) States: ---------- (1.) watertank/PID Controller/Integrator/Continuous/Integrator spec: dx = 0, initial guess: 4 (2.) watertank/Water-Tank System/H spec: dx = 0, initial guess: 1 Inputs: None ---------- Outputs: None ----------

In `opspec1`

, the corresponding value remains 2.

opspec1.States(1).x

ans = 2

This copy behavior occurs because `operspec`

is a *handle object*. For more information about handle objects, see Handle Object Behavior (MATLAB).

Open Simulink model.

```
sys = 'watertank';
open_system(sys)
```

Create a 2-by-3 array of operating point specification objects. You can batch trim model at multiple operating points using such arrays.

opspec = operspec(sys,[2,3]);

Each element of `opspec`

contains a default operating point specification object for the model.

Modify the operating point specification objects using dot notation. For example, configure the second state of the specification object in row `1`

, column `3`

.

opspec(1,3).States(2).SteadyState = 1; opspec(1,3).States(1).x = 2;

You can also create multidimensional arrays of operating point specification objects. For example, create a 3-by-4-by-5 array.

opspec = operspec(sys,[3,4,5]);

`mdl`

— Simulink modelcharacter vector | string

Simulink model name, specified as a character vector or string.

`dim`

— Array dimensionsinteger | row vector of integers

Array dimensions, specified as one of the following:

Integer — Create a column vector of

`dim`

operating point specification objects.Row vector of integers — Create an array of operating point specification objects with the dimensions specified by

`dim`

.For example, to create a 4-by-5 array of operating point specification objects, use:

opspec = operspec(mdl,[4,5]);

To create a multidimensional array of operating point specification objects, specify additional dimensions. For example, to create a 2-by-3-by-4 array, use:

opspec = operspec(mdl,[2,3,4]);

`opspec`

— Operating point specificationsoperating point specification object | array of operating point specification objects

Operating point specifications, returned as an operating point specification object or an array of such objects.

You can modify the operating point specifications using dot notation. For example, if
`opspec`

is a single operating point specification
object, `opspec.States(1).x`

accesses the state values of
the first model state. If `opspec`

is an array of
specification objects `opspec(2,3).Inputs(1).u`

accesses
the input level of the first inport block for the specification in row
`2`

, column `3`

.

Each specification object has the following properties:

Property | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

`Model` | Simulink model name, returned as a character vector. | ||||||||||||||||||||||||||||||

`States` | State operating point specifications, returned as a vector
of state specification objects. Each entry in For a
list of supported states for operating point objects, see Simulink Model States Included in Operating Point Object.
Edit the properties of this object using dot notation or the ## NoteIf the block has multiple named continuous states, Each state specification object has the following fields:
| ||||||||||||||||||||||||||||||

`Inputs` | Input level specifications at the operating point, returned
as a vector of input specification objects. Each entry in Each input specification object has the following fields:
| ||||||||||||||||||||||||||||||

`Outputs` | Output level specifications at the operating point, returned
as a vector of output specification objects. Each entry in You can specify
additional trim output constraints using Each output specification object has the following fields:
| ||||||||||||||||||||||||||||||

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

`CustomObjFcn` | Function providing an additional custom objective function
for trimming, specified as a handle to the custom function, or a character
vector or string that contains the function name. The custom function
must be on the MATLAB You can specify a custom objective function as an algebraic combination of model states, inputs, and outputs. For more information, see Compute Operating Points Using Custom Constraints and Objective Functions. | ||||||||||||||||||||||||||||||

`CustomConstrFcn` | Function providing additional custom constraints for trimming, specified as a handle to the custom function, or a character vector or string that contains the function name. The custom function must be on the MATLAB path or in the current working folder. You can specify custom equality and inequality constraints as algebraic combinations of model states, inputs, and outputs. For more information, see Compute Operating Points Using Custom Constraints and Objective Functions. | ||||||||||||||||||||||||||||||

`CustomMappingFcn` | Function that maps model states, inputs, and outputs
to the vectors accepted by For complex models, you can pass subsets of the model inputs, outputs, and states to the custom constraint and objective functions using a custom mapping function. If you specify a custom mapping, you must use the mapping for both the custom constraint function and the custom objective function. For more information, see Compute Operating Points Using Custom Constraints and Objective Functions. |

To display the operating point specification object properties, use

`get`

.You can create new

`operspec`

variables of in 3 ways:Construct a new object with the

`operspec`

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

Copy an

`operspec`

object using the`copy`

command.

Using

`operspec`

or`copy`

creates a new, independent object. When you use assignment, there is a link between the old and new variable. For an example, see Copy an Operating-Point Specification.

`addoutputspec`

| `copy`

| `findop`

| `update`

A modified version of this example exists on your system. Do you want to open this version instead? (ko_KR)

아래 MATLAB 명령에 해당하는 링크를 클릭하셨습니다.

이 명령을 MATLAB 명령 창에 입력해 실행하십시오. 웹 브라우저에서는 MATLAB 명령을 지원하지 않습니다.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

Select web siteYou can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)