📄 msc_program.asv
字号:
' input dimensions of the motor, m '
N=input(' input coil turns = ');
Np=input(' Pairs_of_Poles_Number= ');
D=input(' Motor_Depth= ');
Dso=input('Stator_outer_Diameter=');
Dsi=input('Inner_Stator_Diameter=');
Dro=input('Out_Rotor_Diameter=');
Dri=input('Inner_Rotor_Diameter=');
Lm=input('Magnet_Thickness=');
Lt=input('Length_of_Teeth=');
Tsp=input('Tooth_Width/Tooth_Pitch='); %propably 1/2
Msp=input('Magnet_span='); %probably 2/3
Uo=4*3.14*10^-7; % permiability of free space
% N=100;
% Np=1;
% D=0.1;
% Dso=0.8;
% Dsi=0.44;
% Dro=0.4;
% Dri=0.12;
% Lm=0.017;
% Lt=0.13;
% Tsp=0.5;
% Msp=2/3;
% Uo=4*3.14*10^-7;
Wt=(Dsi+Dsi+2*Lt)*pi*Tsp/2/2/2/Np;
Wair=(Dsi+Dro+2*Lm)*pi/2/2/2/Np;
Lair=(Dsi-Dro-2*Lm)/2;
Wsbi=(Dso-Dsi-2*Lt)/2;
Lsbi=(Dso+Dsi+2*Lt)*pi/2/2/Np;
Wrbi=(Dro-Dri)/2;
Lrbi=(Dro+Dri)*pi/2/2/Np;
Wm=(Dro+Dro+2*Lm)*pi*Msp/2/2/2/Np;
reply=input(' please choose type of material, input 1 for nolinear, input 2 for linear:');
switch reply
case 1
n = 26;
b=[0 0.02 0.05 0.1 0.2 0.3 0.4 0.5 0.6 0.8 0.97 1.129 1.209 1.261 1.328 1.381 1.43 1.477 1.532 1.573 1.604 1.658 1.721 1.79 1.868 1.956];
h=[0 2.67 6.6 13.3 26.7 40 53.3 66.7 80 111 159 239 318 398 557 795 1114 1591 2387 3183 3978 5570 7957 11140 15915 23873];
b1=b(1);
bn=b(n);
[f]=polyfit(b,h,16); %find a polynomial fit the dates, degree 16,
% plot(b,h,'b.') %plot the point
% hold on;
bi=[b1:0.1:bn];
hi=polyval(f,bi); %returns the value of the polynomial of degree 16 evaluated at bi
% plot(bi,hi,'b-') %plot the curve
b=[0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28];
for i=1:27 % calculate various H around the circuit for given airgap flux density
h1=polyval(f,b(i)*Wair*D/Wt/D); % teeth % bi are airgap flux densities
h2=polyval(f,b(i)*Wair*D/Wsbi/D); % stator back iron
h3=polyval(f,b(i)*Wair*D/Wrbi/D); % rotor back
h4=polyval(f,b(i)*Wair*D/Wm/D); % Magnet
% I(i)=1/N*((h1*2*Lt+h2*Lsbi+h3*Lrbi+2*h4*Lm)+2*b(i)*Lair/Uo);
I(i)=1/N*((h1*2*Lt+h2*Lsbi+h3*Lrbi)+2*b(i)*(Lair+Lm)/Uo);%calculate 18 different current=[.........]
end;
% figure
% plot(I,b)
for i=1:27 % calculate various H around the circuit for given airgap flux density
h1=polyval(f,b(i)*Wair*D/Wt/D); % teeth % bi are airgap flux densities
h2=polyval(f,b(i)*Wair*D/Wsbi/D); % stator back iron
h3=polyval(f,b(i)*Wair*D/Wrbi/D); % rotor back
h4=polyval(f,b(i)*Wair*D/Wm/D); % Magnet
hc(i)=1/2/Lm*((h1*2*Lt+h2*Lsbi+h3*Lrbi)+2*b(i)*Wair*D/Wm/D*Lm/Uo+2*b(i)*Lair/Uo); %calculate 20 different hc=[.........]
end;
% figure
% plot(hc,b)
n=27;
I1 = I(1); In = I(n);
q=N*2*Wair*D*b; % calculation of flux linkage
for i=1:27
LL(i)=q(i)/I(i); %calculate 20 diffent inductance=[.........]
end; %LLi is inductance
figure
Ii=[I1:0.1:In]; %create a look up table to find a certain LLi for a given Ii, the length of the step is 0.1
LLi = interp1(I,LL,Ii);
plot(I,LL,'o',Ii,LLi); %plot the curve
hc1=hc(1);hcn=hc(n);
% figure
hci=[hc1:100:hcn]; %create a look up table to find a certain bi for a given hc, the length of the step is 0.1
bf = interp1(hc,b,hci);
% plot(hc,b,'o',hci,bf); %plot the curve
I0=input(' input current= ');
i=1;
while I0>Ii(i) % to choose Ii(i) from the look up table, make sure it is very closed to the input current I0. The errer is less than 0.1(the length of the step)
i=i+1;
end
LL0=LLi(i);
hc0=input(' input hc= ');
i=1;
while hc0>hci(i) % to choose hc(i) from the look up table, make sure it is very closed to the input
i=i+1;
end
bf0=bf(i);
bf=bf0;
fprintf (1,' The inductance LL0 = %3.4f \n',LL0)
w=input(' input Angular velocity(rpm)= ');
E=w*3.1415926*(Dsi+Lt)/60*D*bf*N;
Force=D*1.5*I0*bf*N*2;
Torque=Force*(Dro/2+Lm);
fprintf (1,' The voltage E = %3.4f \n',E)
fprintf (1,' The Force = %3.4f \n',Force)
fprintf (1,' The Torque = %3.4f \n',Torque)
case 2
bl=[0.00:0.02:0.4];
hl=1000*bl; %for linear material
plot(bl,hl,'b.')
for i=1:21 % bi are airgap flux densities
h1l=1000*bl(i)*Wair*D/Wt/D; % teeth
h2l=1000*bl(i)*Wair*D/Wsbi/D; % stator back iron
h3l=1000*bl(i)*Wair*D/Wrbi/D; % rotor back
h4l=1000*bl(i)*Wair*D/Wm/D; % Magnet
Il(i)=1/N*((h1l*2*Lt+h2l*Lsbi+h3l*Lrbi)+2*bl(i)*(Lair+Lm)/Uo);
end
for i=1:21 % calculate various H around the circuit for given airgap flux density
h1l=1000*bl(i)*Wair*D/Wt/D; % teeth
h2l=1000*bl(i)*Wair*D/Wsbi/D; % stator back iron
h3l=1000*bl(i)*Wair*D/Wrbi/D; % rotor back
h4l=1000*bl(i)*Wair*D/Wm/D; % Magnet
hcl(i)=1/2/Lm*((h1*2*Lt+h2*Lsbi+h3*Lrbi)+2*(Lm+bl(i))*Lair/Uo); %calculate 20 different hc=[.........]
end;
n=21
I1 = I(1); In = I(n);
ql=2*N*Wair*D*bl; % calculation of flux linkage
for il=1:21
LLl(i)=ql(i)/Il(i); %calculate 18 diffent inductance=[.........]
end; %LLi is inductance
figure
Iil=[I1:0.1:In]; %create a look up table to find a certain LLi for a given Ii, the length of the step is 0.1
LLil = interp1(Il,LLl,Iil);
plot(Il,LLl,'o',Iil,LLil); %plot the curve
hc1l=hcl(1);hcnl=hcl(n);
figure
hcil=[hc1l:100:hcnl]; %create a look up table to find a certain bi for a given hc, the length of the step is 0.1
bfl = interp1(hcl,bl,hcil);
plot(hcl,bl,'o',hcil,bfl); %plot the curve
I0l=input(' input current= ');
i=1;
while I0l>Iil(i) % to choose Ii(i) from the look up table, make sure it is very closed to the input current I0. The errer is less than 0.1(the length of the step)
i=i+1;
end
LL0l=LLil(i);
hc0l=input(' input hc= ');
i=1;
while hc0l>hcil(i) % to choose hc(i) from the look up table, make sure it is very closed to the input
i=i+1;
end
bf0l=bfl(i);
bfl=bf0l;
fprintf (1,' The inductance LL0 = %3.4f \n',LL0l)
w=input(' input Angular velocity(rpm)= ');
E=w*3.1415926*(Dsi+Lt)/60*D*bf*N*cos(30/180*3.1415926);
Force=D*1.5*I0l*bfl*N*2;
Torque=Force*(Dro/2+Lm);
fprintf (1,' The voltage E = %3.4f \n',E)
fprintf (1,' The Force = %3.4f \n',Force)
fprintf (1,' The Torque = %3.4f \n',Torque)
otherwise
disp('unknown type');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -