Just like any other software, FEMM has its limitations.

I’ve been talking a lot to David Meeker, the author, who has been extremely kind and thoughtful in guiding me not only in the program’s usage but also in general electromagnetic modeling, while trying to sort out the modeling mess I’ve put myself and my colleague into with this project. 🙂

As it stands, we have a problem: *FEMM only works with a single frequency at a time*. This means that permanent magnets (freq=0Hz) and electromagnets (freq>0Hz) cannot simulate together. That’s a big downer. It means we can’t draw the magnets and the coils and set a current frequency and get the corresponding torque – FEMM will ignore the permanent magnet’s fields and give us the torque from only the AC-induced field.

But perhaps this is a good thing. This “problem” is just an aspect of a greater, deeper problem: time modeling in the finite element method (f.e.m). You see, time is usually only present in f.e.m. in the shape of the sinusoidal E.M. waves: current, field, and all their related partners. There is no way to describe (let alone simulate) mechanical movement between parts of the design. I don’t know if other programs have this solved, but I can guess how difficult it would be to program it into FEMM. Anyway, it would be incorrect to expect good results even if FEMM did do the math with the DC and AC components, because a static PM is not the same as a moving PM.

So we are left without a way to simulate the magnet’s rotation around the stator, which means the machine is always static and we can’t evaluate all the other points of operation that involve speed. If we turn on the frequency, we lose the magnets and so the major source of torque; we turn it off, and we lose the core losses and the counter-electromotive force. And combining the two simulations is not correct, because there are always saturated areas where the flux cannot be summed linearly. So it looks like we can’t simulate in FEMM a brushless DC motor like this one:

Or can we? David was kind enough to show me how.

We basically replace the original design of the permanent magnets in the rotor with an “equivalent alternating field source” that emulates the moving field of the magnets at the desired speed. If things are done properly, this “current sheet” in the rotor will generate the same field as the PMs (with the same amplitude and frequency) when they are rotating. The distance between 2 opposite magnetic poles corresponds to half a wave’s period. The amplitude of the current must be reverse-engineered; David suggests to run a few simulations to find out which current density in the “equivalent rotor sheet” generates the same field strength in a distant point of the machine as the magnets would. Then it’s just a question of dividing the sheet into a lot of small(ish) segments and insert the current density vector into each one. It sounds complicated, but it’s not. Take a look at the very same motor as above, modified according to this technique:

Each one of those new little segments in the rotor has a different material property, which just defines a current density vector with the same amplitude but different orientation. The values are inserted as complex coordinates:

The resulting field is a sinusoidal one which matches the permanent magnet’s field, as you can expect:

This in fact simulates magnet movement. To define the rolling speed of the motor, you set the frequency of the problem. So what’s the catch?

Well, David pointed out one: this only gets you the base sinusoidal frequency. To get the contribution of the harmonics, further simulations are necessary – and you have to know which harmonics to simulate. And our motor model has loads of harmonics because of the squarish shape of the poles, which renders this technique somewhat erroneous.

And me, I’ve always liked the fact that our models are reality-accurate. Replacing real parts with “movement-equivalent” constructs gives me the chills. What if we get it wrong? Double-checking it would take a lot of effort, and we’d still need the magnets version to find out which harmonics we should look at.

Incidentally, this can be done by doing a “generator” simulation: snapshot (at zero frequency) the flux linkage of the phases in each position of the rotor, and draw up a chart with it’s time derivative (the EMF voltage):

Pretty far from sine waves, right?

So, third option: back to basics. Ignore the fact that FEMM can calculate AC problems in the frequency domain, and use it only for DC static “snapshots” of several rotor positions (with the real magnets), effectively calculating in the time domain outside FEMM. Put enough of these snapshots together, and you can get electromotive forces and powers and even calculate core losses by analytical methods (as suggested by David).

Hmm… decisions, decisions… We’re taking the last approach, because time is not on our side. We will build up the script system to look for the highest Torque/Current factor, and save the core losses for a later attempt.

*Motorfemmulator, Strategy*

Tim

November 10, 2009

Interesting work. Well done.

I’ve found FEMM and octave. Is there a “getting started” guide to using the femmulator?

Vasco Névoa

November 10, 2009

Hello Tim.

