The alternator simulation project
In this post I’m going to illustrate how to implement a finite element simulation of an alternator in motion coupled to a linear electrical circuit.
The simulation computes the magnetic vector potential within a (2D) radial cross section of the machine I’m about to describe.
Here’s an example for a 3000rpm rotor speed and a stator energized with a 50Hz AC current:
The code is here
Description of the machine
The machine we’re going to study is an unusual induction generator of the squirel-cage type.
This is \(1/12^{th}\)
of the machine:
The rotor has 12 massive coper rods shorted by rings at both ends: the so called squirel cage. Rods are enclosed in a cyclinder made of iron laminations.
The stator, made of iron laminations too, has 12 winding slots. The winding pattern is as follow:
Notice that the field coil goes up/up, down/down, up/up … This will be very important later on when computing the current density in the coils.
Again, notice that the armature coil goes up/down when the field coil goes up/up, and then down/up, up/down …
The diameter of the machine is 80mm, its depth/thickness is 50mm.
Modelization
Periodicity
Because of the problem periodicity, we can reduce the ammount of computation by modeling only a slice of the machine.
To find the size of the smallest possible slice we compute the greatest common divisor (\(gcd\)
) of the number of rods and slots and only simulate a \(360 / gcd\)
degrees machine slice.
Next, in order to decide if we need to use periodic or anti-periodic boundary conditions to join our alternator slices, we simply observe that if we apply Kirchoff current’s law to the rotor squirel cage topology, the eddy currents flowing through one rod will flow in the opposite direction in the previous and next rods so that we use periodic (respectively anti-periodic) boundary condition if the slice contains an even (respectively odd) number of rod.
It comes that for this particular endeavour we can simulate \(1/12^{th}\)
of the machine (30 degrees), so a single rod and a single slot, and must use anti-periodic boundary condition.
When implementing the finite element method using first order Lagrange element to solve non periodic problem we have a one to one mapping between mesh vertices and degrees of freedom (\(dof\)
) so that we can identify vertices with \(dof\)
.
For example a single quadrangular first order Lagrange element has 4 vertices and leads to a 4 \(dof\)
stiffness matrix:
However if we consider an (anti-)periodic along one axis element, it leads to a 2 \(dof\)
stiffness matrix:
We can also illustrate further what’s going on by writing the equations:
Notice that we also end up with a symmetric linear system.
So that the key to implement (anti-)peridic boundary conditions is to compute the non injective mapping from mesh vertices to \(dof\)
as well as introduce a sign/polarity vector in order to remember the sign of each nodal value relative to its \(dof\)
(or in short: to deal with all these \(\pm\)
in the equations).
- This is how I compute the mapping:
The relevant project class is in https://github.com/ssrb/alternator-fem-webapp/blob/master/domain.ts
- And this is how I assemble the stiffness matrix and load vector using the computed mapping:
The relevant project class is in https://github.com/ssrb/alternator-fem-webapp/blob/master/solver.ts
Motion
In order to simulate the entire machine, we need to match rotor and stator \(dof\)
along their common interface.
One way to get a match is to first discretize the interface and then use these interface vertices to compute the Delaunay triangulations of both the stator and rotor domains.
How about motion ? Ideally we would like to solve for any rotor/stator angle.
That’s doable but a bit too ambitious and we’re instead going to only consider rotations multiple of a fixed “rotation step”.
Furthermore we choose a “rotation step” equal to a unit fraction of the domain slice angle, for example \(1/32\)
of 30 degrees, so that, by uniformly dividing the interface into 32 segments we can match rotor and stator \(dof\)
regardless of the “discrete” rotation angle.
The advantage of this method is that we compute the mesh for both domains once and for all, regardless of the rotation angle.
A drawback of this method is that given the angular speed of the rotor we need to choose the time step of the simulation accordingly.
In our example, for a rotor speed of 3000rpm, the time step will be \(60 / (12 * 32 * 3000)\)
seconds.
As it rotates, the rotor slice will face both a stator and an “anti-stator” slice.
But we won’t explicitly model the anti-stator slice since its nodal values are the opposite of those of the stator slice.
Instead we will model a rotor slice which wraps around and use the sign/polarity vector introduced earlier in order to decide if a rotor nodal value is coupled to a stator or “anti-stator” \(dof\)
.
One last thing we need to discuss is how to generate the mapping between rotor/stator “local” \(dof\)
to the machine “global” \(dof\)
:
- We first map interior “local”
\(dof\)
for both domains; - We then match interface rotor/stator local
\(dof\)
and assign a single “global”\(dof\)
to each pair.
Here is a sketch:
Here is how I compute the mapping:
Relevant project class is in https://github.com/ssrb/alternator-fem-webapp/blob/master/domain.ts
Maxwell’s equations
In this section, I will describe as concisely as I can the derivation of the PDE we’re about to solve.
DISCLAIMER: I’M BY NO MEANS A MAXWELL’S EQUATIONS EXPERT.
Within the machine, the physical quantities we’re intested in, such as magnetic vector potential and current density, are governed by Maxwell’s equations.
- The main equation we’re interested in is the differential form of Ampère’s circuital law which
relates the magnetic vector potential
\(A\)
(V·s·m-1) to the electric field\(E\)
(V·m-1):
\(\mu\)
(H·m-1) is the relative magnetic permeability and \(\sigma\)
(S·m-1) the electrical conductivity. In this toy simulation, these quantities are assumed constant for a particular medium (coper, iron, air).
- The next equation we use is the Maxwell–Faraday induction law.
It relates the electric field
\(E\)
to the magnetic vector potential\(A\)
and the electric potential\(V\)
:
Putting these two together we got:
For this 2D problem \(A\)
and \(\nabla V\)
are reduced to their z components. That is \(A \equiv \left(0,0,A\right)\)
and \(\nabla V \equiv \left(0,0,\partial V / \partial z\right) \)
.
Now we’re going to make a gross simplification and say that \(\partial V / \partial z \neq 0\)
only within the coils.
Furthermore, within a coil, we’re going to estimate this quantity as the difference of electric potential at both ends of a single conductor
divided by its length:
Since the machine is 50mm thick, we set \(L = 0.05\)
.
Then, using Ohm’s law, we say that:
with \(i\)
the current going through the coil and \(R\)
the resistance of that 50mm long coper conductor.
Remember that we care about the sign of \(i\)
which depends on the winding pattern.
We can estimate \(R\)
using Pouillet’s law:
with \(\mathscr{A}\)
the cross-sectional area of the conductor.
Ultimately within a single conductor we got:
In the code we estimate the cross-sectional area of a single conductor dividing the cross-sectional area of the entire coil by the number of conductors within the coil.
Putting everything back together we want to solve:
for \(A \equiv \left(0,0,A\right)\)
and \(i_k, k = 1 \dots n_{coil}\)
.
Coupling between magnetic & electrical equations
At this stage we got two unknowns:
- the magnetic vector potential
\(A\)
; - the currents flowing through the coils
\(i_k, k = 1 \dots n_{coil}\)
We are going to get rid of the current.
Admittance matrix
In order to do so we model the linear electrical circuit connected to the machine using a lumped element model:
this will give us another relationship between \(A\)
and \(i_k, k = 1 \dots n_{coil}\)
.
The lumped element model of an N port linear electrical circuit can be treated as a single black box whose behavior is concisely described by its admittance parameters:
where \(v_k, k = 1, \ldots, N\)
is the voltage at each port of the circuit.
\(Y\)
is called the nodal admittance matrix.
\(Y\)
is symmetrical and it is extremely important as if it wasn’t we would not end up with a symmetrical bilinear form later on when trying to solve the PDE.
We can label the ports of the electrical circuit so that:
and since we only care about \(i_k, k = 1, \ldots, n_{coil}\)
we write:
Electromotive force
When the machine is connected to the circuit, the voltage at each port will be equal to the electromotive force \(\mathcal{E}_k\)
generated in the matching coil:
As per Lenz’s law:
where \(\Phi_k\)
is the magnetic flux (V·s).
Furthermore
Finally we can rewrite the dextral side of \(\eqref{eq:eq_potential_current}\)
:
and group the vector potential terms on the sinistral side:
We want to solve for the magnetic vector potential.
Discretization
At this stage it’s only calculus.
Time
To solve \(\eqref{eq:eq_potential}\)
numericaly we first integrate over time using the backward Euler method.
It leads to
We want to solve for \(A_{t+\Delta t}\)
.
BEWARE: remember that \(\Delta t\)
depends on the way we spatially discretized the rotor/stator interface as well as the rotor speed.
Space
We next integrate over space using the finite element method. Weak formulation of \(\eqref{eq:eq_potential_time}\)
one baby step at a time (as usual, I skip all the functional analysis details as I’m an engineer, not a mathematician :-)):
BEWARE: coils \(dof\)
are coupled together even though the corresponding vertices don’t belong to a same triangle. This coupling is due to the linear electrical circuit.
This corresponds to the \(\left( \int_{\Omega} \psi_k v dx \right) \left( \int_{\Omega} \psi_l A_{t+\Delta t} dx \right)\)
terms in the equation.
This is how I account for the electrical coupling:
Relevant project class is in https://github.com/ssrb/alternator-fem-webapp/blob/master/solver.ts
Conclusion
That was quite an entertaining project. I must now find a way to validate the results.
My references were:
- Modélisation de systèmes électrotechniques par couplage des équations électriques et magnétiques, By Fréderic Hecht, A. Marrocco, F. Piriou and A. Razek
- A general purpose method for electric and magnetic combined problems for 2D, axisymmetruc and transient systems, By P. Lombard and G.Meunier
- The Finite Element Method for Electromagnetic Modeling, By G. Meunier
- Electromagnetic Modeling by Finite Element Methods By João Pedro, A. Bastos and N. Sadowski
- Wikipedia
blog comments powered by Disqus