Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Design Optimization   

Estimating Initial States

How to Estimate Initial States in the GUI

In general, you choose to estimate only those states that are not already in the model. Before you estimate initial conditions, you must have already imported the estimation data and specified the parameters to estimate, as described in Specifying Data for Parameter Estimation and Specifying Parameters to Estimate, respectively.

To estimate initial conditions (or initial states) if they are not known:

  1. In the Control and Estimation Tools Manager, select the Variables node in the workspace directory tree.

  2. Click the Estimated States tab.

  3. Click Add to open the Select States dialog box.

  4. Select the states to estimate and click OK.

    The states selected for estimation are added to the Estimated States tab. For an example of estimating initial states, see Example — Estimating Initial States of a Mass-Spring-Damper System.

Estimating Initial Conditions for Blocks with External Initial Conditions

When an integrator block uses an initial-condition port, which you specify by an IC block feeding into the integrator block, you cannot estimate the initial conditions (ICs) of the integrator using Simulink Design Optimization software. This is because external ICs have priority over the ICs of a specific block to maintain the integrity of the model.

To tune the ICs of an integrator block with external ICs, you must modify the model to make the external signal into a tunable parameter. For example, you can set the IC block that feeds into the integrator to be a tunable variable and estimate it.

Example — Estimating Initial States of a Mass-Spring-Damper System

Loading the Example

To open the Simulink model of a mass-spring-damper system and two sets of model data with differing initial conditions, type:

msd_system

at the MATLAB prompt.

The figure shown next is a model of a mass-spring-damper system.

You can run the demo from Simulink > Simulink Design Optimization on the Demo pane of the Help browser.

This example goes beyond what is included in the Simulink Design Optimization demo that uses this model by providing in-depth discussion of each task.

Model Parameters

The Simulink msd_system model's output is the displacement (or position) of the mass in a mass-spring-damper system, subject to a constant force F, and an initial condition, x0, for the mass displacement. x0 is indicated by the initial condition of the Position integrator block. Click the Start Simulation button to run the simulation once and observe the response of the model to two sets of parameter values.

The model parameters of interest are the mass, m, the viscous damping, b, and the spring constant, k. For more information about physical modeling of mass-spring-damper systems, see any elementary book on mathematical modeling or on automatic control systems.

For the estimation of the model parameters m, b, and k, this model uses two sets of experimental data. These data sets were obtained using two different initial positions, x0=0.1 and x0=0.3, and also contain additive noise. A plot of these data sets is shown in the figure above (top curves), along with the simulated response (bottom curve) of the Simulink model msd_system for x0=-0.1 and a nominal set of parameter values, m=8, k=500, and b=100.

Setting Up the Estimation Project

To set up the estimation of initial conditions and then transient state space data, select Tools > Parameter Estimation in the msd_system model window.

Importing Transient Data and Selecting Parameters for Estimation

The process for importing transient data and selecting parameters for estimation is discussed in Importing Data into the GUI, and Specifying Parameters to Estimate.

  1. In the Control and Estimation Tools Manager, select Estimation Task > Transient Data in the workspace directory tree.

  2. Right-click Transient Data and select New to add a new data set.

  3. Right-click the New Data node in the workspace directory tree and select Edit to open the Input Data, Output Data, and State Data panes.

  4. In the Output Data pane, click Import and add yexp1 to the Data column and texp1 to the Time/Ts column of the msd_system/Position state.

  5. If you like, right-click New Data in the workspace directory tree and rename it to Data set #1.

  6. Repeat steps 1 to 5 to add a second data set, yexp2 and texp2, and rename it to Data set #2.

    The Control and Estimation Tools Manager should resemble the next figure:

Selecting Parameters and Initial Conditions for Estimation

First, select the parameters you want to estimate for the Simulink msd_system model. In this case, select b, k, and m. To do this:

  1. Select the Variables node in the workspace directory tree of the Control and Estimation Tools Manager.

  2. Click the Estimation Parameters tab.

  3. Click Add to open the Select Parameters dialog box.

  4. Select the parameters b, k, and m, and then click OK.

  5. Do the same with the Estimation States pane, and select msd_system/Position from the Select States dialog box.

    Your Control and Estimation Tools Manager should look like this.

Creating the Estimation Task

To create the New Estimation task in the Control and Estimation Tools Manager, right-click the Estimation node in the workspace directory tree and select Add. While the initial velocity is also a state of the model, assume (for simplicity) that it is known to be 0. The estimation task for this case is Estim (with IC).

In the Data Sets, Parameters, and States panes for the New Estimation task, select all the check boxes in each table. Be sure to select Position for both data sets in the States pane to estimate the initial condition for the spring's position.

The initial position estimates for the two data sets are known to differ, but set the initial state guesses for both data sets to -0.1.

Running the Estimation and Viewing Results

Click Start in the Estimation pane to run the estimation. As the estimation proceeds, the most current estimation of position response (yellow curve) updates itself in the Scope. The curve appears to toggle between the two experimental data sets, since the estimator uses the two sets successively to update the estimates of the parameter values. The estimator converges to the correct parameter values, within the scope of experimental noise and optimization options settings, as indicated by the closeness of the estimated response (yellow) to the experimental data (magenta). Good state estimates for the initial position are also obtained, as can be observed from the States tab of Estim(with IC) estimation task.

The estimation of initial states is important for obtaining the correct estimates of the model parameters. Why not set the initial states (x0 in this case) as parameters as well? The reason is that the initial states are not fixed physical properties of the system. For different experimental data or operating conditions, these states need not be unique. In this example, two data sets, with distinct initial positions, were used together for a single estimation of model parameters. While the estimates of the model parameters are unique, the initial state (position) is different, and is estimated individually for each data set.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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