**4. Conclusion**

In this chapter, the detailed control laws to control the magnetic bearing was not included, and the method to designing a magnetic bearing system, obtaining a mathematical model, and the preparations necessary for control were explored with the aim of implementing a magnetic bearing system to apply various controllers.

## **Appendix**


#### **1. Attractive force calculation of the electromagnet using probable flux paths method**

It is assumed that the levitating object is supported by the electromagnet. Here, the gap between the electromagnet and the levitating object is 0.6mm, the number of coil winding to the electromagnet is 400turns, and the current flowing in the coil is 1A.

**Figure 19.** Electromagnet core drawing

212 Performance Evaluation of Bearings

sinθ� � ��

sinθ� � ��

**Figure 18.** Magnetic bearing system taking into consideration rotational motion

Jθ�

� � J�ωθ�

motion about the y-z plane is as shown in Equation (37).

magnetic bearing system to apply various controllers.

2. RCGA Program for Amplifier Peripheral Circuit Design 3. RCGA Program for Magnetic Bearing System Identification

using state-space expression is necessary.

**4. Conclusion** 

**Appendix** 

When the levitating object undergoes rotational motion, the torque caused by the rotational

In order to control the rotating levitating object, application of a multi-variable controller

In this chapter, the detailed control laws to control the magnetic bearing was not included, and the method to designing a magnetic bearing system, obtaining a mathematical model, and the preparations necessary for control were explored with the aim of implementing a

1. Attractive Force Calculation of the Electromagnet Using Probable Flux Paths Method

� � θ� (35)

� � θ� (36)

� � ����� � ���� (37)

**Figure 20.** Magnetic circuit of the electromagnet

Fig. 19 shows the drawing of the electromagnet core. Fig. 20 shows the magnetic circuit that satisfies the Probable Flux Paths Method in the core of Fig. 19. The attractive force of the electromagnet is as shown in Equation (38).

$$\mathbf{F\_m} = \frac{\mu\_0 \mathbf{N}^2 \mathbf{l\_m^S}}{\left(\frac{\mathbf{l\_m}}{\mu\_S} + 2\mathbf{x\_0}\right)^2} \tag{38}$$

Here, the length of the magnetic path is as shown in Equation (39) according to Fig. 2.

$$\mathrm{H}\_{\mathrm{m}} = \frac{\pi \mathrm{d}\_{\mathrm{1}}}{\mathrm{s}} + \frac{\pi \mathrm{d}\_{\mathrm{2}}}{\mathrm{s}} + 2\mathrm{h} = \left(\frac{\pi(82 + 41.2)}{\mathrm{s}} + 2 \times 40\right) \times 10^{-3} \mathrm{[m]}\tag{39}$$

$$F\_{\rm m} = \frac{{}^{4\pi \times 10^{-7} \times 400^2 \times 1^2 \times 2 \times 30 \times 10^{-3} \times 0.0 \times 10^{-3}}}{\left(\left(\frac{{\text{tr}(\text{tr}2 \times 41.2})}{\text{tr} \times 300} + 2 \times 40 + 2 \times 0.6\right) \times 10^{-3}\right)^2} = 6.2485 \text{[N]} \tag{40}$$

$$\mathbf{B} = \frac{\oplus}{\mathbf{S}} = \frac{\mu\_0 \mathbf{N} \mathbf{l}\_\mathbf{m}}{\frac{\mathbf{l} \mathbf{m}}{\mu\_\mathbf{s}} + 2 \mathbf{x}\_\mathbf{0}} \tag{41}$$

$$\mathbf{I}\_{\max} = \frac{(\frac{\text{lm}}{\mu\_{\text{s}}} + 2\mathbf{x}\_{0})\mathbf{B}\_{\max}}{\mu\_{\text{o}}\mathbf{N}}$$

$$\mathbf{I}\_{\max} = \frac{\left(\frac{\text{l}\,(\text{l2} + \text{4}\,\text{1}\,\text{2})}{\text{u} \times \text{300}} + 2 \times 40 + 2 \times 0.6\right) \times 10^{-3} \times \text{1.5}}{4\pi \times 10^{-7} \times 400} = \mathbf{3.7087} \,\text{[A]}\tag{42}$$

$$F\_{\max} = \frac{4\pi \times 10^{-7} \times 400^2 \times 3.7097^2 \times 2 \times 30 \times 10^{-3} \times 0.8 \times 10^{-3}}{\left(\left(\frac{\pi (02 + 4 \times 2)}{0 \times 3000} + 2 \times 40 + 2 \times 0.6}\right) \times 10^{-3}\right)^2} = 85.9442 \text{[N]} \tag{43}$$

$$\mathbf{i\_1} = \mathbf{i\_2} + \mathbf{i\_3} \tag{44}$$

$$\frac{\mathbf{v\_{IN}} - \mathbf{v\_{fb}}}{\mathbf{R\_I}} = \frac{\mathbf{v\_{fb}} - \mathbf{v'\_{tb}}}{\mathbf{R\_F}} + \frac{\mathbf{v\_{fb}} - \mathbf{v\_o}}{\mathbf{Z\_F}} \tag{45}$$

$$\mathbf{i}\_2 + \mathbf{l}\_o = \mathbf{i}\_4\tag{46}$$

$$\frac{\mathbf{v\_{1N}} - \mathbf{v'\_{fb}}}{\mathbf{R\_F}} + \mathbf{I\_o} = \frac{\mathbf{v'\_{tb}} - \mathbf{o}}{\mathbf{R\_s}} \tag{47}$$

$$\mathbf{V\_{fb}} = -\frac{\mathbf{v\_o}}{\mathbf{A}}\tag{48}$$

$$\mathbf{V}'\_{\mathbf{fb}} = \mathbf{V}\_{\mathbf{o}} - \mathbf{l}\_{\mathbf{o}} \mathbf{Z}\_{\mathbf{L}} \tag{49}$$

$$\frac{\mathbf{u}\_o}{\mathbf{u}\_{\text{IN}}} = \frac{\mathbf{n}'}{\mathbf{d}'} \tag{50}$$

$$\mathbf{R\_{F}} = -\mathbf{R\_{I}}\mathbf{R\_{s}}\frac{\mathbf{l\_{o}}}{\mathbf{v\_{IN}}}\tag{51}$$

$$R\_{\rm F} = -R\_{\rm I}R\_{\rm s} \tag{52}$$


$$\text{R}000 \le \text{R}\_{\text{l}} \le 11000 \tag{53}$$

$$10^{-1} \le \mathcal{R}\_{\mathsf{d}} \le 10^{\mathsf{d}} \tag{54}$$

$$10^{-10} \le \mathcal{C}\_{\mathbb{f}} \le 10^{-7} \tag{55}$$

$$\mathcal{G}\_{\mathbf{r}}(\mathbf{s}) = -\frac{\mathbf{e}\_1 \mathbf{s} + \mathbf{e}\_0}{\mathbf{s}^2 + \mathbf{d}\_1 \mathbf{s} + \mathbf{d}\_0} \tag{56}$$

$$\mathcal{G}\_{\rm r}(\mathbf{s}) = -\frac{3000\mathbf{s} + 210000}{\mathbf{s}^2 + 3600\mathbf{s} + 210000} \tag{57}$$

$$\mathbf{F}\_{\rm obj} = \int \mathbf{e}(\mathbf{t})^2 \mathbf{d}\mathbf{t} \tag{58}$$

Here, e�t� � y��t� � y����t�, y��t� is the step response of the system satisfying the required time response characteristics and y����t� is the current amplifier circuit transfer function step response obtained from the selected chromosome.

Control of Magnetic Bearing System 219

% The RCGA implements a real coded genetic algorithm for finding the

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha,Ev]=

% component value in the current amp. circuit

% rcga.m

% Encoding: % - Real

% Genetic operators:

% Other strategies: % - Elitism

% - Dynamic mutation

% Revision 0.9 2003/4/17

% - Gradient-like selection % - Modified simple crossover

% - scaling window scheme(Ws=1)

% Edit by Hwanghun Jeong, CME PKNU

% initializes the generation counter

% initializes the parameters of a RCGA

pop= rInitPop(rseed,popsize,lchrom,xlb,xub);

% calculates fitness using the scaling window scheme fitness= ScaleFit(objfunc,popsize,gam,maxmin);

% calculates the objective function value objfunc= EvalObj\_new3(pop,lchrom,popsize);

[chrombest,objbest,fitbest,objave,gam]= rStatPop(pop,objfunc,fitness,maxmin);

% creates a polulation randomly

%

%

%

%

%

else

end

% Remarks:

University

clear;

gen= 1;

rInitPa;

% calculates gam if(maxmin == 1) gam= min(objfunc);

gam= min(-objfunc);

% computes statistics

Table 2 shows the parameter values necessary to implement the real coded genetic algorithm.

The real coded genetic algorithm problem was implemented through matlab and the solution could be found by executing the rcga.m file. The names of files linked to rcga.m and their functions are shown in Table 3. Each script is as follows.


**Table 2.** The parameter's value of the RCGA for the current amplifier design


**Table 3.** Program file list for the execution of the real coded genetic algorithm

```
% rcga.m
% The RCGA implements a real coded genetic algorithm for finding the
% component value in the current amp. circuit
% 
% Encoding: 
% - Real 
% 
% Genetic operators: 
% - Gradient-like selection 
% - Modified simple crossover 
% - Dynamic mutation 
% 
% Other strategies: 
% - Elitism 
% - scaling window scheme(Ws=1) 
% 
% Remarks: 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
clear; 

% initializes the generation counter
gen= 1; 

% initializes the parameters of a RCGA
[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha,Ev]= 
rInitPa; 

% creates a polulation randomly
pop= rInitPop(rseed,popsize,lchrom,xlb,xub); 

% calculates the objective function value
objfunc= EvalObj_new3(pop,lchrom,popsize); 

% calculates gam
if(maxmin == 1) 
 gam= min(objfunc); 
else
 gam= min(-objfunc); 
end
% calculates fitness using the scaling window scheme
fitness= ScaleFit(objfunc,popsize,gam,maxmin); 

% computes statistics
[chrombest,objbest,fitbest,objave,gam]= 
rStatPop(pop,objfunc,fitness,maxmin);
```
algorithm.

file name

(\*.m) function

response obtained from the selected chromosome.

Parameter Parameter

their functions are shown in Table 3. Each script is as follows.

Here, e�t� � y��t� � y����t�, y��t� is the step response of the system satisfying the required time response characteristics and y����t� is the current amplifier circuit transfer function step

Table 2 shows the parameter values necessary to implement the real coded genetic

The real coded genetic algorithm problem was implemented through matlab and the solution could be found by executing the rcga.m file. The names of files linked to rcga.m and

Population 50 Generate initial population

Max. generation 200 Generate initial population

Chromosome length 3 Generate initial population

Crossover probability 0.9 Modified simple crossover

Mutation probability 0.1 Dynamic mutation

eta 1.7 Scale fitting

EvalObj Evaluate the object function on the population for the reproduction

rElitism Let to survive the best chromosome at the present generation to next

rGradSel Reproduction operator with a gradient like selection method rMsXover Crossover operator with a modified simple crossover method

rDynaMut Mutation operator with a dynamic mutation method

ScaleFit To improve the reproduction operator's efficience rStatPop Memorize the poplation's state for each generation

**Table 3.** Program file list for the execution of the real coded genetic algorithm

**Table 2.** The parameter's value of the RCGA for the current amplifier design

rcga Find optimal value on object function with RCGA

rInitPa Define program variable for RCGA

rInitPop Initialize the population

genetation

value Genetic operator

```
% builds a matrix storage for plotting line graphs
 stats(gen,:)=[gen objbest objave chrombest]; 

for gen= 2:maxgen 

% prints the current generation
 fprintf('gen= %d (%d)\n',gen,maxgen-gen); 

% applies reproduction
 pop= 
rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb,xub,etha); 
% Gradient-like selection
% applies crossover
 [pop,nxover]= rMsXover(pop,popsize,lchrom,pcross); % modified 
simple crossover
% applies mutation
 [pop,nmutat]= 
rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen); %dynamic 
mutation
% calculates the objective function value
 objfunc= EvalObj_new3(pop,lchrom,popsize); 

% applies modified Elitism
[pop,objfunc]= rElitism(pop,objfunc,chrombest,objbest,maxmin); 

% applies the scaling window scheme
 fitness= ScaleFit(objfunc,popsize,gam,maxmin); 

% computes statistics
 [chrombest,objbest,fitbest,objave,gam]= 
rStatPop(pop,objfunc,fitness,maxmin); 

% builds a matrix storage for plotting line graphs
 stats(gen,:)=[gen objbest objave chrombest]; 

end
figure(1) 
% plots the best and average objective function values
subplot(2,1,1) 
plot(stats(:,1),stats(:,2)) 
xlabel('Generation'),ylabel('object function') 

% plots the variables of the best chromosome
subplot(2,1,2) 
plot(stats(:,1),stats(:,4),'-',stats(:,1),stats(:,5),'--
',stats(:,1),stats(:,6),'--') 
xlabel('Generation'),ylabel('control parameter')
```
Control of Magnetic Bearing System 221

legend('R1','Rd','Cf')

R1 = chrombest(1,1) ;

var(i,1) = chrombest(1,2); var(i,2) = chrombest(1,3);

b = -(Rs/A +Rs +Rf)\*Rf;

+Rf)\*R1\*var(i,1)\*var(i,2)\*L;

Rs = 2; R = 6.2; A = 10^(107/20); L = 9.2 \* 10^-3;

c = ((Rf/A + R1/A +R1)\*var(i,1)\*var(i,2) + R1\*Rf\*var(i,2)/A +

d1 = ((Rf/A + R1/A +R1)\*var(i,1)\*var(i,2) + R1\*Rf\*var(i,2)/A + R1\*Rf\*var(i,2))\*(Rs\*R + Rf\*Rs + Rf\*R) + (Rs + Rf)\*L\*(Rf/A + R1/A

% The RINITPA function initializes the parameters of a RCGA

% maxmin= -1 for minimization, 1 for maximization

% etha- parameter of the selection operator

% popsize- population size(must be an even integer)

e = (Rf/A + R1/A +R1)\*(Rs\*R + Rf\*Rs + Rf\*R) - (Rs/A + Rs +Rf)\*R1\*R;

+R1) - (Rs/A + Rs +Rf)\*R1\*(var(i,1)\*var(i,2)\*R + L);

a = -(Rs/A +Rs +Rf)\*Rf\*var(i,1)\*var(i,2);

R1\*Rf\*var(i,2))\*(Rs + Rf)\*L - (Rs/A + Rs

h= 0.0001; wdata = 150; t=0:h:wdata\*h;

xlabel('Time[s]'),ylabel('Current[A]')

% maxgen- maximum generation

% lchrom- chromosome length % pcross- crossover probability % pmutat- mutation probability % xlb- lower bound of variables % xub- upper bound of variables

 

 i=1;

%

n=[a b]; d=[c d1 e];

% rInitPa.m

% Output:

yn=[3000 2100000]; yd=[1 3600 2100000]; r2=step(-yn,yd,t); r1=step(n,d,t);

plot(t,r1,'-',t,r2,'--') legend('yout','yr')

% rseed- random seed

figure(2)

Rf = Rs \* R1;

```
legend('R1','Rd','Cf') 

figure(2) 

Rs = 2; R = 6.2; A = 10^(107/20); L = 9.2 * 10^-3; 

i=1; 
R1 = chrombest(1,1) ; 
Rf = Rs * R1; 
var(i,1) = chrombest(1,2); 
var(i,2) = chrombest(1,3); 

a = -(Rs/A +Rs +Rf)*Rf*var(i,1)*var(i,2); 
b = -(Rs/A +Rs +Rf)*Rf; 
c = ((Rf/A + R1/A +R1)*var(i,1)*var(i,2) + R1*Rf*var(i,2)/A + 
R1*Rf*var(i,2))*(Rs + Rf)*L - (Rs/A + Rs 
+Rf)*R1*var(i,1)*var(i,2)*L; 
d1 = ((Rf/A + R1/A +R1)*var(i,1)*var(i,2) + R1*Rf*var(i,2)/A + 
R1*Rf*var(i,2))*(Rs*R + Rf*Rs + Rf*R) + (Rs + Rf)*L*(Rf/A + R1/A 
+R1) - (Rs/A + Rs +Rf)*R1*(var(i,1)*var(i,2)*R + L); 
e = (Rf/A + R1/A +R1)*(Rs*R + Rf*Rs + Rf*R) - (Rs/A + Rs +Rf)*R1*R; 

n=[a b]; 
d=[c d1 e]; 
h= 0.0001; wdata = 150; t=0:h:wdata*h; 

yn=[3000 2100000]; 
yd=[1 3600 2100000]; 
r2=step(-yn,yd,t); 
r1=step(n,d,t); 

plot(t,r1,'-',t,r2,'--') 
legend('yout','yr') 
xlabel('Time[s]'),ylabel('Current[A]') 
% rInitPa.m
% The RINITPA function initializes the parameters of a RCGA
% 
% Output: 
% rseed- random seed 
% maxmin= -1 for minimization, 1 for maximization 
% maxgen- maximum generation 
% popsize- population size(must be an even integer) 
% lchrom- chromosome length 
% pcross- crossover probability 
% pmutat- mutation probability 
% xlb- lower bound of variables 
% xub- upper bound of variables 
% etha- parameter of the selection operator
```
for gen= 2:maxgen

% applies reproduction

% applies crossover

simple crossover

% applies mutation [pop,nmutat]=

% Gradient-like selection

% applies modified Elitism

% computes statistics

% prints the current generation

pop=

mutation

 end

figure(1)

subplot(2,1,1)

subplot(2,1,2)

plot(stats(:,1),stats(:,2))

',stats(:,1),stats(:,6),'--')

% builds a matrix storage for plotting line graphs stats(gen,:)=[gen objbest objave chrombest];

fprintf('gen= %d (%d)\n',gen,maxgen-gen);

% calculates the objective function value objfunc= EvalObj\_new3(pop,lchrom,popsize);

% applies the scaling window scheme

rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb,xub,etha);

