Sie sind auf Seite 1von 15

Using FEMM software tool

Electric Drive Laboratory


May 10, 2006

Introduction
Rules for the use of FEMM (Finite Element Method Magnetics) in the analysis of the
electrical machines.
The elements of the problem can be divided in:

Drawing Mark Properties Operations


points labels materials pre–processing
segments groups boundary conditions mesh
arcs circuits solution
post–processing

1
Nicola Bianchi Using FEMM

Part I
Simple examples
1 A first example: the electromagnetic actuator
Let us consider the electromagnetic actuator of Fig. 1. It includes a fixed iron yoke
around which a coil is wound, and an iron plate. When the coil carries current, the
iron yoke attracts the iron plate, due to the magnetic pressure on its surface.
Neglecting the end effects, the simulation is carried out by assuming a planar
symmetry. This is that all the magnetic fields are repeated equal for each section of
the electromagnetic actuator. Then an unitary length is assumed, that is, Lstk =1 m.

Figure 1: Sketch of the electromagnetic actuator

1.1 Problem setting


The first step is to define the problem:
Type: the symmetry is planar,
Units: the unity is millimeter,

Frequency: since this is a magneto–static problem, the frequency is set to be zero,


Depth: a unity length is selected (this corresponds to 1000 mm).

1.2 Drawing
At first all the points of the structure are drawn, as shown in Fig. 2. The points can
be chosen by using the mouse (in this case it is suggested to use the snap to the grid)
or by using the keyboard (press TAB and insert the point coordinates).

2
Nicola Bianchi Using FEMM

Figure 2: Points of the drawing

After drawing the points, they have to be connected by segments. Select two
points at a time by the left bottom of the mouse, so that they are connected together.
Fig. 3 shows the segments that connect the points of Fig. 2.

Figure 3: Segments of the drawing

At this point the drawing of the structure is completed.

1.3 Boundary conditions


In a field problem, the the magnetic fields are required to satisfy suitable conditions
on the boundary of the domain. These conditions are called boundary conditions. In
a two–dimensional problem, they are imposed along the segments of the border.
There are four main boundary conditions:
Dirichlet: this condition prescribes a given value of the magnetic vector potential Az

3
Nicola Bianchi Using FEMM

along a segment. Thus, the flux lines results tangential to this segment. This
condition is used to confine the field lines into the domain.
Neumann: this condition imposed the flux density lines to be normal to the se-
lected segment. This condition is a natural condition. This means that it is
automatically satisfied, if other conditions are not assigned.
Periodic: this condition is assigned to two segments and imposes that the magnetic
vector potential behavior is the same along the two segments, i.e. Az,segment1 =
Az,segment2 .
Anti–periodic: this condition is assigned to two segments and imposes that the
magnetic vector potential behavior is the one opposite to the other along the
two segments, i.e. Az,segment1 = −Az,segment2 .
It is worth noticing that the boundary conditions are defined to confine the field
analysis to a given region, reducing the domain as minimum as possible.
In this specific problem, it will be assigned that no flux lines can cross this bound-
ary:
1. A boundary condition Az = 0 is defined in the problem.
2. The external lines, that is, the segments of the box are selected, using the right
bottom of the mouse.
3. The boundary condition is assigned.

1.4 Materials
The material of the objects that form the structure have to be defined. They can be
new materials, suitably defined for this analysis, or they can be selected from a given
Material Library. This includes the commonly used materials.
In the example, the materials that are used are Air, Iron and Copper.
A label is defined for each object. Then, the appropriate material is assigned to
the object: Iron is assigned to the two magnetic pieces, Copper is assigned to the two
coil sides, and Air is assigned to the remanent space.
Fig. 4 shows the label of the electromagnetic actuator.

1.5 Mesh
The subdivision of the structure in finite elements is automatic. This process is
commonly called ”to create the mesh”. Each object will be subdivided in small
elements (the finite element), which are triangles in FEMM.
It is possible to force the maximum mesh size in each object. The mesh size
refers to the area of the triangle used for this subdivision. The choice of the mesh
size depends on the problem to be analyzed. It is better to refine the parts of the
problem, in which the higher field gradients are expected.
Fig. 5 shows the final mesh of the electromagnetic actuator.

