| Simulink® Control Design™ | ![]() |
This section continues the example from Example: Water-Tank System. At this stage in the example, linearization point objects have been created in the MATLAB® workspace. See Configuring the Model for Linearization Using Functions for more information on creating linearization point objects.
To determine the operating points from specifications:
Create an operating point specification object. See Creating an Operating Point Specification Object.
Configure the object to store the specifications such as any constraints or known information about the operating point. See Configuring the Operating Point Specification Object.
Use the findop function to find the operating point values by optimization. See Computing the Complete Operating Point.
When you know only some values exactly, or you know constraints on the values in the operating point, use the function operspec to create an operating point specification object for your model.
For example, to create an operating point specification object for the watertank model, type
watertank_spec = operspec('watertank')
MATLAB software displays
Operating Specificaton for the Model watertank.
(Time-Varying Components Evaluated at time t=0)
States:
----------
(1.) watertank/Controller/Integrator
spec: dx = 0, initial guess: 0
(2.) watertank/Water-Tank System/H
spec: dx = 0, initial guess: 0
Inputs: None
Outputs: None
The operating point specification object contains objects for all the states, inputs, and outputs in the model. By typing the object's name at the command line you can see a formatted display of key object properties. Alternatively, to list all the properties for a particular object, use the get function. For example
get(watertank_spec.States(1))
returns
Block: 'watertank/Controller/Integrator'
x: 0
Nx: 1
Ts: [0 0]
SampleType: 'CSTATE'
inReferencedModel: 0
Known: 0
SteadyState: 1
Min: -Inf
Max: Inf
Description: ''Edit these properties to provide specifications for the operating point. For example:
To set the second state to a known value (such as the desired height of water), first change Known to 1.
watertank_spec.States(2).Known=1
Next, provide the known value.
watertank_spec.States(2).x=10
To find a steady-state value for the first state, set SteadyState to 1.
watertank_spec.States(1).SteadyState=1
To provide an initial guess of 2 for this steady-state value, first make sure that Known is set to 0 for this state.
watertank_spec.States(1).Known=0
Then, provide the initial guess.
watertank_spec.States(1).x=2
To set a lower bound of 0 on this state,
watertank_spec.States(1).Min=0
Optimization settings used with the findop function can be configured with the linoptions function.
The operating point specification object, watertank_spec, now contains specifications for the operating point. Use this information to find the complete operating point using the findop command. Type
[watertank_op,op_report]=findop('watertank',watertank_spec)
This returns the optimized operating point. The optimized values of the states are contained in the x property, or u property for inputs.
Operating Point for the Model watertank.
(Time-Varying Components Evaluated at time t=0)
States:
----------
(1.) watertank/Controller/Integrator
x: 1.26
(2.) watertank/Water-Tank System/H
x: 10
Inputs: None
The operating point search report, op_report, is also generated. The x or u values give the state or input values. The dx values give the time derivatives of each state, with desired dx values in parentheses. The fact that the dx values are both zero indicates that the operating point is at steady state.
Operating Point Search Report:
---------------------------------
Operating Point Search Report for the Model watertank.
(Time-Varying Components Evaluated at time t=0)
Operating condition specifications were successully met.
States:
----------
(1.) watertank/Controller/Integrator
x: 1.26 dx: 0 (0)
(2.) watertank/Water-Tank System/H
x: 10 dx: 0 (0)
Inputs: None
Outputs: None
In some cases you might want to use a previously created operating point to specify initial guesses in another operating point specification object. For example, after extracting an operating point from a simulation, as in Extracting Values from Simulation, you can use this operating point as a starting point for finding a more accurate steady state value using findop. You can do this with the initopspec function.
For example, first extract an operating point from simulation, in this case after 10 time units.
watertank_op2=findop('watertank',10);
Then create an operating point specification object.
watertank_spec=operspec('watertank');
Specify initial guesses in this object with the following command.
watertank_spec=initopspec(watertank_spec,watertank_op2)
This returns an operating point specification with the initial guess, or x property filled with operating point values from watertank_op2.
Operating Specificaton for the Model watertank.
(Time-Varying Components Evaluated at time t=0)
States:
----------
(1.) watertank/Controller/Integrator
spec: dx = 0, initial guess: 0.872
(2.) watertank/Water-Tank System/H
spec: dx = 0, initial guess: 9.7
Inputs: None
Outputs: None
This operating point specification can now be used with findop to find an optimized steady state operating point. You can access individual elements of this object using the get function or dot-notation as in Configuring the Operating Point Specification Object.
When you want to constrain additional signals of the model, you can add an output constraint to the operating point specification object with the function addoutputspec.
For example, to add an output constraint to the operating point specification created in Alternative Method for Specifying Initial Guesses, use the following command:
watertank_spec=addoutputspec(watertank_spec,'watertank/Water-Tank System/Sum',1)
This adds a constraint on the signal between the Sum block and the integrator block, H, within the Water-Tank System block. The constraint is associated with an outport of a block, in this case outport 1 of the block watertank/Water-Tank System/Sum (the preceding block).
Operating Specificaton for the Model watertank.
(Time-Varying Components Evaluated at time t=0)
States:
----------
(1.) watertank/Controller/Integrator
spec: dx = 0, initial guess: 0.872
(2.) watertank/Water-Tank System/H
spec: dx = 0, initial guess: 9.7
Inputs: None
Outputs:
-----------
(1.) watertank/Water-Tank System/Sum
spec: none
You can edit the specifications for this output in the same way as you would for any other specifications, by changing the values of Known, y, Min, etc. There is no SteadyState option for outputs.
![]() | Creating or Opening a Simulink® Model | Specifying Completely Known Operating Points | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |