In this video you will see how to estimate parameters of a Simulink model from test data.
In this model we have a block representing a DC motor.
This block is parameterized with five variables: resistance, inductance, back EMF, damping, and inertia.
Looking under block mask, we see that motor dynamics is implemented using Simscape and SimPowerSystems components
We have the initial values of five parameters obtained from the datasheet and we have also
received the test data where we applied the voltage to the motor and recorded the motor speed.
We can run the simulation using the values of parameters that we have and compare simulation results to the test data.
As this plot here shows, the simulation output is quite different from the measured RPM.
We'd like to improve this fit by automatically estimating model parameter values using Simulink Design Optimization.
To do that, we go into "Analysis", "Parameter Estimation", and launch Parameter Estimation tool.
In this tool we work from left to right, so the first thing that we do is specify the parameters we want to estimate.
All our parameters start with the word "motor",
So here we see the five parameters.
We specify them as parameters to estimate.
and click OK.
We can now specify the minimum and maximum values of these parameters
during parameter estimation. Because all these parameters are
physical values, we know that they should be positive.
So we specify that in this dialog,
and click OK.
Next, we need to specify where the experimental data is. To do that we click "New Experiment",
and here we specify the measured output signal
in the format that is shown in the yellow highlight box, so time vector first and the signal.
So, let's do that. Our time vector for the output signal is
this variable,
and the measured RPM is this variable.
We also have to specify the excitation signal, the voltage that was fed into the motor.
So, again, we specify a time vector first,
and the measured voltage signal next.
We click OK.
Next, we specify the plots that we want to look at. We want to compare the measured experiment data and the simulation output,
so that's one plot. Here, we see the experimental data. We can again plot the model response
shown in the red line. And another plot that we want to look at is the parameter trajectory. We want to see how the parameter values
are changing during the estimation. We can put those two plots side by side,
let's do that.
We can specify the cost function to use,
specify some additional options - for the tolerances, when to stop the optimization, and, for example, if you want to use parallel
computing, and then we can just click "Estimate".
This launches Estimation Progress Report window, let me move it here so that it does not block the view,
and in these 2 windows here we'll see how the parameters are changing during the optimization, and we will see how with the
updated parameter values, the simulated model response gets closer and closer
to the measured data.
We see that parameter estimation converges after about 14 iterations.
We see how much the initial cost function changed during the optimization process.
We see much better fit.
The updated values are written back to the model, so we can again run the simulation, and compare simulation to test. And we see much
better fit between the model and the test data. So this shows you how you can use Simulink Design Optimization
to automatically estimate model parameters from test data.
This concludes the video.