4
Nicola Bianchi Using FEMM

Figure 4: Labels of the drawing

Figure 5: Mesh of the structure

1.6 Current sources


The current is imposed in the coil sides by defining two current sources, or circuits.
In our example, we define two circuits:
CurrentPos: the positive current, for instance equal to 100 A.
CurrentNeg: the negative current, whose value has to be –100 A.
After their definition, they are assigned to the two coils of the structure, as shown
in Fig. 6.

5
Nicola Bianchi Using FEMM

Figure 6: External circuits connected to the coil sides

1.7 Groups
A group of objects can be defined to belong to the same group, defined by an identi-
fication number. The group can also contain one object only.
The group definition is useful when the automatic analysis is adopted, as will be
shown when the script files are dealt with.
In this example, we define the upper coil side as group 1001, the lower coil side as
group 1002 and the moving keeper as group 10.

1.8 Plot
Once all the steps above have been completed, the problem is ready to be solved. The
problem is analyzed. Then the results can be
At first the flux lines are plotted as shown in Fig. 7. This plot give us a rapid idea
if the problem has been correctly set.
A further visual analysis refers to the flux density map, shown in Fig. 8. This
gives an indication of the range of flux density values reached in the structure.

2 Use of the LUA script


The purpose of the LUA file is to automatize a series of computations using the
FEMM code.
A series of instructions can be written in a unique file (the LUA file) and they are
executed consecutively when the file is read within a FEMM editor or viewer. Often
a FOR loop is implemented, in which one or two parameters are changed.
This kind of programming is useful when several simulations have to be carried
out searching the dependence of the machine performance on one parameter, e.g. the
working frequency, the operating currents, or the geometrical position.
Some examples are given in the following. Further informations and documen-

6
Nicola Bianchi Using FEMM

Figure 7: Flux lines of the solved structure

Figure 8: Flux density map of the solved structure

