Integrating FEM Motor Data into Simscape Electrical - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 24:09
Loaded: 0.68%
Stream Type LIVE
Remaining Time 24:09
 
1x
  • descriptions off, selected
  • en (Main), selected
    Video length is 24:09

    Integrating FEM Motor Data into Simscape Electrical

    Overview

    Engineers developing electric motor controls often need to simulate the nonlinear behavior of a motor which depends on things like load torque, speed and rotor angle. The motor design tool Motor-CAD solves for this nonlinear behavior using finite element (FE) analysis. This webinar will show how motor data is extracted from a Motor-CAD model and imported into a Simscape Electrical model as look-up tables. The look-up tables work in Simulink, letting a control engineer perform control design using a motor model exhibiting nonlinear behavior. This approach accounts for behaviors such as saturation and spatial harmonics. This capability is demonstrated for 3-phase machines and an example for 6-phase machines is also provided. This webinar will also show how efficiency map data from Motor-CAD can be imported into a Simcape™ Electrical™ Motor & Drive (System Level) block. This provides fast system-level simulation capability of a motor drive whilst still making accurate predictions about losses.

    Highlights

    • Demonstration of exporting flux linkage from Motor-CAD to Simscape
    • Demonstration of exporting iron losses from Motor-CAD to Simscape
    • Exporting current profiles from Simscape back into Motor-CAD for accurate iron loss calculation
    • Exporting efficiency map data from Motor-CAD to Simscape

    About the Presenters

    Rick Hyde is the technical lead for the Simscape™ libraries group. He has expertise in control engineering, mechatronics and electrical/electronic systems. He has a first degree in Electrical and Information Sciences and a PhD in robust control, both from the University of Cambridge (UK).

    James Goss is the Chief Executive Officer of Motor Design Ltd where he mainly works on automotive R&D projects and software development with large industrial partners. James received an MEng degree in Systems Engineering from the University of Warwick in 2009 and in 2014 received an Engineering Doctorate from the University of Bristol in the design of brushless permanent magnet machines for automotive traction.

    Recorded: 30 Nov 2021

    Welcome to this webinar on motor and drive design. So this is a joint presentation from Motor Design and MathWorks, and it showcases a collaboration that we started back in 2018. So let's start by introducing ourselves. James, do you want to go first?

    Thank you, Rick. So I'm James Goss. I'm the CEO at Motor Design Limited. I have a doctorate in the design of electric machines, and I've been working in the design, modeling, and simulation of electric machines for automotive and aerospace applications for the past 10 years.

    And my name is Rick Hyde and I'm the technical lead in the Simscape Libraries group at MathWorks. So I've been at MathWorks for over 20 years, originally working in consulting, using my background in control engineering, and then more recently working on physics based modeling as part of the Simscape team.

    So one of the things I've been working on is how to efficiently implement non-linear motor models in Simscape, and that will come through in his presentation.

    So, one of the things I've learned actually, James, from working with you on this project, is that there are multiple steps to designing a motor drive, and you need engineering expertise from multiple engineering backgrounds.

    Right, yes, sir Rick, as you say, there's multiple steps in designing an electric motor. And obviously the first step in the design of electric machine is the configuration of the design. So sizing the machine, looking at the topology, such as the slot/pole combination, the type of winding, the layout of the winding, and the configuration of that winding.

    From there, we have to analyze the performance of the machine, and as we know the electric motor is inherently a multi-physics problem. So we have to look at the electromagnetics, we have to look at the thermal, and we have to look at the mechanical performance. And we also have to do that over a large, or a wide, torque speed operating range. So often looking at the efficiency maps, or the drive cycle.

    From there, and once we've done some iteration of the design, we then want to validate that design and understand the interaction between the motor and the other system components. One thing that we know, is that when we simulate the electric machine, or when we connect the electric machine to an inverter, you can experience higher losses in the motor due to the actual PWM switching and the current waveforms. So that final validation step is to simulate the combined behavior of the electric motor and the inverter together to calculate accurate losses.

    OK, so in parallel with these steps, the Systems and Control Engineer is focusing on some different tasks and, first of all, designing the inner loop feedback controllers that controls the current, and hence the torque of the motor. But to do that they need flex linkage information from Motor-CAD. So that's the first step, bringing in that information from Motor-CAD and doing that design.

    And then the outer loop control, you need to work out how to optimally portion the d and the q-axis currents to minimize losses when you're delivering a given torque at a given speed. So that's what I've called Operating Management there. And that needs information, again, about the efficiency map of the motor as a function of operating point to do that.

    And once you've done that, then you can start thinking about the drive electronics, to the topology of the drive electronics, and then selecting the devices and doing the gate driver and all of the electronic design.

    And then you can put the whole thing together and do system simulations and look at, for example, the harmonics on the electrical side or on the mechanical load side, and maybe come up with some initial efficiency estimates for the overall system. But then, as James said, you've got to go back and validate the performance by going back into the detailed motor modeling.

    OK, so that just sort of sets up the introduction to this webinar. So what we're going to do today is, we're going to explain to you how we start with electric motor design in Motor-CAD, and then we can work through that workflow. So we export the design into Simscape, and then we model the complete drive with the motor and the power electronics and the control in Simscape and Simulink. By doing that, we can calculate the accurate behavior of the current waveforms, bring those back into Motor-CAD and simulate the associated losses with the additional harmonics that are due to the interaction between the motor and the drive. Finally, we're going to explain how we can extend this workflow to not just three phase motors, but also multi phase motors. And we have a six phase example to finish with.

    So we're going to start the webinar today just by explaining how we use Motor-CAD to design an electric machine and what Motor-CAD is. It's a multi-physics dedicated electric machine design tool for the design and simulation of electric machines. It allows you to use the comprehensive geometry templates that exist within Motor-CAD to rapidly explore the design space and perform variation analysis to understand what impact of making different geometric, or other design decisions are, on your electromagnetic, thermal, and mechanical performance, and also allowing you to do that simulation over the full torque speed operating range.

    One of the key capabilities within Motor-CAD is by using that Motor-CAD lab module, you can do that analysis over the full torque speed operating range and generate things like, drive cycles, torque speed curves, peak and continuous, as well as efficiency maps. And in this slide here, we're showing an efficiency map that's been generated and calculated for a particular interior permanent magnets machine design.

    With that efficiency map, you can see the plot on the screen, and also the data. And that data can be exported directly into a .mat file format. And we're just going to explain, shortly, how we can use that data to bring that into Simulink and perform a full drive system efficiency calculation.

    A second workflow that we're going to focus on a lot today, is the ability to simulate that switching behavior between the motor and the drive. And to do this, we need to extract the kind of electromagnetic performance maps of the electric machine from the electromagnetic finite elements within Motor-CAD. To do this, we've built a really nice tool here that allows you to very easily set up this simulation.

    So you specify the range of currents that you want to do the simulation over, and the range of current phase advance angles. We set up a couple of other settings there to make sure that we're capturing the variation of the flux linkages with rotor position, and then we send this away and the solver generates all that data. Again, all of this data, this flux linkage and loss map data, is generated and exported in a .mat file format.

    And Rick's going to explain, in this workflow, how we can use that data to bring it into Simscape, and do this complete couple drive and motor simulation.

    Great, thanks, James. So focusing on that first workflow, so that's the efficiency map one, this is our end product example that shows how to use Motor-CAD and Simscape together to do this. And it uses the motor and drive system level block you can see in the diagram. So this system level block, it balances electrical, mechanical, and losses. Electrical, mechanical powers and losses. So it's very, very simple, runs fast, and good for systems level simulations.

    If you look at the mask, it's looking for that tabulated data of losses or efficiency as a function of operating points. And it reads that information indirectly from Motor-CAD. So we're loading the MATLAB file there in the first line, then there's eight lines of code, which are basically just extracting the range of torque and speed, and then doing some mapping on the efficiency information, putting it into a regular grid should be required for our block. And we've got a utility that just validates that, so you can see the original data. Those little circles there are superimposed on the other plot to validate that we've done that correctly.

    So having done that, then we can use this parameterized motor and drive block in a complete electric vehicle model. So on the left we've got a Simscape model on an electric vehicle. Say it's got a drive cycle, so on the far left it says inputs and on the graph, on the right, that just shows you what we're doing. We're cycling the speed up to just short of 40 miles an hour and then back down again, and then as an incline. It's going up a hill to start and then going down the hill, halfway through the simulation it starts going downhill. And so we're testing the motor out in the different quadrants as well during the simulation.

    So the PMSM system level motor and drive block that we talked about in previous slide, is in this PMSM drive subsystem. And so if we're looking at subsystem you can see it's also got a very simple liquid cooling circuit there as well. So that means that over the drive cycle we can track what the temperature of the motor is doing. So this is an estimate of the motor temperature, it's a simple thermal model. And we can also work out what the torque profile required from the motor is as well. So with this kind of system level approach you can get simulation speeds of 100 times real time, that kind of speed is achievable.

    So let's now look at the second workflow, which is using the saturation and loss map, that's the detailed flex linkage as a function of currents and rotor angle. So this is another Simscape example that we have that shows you exactly how to work with Motor-CAD and Simscape together to bring in this data. And this uses another block, FEM parameterized PMSM. So FEM is finite element magnetic, it stands for finite element magnetic here. And this block brings in tabulated data for the flux linkage. It also brings in tabulated high losses, Steinmetz coefficients, also exported from Motor-CAD. And so you can see the parameters that we require there in the mask.

    On the right here, here's a screenshot of how we load the MATLAB file that Motor-CAD has created. So we load it in. I've got these extra arguments here, which you don't need to add, if you could just load the mat file and you get all the data. I've just picked out the things that I'm going to use in this example. And then you can see that structure that I've loaded, the elements of that structure relate directly to the parameters that are needed on our block. So it really is as straightforward as that.

    So having done that, you can now use this inside a full electric drive model. So there's the motor that we've imported from Motor-CAD and that subsystem. So let's just have a look at the other subsystems in this model. So bottom left here, we've got the drive electronics. So here we've got six IGBTs in a three arm bridge configuration. Then we've also got the motor controller. so there's the inner loop and the outer loop controllers, and then there's also the modulation scheme, in the PWM block there.

    Now, remember starting we said that for doing the outer loop, or for working out what the ID and the IQ current are, we need information about the efficiency map. And this is a MATLAB plot that is taking the efficient map data and it's working out what the optimum kind of ratio of ID to IQ is to deliver a given torque at a given speed. So that's another part of it. And then the final part is a test harness around it. So this test harness in this case is setting up a given loop torque, and setting up to given speed. And then with that we can get efficiency information out at that operating point.

    So if I've run it here at 4,000 RPM, 100 meter load, we can then determine the losses. And we've got a utility get power loss summary here that just reads the whole what we call the Sim log, that's all the simulation data, and it extracts a summary of all the losses in the system. And here, it's summarizing the total losses in the motors is 1,200 watts, and the total losses in the inverter is 900 watts. And because we can dig into these values by going into the Sim log, into the log data. So doing that and just looking at the motor here, we see total losses in the yellow, that's the 1,200 watts. And then the red is the stator iron losses. And the blue is the rotor iron losses. So you can see roughly half the losses are iron losses here, and the other half are copper losses.

    We can also look at the impact on the mechanical side, predicting spectral analysis of the torque response, showing all the torque harmonics there. And the same on the electrical side, sometimes you want to know what the harmonics are that you're putting on the electrical and the DC supply of the motor and drive.

    OK, thanks Rick, that's very interesting. So from that drive simulation, what we can do now is we can take the calculated current waveforms and bring them back into Motor-CAD. There are actually two ways of doing this. We can either just directly import the waveforms for the three phase currents as a function of rotor position, or we could do a harmonic analysis on those waveforms and specify the harmonic composition of those waveforms, and apply that to Motor-CAD as well.

    In this case, we've just taken the three phase waveforms, extracted them from Simulink, and then imported them into Motor-CAD. You do that by selecting the custom current option, and you can see on the left hand side here, this is the interface for importing those current waveforms. Once we've done that, we can then run the electromagnetic simulation and the EMAG model. And it's going to use those new current waveforms with the harmonics included to calculate the torque, the power, and also the different loss components.

    When we do this, there are a couple of settings that we need to take into account. One is the number of steps per cycle that we use in the electromagnetic finite element simulation. We can independently vary those from the custom current waveform definition, but these need to be at least 10 times higher than the highest harmonic that we want to account for in the current waveform. We also need to specify the number of air gap points in the mesh, and we recommend that that's a multiple of the number of steps, and the number of pull pairs.

    OK, so when we've done that, we've run our simulation. As you can see here on the screen, there's quite a dramatic change in the losses. There's quite a lot of harmonics in this current waveform that are driving these additional losses. So if we look at the stator iron losses, you can see that the iron losses in the stator are almost doubled by these additional harmonics that are induced from the switching. The rotor is even greater. And there's actually four times the amount of iron losses in the rotor, compared to the sinusoidal current waveform. And then the magnet losses have a really dramatic impact. And we've actually got 20 times higher losses in the magnets when we look at the harmonics that are included in this waveform.

    OK, so we've gone through a conventional three phase motor example there, and hopefully we've shown you we've got a very good integration between Motor-CAD and Simscape, and it's very straightforward to get a design between the two tools. So what if you're working on a more novel configuration? There's a lot of interest in six phase motors at the moment. So with that in mind, James and I started another example on a six phase machine. And this is a screenshot here of the example that we shipped in 21b, based on that collaboration. And there are four main steps to putting this example together, and we're going to just run through those four steps.

    OK, so as before, we want to start our design in Motor-CAD. And Motor-CAD obviously can simulate not just three phase machines, but also multi phase machines, and in this case a six phase machine. So this is a 72 slot, six pole interior permanent magnet configuration. If we go to the winding page, you can see how the individual coils in the different phases have added up to give us a phasor diagram, and an overall balance winding. We've got two three phase sets here in this case. And the two sets are separated from each other by 30 electrical degrees.

    OK, so having set the motor up in Motor-CAD, step two, is to bring that design into MATLAB as before. So we need the winding configuration. So there's a bit more information this time that's required in writing the winding configuration, but we also need to bring in the flux and the losses as before.

    So this time we used the Motor-CAD ActiveX interface, which you can call directly from MATLAB, and you can customize how you bring in the flux information, which is what we did here. So having done that, we then need to generalize Park and Clarke to a six phase machine. So the Clarke transforms now has six columns because there are six windings, and you've got to resolve those windings into one axis set, so that's the six columns. But to have full information, we've got to have a square matrix. And we picked the third and the fifth harmonics. And so that gives us what we need in full information, and the fifth and the third harmonics were dominating the response to this kind of motor. So that's a good choice.

    And then having done that, then we need to work out what equations to implement. Now with six windings and motor angle and the flux, depending on all seven of those things, you could end up with a seven dimensional table, which just doesn't scale the number of electromagnetic solves that you need to do to get the flux linkage tables. So what we've done here is keep the dimension down to three, so the conventional kind of three we saw in the first example. And to do that we've made the assumption that the third and the fifth harmonics can be superimposed on top of the nonlinear behavior of the fundamentals.

    So in the equation here, circled in green, this is the third and fifth harmonics that are being modeled. And then circled in the blue, is the nonlinear, so it tabulated in three dimensions. And we do this superposition. So we can validate this in step four, which we'll come to, and make sure that we got sufficient accuracy still. So that's step two.

    And then step three, we need to write a custom Simscape block that implements the equations that we've identified in that live script. So this is the block. And if you double click on the block in the example, you can see the parameters required are very similar to what we had with the three phase motor. And here you can click on the source code. So you click on that link, and then you can see what the code is.

    So this example is not just about six phase motors, it's about the whole workflow for any type of custom motor. That shows you the whole workflow, and you can take this example and tailor it to whatever motor type, or configuration, you have.

    Now one thing to note is that the Simscape code is really easy to program. There's a direct correlation between, for example, that line of code there, number of pull pairs. Comment is what creates the mask prompt on the right, number of pole pairs. And it's automatically produced that mask, so it's very, very straightforward. And actually the harder thing when you're writing a Simscape component like this, is getting the maths right, working out what the equations are that you want to model. And that's what we capture in the live script in this example.

    So finally, we need to validate the implementation. So this shows the Simscape results. So a no load constant speed rotation of the motor, so we've got the back EMFs at the top, and the phase voltages, and then we got the flux linkages in the bottom plot there. And then the same scenario run in Motor-CAD, here I've just plotted the flux linkages, you can see the same shape and the same peak value. So that's validating the way that we've gone about that, and particularly the linear superposition of the third and the fifth harmonics.

    OK, so that brings us towards the end of our presentation. So just to summarize, there's been three main things that we have shown in this presentation. First of all, there's a very straightforward, out of the box integration of Motor-CAD with Simscape. It's very straightforward for you to do design in Motor-CAD, get it into Simscape, do the control, and do the round trip and go back to the Motor-CAD. And secondly, we've shown this round trip workflow, or shown how it's done, and how it's important, particularly when you're looking at the iron losses, or getting an accurate loss of that overall motor and drive. And then finally we've shown you a workflow where you've got a novel motor configuration. And this workflow is very much customizable, so you can take it to a starting point for designs that you're working on.

    So if you'd like further information, at the top here, we've got a list of the four standard Simscape electrical examples that we use. So these are just the things you type at the command prompt to open those examples. And then under further information there, that's a link to an electric vehicle example, battery electric vehicle example, on MATLAB Central, which adds a lot more detail. So you might be interested in that.

    Yeah, OK. And within Motor-CAD as well, you can access tutorials just under the Help menu as you can see here on the screen. Click on tutorials, and open up a folder with all of those in there. And within that folder, there's lots of examples related to MATLAB and Simscape, and some of the ones that have been detailed in this webinar.

    So thank you very much for your time today and for listening to us. We hope you found the webinar interesting, and please feel free to get into contact with us if you've got any further questions.