[pop,nxover]= rMsXover(pop,popsize,lchrom,pcross); % modified

rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen); %dynamic

[pop,objfunc]= rElitism(pop,objfunc,chrombest,objbest,maxmin);

fitness= ScaleFit(objfunc,popsize,gam,maxmin);

% builds a matrix storage for plotting line graphs stats(gen,:)=[gen objbest objave chrombest];

% plots the best and average objective function values

plot(stats(:,1),stats(:,4),'-',stats(:,1),stats(:,5),'--

xlabel('Generation'),ylabel('object function')

xlabel('Generation'),ylabel('control parameter')

% plots the variables of the best chromosome

[chrombest,objbest,fitbest,objave,gam]=

rStatPop(pop,objfunc,fitness,maxmin);

```
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function
[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha,Ev]= 
rInitPa 

rseed= 8512; 
maxmin= -1; % -1 for minimization
maxgen= 200; 
popsize= 100; % popsize should be even
lchrom= 3; 
etha= 1.7; 
pcross= 0.9; 
pmutat= 0.1; 
xlb(1,1) = 8000; 
xlb(1,2) = 0.1; 
xlb(1,3) = 1*10^-10; 

xub(1,1) = 11000; 
xub(1,2) = 1000000; 
xub(1,3) = 1*10^-7; 

Ev=0; 

if(rem(popsize, 2) ~= 0) % do not move
 popsize= popsize + 1; 
end
% rInitPop.m
%
% The RINITPOP function creates an initial population 
% 
% Input: 
% rseed- random seed 
% popsize- population size 
% lchrom- chromosome length 
% xub- upper bound for variables, vector 
% xlb- lower bound for variables, vector 
% Output: 
% pop- population 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU
```
Control of Magnetic Bearing System 223

function pop= rInitPop(rseed,popsize,lchrom,xlb,xub)

% The EVALOBJ function evaluates the objective function value

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

c = ((Rf/A + R1/A +R1)\*var(i,2)\*var(i,3) + R1\*Rf\*var(i,3)/A +

d1 = ((Rf/A + R1/A +R1)\*var(i,2)\*var(i,3) + R1\*Rf\*var(i,3)/A + R1\*Rf\*var(i,3))\*(Rs\*R + Rf\*Rs + Rf\*R) + (Rs + Rf)\*L\*(Rf/A + R1/A

e = (Rf/A + R1/A +R1)\*(Rs\*R + Rf\*Rs + Rf\*R) - (Rs/A + Rs +Rf)\*R1\*R;

+R1) - (Rs/A + Rs +Rf)\*R1\*(var(i,2)\*var(i,3)\*R + L);

pop(i,:)= (xub-xlb).\*rand(1,lchrom)+xlb;

% objfunc- objective function value, vector

function objfunc= EvalObj\_new3(var,npara,popsize);

Rs = 2; R = 6.2; A = 10^(107/20); L = 9.2 \* 10^-3;

a = -(Rs/A +Rs +Rf)\*Rf\*var(i,2)\*var(i,3);

R1\*Rf\*var(i,3))\*(Rs + Rf)\*L - (Rs/A + Rs

h= 0.0001; wdata = 150; t=0:h:wdata\*h;

err(:,1) = resp(:,1) - yr(:,1);

rand('seed',rseed);

for i=1:popsize

% EvalObj\_new3.m

end

%

%

%

n=[a b]; d=[c d1 e];

% Input:

% Output:

University

for i= 1:popsize

R1 = var(i,1); Rf = Rs \* R1;

objfunc(i)=0; oldobj=0;

b = -(Rs/A +Rs +Rf)\*Rf;

yn=[-3000 -2100000]; yd=[1 3600 2100000]; yr = step(yn,yd,t); resp = step(n,d,t);

+Rf)\*R1\*var(i,2)\*var(i,3)\*L;

pop= zeros(popsize,lchrom);

% var- variables, matrix

% Revision 0.9 2003/4/17

% popsize- population size

% npara- number of the variables

% Edit by Hwanghun Jeong, CME PKNU

```
function pop= rInitPop(rseed,popsize,lchrom,xlb,xub) 
rand('seed',rseed); 
pop= zeros(popsize,lchrom); 
for i=1:popsize 
 pop(i,:)= (xub-xlb).*rand(1,lchrom)+xlb; 
end
% EvalObj_new3.m
%
% The EVALOBJ function evaluates the objective function value 
% 
% Input: 
% var- variables, matrix 
% npara- number of the variables 
% popsize- population size 
% Output: 
% objfunc- objective function value, vector 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function objfunc= EvalObj_new3(var,npara,popsize); 

Rs = 2; R = 6.2; A = 10^(107/20); L = 9.2 * 10^-3; 

for i= 1:popsize 
objfunc(i)=0; oldobj=0; 
R1 = var(i,1); 
Rf = Rs * R1; 
a = -(Rs/A +Rs +Rf)*Rf*var(i,2)*var(i,3); 
b = -(Rs/A +Rs +Rf)*Rf; 
c = ((Rf/A + R1/A +R1)*var(i,2)*var(i,3) + R1*Rf*var(i,3)/A + 
R1*Rf*var(i,3))*(Rs + Rf)*L - (Rs/A + Rs 
+Rf)*R1*var(i,2)*var(i,3)*L; 
d1 = ((Rf/A + R1/A +R1)*var(i,2)*var(i,3) + R1*Rf*var(i,3)/A + 
R1*Rf*var(i,3))*(Rs*R + Rf*Rs + Rf*R) + (Rs + Rf)*L*(Rf/A + R1/A 
+R1) - (Rs/A + Rs +Rf)*R1*(var(i,2)*var(i,3)*R + L); 
e = (Rf/A + R1/A +R1)*(Rs*R + Rf*Rs + Rf*R) - (Rs/A + Rs +Rf)*R1*R; 

n=[a b]; 
d=[c d1 e]; 

h= 0.0001; wdata = 150; t=0:h:wdata*h; 
yn=[-3000 -2100000]; 
yd=[1 3600 2100000]; 
yr = step(yn,yd,t); 
resp = step(n,d,t); 
err(:,1) = resp(:,1) - yr(:,1);
```
rseed= 8512;

lchrom= 3; etha= 1.7; pcross= 0.9; pmutat= 0.1; xlb(1,1) = 8000; xlb(1,2) = 0.1; xlb(1,3) = 1\*10^-10;

xub(1,1) = 11000; xub(1,2) = 1000000; xub(1,3) = 1\*10^-7;

maxgen= 200;

% Revision 0.9 2003/4/17

% Edit by Hwanghun Jeong, CME PKNU

if(rem(popsize, 2) ~= 0) % do not move

popsize= popsize + 1;

% rseed- random seed

% pop- population

% Revision 0.9 2003/4/17

% Edit by Hwanghun Jeong, CME PKNU

% popsize- population size % lchrom- chromosome length

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

maxmin= -1; % -1 for minimization

popsize= 100; % popsize should be even

% The RINITPOP function creates an initial population

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

% xub- upper bound for variables, vector % xlb- lower bound for variables, vector

[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha,Ev]=

%

University

function

rInitPa

 Ev=0; 

end

%

%

%

% rInitPop.m

% Input:

% Output:

University

```
for j= 1:wdata 
 obj= err(j,1)^2; 
 objfunc(i)= objfunc(i)+0.5*h*(obj+oldobj); 
 oldobj= obj; 
 end
end
% ScaleFit.m
%
% The SCALEFIT function converts objective function values into 
fitness using 
% the scaling window scheme(window size= 1) 
%
% Input: 
% objfunc- objective function value, vector 
% popsize- population size 
% gam- minimun of objfunc or -objfunc in the previous population
% maxmin= -1 for minimization, 1 for maximization 
% Output: 
% fitness- scaled fitness, vector 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function fitness= ScaleFit(objfunc,popsize,gam,maxmin) 

if(maxmin == 1) 
 fitness= objfunc-gam; 
else
 fitness= -objfunc-gam; 
end
for i=1:popsize 
 if(fitness(i) < 0) 
 fitness(i)= 0; 
 end
end
% rStatPop.m
%
% The RSTATPOP function calculates the statistics of a population 
% 
% Input: 
% pop- population, matrix 
% objfunc- objective function value, vector 
% fitness- fitness, vector 
% maxmin= -1 for minimization, 1 for maximization
```
Control of Magnetic Bearing System 225

% Output:

University

fitness,maxmin)