tation can be found in the chapter ”LUA Scripting Documentation” of the ”FEMM
User’s Manual” (Press key Help topics in the menu Help of the application.

2.1 Scripts for the Pre–processing


An example is given to modify the current of the circuits.
At first we could need to compute the maximum current from the geometrical
data

S_coil = 600 -- (mm2)


k_fill = 0.4
J_max = 6 -- (A/mm2)
I_max = S_coil * J_max

7
Nicola Bianchi Using FEMM

\begin{verbatim}
%
where the text following \verb"--" is a comment.

Then a series of analysis at various currents can be implemented as


follows. Ten simulations are considered with linear variation of the
current:

\begin{verbatim}
N_sim = 10
for n = 1, (N_sim + 1), 1 do
I_coil = I_max * (n - 1) / N_sim

Once the value of the current is computed, the correspond circuits have to be
modified. The instructions that have to be used are

modifycircprop("CurrentPos", 1, I_coil)
modifycircprop("CurrentPos", 1, -I_coil)

It is also convenient to operate as follows:


1. to open an original FEMM file,
2. to modify as required,

3. to save in a temporary FEMM file, which becomes a copy of the original project
but with the modifications, and

4. to analyze the temporary FEMM file.


In this way, the original file is not modified. The LUA code becomes

openfemmfile("electromagnet.fem")
modifycircprop("CurrentPos", 1, I_coil)
modifycircprop("CurrentPos", 1, -I_coil)
savefemmfile("tempfile.fem ")
analyse()

A copy of the original project ”electromagnet.fem” to save in the temporary file


”tempfile.fem”, with the modifications implemented. This allows the original project
to remain unchanged.
The command analyse() start the finite element computation.

8
Nicola Bianchi Using FEMM

2.2 From Pre– to Post–processing


Sometimes there is the needs to transfer one or more data from the pre–processing
to the post–processing. This can be accomplished by write the information in a text
file that will be read when the post–processing will run.
An example of writing (e.g. the value of the current of the coil) in the ”temp.txt”
file is
handle = openfile("temp.txt", "w");
write (handle, I_coil, "\n");
closefile(handle);
Finally, once the problem is analyzed, it is necessary that the solved problem is
processed. Then the last command within the FOR loop of the pre–processing file
is the call to the post–process LUA file. This procedure will be described in the
following subsection. It is called as follows
runpost("postprocess.lua")
All the command that have written in the file ”postprocess.lua” will be executed.
Then the complete ”preprocess.lua” becomes
S_coil = 600 -- (mm2)
k_fill = 0.4
J_max = 6 -- (A/mm2)
I_max = S_coil * J_max
N_sim = 10
for n = 1, (N_sim + 1), 1 do
I_coil = I_max * (n - 1) / N_sim
openfemmfile("electromagnet.fem")
modifycircprop("CurrentPos", 1, I_coil)
modifycircprop("CurrentPos", 1, -I_coil)
savefemmfile("tempfile.fem ")
analyse()
handle = openfile("temp.txt", "w");
write (handle, I_coil, "\n");
closefile(handle);
runpost("postprocess.lua")
end

2.3 Post–processing
The post–processing file contains the instructions that have to executed after the field
problem has been solved. This file can be called separately or can be launched by the
pre–processing, for instance when it is included within an analysis loop.
At first, the value of some parameters are assigned, e.g. the z–axis length and the
number of turns of the coil:

9
Nicola Bianchi Using FEMM

-- length (m)
L_z = 0.100
-- number of turns
N_t = 80

The first operation of the post–process is to read the data written in the temporary
file during the pre–processing.

handle = openfile("temp.txt", "r");


I_coil = read (handle, "*n");
closefile(handle);

Then, some operations are executed. The same conventions used in the pre–
processing have to be of course used. Some examples are reported hereafter.
Each operation is divided in two steps:
1. at first, an element (line, object, group) or a set of elements is selected,
2. an operation is executed referring to this element or this set of elements.
In the following example, the line on the top of the moving keeper is selected by
means of the two extremes of the line. Then the computation of the force along the
line is required. Fcx and Fcy are the constant component of the force along the x
and y directions respectively, while Fpx and Fpy are the pulsating force components
along the x and y directions respectively. The latter components are equal to zero in
magneto–static problems.

seteditmode(contour)
selectpoint(-60, -10)
selectpoint( 60, -10)
F_cx, F_px, F_cy, F_py = lineintegral(3)

Alternatively, the moving iron keeper could be selected by means of its group
number 10, and the force components are achieved from the Maxwell stress tensor:

groupselectblock(10)
F_cx = blockintegral(18)
F_cy = blockintegral(19)
F_px = blockintegral(20)
F_py = blockintegral(21)

In the following example, the flux linkage with the coil is computed. The two
coils can be selected by means their group number (1001 and 1002 for the upper
and the lower coil side respectively). The coil side surface is firstly computed. Then
the magnetic potential is integrated over the two surfaces, and the flux linkage is
computed from their difference.

10
Nicola Bianchi Using FEMM

-- surface
groupselectblock(1001)
Sup = blockintegral(5)
clearblock()
-- integral of Az
groupselectblock(1001)
intg_Are_1, intg_Aim_1 = blockintegral(1)
clearblock()
groupselectblock(1002)
intg_Are_2, intg_Aim_2 = blockintegral(1)
clearblock()
-- flux linkage
flux_re_1 = (intg_Are_1 / Sup) * L_z * N_t
flux_im_1 = (intg_Aim_1 / Sup) * L_z * N_t
flux_re_2 = (intg_Are_2 / Sup) * L_z * N_t
flux_im_2 = (intg_Aim_2 / Sup) * L_z * N_t

In order to compute the magnetic energy all the elements of the domain are se-
lected. No number is specified in the command groupselectblock() so as all blocks
are selected. Then, magnetic energy density, magnetic coenergy density and the prod-
uct A · J are integrated.

groupselectblock()
Energy = blockintegral(2)
Coenergy = blockintegral(17)
AJ_intgr = blockintegral(0)

Once the computation is finished, the results have to be stored into a file. The
file ”results.txt” is open to append (note the command ”a”) the results of the com-
putation. In the example hereafter the values are written on the same row, spaced by
some blank spaces, followed by a line end command (”\n”).

handle = openfile("results.txt", "a")


write(handle,
I_coil, " ",
F_cx, " ",
F_cy, " ",
flux_re_1, " ",
flux_im_1, " ",
flux_re_2, " ",
flux_im_2, " ",
Energy, " ",
Coenergy, " ",
AJ_intgr,

11
Nicola Bianchi Using FEMM

"\n")
closefile(handle)

At last, the view editor is closed:

exitpost()

3 A second example: a cylindrical actuator


According to the cylindrical actuator shown in Fig. 3, the pre– and post–processing
files are reported in the following.

(a) Pre–processor (b) Post–processor

Figure 9: Actuator

The pre–processing is
PRE_ATT.LUA
-- Current density is defined
jm=3
handle = openfile("result.txt", "a");
write(handle, jm, " ");

12
Nicola Bianchi Using FEMM

closefile(handle)
-- Loop of simulations varying the air--gap thickness
-- dz is the variation with respect to the initial position
for dz = 0,-0.6,-0.2 do
-- Its value is stored in the result file
handle = openfile("result.txt", "a");
write(handle, dz, " ");
closefile(handle)
-- The actuator structure is loaded
open_femm_file("actuator.fem")
-- The current density is assigned to the coil
modifymaterial("Copper", 4, jm)
-- Mover (group=1) is selected and moved
selectgroup(1)
move_translate(0, dz)
-- The changed structure is save in a temporary file
save_femm_file("temp.fem")
-- Solving the problem
analyse(1) -- (0) show window
-- (1) hide window
-- Post-processing
runpost("post_att.lua", "-windowhide")
end

The post–processing is
POST_ATT.LUA
-- selection of the line to integrate the flux density
seteditmode(contour)
selectpoint(0,10.5)
selectpoint(3,10.5)
Flux, B_avg = lineintegral(1)
-- unselection
clearcontour()
-- Data storage
handle = openfile("result.txt", "a");
write(handle, Flux, " ",
B_avg, "\n")
closefile(handle)
-- post-processing end
exitpost()

13
Nicola Bianchi Using FEMM

4 Useful functions
4.1 Mathematic functions
sin(x) Sine of x
cos(x) Cosine of x
tan(x) Tangent of x
asin(x) Inverse sine of x [−π/2, π/2], x ² [−1, 1]
acos(x) Inverse cosine of x [0, π], x ² [−1, 1]
atan(x) Inverse tangent of x [−π/2, π/2]
atan2(x, y) Inverse tangent of x/y [−π, π]
sinh(x) Hyperbolic sine of x
cosh(x) Hyperbolic cosine of x
tanh(x) Hyperbolic tangent of x
esp(x) Exponential ex
log(x) Natural logarithm of x, with x¿0
log10 (x) Common (base 10) logarithm of x, with x¿0
pow(x, y) Power xy √
sqrt(x) Square root x
ceil(x) Round towards plus infinity of x
f loor(x) Round towards minus infinity of x
abs(x) Absolute value of x

4.2 Vectors
When a vector of numbers has to be defined, we can use the curly brackets. For
instance, a vector of three number is

Vector = {number1, number2, number3}


The values of the vector are gained by using the squared brackets:
number1 = Vector[1]
number2 = Vector[2]
number3 = Vector[3]

4.3 Indexed variables


Sometimes it is needed to adopt some variables whose name has a common root
followed by a varying number.
For example, CoilSide1 and CoilSide2 that are used in the first example.
These names can be obtained by link the common root CoilSide2 with an index
that assumes the numerical value 1 and 2. The link is achieved as
"CoilSide" .. index

14
Nicola Bianchi Using FEMM

Acknowledgment
This report has been possible thanks to contribution of many students and PhD stu-
dents of the Electric Drive Laboratory of the Department of Electrical Engineering,
University of Padova, Italy. In particular, the big work of PhD. Eng. Fabio Luise,
PhD. Eng. Giorgio Grezzani, Eng. Diego Bon and Eng. Michele Dai Prè is acknowl-
edged.

Contacts
Prof. Nicola Bianchi, Prof. Silverio Bolognani, Electric Drive Laboratory, Depart-
ment of Electrical Engineering, University of Padova, Via Gradenigo 6 A Padova,
Italy. Phone: +39 049 827 7500, Fax: +39 049 827 7599, email: [bianchi] [bolognani]
@die.unipd.it.

15

Das könnte Ihnen auch gefallen