No, not really… didn’t get around to writing one. There’s a README file together with the source, where I tried to keep the important info.

But since the motorfemmulator framework is very much work in progress, and it’s design still in flow, there is no single way to attack it; people are expected to experiment with it.

I did try to make it work “out-of-the-box” with an automated example; it *should* work for you by following these steps:

1 – install FEMM and octave;

2 – place the framework files somehwere handy;

3 – declare the path to the FEMM m-files and the framework’s m-files inside Octave (addpath(…)).

4 – load START_HERE_… script to get the thing runnning. Octave should launch FEMM and start drawing a motor.

If that doesn’t work, let me know.

Florin

November 12, 2010

Hello, can you attach files of FEMM permanent magnet and “current sheet” for a better understanding.

David

December 13, 2010

Hi – I’ve used both FEMM & Maxwell, by Ansoft. The latter can do the full simulation desired above, with multiple frequencies together with permanent (DC) magnets, using its “transient” analysis. It’s much more computationally intensive, but can give some incredible insight into such problems. For example, I was able to calculate intermodulation distortions between multiple drive frequencies in a coil + PM motor. I think Magnet by Infolytica has a similar capability, but I’ve never used it. Neither are cheap though!

Vasco Névoa

December 13, 2010

David, that’s good to know, thanks for that info! 🙂

I’ll keep it in mind, even though I prefer Free Software to closed proprietary applications.

Jose Vinoth

February 12, 2013

Hi David,

I am doing my post graduation in Machine design (mechanical Engineering). Now I am working on my final project on “Energy Harvesting Using Linear Generator (LG)”. This is LG coisist og magnet and copper coil array.I am trying to simulate the analysis using Maxwell to find the induced voltage in the coils when the magnet array translate linearlly.

I am struck when assigning the BAND while doing 3D transient analysis.

Could you please help with some maxwell tutorials to simulate the analysis.

Henry

September 28, 2011

Hello vasco, i’ve been searching for sites like this. I have only two weeks to answer this question and i’ll be very happy if you help me out. How can i use a FEMM software to get the magnetic flux density at a distance from a ferrite magnet?

Vasco Névoa

September 28, 2011

Hello Henry.

That shouldn’t be hard at all.

1 – create a new “magnetic problem” in FEMM.

2 – open the “Problem” menu and set the “Depth” equal to your magnet’s thickness. Be aware of the “Length Units” used.

3 – open the “Properties/Materials Library” menu. In there you select the Ferrite material that matches your magnet and create a new Material into your model. You must also copy “Air” into your model.

4 – open the “Properties/Boundary” menu. In here you add a new boundary property with name “A=0” and type “Prescribed A”. Leave everything else at zeros.

5 – draw the magnet’s geometry with “nodes” and use “segments” and/or “arcs” to connect the nodes. Make sure the shape and dimensions are close to reality. Use the “zoom extents” button to fit it all into screen.

6 – you should have a good representation of your magnet (a 2-D figure that is a closed line). Now put a “Block Label” (button with a circle and square) in the centre of the magnet. Open its properties and pick the new ferrite material you created. You may have to adjust “Magnetization Direction” (in degrees) and “Mesh Size”, or not. Depends on your drawing.

7 – put another block label outside the magnet. In its properties pick “Air”.

8 – now you need to draw the limits of the magnetic domain; zoom out on the drawing, and draw a closed circle around the magnet. It should be at least 3 times larger than the magnet. A circle in FEMM is best composed of 2 nodes and 2 arcs. Set the arcs to have the “A=0” boundary.

9 – save your project. Press the “Mesh” button to generate a finite element mesh. Take a look at the mesh and learn from it. 😉 There should be finer meshing around the magnet / air frontier, and coarser meshing everywhere else. The defaults of FEMM are a bit disappointing for mesh size, so I advise you to edit the properties of the 2 block labels (air and magnet) and set a mesh size that is substantially smaller than the magnet. This should bring you closer to reality.

10 – press the “Run Analysis” button. When it is finished, press the “View Results” button. FEMM will open a new window and show you the computed magnetism results.

11 – in that results window, you can do a lot of analysis yourself. To find the flux density at a point, I suggest you draw a couple of nodes in the air (back in the design window, before running analysis), and then in the results window you draw a line between those two nodes (like this) and ask for a “plot” of the “|B| (Magnitude of Flux Density)”. The resulting graph should be clear enough. Experiment to get the best results.

Have fun with FEMM! It takes a little while to get used to the strange way it uses “modes” when drawing (Node mode, Segment mode, Arc mode, Block mode, etc.) but you’ll get the hang of it.

henry

October 5, 2011

Hi Vasco, thank you very much. I tried it out and it worked. However I still need some clarification on something similar.

I want to model two ring magnets that have like poles facing each other and they are separated by a soft iron spacer. Should the “problem type” be Planar or axisymmetric? Also how will the boundary condition look like? I have come across a boundary condition like this: Co=1/uo*4*inch

Vasco Névoa

October 6, 2011

I think it should clearly be an axi-symmetric problem. In this case you should draw half of the cross-section of the magnets. I’ve never experimented with this type of design, so you’re on your own there.

Consult the examples and the magnetics tutorial to get a better idea.

I see in this axi-symmetric example that the boundary condition is still A=0, I don’t know why you would pick a different formula for “Infinity”, it pretty much satisfies most of the problems.

Note that the left edge of the drawing is the axis of the model, and so it does not require a boundary condition.

Good luck and good work! 🙂

Jose Vinoth

February 12, 2013

Hi Vasco,

I have a problem to analyse the induced voltage and current in a coil array(1mm wire dia) by moving a array of FeNdB grade N52 magnets inside the coil array. Its a kind of linear generator generating EMF form linear vibration.

I did a Axis Symmetric analysis Using FEMM and found the Magnetic flux density distribution using LUA script.

I also like to know the radial and axial magnetic flux distribution and like to plot the voltage induced against time.

Could you please help me how to do this in FEMM software?

waiting for your reply.

Thanks in advance.

regards,

Jose

Vasco Névoa

February 13, 2013

Hello Jose.

I haven’t done any of this in years now, but I do know that FEMM does not “do movement”. It does not have the notion of “time” in it, so it doesn’t know about “speed” either.

So, you always need to take several simulation “snapshots” with the machine parts in specific positions, and then calculate whatever you want outside FEMM with the data that FEMM gives you.

I strongly advise you to learn how to script FEMM, because this saves you a lot of hand work… if you just want a few values, learn to do it in LUA inside FEMM. If you have a major academic / exploration project there, then maybe you should consider Matlab/Octave/Mathematica as your front-end to the problem. AFAIK, all these 3 apps allow you to control FEMM’s functions. You can extract all the information you want from it like this, and plug it into any kind of algorithm you like inside them, complex or simple, you decide.

With 2 simulations of the machine in 2 different proximal positions, you can extract first-order variables {torque, flux linkage, voltage drop} and then, with time information supplied by you, you can calculate any second-order variable you need (derivatives like mechanical power, back-emf, etc). You can take a peek in one of my last Octave files here, but I promise you it’s not pretty, or perfect, or complete, it’s just a guideline. 😉

Good luck! 😀

henry

October 6, 2011

Thank you for all the help you have render to me. I have never used any FEA software before but with your help I am learning things I never knew before. May God bless your site!

Vasco Névoa

October 7, 2011

Thank you, Henry.

I’m glad you are glad. 😉

Just remember to pass the love around (teach someone else) and we’ll call it even. 🙂

Cheers.

C

August 25, 2012

I am trying to model a bldc slotless in runner and find how the available running torque of the motor depends on the size of the air gap. It seems that i was able and use one of the online examples to model the cogging torque. How would i get to the running torque from here?

Amit

September 28, 2012

Hi C,

What you need to do is assign correct values of currents to each phase windings of your motor which will be position dependent. ( you need to write a lua code for this). The rotor will be stepped (rotate using lua) and calculate torque on rotor at every position from any of the solvers.

Hope this helps.

Regards,

Amit

rolf

November 24, 2013

Hi, I’d like to ask you a last question:

Are you comfortable to find back the voltage of a induction machine fed with a certain current ? FEMM show an example when material are not saturated, but what about when saturation is taken into account. I send an email to dave but I have no reply.

Thanks, I love to share knowledge. If you have question about anything related to electricity let me know, because I might have the answere who knows…

rolf

January 14, 2014

Hi,

You never reply to me…

How do you do to know the value of the current which simulate the magnet ?

How do you know about the real and imaginary part ?

Thank you

Vasco Névoa

January 15, 2014

Sorry, Rolf, I haven’t worked in any of this for years.

I only simulated in DC (0 Hz) and I used the proper magnetic materials to describe the magnets.

Each material in FEMM allows you to input a magnetic coercivity.

Hope this helps, good luck.

I never got to use this trick that is in the post.

ROLF

January 15, 2014

Thanks you, you’re a good man ! I’m still confused because you wrote :

We basically replace the original design of the permanent magnets in the rotor with an “equivalent alternating field source”

That’s what I’m looking for. We can see on the screen shot real and imaginary part of the current. Is it a mistake ?

Vasco Névoa

January 15, 2014

Ok, to clarify: what is described in this post is correct, but it is not something I have used very much. It is just a cool trick that was shown to me, and even though I didn’t use it myself in the project, I thought it could be important for others so I tried it once and posted it here.

What I meant was that I always did my (other) simulations in DC, at zero Hz, with “real” magnets so I never even had to specify an imaginary component.

Now… trying to answer your question…

This post is about a pretty advanced topic. So, I’m assuming you know how to work with complex variables (vectors) and you know what they mean in this context (orientation of a vector).

First you find out the pseudo-magnet’s current intensity by trial-and-error, you set magnetic field to zero and decide a current value and simulate it; and compare with the original simulation of a magnet. When you have the same field strength, you have found the necessary equivalent current.

Then you can redesign the motor with all the small pseudo-magnets and use this current density as a vector that is rotated a little bit more at each of the new pseudo-magnets, until you get a full 360 degree turn of this current vector when you cover N – S – N (or S – N – S) poles. So, if your motor has 4 poles (N – S – N – S), your equivalent current will rotate 2x360deg (N-S-N-S-N).

This is easy to check: you simulate the motor with the new “pseudo-magnets” with your complex current vector, and compare the magnetic flux it generates with the flux from the original simulation that had permanent magnets. If the flux/field looks almost the same, then it’s ok.

This is the best I can do now. Good luck!

rolf

January 15, 2014

Thanks. If you have one day a question about motors don’t hesitate to write me. I could probably help you.

Bye

Vasco Névoa

January 15, 2014

Thank you Rolf. I’ll keep that in mind. 😉

Sandeep

February 28, 2014

Hello , Great Work

I am also working on the BLDC motor analysis in FEMM but I am not able to model the permanent magnets to get correct values of torque. Can you please help me to get the current density modelling of the permanent magnets. I am trying to calculate the respective strength and corelate it but getting them wrong. Can you please mail me some documents regarding the calculations of the same. Also I would like to see how you have modeled it, so can you share with me the .fem file of the above design.

I would be very grateful to you for that.

wang peng

June 15, 2015

Hello， Great and interesting work! I am working on transformer DC bias, so both AC and DC should be simulated at one time! However the FEMM can only simulate one frequency at one time! So the transformer bias problem can be solved by FEMM? and How?

I will be very appreciate for your help.

Buk

February 23, 2016

Hey Vasco,

I’m really interested in your description of the two ways of achieving a dynamic frequency analysis with FEMM.

Unfortunately, the pictures of the FEMM setup for the first method are not found; which makes the words difficult to follow.

And the pdf (c28.pdf) describing the second method also seems to have disappeared.

Any chance that you can ‘find them’ again?

Vasco Névoa

February 24, 2016

Thanks for the feedback Buk.

I’ve found the PDF again and now it’s hosted on my blog so it doesn’t get lost again. 🙂

As to the pictures, they are all there and they are visible. Sometimes tne PNG files are invisible in Windows browsers, I don’t know why; please try another browser and see if that solves it.

ilgaz

October 20, 2016

Hello Vasco,

First of all thank you for femmulator. I have one question regarding it. I downloaded script files from sourceforge few days ago.

However, I cannot load any model you have created using START_HERE_motor_loader.m, all of them raises some errors. If needed I can send error list to you.

Secondly if I wanted run START_HERE_motor_loader from release folder ( not Magnetic m-files ) octave says clearconsole() command is not found. And it is true I also couldnt find it in femm m-files directory. Some kind of mistake at femm side?

Can I simply comment clearconsole() ?

Thank you, Ilgaz