Tutorial — Computing a Steady-State Operating Point for a Simulink® Model Using the Command Line

About This Tutorial

Objectives

In this tutorial, you learn how to use Simulink® Control Design™ functions at the command line to accomplish the following tasks:

About the Model

The watertank Simulink® Model.   The watertank model shown in the following figure contains the Water-Tank System plant. It also contains a simple proportional-integral-derivative controller, called Controller, in a single-loop feedback system.

To view the Water-Tank System and the Controller, double-click the corresponding subsystem in the watertank model. For descriptions of these subsystems, see the following sections:

For information about creating Simulink models, see Creating a Simulink® Model.

Water-Tank Subsystem.   The Water-Tank subsystem of the watertank model appears in the following figure.

This model represents the water-tank system depicted in the following figure.

Water enters the tank from the top at a rate proportional to the voltage, V, applied to the pump. The water leaves through an opening in the tank base at a rate that is proportional to the square root of the water height in the tank. The presence of the square root in the water flow rate results in a nonlinear plant.

The following table describes the variables, parameters, differential equations, states, inputs, and outputs of the water-tank system.

Variables

H is the height of water in the tank.

Vol is the volume of water in the tank.

V is the voltage applied to the pump.

Parameters

A is the cross-sectional area of the tank.

b is a constant related to the flow rate into the tank.

a is a constant related to the flow rate out of the tank.

Differential equation

StatesH
InputsV
OutputsH

Controller Subsystem.   The Controller subsystem of the watertank model appears in the following figure.

This model represents a simple proportional-integral-derivative controller that controls the height of the water in the Water-Tank System. This model contains one state, Integrator.

Computing a Steady-State Operating Point

Why Compute a Steady-State Operating Point?

An operating point is a set of inputs, outputs, and states that describe the operating conditions of a system. A steady-state operating point is an operating point in which all states remain constant over time. Many real-world systems are designed to operate at steady-state operating points. Computing a steady-state operating point is required for:

For more information about steady-state operating points, see Equilibrium Operating Points.

How to Compute a Steady-State Operating Point

To compute a steady-state operating point:

  1. Open the watertank model by typing the following in the MATLAB® command window:

    watertank

    The model opens in Simulink, as shown in the following figure.

  2. Create an operating point specification object using the operspec command by typing the following:

    watertank_spec = operspec('watertank')

    This command returns the following result:

    Operating Specification 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 watertank_spec contains objects for all the states, inputs, and outputs in the model. You can view the operating point specification for a state using the get command. For example, to view the state H, type the following:

    get(watertank_spec.States(2))

    This command returns the following result:

        Block: 'watertank/Water-Tank System/H'
                StateName: ''
                        x: 0
                       Nx: 1
                       Ts: [0 0]
               SampleType: 'CSTATE'
        inReferencedModel: 0
                    Known: 0
              SteadyState: 1
                      Min: -Inf
                      Max: Inf
              Description: ''

    SteadyState defaults to a value of 1 for both states, H and Integrator. This indicates that a steady-state operating point will be computed.

  3. Compute the operating point from the operating point specification object watertank_spec using the findop command by typing the following:

    [watertank_op,op_report]=findop('watertank',watertank_spec)

    This command returns the following result:

    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 
    ----------
    
     Operating Report for the Model watertank.
     (Time-Varying Components Evaluated at time t=0)
    
    Operating point specifications were successfully met. 
    
    States:  
    ----------
    (1.) watertank/Controller/Integrator
          x:          1.26      dx:             0 (0)
    (2.) watertank/Water-Tank System/H
          x:            10      dx:    -2.66e-013 (0)
     
    Inputs: None 
    ----------
     
    Outputs: None 
    ----------
     

    This operating point and operating point report shows the following information for each state:

  4. Save the operating point for future reuse using the save command by typing the following:

    save watertank_op

Simulating the Model at the Steady-State Operating Point

Steps for Simulating the Model

To simulate the model at the steady-state operating point you computed, perform the following steps:

  1. Initialize the Simulink model with the steady-state operating point. See Initializing the Simulink® Model with the Steady-State Operating Point.

  2. Simulate the initialized model. See Simulating the Initialized Model.

Initializing the Simulink® Model with the Steady-State Operating Point

In this portion of the tutorial, you initialize the Simulink model using a steady-state operating point. You must have already computed this operating point, as described in Computing a Steady-State Operating Point.

To initialize the model with the steady-state operating point:

  1. In the watertank Simulink model window, select Simulation > Configuration Parameters.

    The Configuration Parameters dialog box opens.

  2. Select the Data Import/Export node.

  3. In the Load from workspace portion of the Data Import/Export node, do the following:

  4. Click OK.

Simulating the Initialized Model

In this portion of the tutorial, you simulate the Simulink model that is initialized at the steady-state operating point.

You must have already initialized the watertank model in Initializing the Simulink® Model with the Steady-State Operating Point.

To simulate the initialized model:

  1. Add a Scope block to each subsystem.

    1. In the Water-Tank System model, add a Scope block to the output signal of the integrator. This signal is the state H.

    2. In the Controller model, add a Scope block to the output signal of the integrator. This signal is the state Integrator.

  2. Open the Scope block window for each model by double-clicking the Scope blocks in the corresponding Simulink model windows.

  3. Simulate each model by clicking the play arrow in the Simulink model windows.

    This action displays the states H and Integrator in their respective Scope windows. The Scope outputs shows these results:

    Both state values match the values found during the steady-state operating point computation.

    Scope Output for State H

    Scope Output for State Integrator

The simulations show that both of the states in the model remain constant over time.

  


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