This example shows how to use Simulink® Design Optimization™ to estimate multiple parameters of a model by iterated estimations.
|On this page…|
The Simulink® model for the system is shown below.
The pendulum system has an arm that swings in the horizontal plane, driven by a DC motor. The purpose of the arm to provide a balancing torque to a swinging pendulum to keep the pendulum in an upright position. The angle of both the arm and pendulum is monitored and used as feedback to control the motion of the system. For this example we will only concentrate on estimating parameters of the uncontrolled system shown below.
The system is modeled using SimMechanics. There are two bodies modeled in this system. The machine consists of one body representing the rotational arm and the other representing the pendulum. The bodies are connected by revolute joints that constrain the motion of the bodies relative to each other. An input voltage is delivered to a DC motor that provides the torque to the rotational arm.
The motor is modeled as a torque gain Kt. The arm of the pendulum has mass Ma, inertia Jb and length r. The pendulum has length lp and mass mp. For this example damping is modeled in the revolute joints using gains Kda and Kdp. The outputs of the system are the angles of the arm and the pendulum.
For this example we will run two estimations using different parameter sets for each estimation. This allows us to customize our estimation and can result in a more efficient and accurate solution.
A new data set can be created by clicking on the "Transient Data" node and pressing the "New" button in the right-hand-side panel. These data sets can then be used for estimation and/or validation.
We have already defined two data sets. The first one will be used for parameter estimation and the second for validating the response of the Simulink® model with the estimated parameters.
These data sets can be imported from various sources including MATLAB® variables, MAT files, Excel® files, or comma-separated-value files. Once we import the data, we can plot them to confirm that we have the right data sets in our estimation project.
The next step is to define the variables for the estimation. This establishes which parameters of the simulation can be adjusted, and any rules governing their values.
The Estimation variables are selected by clicking on the "Variables" node and pressing the "Add" button. This open a "Parameter Selection Dialog" from which we can select the model parameters that we desire to estimate.
We have already added the unknown parameters in our model using the selection dialog. These parameters are the arm inertia, J; the arm mass Ma; the pendulum length lp; the pendulum mass mp; the torque gain of the motor Kt; and the damping coefficients of the revolute joints Kda and Kdp.
On the panel to the right of the list of parameters, you can set the initial guesses for the parameter values, and the minimum and maximum bounds on these values.
Since we know from our physical insight that all of these parameters have positive values, we set their lower limits to zero We can also select an initial value for the parameters. These values come from trial and error of some previous experiments.
In order to run an estimation, we first need to create an "Estimation" node. This is done by clicking on the "Estimation" node and pressing the "New" button in the right-hand-side panel.
In our project, we have already created an estimation node called "New Estimation." We can click on this node to set up its various options.
The first panel is where we select the data sets to be used in this estimation. It is possible to use one or more data sets at once in a given estimation. For this model, we will use the data set called "Estimation."
The next panel called "Parameters" is where we select which parameters to adjust in this estimation. For our first estimation we only select the torque motor gain Kt. This parameter is used to provide a better fit for the output angle of the arm.
Now we are almost ready to start our estimation. However, in order to monitor the progress of the estimation process, we would like to create a number of dynamics plots, called "Views."
The plot below shows the experimental data overlaid with the simulated data. The simulated data comes from the model with the estimated parameter Kt. The results of the estimation show that the first output (the position of the arm) matches, however we can see that the second output (the position of the pendulum) does not show very satisfactory results. It is clear that additional estimation is needed to obtain better results.
This time we will leave the torque gain, Kt, constant and estimate the other parameters of the model. To do this we go back to the Estimation node, select the "Parameters" tab. Now we uncheck Kt, and check the other parameters as shown below.
We run another estimation by going to the "Estimation" tab and pressing the Start button. When the second estimation has completed we can go back the "Views" node and select "New View." The results of the second estimation are shown below.
This is clearly a better result. This shows that in order to complete an estimation task it is not necessary to estimate all the parameters in the model at the same time. We can run multiple estimations keeping some parameters constant while varying others.
It is important to validate the results against other data sets. A successful estimation will not only match the experimental data that was used for estimation, but also the other data sets that were collected in experiments. A validation was already created for this project. Clicking on this validation node will create a measured vs. simulation plot that can be used to compare the simulation response against experimental data.
The figure below shows how the inverted pendulum system responds to the validation input data. The validation shows that this model does handle the lower frequencies of the input validation data well and the model parameters were successfully estimated.
This example shows the flexibility of Parameter Estimation for segmenting an estimation task into multiple estimations. This allows for estimations to be run on different parameter sets which can help in the speed and accuracy of estimating a given model.