How to Calibrate Sensors and Estimate Parameters for motor modeling | Field-Weakening Control of PMSM with Simulink, Part 1
From the series: Field-Weakening Control for PMSMs with Simulink and Motor Control Blockset
Discover the fundamentals of field-oriented control (FOC) and effectively implement field-weakening control with Simulink for precise control of your permanent magnet synchronous motors (PMSMs) in this MathWorks tutorial series. In Part 1, learn about the essential steps for calibrating your current and position sensors. Explore the process of accurately estimating motor parameters using instrumented test in Motor Control Blockset by collecting data directly from hardware. Learn how to save the estimated values for parameterizing motor models and work with different plant fidelities.
Published: 14 Apr 2021
Hello, everyone. Welcome to this section of Field Oriented Control Made Ease. My name is Shang-Chuan Lee. I'm the application engineer at The MathWorks. I base in Dallas, Texas. Before I joined MathWorks, I worked for my PhD at UW Madison in Wisconsin. My specialty is the motor control and polyelectronics.
So in this talk, we will show you how to spin brushless motors using Model-Based Design in Simulink. To be more specific, we will walk you through how to develop and control everything in Simulink and generate embedded from the model. So let me show you how to develop and implement field-orientation control with signaling and model based design. So during our discussion, we will use this very simplified workflow covered by these key steps.
So for today's presentation, we are going to use TIC200 motor control kits to illustrate the workflow. The kits include a surface mount, motors, F2AX series microcontroller, and DRV8305 three phase inverter. So we will start with the sensor calibration by measuring phase currents using ADC.
Calibrating current offsets is essential to ensure accurate current measurement. In the Motor Control Blockset, we provide the reference example for ADC offset calibration. The reference example include the model that we can generate a code and download to the processor and host model control the target.
As you can see here, we are starting with this connect the motor from the inverter to make sure there are no face current going through the motor. So the model we generate a code from can capture ADC counts and send in over through serial [INAUDIBLE] to the host model. By reading the mean value of the signals, the offset of the phase a and phase b current are shown here around 2,300. Finally, we enter those offset into the manuscript so that we will use them later for closer control.
Next, we will compute the position sensor offset. The kit that we provide can calibrate for both hall sensor and quadrature encoder. But here, we are using Hall sensor as a example. For those of you who are interested in sensors for the orientation control, you could definitely skip this step. So we will start with the model that we will generated a code from by specifying a power supply voltage, which is 20 volts, in this case. The idea of the model runs open the control to compute the position sensor offset, and the whole sensor takes the reading until the position is commanded to be 0 degrees at this moment.
Then, we will generate a code from this model and download to our processor. We then use the host motto to start the calibration. After then, we click this round button and start calibrating. We will see the motor will start spinning, and the offset will be automatically computed. Now, the green LED, here, shows the motor is spinning in the right direction, which is counterclockwise. If not, the motor spinning clockwise direction, the LED turns red, indicating we need to swap the wires between the motor and the inverter.
So our next step is parameter estimation for the brashest motor. As we know, an accurate claim model have a better design for our controller in the possible simulation. In our case, we already have the actual motor, and we can take advantage of that. So with the Motor Control Blockset, it provides instruments
test. We can run out of processor to estimate motor parameters. Another other nice thing is we have a host model to control and monitor the progress of parameter estimation. So let's see how it works.
So we start with a house motto which serve as a user interface. Here, we define all the parameters, nominal voltage, current speed, and input voltage. We also define a host sensor asset based on the previous computed value. Once we have defined all this value, then, we go to a target model and update the value from the instruments to generate a code. We then start parameter estimation from the host model, pass around on the motor to estimate data resistance, inductance, Ld and Lq, Bemf constants, moments of inertia, and friction coefficient.
So it's going to take around 30 seconds to finish the estimation process. And now, we can use a provided scope to examine the signal of our interests. Like here, we are looking at the speed. Now that the parameter has been estimate, we can save them into a file. If we load this file in MATLAB, we will see a structure with [INAUDIBLE] parameter values.
Later, we can use the surroundings for accurate close loop FLC simulation and low tuning. So we have seen more control blocks and parameter estimation capabilities, which are handy if you already have motor. However, sometimes, you have to start development before power is available. In that case, you can import mortar parameters from the datasheet perimeter rise motor front FEA tools, such as JMAG, or ANSYS Maxwell, or even from dyno data. There are plenty of examples and capabilities using Simscape electrical and other products can help you to do that.
So with Simscape Electrical, we are not only can model a physical component, but also, model different level of ability for different purposes. What I mean here is if you are assistant architecture engineer, you probably only focus on system level simulation. So you can use lump parameters to model the entire distributed power plant, for example.
And if you are an electrical engineer, who is only focus on component level, space levels simulation, you can increase the non-linear model to see the situation and harmonics effect. And the trade is for one parameter linear model that allow you to run faster simulation, as for a detailed modeling considering non-linear effect, it will take a longer time but allow you to have realistic simulation retail.
OK. Now, I would like to show you a demo. How do we model inverter in different facility? As we can see from the demo, we have our motor parameters that we just measure from experiments. So we can model motor and motor dynamics. In this motto we have set out three variants for modeling motor and inverter.
In the first variant, we use box from Motor Control Boxset for modeling linear long parameter motor dynamics. We suffix in [INAUDIBLE] value by directly loading estimate motor parameters into a block. So for first simulation, we can model motor. We can model inverter as an average value device.
As for the second [? variant, ?] for those of you who are interested in switching events in the Powertronics, we can use Simscape Electrical to model the key signals for the inverter. Now, we are modeling ideal switch inverter, but we can also model power semiconductors, such as most Fed or IGBTs.