if(maxmin == 1)

% rGradSel.m

% Input:

% Output:

University

% Revision 0.9 2003/4/17

rStatPop(pop,objfunc, ...

gam= min(objfunc);

gam= min(-objfunc);

chrombest= pop(index,:); fitbest= fitness(index); objave= mean(objfunc);

% popsize- population size % lchrom- chromosome length % fitness- fitness, vector

% newpop- mating pool, matrix

% Edit by Hwanghun Jeong, CME PKNU

% Revision 0.9 2003/4/17

% Edit by Hwanghun Jeong, CME PKNU

[objbest, index]= max(objfunc);

[objbest, index]= min(objfunc);

%

else

end

%

%

% chrombest- best chromosome, vector % objbest- best objective function value % fitbest- fitness of the best chromesome % objave- average objective function value % gam- minimun of objfunc or -objfunc

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

% The RGRADSEL function performs gradient-like selection

% %

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

% pop- population of chromosomes, matrix

% chrombest- best chromosome, vector % fitbest- fitness of the best chromesome % xlb- lower bound for variables, vector % xub- upper bound for variables, vector % etha- parameter of the selection operator

function [chrombest,objbest,fitbest,objave,gam]=

```
% Output: 
% chrombest- best chromosome, vector 
% objbest- best objective function value 
% fitbest- fitness of the best chromesome 
% objave- average objective function value 
% gam- minimun of objfunc or -objfunc 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function [chrombest,objbest,fitbest,objave,gam]= 
rStatPop(pop,objfunc, ...

fitness,maxmin) 

if(maxmin == 1) 
 [objbest, index]= max(objfunc); 
 gam= min(objfunc); 
else
 [objbest, index]= min(objfunc); 
 gam= min(-objfunc); 
end
chrombest= pop(index,:); 
fitbest= fitness(index); 
objave= mean(objfunc); 
% rGradSel.m
%
% The RGRADSEL function performs gradient-like selection 
% 
% Input: 
% pop- population of chromosomes, matrix 
% popsize- population size 
% lchrom- chromosome length 
% fitness- fitness, vector 
% chrombest- best chromosome, vector 
% fitbest- fitness of the best chromesome 
% xlb- lower bound for variables, vector 
% xub- upper bound for variables, vector 
% etha- parameter of the selection operator 
% Output: 
% newpop- mating pool, matrix 
% %
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU
```
obj= err(j,1)^2;

objfunc(i)= objfunc(i)+0.5\*h\*(obj+oldobj);

% the scaling window scheme(window size= 1)

% popsize- population size

% Revision 0.9 2003/4/17

fitness= objfunc-gam;

fitness= -objfunc-gam;

% pop- population, matrix

% fitness- fitness, vector

% objfunc- objective function value, vector

% maxmin= -1 for minimization, 1 for maximization

% fitness- scaled fitness, vector

% Edit by Hwanghun Jeong, CME PKNU

% objfunc- objective function value, vector

% maxmin= -1 for minimization, 1 for maximization

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

function fitness= ScaleFit(objfunc,popsize,gam,maxmin)

% The SCALEFIT function converts objective function values into

% gam- minimun of objfunc or -objfunc in the previous population

% The RSTATPOP function calculates the statistics of a population

for j= 1:wdata

oldobj= obj;

 end end

%

%

%

else

end

 end end

%

%

% ScaleFit.m

fitness using

% Input:

% Output:

University

if(maxmin == 1)

for i=1:popsize if(fitness(i) < 0) fitness(i)= 0;

% rStatPop.m

% Input:

```
function newpop= 
rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb, ...

xub,etha) 
if(fitbest > 0) 
 for i= 1:popsize 
 etha1= etha; 
 normfit= 1-fitness(i)/fitbest; 
 pass= 0; 
 while(pass == 0) 
 pass= 1; 
 for j= 1:lchrom 
 newpop(i,j)= pop(i,j)+etha1*normfit*(chrombest(j)-
pop(i,j)); 
 if(newpop(i,j) < xlb(j) | newpop(i,j) > xub(j)) 
 etha1= etha1*0.8; 
 pass= 0; 
 break; 
 end
 end
 end
 end
else
 for i= 1:popsize 
 k= Pickup(popsize); 
 newpop(i,:)= pop(k,:); 
 end
end
% Pickup.m
%
% The PICKUP function picks up an integer random number between 1 
and num 
% 
% Input: 
% num- integer number greater than or equal to 1 
% Output: 
% rnum- random number between 1 and num 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function rnum= Pickup(num) 

if min(num) < 1 
 disp('num is less than one !') 
 return; 
end
```
Control of Magnetic Bearing System 227

fr= rand(size(num)); rnum= floor(fr.\*num)+1;

% The RMSXOVER function performs modified simple crossover

% nxover- number of times crossover was performed

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

function [pop,nxover]= rMsXover(pop,popsize,lchrom,pcross)

temp= lam\*pop(mate2,xpoint)+(1-lam)\*pop(mate1,xpoint);

pop(mate1,xpoint+1:lchrom)= pop(mate2,xpoint+1:lchrom);

pop(mate2,xpoint)= lam\*pop(mate1,xpoint)+(1-

% The RDYNAMUT function performs dynamic mutation

% pop- population of chromosomes, matrix

% popsize- population size % lchrom- chromosome length % pcross- crossover probability

% Revision 0.9 2003/4/17

halfpop= floor(popsize/2);

 if (rand <= pcross) nxover= nxover+1; mate1= 2\*i-1; mate2= 2\*i;

% pop- mated population, matrix

% Edit by Hwanghun Jeong, CME PKNU

xpoint= Pickup(lchrom-1);

pop(mate1,xpoint)= temp;

temp= pop(mate1,xpoint+1:lchrom);

pop(mate2,xpoint+1:lchrom)= temp;

% rMsXover.m

% Input:

% Output:

University

nxover= 0;

for i= 1:halfpop

lam= rand;

lam= rand;

lam)\*pop(mate2,xpoint);

%

%

%

%

%

 end end

% rDynaMut.m

```
fr= rand(size(num)); 
rnum= floor(fr.*num)+1; 
% rMsXover.m
%
% The RMSXOVER function performs modified simple crossover
%
% Input: 
% pop- population of chromosomes, matrix 
% popsize- population size 
% lchrom- chromosome length 
% pcross- crossover probability 
% Output: 
% pop- mated population, matrix 
% nxover- number of times crossover was performed 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function [pop,nxover]= rMsXover(pop,popsize,lchrom,pcross) 

nxover= 0; 
halfpop= floor(popsize/2); 
for i= 1:halfpop 
 if (rand <= pcross) 
 nxover= nxover+1; 
 mate1= 2*i-1; 
 mate2= 2*i; 
 xpoint= Pickup(lchrom-1); 
 lam= rand; 
 temp= lam*pop(mate2,xpoint)+(1-lam)*pop(mate1,xpoint); 
 lam= rand; 
 pop(mate2,xpoint)= lam*pop(mate1,xpoint)+(1-
lam)*pop(mate2,xpoint); 
 pop(mate1,xpoint)= temp; 

 temp= pop(mate1,xpoint+1:lchrom); 
 pop(mate1,xpoint+1:lchrom)= pop(mate2,xpoint+1:lchrom); 
 pop(mate2,xpoint+1:lchrom)= temp; 
 end
end
% rDynaMut.m
%
% The RDYNAMUT function performs dynamic mutation 
%
```
function newpop=

if(fitbest > 0) for i= 1:popsize etha1= etha;

pass= 0;

 end end end end

for i= 1:popsize

 k= Pickup(popsize); newpop(i,:)= pop(k,:);

% Revision 0.9 2003/4/17

function rnum= Pickup(num)

% Edit by Hwanghun Jeong, CME PKNU

disp('num is less than one !')

 while(pass == 0) pass= 1;

for j= 1:lchrom

 pass= 0; break;

normfit= 1-fitness(i)/fitbest;

etha1= etha1\*0.8;

xub,etha)

