Configuring the Model for Linearization Using Functions

Workflow for Configuring the Model for Linearization

This section describes how to configure the model for linearization using functions. For a description of how to use the graphical interface for this task, see Configuring Inputs and Outputs for the Linearized Model in the Simulink® Control Design™ getting started documentation.

Before linearizing the Simulink® model of your system, configure it by

  1. Choosing linearization input and output points.

  2. Storing linearization points in an input/output (I/O) object.

  3. Editing the I/O object, when necessary, such as when computing the open-loop model.

The input and output points define the portion of your model being linearized. Setting the OpenLoop property of a linearization point to 'on' allows you to compute an open-loop model. Refer to Linearization of Simulink® Models in the Simulink Control Design getting started documentation for more information on linearization input and output points.

Choosing and Storing Linearization Points

This section continues the example from Example: Water-Tank System.

In the watertank model, the nonlinearities are in the water-tank system itself. To linearize this portion of the model, place an input point before it and an output point after it. Information about the linearization points is stored in an input/output (I/O) object in the MATLAB® workspace.

Each linearization point is associated with an outport of a block. To place an input point before the Water-Tank System block, you need to associate this input point with the outport of the Controller block.

To create an I/O object for the input point, use the linio function.

watertank_io(1)=linio('watertank/Controller',1,'in')

This creates an object, watertank_io, in the MATLAB workspace and displays the object as shown below.

Linearization IOs: 
--------------------------
Block watertank/Controller, Port 1 is marked with the following 
properties:
 - No Loop Opening
 - An Input Perturbation
 - No signal name. Linearization will use the block name

The first input argument of the linio function is the name of the block that the linearization point is associated with. The second argument is the number of the outport on this block that the linearization point is associated with. These two arguments allow the linearization point to be placed on a specific signal line. The third argument is the type of linearization point. Available types are

'in'

input point

'out'

output point

'inout'

input point followed by output point

'outin'

output point followed by input point

To create a second object within watertank_io for an output point, use the following command.

watertank_io(2)=linio('watertank/Water-Tank System',1,'out')

This creates an I/O object for the output point that is located at the first outport of the block watertank/Water-Tank System. The object watertank_io is displayed, as shown below.

Linearization IOs: 
--------------------------
Block watertank/Controller, Port 1 is marked with the following 
properties:
 - No Loop Opening
 - An Input Perturbation
 - No signal name. Linearization will use the block name
 
Block watertank/Water-Tank System, Port 1 is marked with the 
following properties:
 - An Output Measurement
 - No Loop Opening
 - No signal name. Linearization will use the block name

Both the input and output points are now stored in the MATLAB workspace in the I/O object watertank_io. To view the linearization points on the model diagram, upload the settings in watertank_io using the setlinio function.

setlinio('watertank',watertank_io)

The model diagram should now look like that in the following figure.

Water-Tank Model with Input and Output Points Selected

Extracting Linearization Points from a Model

This section continues the example from Example: Water-Tank System. At this stage in the example, linearization points have been inserted in the model. See Choosing and Storing Linearization Points for more information on inserting linearization points in the model using functions.

An alternative way to create an I/O object is to extract the linearization points from the model diagram when they have been selected using the right-click menus described in Inserting Linearization Points. The extracted linearization points are stored in an I/O object. Use the getlinio function to extract the linearization points in the following way.

watertank_io=getlinio('watertank')

This returns

    Linearization IOs: 
--------------------------
Block watertank/Controller, Port 1 is marked with the following 
properties:
 - No Loop Opening
 - An Input Perturbation
  - No signal name. Linearization will use the block name

Block watertank/Water-Tank System, Port 1 is marked with the 
following properties:
 - An Output Measurement
 - No Loop Opening
 - No signal name. Linearization will use the block name

Editing an I/O Object

This section continues the example from Example: Water-Tank System. At this stage in the example, linearization points have been inserted in the model and extracted to an object in the MATLAB workspace. See Extracting Linearization Points from a Model for more information on extracting linearization points from a model using functions.

Typing the name of the I/O object at the command line returns a formatted display of key object properties. To view a list of all properties, use the get function. Each object within the I/O object has six properties. For example, to view the properties of the second object in watertank_io, type

get(watertank_io(2))

MATLAB displays

         Active: 'on'
          Block: 'watertank/Water-Tank System'
       OpenLoop: 'off'
     PortNumber: 1
           Type: 'out'
    Description: ''

You can edit this object to make any necessary changes. For example, to make this linearization point a loop opening as well, type

watertank_io(2).OpenLoop='on'

To refresh the model diagram so that it reflects any changes made to the I/O object using the functions, use the setlinio function.

setlinio('watertank', watertank_io);

A small x appears next to the output point in the diagram, indicating a new loop opening, as shown in this figure.

Water-Tank Model with Loop Opening

You can edit the other properties of I/O objects in a similar way. For more information about each property and the possible values it can take, see the getlinio reference page.

Open-Loop Analysis Using Functions

When you want to remove the effect of signals feeding back into the portion of the model you are linearizing, it is often convenient to insert open-loop points in the model. For methods on inserting loop openings with the Simulink Control Design GUI, refer to Performing Open-Loop Analysis in the Simulink Control Design getting started documentation. An alternative method of inserting loop openings, using functions, is to edit the I/O object as described in Editing an I/O Object.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS