usingfemm software tool

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

Upload: soras56

Post on 25-Oct-2014

97 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: UsingFEMM Software Tool

Using FEMM software tool

Electric Drive Laboratory

May 10, 2006

IntroductionRules for the use of FEMM (Finite Element Method Magnetics) in the analysis of theelectrical machines.

The elements of the problem can be divided in:

Drawing Mark Properties Operationspoints labels materials pre–processingsegments groups boundary conditions mesharcs circuits solution

post–processing

1

Page 2: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

Part I

Simple examples

1 A first example: the electromagnetic actuatorLet us consider the electromagnetic actuator of Fig. 1. It includes a fixed iron yokearound which a coil is wound, and an iron plate. When the coil carries current, theiron 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 planarsymmetry. This is that all the magnetic fields are repeated equal for each section ofthe 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 canbe 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

Page 3: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

Figure 2: Points of the drawing

After drawing the points, they have to be connected by segments. Select twopoints 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 conditionson the boundary of the domain. These conditions are called boundary conditions. Ina 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

Page 4: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

along a segment. Thus, the flux lines results tangential to this segment. Thiscondition 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 isautomatically satisfied, if other conditions are not assigned.

Periodic: this condition is assigned to two segments and imposes that the magneticvector 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 themagnetic vector potential behavior is the one opposite to the other along thetwo segments, i.e. Az,segment1 = −Az,segment2.

It is worth noticing that the boundary conditions are defined to confine the fieldanalysis 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 rightbottom 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 benew materials, suitably defined for this analysis, or they can be selected from a givenMaterial 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 twocoil 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 iscommonly called ”to create the mesh”. Each object will be subdivided in smallelements (the finite element), which are triangles in FEMM.

It is possible to force the maximum mesh size in each object. The mesh sizerefers to the area of the triangle used for this subdivision. The choice of the meshsize depends on the problem to be analyzed. It is better to refine the parts of theproblem, in which the higher field gradients are expected.

Fig. 5 shows the final mesh of the electromagnetic actuator.

4

Page 5: UsingFEMM Software Tool

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 shownin Fig. 6.

5

Page 6: UsingFEMM Software Tool

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 beshown when the script files are dealt with.

In this example, we define the upper coil side as group 1001, the lower coil side asgroup 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. Theproblem 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 ideaif the problem has been correctly set.

A further visual analysis refers to the flux density map, shown in Fig. 8. Thisgives an indication of the range of flux density values reached in the structure.

2 Use of the LUA scriptThe purpose of the LUA file is to automatize a series of computations using theFEMM code.

A series of instructions can be written in a unique file (the LUA file) and they areexecuted consecutively when the file is read within a FEMM editor or viewer. Oftena FOR loop is implemented, in which one or two parameters are changed.

This kind of programming is useful when several simulations have to be carriedout searching the dependence of the machine performance on one parameter, e.g. theworking frequency, the operating currents, or the geometrical position.

Some examples are given in the following. Further informations and documen-

6

Page 7: UsingFEMM Software Tool

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 ”FEMMUser’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.4J_max = 6 -- (A/mm2)I_max = S_coil * J_max

7

Page 8: UsingFEMM Software Tool

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 asfollows. Ten simulations are considered with linear variation of thecurrent:

\begin{verbatim}N_sim = 10for 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 bemodified. 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 projectbut 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 projectto remain unchanged.

The command analyse() start the finite element computation.

8

Page 9: UsingFEMM Software Tool

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–processingto the post–processing. This can be accomplished by write the information in a textfile 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 isprocessed. Then the last command within the FOR loop of the pre–processing fileis the call to the post–process LUA file. This procedure will be described in thefollowing 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.4J_max = 6 -- (A/mm2)I_max = S_coil * J_maxN_sim = 10for n = 1, (N_sim + 1), 1 do

I_coil = I_max * (n - 1) / N_simopenfemmfile("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 fieldproblem has been solved. This file can be called separately or can be launched by thepre–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 thenumber of turns of the coil:

9

Page 10: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

-- length (m)L_z = 0.100

-- number of turnsN_t = 80

The first operation of the post–process is to read the data written in the temporaryfile 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 bymeans of the two extremes of the line. Then the computation of the force along theline is required. Fcx and Fcy are the constant component of the force along the xand y directions respectively, while Fpx and Fpy are the pulsating force componentsalong the x and y directions respectively. The latter components are equal to zero inmagneto–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 groupnumber 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 twocoils can be selected by means their group number (1001 and 1002 for the upperand the lower coil side respectively). The coil side surface is firstly computed. Thenthe magnetic potential is integrated over the two surfaces, and the flux linkage iscomputed from their difference.

10

Page 11: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

-- surfacegroupselectblock(1001)Sup = blockintegral(5)clearblock()

-- integral of Azgroupselectblock(1001)intg_Are_1, intg_Aim_1 = blockintegral(1)clearblock()groupselectblock(1002)intg_Are_2, intg_Aim_2 = blockintegral(1)clearblock()

-- flux linkageflux_re_1 = (intg_Are_1 / Sup) * L_z * N_tflux_im_1 = (intg_Aim_1 / Sup) * L_z * N_tflux_re_2 = (intg_Are_2 / Sup) * L_z * N_tflux_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 blocksare 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. Thefile ”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 bysome 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

Page 12: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

"\n")closefile(handle)

At last, the view editor is closed:

exitpost()

3 A second example: a cylindrical actuatorAccording to the cylindrical actuator shown in Fig. 3, the pre– and post–processingfiles 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=3handle = openfile("result.txt", "a");write(handle, jm, " ");

12

Page 13: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

closefile(handle)-- Loop of simulations varying the air--gap thickness-- dz is the variation with respect to the initial positionfor 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 loadedopen_femm_file("actuator.fem")

-- The current density is assigned to the coilmodifymaterial("Copper", 4, jm)

-- Mover (group=1) is selected and movedselectgroup(1)move_translate(0, dz)

-- The changed structure is save in a temporary filesave_femm_file("temp.fem")

-- Solving the problemanalyse(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)

-- unselectionclearcontour()

-- Data storagehandle = openfile("result.txt", "a");write(handle, Flux, " ",

B_avg, "\n")closefile(handle)

-- post-processing endexitpost()

13

Page 14: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

4 Useful functions4.1 Mathematic functions

sin(x) Sine of xcos(x) Cosine of xtan(x) Tangent of xasin(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 xcosh(x) Hyperbolic cosine of xtanh(x) Hyperbolic tangent of xesp(x) Exponential ex

log(x) Natural logarithm of x, with x¿0log10(x) Common (base 10) logarithm of x, with x¿0pow(x, y) Power xy

sqrt(x) Square root√

xceil(x) Round towards plus infinity of xfloor(x) Round towards minus infinity of xabs(x) Absolute value of x

4.2 Vectors

When a vector of numbers has to be defined, we can use the curly brackets. Forinstance, 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 rootfollowed 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

Page 15: UsingFEMM Software Tool

Nicola Bianchi Using FEMM

AcknowledgmentThis 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 Pre is acknowl-edged.

ContactsProf. 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