pop(i,j));

else

 end end

%

%

%

end

% Pickup.m

and num

% Input:

% Output:

University

return;

if min(num) < 1

rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb, ...

newpop(i,j)= pop(i,j)+etha1\*normfit\*(chrombest(j)-

% The PICKUP function picks up an integer random number between 1

% num- integer number greater than or equal to 1

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

% rnum- random number between 1 and num

if(newpop(i,j) < xlb(j) | newpop(i,j) > xub(j))

```
% Input: 
% pop- population of chromosomes, matrix 
% popsize- population size 
% lchrom- chromosome length 
% pmutat- mutation probability 
% xlb- lower bound of variables 
% xub- upper bound of variables 
% Output: 
% pop- mutated population, matrix 
% nmutat- number of times mutation was performed 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function [pop,nmutat]= 
rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen) 

b= 5; 
nmutat= 0; 
for i= 1:popsize 
 for j= 1:lchrom 
 if (rand <= pmutat) 
 nmutat= nmutat+1; 
 r= rand; 
 if(round(rand)) 
 pop(i,j)= pop(i,j)+(xub(j)-pop(i,j))*r*(1-
gen/maxgen)^b; 
 else
 pop(i,j)= pop(i,j)-(pop(i,j)-xlb(j))*r*(1-
gen/maxgen)^b; 
 end
 end
 end
end
% rElitism.m
%
% The RELITISM function performs elitism 
% 
% Input: 
% pop- population of chromosomes, matrix 
% objfunc- objective function value 
% chrombest- best chromosome, vector 
% objbest- best objective function value 
% maxmin= -1 for minimization, 1 for maximization 
% Output: 
% pop- modified population of chromosomes, matrix 
% objfunc- modified objective function value
```
Control of Magnetic Bearing System 229

%

 end else

 end end

University

if(maxmin==1)

% Revision 0.9 2003/4/17

function [pop,objfunc]=

 cobjbest= max(objfunc); if(cobjbest < objbest)

 cobjbest= min(objfunc); if(cobjbest > objbest)

 pop(index,:)= chrombest; objfunc(index)= objbest;

 pop(index,:)= chrombest; objfunc(index)= objbest;

% Edit by Hwanghun Jeong, CME PKNU

[objworst, index]= min(objfunc);

[objworst, index]= max(objfunc);

**3. RCGA program for magnetic bearing system identification** 

installed PC through the DAQ board(PCI6010) for monitoring.

The transfer function from the reference input of the magnetic bearing system including the PID controller to the displacement of the levitating object is as shown in Equation (59).

The PID controller coefficients selected for the stabilization of the magnetic bearing system are K� � �, K� � �����, K� � � and the sampling time is 0.001s. If the PID controller is expressed in cyclic form to implement as a micro processor, it is as shown in Equation (59).

Fig. 25 is the step response that was obtained from the magnetic bearing system including the PID controller designed for stabilization. Specially, Fig. 25 is the step response of the displaced levitating object displacement x when the right side electromagnet reference input

Fig. 60 shows the connection diagram of the magnetic bearing control system. The power of the system uses a DC power supply, displacement sensor amplifier, DSP, and AC220V power for the PC, and DC power is used for the current amplifier. The control system is connected to the magnetic bearing coil and displacement measurement sensor through a port. The delivered signal from the displacement sensor amplifier is compared to the reference input in the DSP and a control signal is generated, where the control signal generated in the DSP is provided to the linear current amplifier circuit to control the electromagnet. The signals occurring during control are stored in the independently

was modified from 0.4mm to 0.6mm where the left side electromagnet was fixed.

u�n��� � �������n��� � ��������n � �� � ���n� � u�n��� (59)

rElitism(pop,objfunc,chrombest,objbest,maxmin)

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

```
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function [pop,objfunc]= 
rElitism(pop,objfunc,chrombest,objbest,maxmin) 

if(maxmin==1) 
 cobjbest= max(objfunc); 
 if(cobjbest < objbest) 
 [objworst, index]= min(objfunc); 
 pop(index,:)= chrombest; 
 objfunc(index)= objbest; 
 end
else
 cobjbest= min(objfunc); 
 if(cobjbest > objbest) 
 [objworst, index]= max(objfunc); 
 pop(index,:)= chrombest; 
 objfunc(index)= objbest; 
 end
end
```
### **3. RCGA program for magnetic bearing system identification**

228 Performance Evaluation of Bearings

% popsize- population size % lchrom- chromosome length % pmutat- mutation probability % xlb- lower bound of variables % xub- upper bound of variables

% Revision 0.9 2003/4/17

 if (rand <= pmutat) nmutat= nmutat+1;

if(round(rand))

% The RELITISM function performs elitism

% pop- population of chromosomes, matrix % objfunc- objective function value % chrombest- best chromosome, vector % objbest- best objective function value

% maxmin= -1 for minimization, 1 for maximization

% pop- modified population of chromosomes, matrix % objfunc- modified objective function value

function [pop,nmutat]=

for i= 1:popsize for j= 1:lchrom

gen/maxgen)^b; else

gen/maxgen)^b; end end end end

% rElitism.m

% Input:

% Output:

%

%

r= rand;

% pop- mutated population, matrix

% Edit by Hwanghun Jeong, CME PKNU

% pop- population of chromosomes, matrix

% nmutat- number of times mutation was performed

rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen)

