You can create new operspec
variables in three ways:
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.
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
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.
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.
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.
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.
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.
This copy behavior occurs because operspec
is a handle object. For more information about handle objects, see Handle Object Behavior.