You can create new operating-point variables in three ways:
Using the =
operator results in linked variables that both point to the same underlying data. Using the copy
function results in an independent operating-point object. In this example, create operating-point objects both ways, and examine their behavior.
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
----------
Create a new operating-point object using assignment with the =
operator.
op2
is an operating-point object that points to the same underlying data as op1
. Because of this link, you cannot independently change properties of the two operating-point objects. To see this, change a property of op2
. For instance, change the value for the first state from 0 to 2. The change shows in the States
section of the display.
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 of op1
to see that the corresponding property value of op1
also changes from 0 to 2.
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 the copy
function.
Now, when you change a property of op3
, op1
does not change. For instance, change the value for the first state from 2 to 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
----------
In op1
, the corresponding value remains 2.
This copy behavior occurs because the operating-point object is a handle object. For more information about handle objects, see Handle Object Behavior.