pop(i,j)= pop(i,j)+(xub(j)-pop(i,j))\*r\*(1-

pop(i,j)= pop(i,j)-(pop(i,j)-xlb(j))\*r\*(1-

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

% Input:

% Output:

University

%

 b= 5; nmutat= 0;

> The transfer function from the reference input of the magnetic bearing system including the PID controller to the displacement of the levitating object is as shown in Equation (59).

> The PID controller coefficients selected for the stabilization of the magnetic bearing system are K� � �, K� � �����, K� � � and the sampling time is 0.001s. If the PID controller is expressed in cyclic form to implement as a micro processor, it is as shown in Equation (59).

$$\mathbf{u(n+2)} = 6.001\mathbf{e(n+2)} - 10.9999\mathbf{e(n+1)} + 5\mathbf{e(n)} + \mathbf{u(n+1)}\tag{59}$$

Fig. 25 is the step response that was obtained from the magnetic bearing system including the PID controller designed for stabilization. Specially, Fig. 25 is the step response of the displaced levitating object displacement x when the right side electromagnet reference input was modified from 0.4mm to 0.6mm where the left side electromagnet was fixed.

Fig. 60 shows the connection diagram of the magnetic bearing control system. The power of the system uses a DC power supply, displacement sensor amplifier, DSP, and AC220V power for the PC, and DC power is used for the current amplifier. The control system is connected to the magnetic bearing coil and displacement measurement sensor through a port. The delivered signal from the displacement sensor amplifier is compared to the reference input in the DSP and a control signal is generated, where the control signal generated in the DSP is provided to the linear current amplifier circuit to control the electromagnet. The signals occurring during control are stored in the independently installed PC through the DAQ board(PCI6010) for monitoring.

The MPU to implement the PID controller is TMS320C32, and a 12 bit A/D converter (MAX122) and 12 bit D/A converter (AD664) were used. Eddy current type sensor (AH-305) was used as the displacement measurement sensor for the feedback signal and an appropriate sensor amplifier (AS-440-01) was applied.

Control of Magnetic Bearing System 231

of the levitating

Table 4 shows the parameter values already known regarding the magnetic bearing system. Therefore, the parameters that their values cannot be relatively exactly known in this system are the levitating object mass m, the current during normal state I��, coil inductance value L,

In the experiment for the identification of the magnetic bearing, the levitating object was supported using one side of the magnetic bearing. When supporting the levitating object with one side of the electromagnet, the levitating object becomes slanted so the vertical direction force that the electromagnet supports varies with the tilted angle of the levitating object and the impact force(mass m) of the levitating object on the electromagnet is difficult to measure. If the mass of the levitating object changes, the current I�� at normal state depending on the mass also varies. Additionally, the coil inductance value L varies depending on the levitating object location within the electromagnet coil, thus, it is a

object is also difficult to exactly obtain due to the uneven nature of the material, and the random gain to calibrate the normal deviation that occurs due to the mathematical model error is defined as K� and is additionally included in the list of parameters to be identified. Equation (60) shows the search ranges of the 5 unknown parameter values to be estimated by using the genetic algorithm. For each parameter, the search range was determined based on the actual experimented system and with the consideration of the physical

��� � m � ���

��I�� � ���

� � L � ���

���� � �����

Parameter Value

Length of a path for magnetic flux 0.1711m

Displacement for levitate object(at steady state) 0.6mm

Cross section of armature 4.8 × 10-4 m2

Number of coil turn for magnetic bearing 200 turn

**Table 4.** The table for the known parameters

��K� � � (60)

parameter that is difficult to exactly measure. The relative permeability µ�

of the levitating object, and additional gain K� for normal deviation

relative permeability µ�

calibration.

characteristics.

**Figure 24.** Magnetic bearing system including the PID controller

**Figure 25.** Step response of magnetic bearing system including the PID controller

Table 4 shows the parameter values already known regarding the magnetic bearing system. Therefore, the parameters that their values cannot be relatively exactly known in this system are the levitating object mass m, the current during normal state I��, coil inductance value L, relative permeability µ� of the levitating object, and additional gain K� for normal deviation calibration.

In the experiment for the identification of the magnetic bearing, the levitating object was supported using one side of the magnetic bearing. When supporting the levitating object with one side of the electromagnet, the levitating object becomes slanted so the vertical direction force that the electromagnet supports varies with the tilted angle of the levitating object and the impact force(mass m) of the levitating object on the electromagnet is difficult to measure. If the mass of the levitating object changes, the current I�� at normal state depending on the mass also varies. Additionally, the coil inductance value L varies depending on the levitating object location within the electromagnet coil, thus, it is a parameter that is difficult to exactly measure. The relative permeability µ� of the levitating object is also difficult to exactly obtain due to the uneven nature of the material, and the random gain to calibrate the normal deviation that occurs due to the mathematical model error is defined as K� and is additionally included in the list of parameters to be identified.

Equation (60) shows the search ranges of the 5 unknown parameter values to be estimated by using the genetic algorithm. For each parameter, the search range was determined based on the actual experimented system and with the consideration of the physical characteristics.

> ��� � m � ��� ��I�� � ��� � � L � ��� ���� � ����� ��K� � � (60)


**Table 4.** The table for the known parameters

230 Performance Evaluation of Bearings

appropriate sensor amplifier (AS-440-01) was applied.

**Figure 24.** Magnetic bearing system including the PID controller

0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7

Displacement[mm]

**Figure 25.** Step response of magnetic bearing system including the PID controller

0 2 4 6 8 10

Time[s]

The MPU to implement the PID controller is TMS320C32, and a 12 bit A/D converter (MAX122) and 12 bit D/A converter (AD664) were used. Eddy current type sensor (AH-305) was used as the displacement measurement sensor for the feedback signal and an

Control of Magnetic Bearing System 233

dt (61)

Value Genetic operator

IAE(Integrated Absolute Error) as shown in Equation (61) was selected as the objective

f��� � � |��t�| �� ��

Here, ��t�is the difference between the magnetic bearing step response obtained experimentally and the magnetic bearing model step response obtained mathematically

For the implement the real coded genetic algorithm, the program and the modified parts of

Population 100 Generate initial population

Max. generation 100 Generate initial population

Chromosome length 5 Generate initial population

Probability 0.9 Modified simple crossover

Probability 0.1 Dynamic mutation

EvalObj evaluate the object function on the population for the reproduction

Eta 1.7 Scale fitting

**Table 5.** Shows the program parameters necessary to execute RCGA.

rcga Find optimal value on object function with RCGA

**Table 6.** Modified program file list to execute real coded genetic algorithm

rInitPa Define program variable for RCGA

function to execute RCGA.

Crossover

Mutation

file name

(\*.m) function

through the selected chromosome.

Table 3 are shown in Table 6 and the scripts are as follows.

Parameter Parameter

**Figure 26.** The connecting diagram for the magnetic bearing system

IAE(Integrated Absolute Error) as shown in Equation (61) was selected as the objective function to execute RCGA.

232 Performance Evaluation of Bearings

**Figure 26.** The connecting diagram for the magnetic bearing system

$$\mathbf{f\_{obj}} = \int\_{\mathbf{t\_0}}^{\mathbf{t\_f}} |\mathbf{e(t)}| \,\mathrm{d}\mathbf{t} \tag{61}$$

Here, ��t�is the difference between the magnetic bearing step response obtained experimentally and the magnetic bearing model step response obtained mathematically through the selected chromosome.

For the implement the real coded genetic algorithm, the program and the modified parts of Table 3 are shown in Table 6 and the scripts are as follows.


**Table 5.** Shows the program parameters necessary to execute RCGA.


**Table 6.** Modified program file list to execute real coded genetic algorithm

```
% rcga22.m
%
% The RCGA22 implements a real coded genetic algorithm for finding 
system parameter in the MBS
% 
% Encoding: 
% - Real 
% 
% Genetic operators: 
% - Gradient-like selection 
% - Modified simple crossover 
% - Dynamic mutation 
% 
% Other strategies: 
% - Elitism 
% - scaling window scheme(Ws=1) 
% 
% Remarks: 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
clf; 
clear; 
Test_data = xlsread('a_pidR.xls'); 

% initializes the generation counter
gen= 1; 

% initializes the parameters of a RCGA
[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha]= 
rInitPa22; 

% creates a polulation randomly
pop= rInitPop(rseed,popsize,lchrom,xlb,xub); 

% calculates the objective function value
objfunc= EvalObj22(pop,lchrom,popsize,Test_data); 

% calculates gam
if(maxmin == 1) 
 gam= min(objfunc); 
else
 gam= min(-objfunc); 
end
% calculates fitness using the scaling window scheme
fitness= ScaleFit(objfunc,popsize,gam,maxmin);
```
Control of Magnetic Bearing System 235

% computes statistics

for gen= 2:maxgen

% applies reproduction

% Gradient-like selection

% applies crossover

simple crossover

% applies mutation [pop,nmutat]=

% applies Elitism

% computes statistics

% prints the current generation

pop=

mutation

end

figure(1)

subplot(2,1,1)

subplot(2,1,2)

axis([0 100 0 10000]);

[chrombest,objbest,fitbest,objave,gam]= rStatPop(pop,objfunc,fitness,maxmin);

% calculates the objective function value

% applies the scaling window scheme

objfunc= EvalObj22(pop,lchrom,popsize,Test\_data);

fitness= ScaleFit(objfunc,popsize,gam,maxmin);

% builds a matrix storage for plotting line graphs stats(gen,:)=[gen objbest objave chrombest];

% plots the best and average objective function values

[chrombest,objbest,fitbest,objave,gam]=

% plots the variables of the best chromosome

plot(stats(:,1),stats(:,4:lchrom+3))

rStatPop(pop,objfunc,fitness,maxmin);

plot(stats(:,1),stats(:,2:3))

% builds a matrix storage for plotting line graphs stats(gen,:)=[gen objbest objave chrombest];

fprintf('gen= %d (%d) %f\n',gen,maxgen-gen,objbest);

rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb,xub,etha);

[pop,nxover]= rMsXover(pop,popsize,lchrom,pcross); % modified

rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen); %dynamic

