Simulink Control Design
This example shows how to use Simulink Control Design from command line. The MATLAB functionsMATLAB functions available in Simulink Control Design software allow for the programmatic specification of the input and output points for the linearization of a model. Additionally, there are MATLAB functionsMATLAB functions to extract and specify (trimming) operating points for a linearization. This example introduces some of these commands by linearizing a water-tankwater-tank feedback control system. An open loop linearized model of the watertank will be extracted at an operating point where the tank level is at H = 10. The following 3 steps linearize and analyze the water-tank model.
Step 1: Configuring Linearization Points
Open the model.
The linearization points specify the inputs and outputs of a linearized model. To extract the open loop linearized model, add an input point at the output of the Controller block and an output point, with a loop opening, at the output of the Water-Tank System block.
Specify the input point.
Specify the output point with a loop opening.
The linearization points can then be set and viewed in the model.
Step 2: Computing and Specifying Operating Points
This next step involves finding an operating point of the Simulink model 'watertank' so that the level of the tank is at H = 10. One approach is to simulate the model then extract the operating point when the simulation is near the desired value. The command FINDOP will simulate a model and extract the operating points at times defined in the function call.
opsim = findop('watertank',10)
Operating Point for the Model watertank. (Time-Varying Components Evaluated at time t=10) States: ---------- (1.) watertank/PID Controller/Integrator x: 1.69 (2.) watertank/Water-Tank System/H x: 10.1 Inputs: None ----------
In this operating point, H is not at the desired value of 10. However, you can use this operating point to initialize a search for the desired operating point where H = 10. An operating point specification object allows you to specify the desired value of H = 10.
Create an operating point specification object.
opspec = operspec('watertank');
Initialize the values of the states of the operating point specification with the ones in the operating point opsim.
opspec = initopspec(opspec,opsim);
The specified operating point can then be searched for (trimmed) using the FINDOP command.
opss = findop('watertank',opspec);
Operating Point Search Report: --------------------------------- Operating Report for the Model watertank. (Time-Varying Components Evaluated at time t=10) Operating point specifications were successfully met. States: ---------- (1.) watertank/PID Controller/Integrator x: 1.26 dx: 0 (0) (2.) watertank/Water-Tank System/H x: 10 dx: -1.1e-14 (0) Inputs: None ---------- Outputs: None ----------
Step 3: Linearizing and Analyzing the Model
You are now ready to linearize the plant model by using the LINEARIZE function.
sys = linearize('watertank',opss,watertank_io);
The resulting model is a state space object that you can analyze using any of the tools in the Control System Toolbox software.
Close the Simulink model.