Modeling in FEMM Part 5
Using LAU Scripts
In this segment we will analyze how to use a bit of automation to develop a clearer picture of model performance. There is a bit of a challenge for AF motors on how to do this correctly. I wanted to develop a baseline first and try to compare an AF hub motor to a known RF hub motor. Presently I use the
9C 2806 on my ebike as I am quite familiar with how it operates. The complete investigation of the
9C 2806 hub motor in FEMM has come to a safe conclusion, at least to the point where one can understand the nature of the motor well enough, and ending with a nice example of Lua scripting.
What I’d like to do now is adapt those scripts for use with AF. The first step towards that direction is to develop a new AF model for study. I chose a geometry that I think is fun, commonly available, and although perhaps not entirely practical for a hub motor, it is compact enough that it was easy to configure.
AF model using common Windmill magnets
View attachment AF_Magnetics_Windmill.zip
Details:
- Windmill Magnets: 16p N42 (model uses N45) 8†OD x 4†ID x ¼†thick, 2-Rotors (hub covers); inexpensive and easy to acquire. Link
- Windings: 18t of 1x4 Type-8 Litz (~12 AWG-equivalent) x 6 turns per winding. Link
- Coreless. (The model uses Air, but could be a host of non-magnetic materials).
- Back iron is pure iron, 4 mm thick. In the real world this might be Stainless Steel 340.
This model was drawn up and a section was taken at the 76 mm radius (about ½ magnet length). Note that there are a couple of extra poles on the right; we need that for the scripts which will be explained forthwith.
With Radial Flux hub motors we rotate the magnets and back iron relative to the stator. For AF, the motor is unraveled and looks like a racetrack; I think to think of it as a maglev rocket sled track. And instead of rotating magnets, we translate the windings laterally – hence the reason why we need an extra pair of two at the end of the series.
Scripts Examined:
The credit for these scripts rightly belongs to
Biff who was kind enough to give us a hand on the 9C 2806 studies. I took the liberty of studying them and making a couple of adjustments which I’d like to explain in detail if folks would be keen on that.
Two LAU references are the FEMM Help (
very abbreviated), and online – though I have to say that I found it difficult to find a consolidated resource. That said, this link is pretty fun to explore:
http://luatut.com/. Don’t be afraid of Lua; it reminds me of Jscript in a way. :wink:
The big changes to
Biff’s scripts were resetting the poles to the correct amount (natch), and adding variables and maths that would determine the dX translation. With the Windmill model, these values are:
- rotor_poles = 16;
- rotor_radius=76; (in mm)
- dX = 0;
- dX_per_step = (rotor_radius*rotor_angle_per_step*3.1416)/180;
FEMM has a feature where you can group objects together for study. This is the part about FEMM that is goofy: If I assign a volume to have a property then I expect that volume to inherit all the traits. No so in FEMM: We have to do double-duty to get our model correct (and I have already done the diligence with the attached model). To modify a new model, briefly:
- In FEMM, go to Operation|Segment, click the windowing button, and box the whole model sans the bounding box, and group them as “2â€.
- Redo the operation for just the windings and group them as “1â€.
- Now add the nodes for the magnets, and then for windings. Select Operation|Block, then the windowing button and select all the winding nodes. Here I set them all to the same value in one swing: Material, Circuit (default to A), Turns (I set them to “-6â€), and Group = “1â€. Individual processing will now go faster.
- Repeat for the Magnets, setting Material, Direction (I picked “270â€) and Group = “2â€. Then I go back and individually reset every other pair’s direction to “90â€.
Anyway – that’s the trick to getting the nodes AND the segments to move together, and it needs doing for either RF or AF models.
Now, back to Lua:
- With RF, the group selection command is mi_selectgroup(2) which equals the magnets and back iron. I kept that representation in AF, and used Group 1 for the windings. With the AF scripts this changes to mi_selectgroup(1).
- For RF, the model rotates the selected magnets and back iron with this command: mi_moverotate(0, 0, rotor_angle_per_step, 4). However with AF, we want to translate across the X-Axis, so I changed it to: mi_movetranslate(dX,0,4);
- RF then increments with: rotor_angle = rotor_angle + rotor_angle_per_step, whereas AF increments with: dX = dX_per_step;
Broken down into bits, it’s pretty simple to comprehend.
The
variable-torque-AF_Windmill.lua script just ramps the current up from 10 to 110. I think that for the most optimum result the windings need to be in proper alignment with the magnets – and here I am at a loss but to guess that the
running-torque-AF_Windmill.lua script would provide the clue.
Torque:
There is one other change I made to
new-flux and
running-torque scripts for AF...
- RF torque is determined around the X,Y point of 0,0, and the command that is called is: torque = mo_blockintegral(22) which is the “Steady-state weighted stress tensor torqueâ€. However, because of the geometry of our model we do not have a radius per se. Instead I measured mo_blockintegral(11) which is the “x (or r) part of steady-state Lorentz forceâ€. This is at least consistent with my previous AF FEMM modeling. It still needs a bit of help to convert that to an apples-to-apples value so that we can realistically compare the RF and AF models.
By definition, Torque (Ï„) = Radius (r) X F, or
τ = rFsin Θ
If this is correct then it should be a simple matter of modifying the script to provide a suitable output.
Biff, chime in anytime friend
Methodically,
KF