[pop,objfunc]= rElitism(pop,objfunc,chrombest,objbest,maxmin);

```
% computes statistics
[chrombest,objbest,fitbest,objave,gam]= 
rStatPop(pop,objfunc,fitness,maxmin); 

% builds a matrix storage for plotting line graphs
 stats(gen,:)=[gen objbest objave chrombest]; 

for gen= 2:maxgen 

% prints the current generation
 fprintf('gen= %d (%d) %f\n',gen,maxgen-gen,objbest); 

% applies reproduction
 pop= 
rGradSel(pop,popsize,lchrom,fitness,chrombest,fitbest,xlb,xub,etha); 
% Gradient-like selection
% applies crossover
 [pop,nxover]= rMsXover(pop,popsize,lchrom,pcross); % modified 
simple crossover
% applies mutation
 [pop,nmutat]= 
rDynaMut(pop,popsize,lchrom,pmutat,xlb,xub,gen,maxgen); %dynamic 
mutation
% calculates the objective function value
 objfunc= EvalObj22(pop,lchrom,popsize,Test_data); 

% applies Elitism
 [pop,objfunc]= rElitism(pop,objfunc,chrombest,objbest,maxmin); 

% applies the scaling window scheme
 fitness= ScaleFit(objfunc,popsize,gam,maxmin); 

% computes statistics
 [chrombest,objbest,fitbest,objave,gam]= 
rStatPop(pop,objfunc,fitness,maxmin); 

% builds a matrix storage for plotting line graphs
 stats(gen,:)=[gen objbest objave chrombest]; 
end
figure(1) 
% plots the best and average objective function values
subplot(2,1,1) 
plot(stats(:,1),stats(:,2:3)) 

% plots the variables of the best chromosome
subplot(2,1,2) 
plot(stats(:,1),stats(:,4:lchrom+3)) 
axis([0 100 0 10000]);
```
system parameter in the MBS

% - Gradient-like selection % - Modified simple crossover

% - scaling window scheme(Ws=1)

% Edit by Hwanghun Jeong, CME PKNU

Test\_data = xlsread('a\_pidR.xls');

% initializes the generation counter

% initializes the parameters of a RCGA

pop= rInitPop(rseed,popsize,lchrom,xlb,xub);

objfunc= EvalObj22(pop,lchrom,popsize,Test\_data);

% calculates fitness using the scaling window scheme fitness= ScaleFit(objfunc,popsize,gam,maxmin);

% calculates the objective function value

% creates a polulation randomly

% Genetic operators:

% Other strategies: % - Elitism

% - Dynamic mutation

% Revision 0.9 2003/4/17

% The RCGA22 implements a real coded genetic algorithm for finding

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha]=

% rcga22.m

% Encoding: % - Real

%

%

%

%

%

%

clf; clear;

gen= 1;

rInitPa22;

% calculates gam if(maxmin == 1) gam= min(objfunc);

gam= min(-objfunc);

else

end

% Remarks:

University

```
figure(2) 
Rd=273000; 
Ri=10000*1.0045; 
Rf=20000; 
R=9; 
A = 10^(107.7/20); 
Gs=1000; 
Kd=0.005; 
Kp=1; 
Ki=2; 

Cf= 4.94*10^-9; 
L_m=(1/8*pi*90+1/8*pi*40+2*60)*10^-3; 
N=200; 
mu_o=4*pi*10^-7; 
X=0.0006; 
S_a= 480*10^-6 *0.5; 

m= chrombest(1); mu_s=chrombest(2); 
I_ss=chrombest(3);L=chrombest(4); 
pt1= chrombest(5); 
Rs=pt1*2; 

X_o=L_m/(2*mu_s); 
X_1=X+X_o; 

k=N^2*mu_o*S_a/4; 

a=-2*k*I_ss^2/X_1^3; 
b=-2*k*I_ss/X_1^2; 
c=2*k*I_ss/X_1^2; 

n=-Rs*b*Rf*[Rd*Cf*Kd (Rd*Cf*Kp + Kd) (Rd*Cf*Ki + Kp) Ki]; 

d01=Ri*Cf*Rf*m*L; 
d02=Ri*Cf*Rf*m*(R + Rs) + Ri*m*Rd*Cf; 
d03=-(Ri*Cf*Rf*(a*L + Rs*b*c) - Ri*m + Rd*Cf*Rs*Rf*b*Kd*Gs); 
d04=-(Ri*Cf*Rf*a*(R + Rs) + Ri*a*Rd*Cf + (Rd*Cf*Rs*Rf*b*Kp + 
Rs*Rf*b*Kd)*Gs); 
d05=-(Ri*a + (Rd*Cf*Rs*Rf*b*Ki + Rs*Rf*b*Kp)*Gs); 
d06=-Rs*Rf*b*Ki*Gs; 

d=[d01 d02 d03 d04 d05 d06]; 

t_sample = 0:0.001:2.999; 
 y=step(n,d,t_sample); 
 plot(t_sample,Test_data(:,4)/1000,'-.',t_sample,0.21*y,'-') 
 axis([-0.05 0.25 0 0.00032]); 
legend('Step Response','Estimated Value') 
xlabel('Time[s]'),ylabel('Distance[m]')
```
Control of Magnetic Bearing System 237

% rInitPa22.m

% Output:

% rseed- random seed

% maxgen- maximum generation

% Edit by Hwanghun Jeong, CME PKNU

% lchrom- chromosome length % pcross- crossover probability % pmutat- mutation probability % xlb- lower bound of variables % xub- upper bound of variables

% Revision 0.9 2003/4/17

%rseed=input('rseed= ');

xlb= 0\*ones(1,lchrom); xub= 10\*ones(1,lchrom);

% The RINITPA22 function initializes the parameters of a RCGA

% maxmin= -1 for minimization, 1 for maximization

% etha- parameter of the selection operator

maxmin= -1; % -1 for minimization

popsize= 100; % popsize should be even

% popsize- population size(must be an even integer)

% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime

[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha]=

%

%

%

University

function

rInitPa20

rseed= 937;

lchrom= 5; etha= 1.7; pcross= 0.9; pmutat= 0.1;

maxgen= 100;

%xlb(1,1)=0; %xlb(1,2)=0; %xlb(1,3)=0.6; xlb(1,1)=0.5; xlb(1,2)=0; xlb(1,3)=0.7; xlb(1,4)=0.025;

%xub(1,1)=0.5; %xub(1,2)=1000; %xub(1,3)=0.8; xub(1,1)=0.9; xub(1,2)=10000; xub(1,3)=0.9;

```
% rInitPa22.m
%
% The RINITPA22 function initializes the parameters of a RCGA 
% 
% Output: 
% rseed- random seed 
% maxmin= -1 for minimization, 1 for maximization 
% maxgen- maximum generation 
% popsize- population size(must be an even integer) 
% lchrom- chromosome length 
% pcross- crossover probability 
% pmutat- mutation probability 
% xlb- lower bound of variables 
% xub- upper bound of variables 
% etha- parameter of the selection operator 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function
[rseed,maxmin,maxgen,popsize,lchrom,pcross,pmutat,xlb,xub,etha]= 
rInitPa20 

rseed= 937; 
%rseed=input('rseed= '); 
maxmin= -1; % -1 for minimization
maxgen= 100; 
popsize= 100; % popsize should be even
lchrom= 5; 
etha= 1.7; 
pcross= 0.9; 
pmutat= 0.1; 
xlb= 0*ones(1,lchrom); 
xub= 10*ones(1,lchrom); 

%xlb(1,1)=0;
%xlb(1,2)=0;
%xlb(1,3)=0.6;
xlb(1,1)=0.5; 
xlb(1,2)=0; 
xlb(1,3)=0.7; 
xlb(1,4)=0.025; 

%xub(1,1)=0.5;
%xub(1,2)=1000;
%xub(1,3)=0.8;
xub(1,1)=0.9; 
xub(1,2)=10000; 
xub(1,3)=0.9;
```
Ri=10000\*1.0045;

