# Transformer Core Optimization using Genetic Algorithm

(This project is Transformer Core Optimization using Genetic Algorithm. Reader can take a quick introduction of Genetic Algorithm)

# Magnetic Core Optimization using Genetic Algorithm (GA)

## Problem Statement:

For the magnetic circuit shown, a coil with 487 turns is wound on the left leg of the c-core with 3 Amperes current supplied to it. Assuming the core is made from iron that is behaving linearly with a relative permeability of 5600. The main objective is to have exactly 1.1 Tesla of magnetic flux density in the air gap center lines as shown. We can assume coordinates at the defined points and is also assumed that the magnetic circuit has one unit depth. Using Genetic Algorithm, optimize the size of the magnetic circuit to achieve the smallest possibly volume while maintaining the overall shape.

## Problem Description:

The problem is to design the core of a transformer shown in the figure 1 below utilizing a Genetic Algorithm. The main objective is to find the smallest size that would produce a desired Flux Density = 1.1 Tesla in the gap between the two core halves. A sectional view of half of the core transformer is shown in Fig. 1. Design parameters for optimization are given below:

• D: external width
• C: external height
• W: internal width
• H: internal height
• r: width of the core leg where the air gap is
• x: width of the core leg where the air gap is not
• y: width of the core leg top and bottom.
• g: gap distance

The MMF is given

MMF = N*I = 487*3 = 1461 AT---------------- (1)

The relative permeability (μr) is 5600 for the core iron.

The core cross sectional area and air gap area are both set equal. Moreover, the width of the core legs are going to be assumed equal r=x=y. Also, the deep of the core is constant, then will be consider 10cm.  The only way to vary the cross-sectional Area of the core is changing “r”.

## Objective Function:

In order to make optimization, a multi-objective function is chosen to:

• Minimize the magnetic path length through the core and the air gap, to minimize the volume
• Minimize the Error of the flux density

Fitness Function = Berror2 + Volume
Berror = Bdesired - Bcalculated


## Solution:

The magnetic circuit has two different reluctances; the core reluctance (Rc) and air gap reluctance (Ra) which can be calculated by equations (2) and (3):

$$R_c =\frac{L_c}{\mu_r \mu0 A}$$

Where,

$$L_c = L_{total} – g = 2 \frac{C+H}{2} + 2\frac{W+D}{2} – g$$

$$L_c = C+H+W+D-g$$

$$R_A =\frac{g}{\mu_0 A}$$

$$R_{eq} =\frac{L_c}{\mu_r \mu_0 A} + \frac{g}{\mu_0 A}$$

$$R_{eq} = \frac{1}{\mu_0 A} ( \frac{L_c}{\mu_r} + g)$$

The flux density B can be calculated by:

$$B \times A \times R_{eq} = N\times I$$

$$B \times A \frac{1}{\mu_0 A} ( \frac{L_c}{\mu_r} + g) = N\times I$$

So, $$B = \frac {N \times I \mu_0 \mu_r}{L_c +g \times \mu_r}$$

substituting $$L_c$$ into above equation:

$$B= \frac{N\times I \times \mu_0 \mu_r}{L_{total} +g(\mu_r -1)}$$

However, the relative permittivity 5600 compare to 1 is very big, so:

$$B= \frac {N\times I \times \mu_0 \mu_r}{L_{total} +g \mu_r}$$

Then, the fitness function for the minimization of the error of the flux density is:

$$F_1 =( B_{desired} -B{calculated } )^2$$

Then:

$$F_1 = (1.1 – \frac{N\times I \mu_0 \mu_r}{L_{total} +g \mu_r} )^2$$

For the minimization of the volume we need to consider the volume in the fitness function. Then:

$$F_2 =Volume = Surface Area \times Depth$$

Let the depth constant, and equal to unity:

$$Volume =r \times (2D +2C-4r-g) \times depth$$

The depth is 0.1 meters constant. Then:

$$F_2= Volume =r\times (2D+2C-4r-g)\times depth$$

Now, Here are the specifications for the Genetic Algorithm optimization, To perform the optimization with real dimension, certain criteria need to be considered. For example, the core needs to be reflected in the equations:

$$W =D -2r$$

$$H_{no gap} =D -2r$$

$$H_{gap}=D-2r-g$$

Then, the new fitness functions will be:

$$F_1 = (1.1 – \frac {NI \mu_0 \mu_r}{2(C+D) -4r +g\mu_r})^2$$

$$F_2 = r(2(C+D)-4r-g)\times 0.3$$

$$F=k1 \times F_1 +k2 \times F_2$$

Where k1 and k2 are the weights if it is desired to make particular objective more prominent. In such cases, it is necessary to make an IF clause, in which if H or W are less than 10cm then, the fitness function is penalized. If not, then the optimization continues.

## Matlab Code:

The following formulation is used to optimize the transformer core size in this particular problem.

function f = objfun(x)
C = x(1);
D = x(2);
r = x(3);
A = x(4);
miu_o = 4*pi*10e-7;
miu_r = 5600;
N =487 ;
I = 3;
k1 = 1;
k2 = 1;
Bdesired = 1.1;
Ltotal = 2*(C+D)-4*r;
gap=A;
H=C-2*r;
W=D-2*r;

if H < 0.1 || W < 0.1
f = 100;
else
Volume= Ltotal*r*0.2 % the depth is one unit in centimeters
B = N*I*miu_o*miu_r /(Ltotal + gap*miu_r)
f1 = k1*(Bdesired - B)^2; %the goal of magnetic density
f2 = k2*Volume;
f = f1+f2;

end



## Results:

### 1. Optimization considering B = 1.1 T and Volume: ### 2. Optimization considering B = 1.1 T only ## Conclusion:

As it can be seen from the values, the optimization considers to get the value of 1.1Tesla in the center of the air gap and also to minimize the volume of the core. Two different tests were performed:

• For the first optimization, considering the volume and the flux density, we got a value of B very similar to the desired (1.0979T), but the volume is less (0.0180 m3).
• For the second optimization, considering the flux density only, we got the exact value of B (1.1 T), but the volume is higher (0.0691 m3).

Feel free to comment below or contact us for any assistance. Stay tuned with us and like our Facebook page for more.

## 3 thoughts on “Transformer Core Optimization using Genetic Algorithm”

1. Engr Rana Farhan Khan says:

kindly give complete code including function of f

2. M.Usman says:

Sir please tell me how we can find the magnetic flux density in core calculation ?

1. Engr Rana Farhan Khan says:

B=� \frac {N\times I \times \mu_0 \mu_r}{L_{total} +g \mu_r}

This site uses Akismet to reduce spam. Learn how your comment data is processed.