This example shows how to estimate the parameters of a multi-domain DC servo motor model constructed using various physical modeling products.
This example requires Simscape™ Power Systems™ and Simscape™ Driveline™
A DC servo motor, with its electrical and mechanical components, provides a great example to illustrate multi-domain modeling using first principles.
The DC servo motor is part of a larger system that contains the control electronics (H-Bridge) and a disk attached to the motor shaft. The overall model,
spe_servomotor, is shown below, where the Input Signal (V) is the voltage signal applied to the H-bridge circuit, and the Output Signal (deg) is the angular position of the motor shaft.
We developed a first-principles model of the DC motor within the DC servo motor subsystem. We used Simscape Power Systems to model the electrical components and Simscape Driveline to model the mechanical components of the motor. The figure below shows the content of the servo motor subsystem.
The DC motor model shows a relationship from current to torque (the green line on the left). The torque causes the shaft of the motor to spin and we have a relationship between this spinning to the Back EMF (electromotive force). The rest of the parameters include a shaft inertia, viscous friction (damping), armature resistance, and armature inductance.
While manufacturers may provide values for some of these quantities, they are only approximate. We want to estimate these parameters as precisely as possible for our model to ascertain whether it is an accurate representation of the actual DC servo motor system.
When we apply a series of voltage pulses to the motor input, the motor shaft turns in response. However, if the model parameters do not match those of the physical system, the model response will not match that of the actual system, either. This is where Simulink® Design Optimization™ plays a pivotal role in estimating parameter values. A parameter estimation process consists of a number of well-defined steps:
Collect test data from your system (experiment).
Specify the parameters to estimate (including initial guesses, parameter bounds, etc.).
Configure your estimation and run a suitable estimation algorithm.
Validate the results against other test data sets and repeat above steps if necessary.
Simulink Design Optimization provides a Parameter Estimation tool which is a user interface to help you perform parameter estimation, organize your estimation project, and save it for future work.
Double-click the orange block in the lower right corner of the servomotor model to launch the Parameter Estimation tool, pre-loaded with data for this project. This is configured with measured experiment data
EstimationData. For other uses you can import experimental data sets from various sources including MATLAB® variables, MAT files, Excel® files, or comma-separated-value files. The Parameter Estimation tool is also pre-loaded with parameters for the servomotor subsystem selected for estimation:
Ra. It is also configured with validation data
ValidationData which we will use later, after estimation. The measured data in
EstimationData is shown in the experiment plot. There is only one data set used for estimation in this example.
The experiment plot is also used to see how well the measured data matches the current model. Click Plot Model Response in the Parameter Estimation tab to display simulated signal data on the experiment plots. The simulation does not match the measured data, showing that the model parameters need to be estimated.
Simulink Design Optimization lets you estimate some or all of the parameters in your model in a manner that best suits your application. The estimation parameters are selected by clicking Select Parameters in the Parameter Estimation tab. For our DC motor example, we have already loaded the five parameters of the motor model:
Ra. Since we know from our physical insight that none of these parameters can be negative we set their lower limits to zero.
With the parameters for estimation specified, we select experiments to use for estimation. Click Select Experiments in the Parameter Estimation tab and select
EstimationData for estimation.
We are now almost ready to start our estimation but first create another plot to monitor the estimation progress. Click Add Plot and select Parameter Trajectory. This creates a plot that shows how the parameter values change during estimation. Click the View tab to lay out the plots so that the experiment plot and trajectory iteration plot are both visible.
Click the Estimate button in the Parameter Estimation tab to start the estimation. The estimation will keep iterating the parameter values until the estimation converges and terminates. Parameter Estimation provides various state-of-the-art estimation methods. The most common selections include the nonlinear least-squares and Nelder-Mead optimization methods. More information on these methods is available in the Optimization Toolbox™ documentation. You can also use the pattern search method in the Global Optimization Toolbox for parameter estimation.
The plot below shows the measured data overlaid with the simulated data. The simulated data comes from the model with the estimated parameters. Comparing the response of the system before and after the estimation process clearly shows that the estimation successfully identified the model parameters and the simulated response accurately matches the experimental data.
After completing the estimation, it is important to validate the results against other data sets. A successful estimation should match not only the experimental data that we used for estimation, but also the other data sets that we collected in our experiments.
We used our second data set in
ValidationData for validating the estimation results. As the next figure shows, the match between the model response and the data set is very good. In fact, the two curves are almost identical for this example.
Engineers and scientists across disciplines and industries are well acquainted with the benefits of modeling dynamic systems. They may use either first-principles mathematics or test-data based methods. First-principles models provide important insight into system behavior, but may lack accuracy. Data-driven models provide accurate results, but tend to offer limited understanding of the physics of the system. This article showed the use of Parameter Estimation to improve the accuracy of a DC Servo Motor model by estimating the model parameters using experimental data.
Close the model