A = 10^(107.7/20);

Cf= 4.94\*10^-9;

mu\_o=4\*pi\*10^-7;

S\_a= 480\*10^-6 \*0.5;

pt1= chrombest(5);

X\_o=L\_m/(2\*mu\_s);

k=N^2\*mu\_o\*S\_a/4;

d01=Ri\*Cf\*Rf\*m\*L;

Rs\*Rf\*b\*Kd)\*Gs);

d06=-Rs\*Rf\*b\*Ki\*Gs;

d=[d01 d02 d03 d04 d05 d06];

axis([-0.05 0.25 0 0.00032]);

legend('Step Response','Estimated Value') xlabel('Time[s]'),ylabel('Distance[m]')

t\_sample = 0:0.001:2.999; y=step(n,d,t\_sample);

a=-2\*k\*I\_ss^2/X\_1^3; b=-2\*k\*I\_ss/X\_1^2; c=2\*k\*I\_ss/X\_1^2;

L\_m=(1/8\*pi\*90+1/8\*pi\*40+2\*60)\*10^-3;

m= chrombest(1); mu\_s=chrombest(2); I\_ss=chrombest(3);L=chrombest(4);

d02=Ri\*Cf\*Rf\*m\*(R + Rs) + Ri\*m\*Rd\*Cf;

n=-Rs\*b\*Rf\*[Rd\*Cf\*Kd (Rd\*Cf\*Kp + Kd) (Rd\*Cf\*Ki + Kp) Ki];

d03=-(Ri\*Cf\*Rf\*(a\*L + Rs\*b\*c) - Ri\*m + Rd\*Cf\*Rs\*Rf\*b\*Kd\*Gs); d04=-(Ri\*Cf\*Rf\*a\*(R + Rs) + Ri\*a\*Rd\*Cf + (Rd\*Cf\*Rs\*Rf\*b\*Kp +

plot(t\_sample,Test\_data(:,4)/1000,'-.',t\_sample,0.21\*y,'-')

d05=-(Ri\*a + (Rd\*Cf\*Rs\*Rf\*b\*Ki + Rs\*Rf\*b\*Kp)\*Gs);

figure(2) Rd=273000;

Rf=20000; R=9;

Gs=1000; Kd=0.005; Kp=1; Ki=2; 

N=200;

X=0.0006;

Rs=pt1\*2;

X\_1=X+X\_o;

```
xub(1,4)=0.095; 
xub(1,5)=2; 

%xub(1,2)=480*10^-6;
%xub(1,2)=1*10^-3;
%xub(1,1)=10000;
%xub(1,2)=10;
%xub(1,3)=3.5*10^5;
%xub(1,3)=1*10^-7;
if(rem(popsize, 2) ~= 0) % do not move
 popsize= popsize + 1; 
end
% EvalObj22.m
%
% The EVALOBJ6 function evaluates a multivariable function 
% 
% Input: 
% x- variables, matrix 
% npara- number of the variables 
% popsize- population size 
% Output: 
% objfunc- objective function value, vector 
% 
% Copyright (c) 2000 by Prof. Gang-Gyoo Jin, Korea Maritime 
University 
% Revision 0.9 2003/4/17 
% Edit by Hwanghun Jeong, CME PKNU 
function objfunc= EvalObj22(x,npara,popsize,Test_data); 
Rd=273000; 
Ri=10000*1.0045; 
Rf=20000; 
R=9; 
A = 10^(107.7/20); 
Gs=1000; 
Kd=0.005; 
Kp=1; 
Ki=2; 

Cf= 4.94*10^-9; 
L_m=(1/8*pi*90+1/8*pi*40+2*60)*10^-3; 
N=200; 
mu_o=4*pi*10^-7; 
X=0.0006; 
S_a= 480*10^-6 *0.5;
```
Control of Magnetic Bearing System 239

for i= 1:popsize

X\_o=L\_m/(2\*mu\_s);

k=N^2\*mu\_o\*S\_a/4;

d01=Ri\*Cf\*Rf\*m\*L;

Rs\*Rf\*b\*Kd)\*Gs);

d06=-Rs\*Rf\*b\*Ki\*Gs;

 objfunc(i)=0; for j=1:3000

d=[d01 d02 d03 d04 d05 d06];

 t\_sample = 0:0.001:2.999; y=step(n,d,t\_sample);

objfunc(i)= objfunc(i)+obj;

Hwang Hun Jeong, So Nam Yun and Joo Ho Yang

*PuKyong National University, Pusan, Republic of Korea* 

Electrical Engneering 2006; 53-59.

international Journal. Series C 2003;46(2) 391-396.

a=-2\*k\*I\_ss^2/X\_1^3; b=-2\*k\*I\_ss/X\_1^2; c=2\*k\*I\_ss/X\_1^2;

pt1=x(i,5); Rs=pt1\*2;

X\_1=X+X\_o;

 end end

**Author details** 

Joo Ho Yang

**5. References** 

m= x(i,1); mu\_s=x(i,2); I\_ss=x(i,3);L=x(i,4);

d02=Ri\*Cf\*Rf\*m\*(R + Rs) + Ri\*m\*Rd\*Cf;

n=-Rs\*b\*Rf\*[Rd\*Cf\*Kd (Rd\*Cf\*Kp + Kd) (Rd\*Cf\*Ki + Kp) Ki];

d03=-(Ri\*Cf\*Rf\*(a\*L + Rs\*b\*c) - Ri\*m + Rd\*Cf\*Rs\*Rf\*b\*Kd\*Gs); d04=-(Ri\*Cf\*Rf\*a\*(R + Rs) + Ri\*a\*Rd\*Cf + (Rd\*Cf\*Rs\*Rf\*b\*Kp +

d05=-(Ri\*a + (Rd\*Cf\*Rs\*Rf\*b\*Ki + Rs\*Rf\*b\*Kp)\*Gs);

obj=abs(Test\_data(j,4)/1000-0.21\*y(j,1));

*Korea Institute of Machinery and Materials, Daejeon, Republic of Korea* 

[1] Lichuan Li et al. A One-Axis-Controlled Magnetic Bearing and Its Performance. JSME

[2] B. Polajzer et al. Decentralized PI/PD position control for active magnetic bearing .

```
for i= 1:popsize 
m= x(i,1); mu_s=x(i,2); I_ss=x(i,3);L=x(i,4); 
pt1=x(i,5); 
Rs=pt1*2; 

X_o=L_m/(2*mu_s); 
X_1=X+X_o; 

k=N^2*mu_o*S_a/4; 

a=-2*k*I_ss^2/X_1^3; 
b=-2*k*I_ss/X_1^2; 
c=2*k*I_ss/X_1^2; 

n=-Rs*b*Rf*[Rd*Cf*Kd (Rd*Cf*Kp + Kd) (Rd*Cf*Ki + Kp) Ki]; 

d01=Ri*Cf*Rf*m*L; 
d02=Ri*Cf*Rf*m*(R + Rs) + Ri*m*Rd*Cf; 
d03=-(Ri*Cf*Rf*(a*L + Rs*b*c) - Ri*m + Rd*Cf*Rs*Rf*b*Kd*Gs); 
d04=-(Ri*Cf*Rf*a*(R + Rs) + Ri*a*Rd*Cf + (Rd*Cf*Rs*Rf*b*Kp + 
Rs*Rf*b*Kd)*Gs); 
d05=-(Ri*a + (Rd*Cf*Rs*Rf*b*Ki + Rs*Rf*b*Kp)*Gs); 
d06=-Rs*Rf*b*Ki*Gs; 

d=[d01 d02 d03 d04 d05 d06]; 

 t_sample = 0:0.001:2.999; 
 y=step(n,d,t_sample); 
 objfunc(i)=0; 
 for j=1:3000 
 obj=abs(Test_data(j,4)/1000-0.21*y(j,1)); 
 objfunc(i)= objfunc(i)+obj; 
 end
end
```