Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

ST_2

a=input('Enter the variable u want to check: ');
disp(a);
if(a>0) 
disp("given variable is positive");
else if(a<0)
disp("Given Variable is negative");
else
disp("The value of the variable is zero");
end
end

disp('Table of 5')
i = 1;
while(i <= 10) 
    disp(5*i)
    i = i+1;
end

matrix=rand(3,3);
matrix
matrixtranspose=matrix;
for i=1:3
 for j=1:3
  matrixtranspose(j,i)=matrix(i,j);
  end
end
disp("Transpose of the matrix using loop");
matrixtranspose

matrix1=[1 2 3;4 5 6;7 8 9]
matrix2=matrix1;
matrix2
matrixaddition=matrix2;
 for i=1:3
  for j=1:3
   matrixaddition(i,j)=matrix1(i,j)+matrix2(i,j);
   end
  end
disp("Addition of matrix1 and matrix2 is")  
 matrixaddition

matrix1
matrix2
matrixmultiplication=[0 0 0;0 0 0;0 0 0];
for i=1:3
 for j=1:3
  total=0;
   for k=1:3
    total = total + matrix1(i,k)*matrix2(k,j);
    end
    matrixmultiplication(i,j)=total;
  end
 end
 disp("Multiplication Of Matrix1 and Matrix2 is")
 matrixmultiplication

 x=input('Enter the value u want to reverse: ');
 disp(x);
 z=x;
 y=0;
 while(x>0)
  r=rem(x,10);
  y=10*y+r;
  x=(x-r)/10;
  end
 disp('Reverse of ');
 disp(z);
given=input('Enter the number u want to get sum of first and last digit: ');
disp(given);
x=numel(num2str(given));
fprintf('\n');
first_digit=floor(given/10^(x-1))
last_digit=mod(given,10)
total = first_digit + last_digit;
fprintf('The Summation Of First and Last digit Of number %d',given);
fprintf(' is %d',total);
fprintf('\n');

given=input('Enter the number to find larget digit present in it: ');
disp(given);
largest_digit=0;
while(given>0)
 r=mod(given,10);
 if(r>largest_digit)
 largest_digit=r;
 end
 given=floor(given/10);
end
largest_digit

matrix1
matrix2
user_input_col_1=input('Enter first column')
user_input_col_2=input('Enter second column')
summation_of_given_two_cols=matrix1(1:3,user_input_col_1:user_input_col_1)+matrix2(1:3,user_input_col_2:user_input_col_2)


user_input_row_1=input('Enter first row')
user_input_row_2=input('Enter second row')
summation_of_given_two_rows=matrix1(user_input_row_1:user_input_row_1,1:3)+matrix2(user_input_row_2:user_input_row_2,1:3)

l=3;
matrix_1=[5 10 15;7 14 2;1 15 3]
disp('Displaying indices of matrix divisible by 5 and 7');
for row=1:l
 for col=1:l
  if(mod(matrix_1(row,col),5)==0 || mod(matrix_1(row,col),7)==0) 
    row 
    col
    disp("\n")
    end
    end
end


matrix_1
disp('Prime Numbers With their Indices')
for row=1:3
 for col=1:3
  count=0;
  l=matrix_1(row,col);
  for t=1:l
   if(mod(matrix_1(row,col),t)==0)
    count=count+1;
    end
  end
   if(count==2)
    prime=matrix_1(row,col)
    row
    col
   fprintf('\n');
    end
  end    
end


Array_With_Duplicate_Elements=[1, 2, 3, 3 ,5 , 8, 7, 8, 9]
[m,n]=size(Array_With_Duplicate_Elements);
disp('Initial Size of Array with duplicate elements');
n
disp('Now With No Duplicate Elements Size is');
Array_With_No_Duplicate_Elements=unique(Array_With_Duplicate_Elements);
[m,n]=size(Array_With_No_Duplicate_Elements);
n
Array_With_No_Duplicate_Elements


s=1;
user_input=input('Enter the number to check whether it is perfect or not:')
disp(user_input);
fprintf('\n');
for r=2:floor(sqrt(user_input))
  if(mod(user_input,r)==0)
   if(r*r~=user_input)
    s=s+r+user_input/r;
    else
    s=s+r;
    end    
  end
end
if(s==user_input & (user_input~=1))
 disp("Given Number Is A Perfect Number");
else
 disp("Given Number Is Not A Perfect Number");
end

disp("Enter a number Greater than 3");
iterations=input('Enter the number upto which u want to see series: ');
disp(iterations);
fprintf('\n');
Fibonacci_Series=[1 1];
for i=1:iterations-2
  Fibonacci_Series(end+1)=Fibonacci_Series(end)+Fibonacci_Series(end-1);
  end;
  Fibonacci_Series

fprintf('\n');


a= [1, 1,1; 1,1,1; 1, 1, 1]
[r,c]=size(a);

sumr=zeros(r);
sumc=zeros(c);
sumd=zeros(2);

i=0;j=0;
for i=1:r
    sumr(i)=0;
    for j=1:c
      sumr(i)=sumr(i)+a(i,j);
    end
end    
for j=1:c
    sumc(j)=0;
    for i=1:r
      sumc(j)=sumc(j)+a(i,j);
    end
end 
for i=1:r
    for j=1:c
      if(i==j)
          sumd(1)=sumd(1)+a(i,j);
      end    
      if(i+j==r+1)
          sumd(2)=sumd(2)+a(i,j);
      end    
    end
end 

t1=0;
for i=1:r-1
     if(sumr(i)==sumr(i+1))
         continue;
     else
         t1=1;
         break;
     end
end
t2=0;
for i=1:c-1
     if(sumc(i)==sumc(i+1))
         continue;
     else
         t2=1;
         break;
     end
end
t3=0;
for i=1:1
     if(sumd(i)==sumd(i+1))
         continue;
     else
         t3=1;
         break;
     end
end
if(t1==0&&t2==0&&t3==0&&sumr(1)==sumc(1)&&sumc(1)==sumd(1))
    fprintf('it is a magic matrix\n');
else
    fprintf('not a magic matrix\n');
end    


fprintf('\n');
for r=1:4
  for t=1:r
fprintf('* ');
  end
fprintf('\n');
end


Value=5;
for i=1:5
  for j=1:i
   fprintf('%d ' , Value);
   end
   disp("\n");
  Value=Value-1;
end

  
character='A';
for i=1:4
  for j=1:i
   fprintf('%c ' ,character);
    character=character+1;
   end
  disp("\n");
end

DESIGN 1PHASA 1HP

%Design of 1hp,230V,1-ph 1M
%<--------Calculation of Main Dimensions (Part-1)------->
hp=1;%output power 
V=230;%voltage 
P=2;%kutub 
N=2860;%RPM 
hz=50; %frekuensi
kt=1.42; %Type constant for Split-phase type (Kt)
LbyDO=0.3;%%Assuming L/DO ratio (LbyDO) = 0.3,
ki=0.93; %Considering factor staking (ki)
S1=24;%Assuming Stator slots(SI)
S2=30;%Slot Rotor 
%Assumptions
h10=0.07; %Assuming LIP depth of the tip at slot opening-(hl0)
h11=1.3*h10; % WEDGES depth of the mouth (h11)
cdm1=4.5;%main winding current density 
Bt=1.35; %STATOR Flux density tooth 
Bc=1.15; %STATOR Flux density core 
Par1=2;%For_MAIN_Winding_Parallel_Branches
Par2=1;%For_Auxiliary_Winding_Parallel_Branches
b20=0.075;%ROTOR width opening 
h20=0.08; %ROTOR Lip 
h21=1.3*h20;%ROTOR wedges
Rh14=2;%ROTOR Depth of the Slot 
Dm=0.07; 
ERW=1;%ROTOR End Ring Width 
Cde=4;%ROTOR Assuming_Current_density_in_end_ring_cde
K1=1.6; %Assuming Transmission ratio (K)
Kwa=0.83; %winding factor for Auxiliary Wdg (Kwa)
mf=0.95; %persentatsi Area of CS of copper in the conductor of rotor
dc1=2.6456;%Stator Core depth(dc1)
HZ=[25 30 40 45 50 60]; 
KF=[ 0.865 0.885 0.923 0.94 0.96 1];
kf=interp1(HZ,KF,hz,'spline'); %Frequency Constant (Kf)
POLES=[2 4 6 8];
OPTC=[0.32 0.22 0.19 0.17];
CO=interp1(POLES,OPTC,P,'spline');%Output coefficient for 2 pole motor (CO)
DIBYDO=[0.5 0.59 0.64 0.67];
DibyDO=interp1(POLES,DIBYDO,P,'spline');
DOsqL=16.5*CO*hp/N*kf*kt*1e6; 
D01=(DOsqL/LbyDO)^(1/3);
DO=floor(D01); 
L=LbyDO*DO; %Stator Core Length (L)
Di1=DibyDO*DO; 
Di=ceil(Di1); %Stator core Inner Dia (Di)
SP=S1/P;%Slots/Pole (SP)
if P==P bt1a=(1.1+0.032*Di)*Di/S1; % width of tooth (bt1)
bt1=floor(bt1a*100)/100;end;% width of tooth (bt1)
SS=[8 12 18 24 36 48];%Lubang Slot 
B10=[0.176+0.0175*Di 0.140+0.0175*Di 0.104+0.0175*Di 0.068+0.0175*Di 0.038+0.0175*Di 0.0175*Di];%Slot opening 
b10=interp1(SS,B10,S1,'spline'); %Slot opening at tip (b10)
dcl=Bt/Bc*(S1*bt1)/(pi*P);% St. core depth(dcI)
b11=pi*(Di+2*h10+2*h11)/S1-bt1;% Width of Slot at top section (b 11)
h14=DibyDO*(DO-Di)-(h10+h11+dcl); %Depth of the Slot (h14)
alfa=180/S1;%Half-Slot angle (alfa) 
b13=b11+2*h14*tan(alfa*pi/ 180); %Slot-width at the bottom (b13)
STab=h14*(b11+b13)/2;%ROTOR_Area_of_Slot
Lg=0.013+0.0042*Di/sqrt(P);%Length of Air-gap (Lg)
%<--------Design of Main Winding(Part-2)--------->

Ncpp=S1/(P*2);%STATOR No of Coils/pole Ncpp
sum1=0; 
sum2=0; 
sum3=0; 
sum4=0; 
sum5=0;
for i=1:Ncpp; 
y1=(SP-(i-1)*2)/(SP+1); 
Kp(i)=sin(y1*pi/2);
sum1=sum1+Kp(i);end;
for i=1:Ncpp;
PTm(i)=Kp(i)/sum1*100;
sum2=sum2+PTm(i);end;
for i=1:Ncpp;%No. of Coils/pole (Ncpp) 
sum3=sum3+Kp(i)*PTm(i);end;% Winding factor (Kwm) =:sum+Kp(n) x T(n)
Kwm=sum3/sum2;%Winding factor (Kwm)
Li=ki*L; %Net iron length in core (Li)
At=bt1*Li*SP; %Area of tooth (At)
FI=0.637*At*Bt*1e-4; %FluxlPole (FI)
Tm1=0.95*V/(4.44*hz*FI*Kwm);
Tm=ceil(Tm1/2)*2;%No of series turns in Main winding (Tm)
Nm=Tm*2; %Total Conductors in Main winding (Nm)
Tppm=Tm/P; %No. of series turns/pole in Main winding (Tppm)
for i=1:Ncpp;
Tc1(i)=Tppm*PTm(i)/100; 
Tc(i)=round(Tc1(i));
sum4=sum4+Tc(i);end;
corr=Tppm-sum4; 
Tc(Ncpp)=corr+Tc(Ncpp);
sum4=sum4+corr;
HP=[0.05 0.1 0.25 0.5 0.75 1 1.5 2 2.5 3.5 4 4.5]; 
EFF=[0.35 0.44 0.58 0.65 0.68 0.7 0.72 0.74 0.76 0.78 0.80 0.82]; 
PF=[0.45 0.5 0.56 0.62 0.64 0.66 0.68 0.70 0.72 0.74 0.76 0.78]; 
effa=interp1(HP,EFF,hp,'spline');%efficiency (effa)
pfa=interp1(HP,PF,hp,'spline');%Power factor (pfa)
Im=hp*746/(effa*V*pfa);%Current in main wdg (Im)
Amc1=Im/cdm1;
dmc1=sqrt(4*Amc1/pi);
DSWG=[7.62 7.1 6.4 5.89 5.38 4.88 4.47 4.06 3.66 3.25 2.95 2.64 2.31 2.03 1.83 1.63 1.42 1.22 1.02 0.914 0.813 0.711 0.610 0.559 0.508 0.457 0.417 0.376 0.345 0.315];
for i=1:30; 
if dmc1 >= DSWG(i) continue;end;
dmc=DSWG(i); end;
dmcins=dmc+0.075;%Dia of insulated conductor (dmcins)
Amc=pi*dmc^2/4; %Area of CS of copper in the conductor (Arnc)
cdm=Im/Amc;%Current density main. winding (cdm)
if cdm <2.8||cdm >4.5;end;
Socm=Tc(1)*pi*dmcins^2/4/100; %Space occupied by 44 insulated conductors in the slot (Socm) 
Asg=(h11*(b10+b11)+h14*(b11+b13))/2; %Ares ofCS of Gross Slot (Asg)
Sfsm=Socm/Asg; 
if Sfsm >0.5;end;%Space factor of the slot (Sfsm)
Hs=h10+h11+h14; %Height of Stator Slot (Hs)
for i=1:Ncpp; 
Lmt(i)=8.4*(Di+Hs)/S1*(SP-(i-1)*2)+2*L;
sum5=sum5+Lmt(i)*Tc(i);end; 
Lmtm=sum5/sum4;%Mean Length of turn of main wdg (Lmtm)
Rm=0.021*Lmtm*Tm/(Amc*100); %Resistance of Main wdg at 75° (Rm)
Pcus=Im^2*Rm;%Copper loss in main wdg (Peus)
Wcum=Lmtm*Amc*Tm*8.9e-5;
%<---design of Rotor(Part-3)->\

dc2=0.95*dc1; %Rotor Core depth (dc2)
Dr=Di-2*Lg;%Rotor outer dia (Dr)
bt2=0.95*S1*bt1/S2;%Slot Width of Rotor

Rb11=pi*(Dr+2*h20+2*h21)/S2-bt2;% Width of Slot at top section (Rb11)
alfa1=180/S2;%Half-Slot angle (alfa) 
Rb13=Rb11-2*Rh14*tan(alfa1*pi/ 180); %Slot-width at the bottom (Rb13)
Rsab=Rh14*(Rb11+Rb13)/2;%ROTOR_Area_of_Slot
Rhs=Rh14+h20+h21;%Total Depth of the Slot 
Dri=Dr-2*(Rhs+dc2);%diameter internal of Rotor

r21=(pi*(Dr-2*h20)-S2*bt2)/(2*(S2+pi)); %Radius of round slot (r21)
drc1=2*r21-0.038;%-----------------------------------------
for i=1:15;
if drc1*10>=DSWG(i) continue;end;
drc=DSWG(i); end;%Dia of rotor conductor (drc)
Ab=pi *drc^2/4; %Area of Bar conductor (Ab)
Ab1=Ab/10;%Area of Bar conductor (Ab)
Nb=S2; %Slot bar rotor
Aer=Ab/pi*Nb/P;%Area 0f CS 0f end ring 
Aer1=Aer/100;%Area 0f CS 0f end ring 
Ie=Aer*Cde;%End_ring_Current_A_Ie
ERH=Aer1/ERW;%End Ring Height 
Lb=L+(ERH*2); %Length of Bar leonduetor (Lb)
%Resistance of Rotor wdg at 75° referred to stator main wdg (R2md)
R2md=P*Nm^2*Kwm^2*0.021*(Lb/(100*Ab*Nb)+2/pi*Dm/P^2/Aer);
I2d=Im*pfa; %Equivalent Rotor current (I2d)
Pcur=I2d^2*R2md; %Rotor Copper Loss (Pcur)
Wcur=Lb*Ab*Nb*8.9e-5;%Weight of Rotor Copper (Wcur)
Wtr=((pi*Dr^2/4)-(S2*pi*r21^2))*L*7.8*1e-3;%Weight or Rotor Steel (Wtr)
%<-Amp-Turns Calculation (Part-4)------------>\n');

SobyAg1=b10/Lg;
SOBYAG=[0 1 2 3 4 5 6 7 8 9 10 11 12];
CC=[0 .19 .34 .46 .55 .61 .66 .71 .75 .79 .82 .86 .89];
plot (SOBYAG, CC); grid; xlabel ('Slot-Opening/Air-gap -->'); 
ylabel ('Carters Coefft -->'); 
title ('Carter coefft for Semi closed Slot');
%semi-closed-slot
K01=interp1(SOBYAG,CC,SobyAg1,'spline');%Carter Coefft. read from Fig. 8.1
%corresponding to the ratio = 5.6911 is (KO1)
sp1=pi*Di/S1; %Slot pItch (spl)
Kgs=sp1/(sp1-b10* K01);%Stator Slot coefft (Kgs)
SobyAg2=b20/Lg; 
K02=interp1(SOBYAG,CC,SobyAg2,'spline');
sp2=pi*Dr/S2; %Slot pitch ( sp 2)
Kgr=sp2/(sp2-b20*K02); %Stator Slot coefft (Kgr)
Kag=Kgs*Kgr; %Air gap coefft(Kag)
Lgd=Kag*Lg;%Air Gap length, effective (Lgd)
Aga=pi*Di/P*L;%Arr gap area(Aga)
Bag=FI*1e4/0.637/Aga;
ATag=0.796*Bag*Kag*Lgd*1e4;%Amp Turns for the gap (ATag)
BB=[ .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 ] ; %Tesla 
HH=[18 28 38 48 67 80 95 120 140 180 220 295 390 580 1000 2200 5000 9000 16000 24000];
semilogx (HH, BB); grid; xlabel ('AT/m -->'); 
ylabel ('Fluxdensity(T) -->'); 
title ('Magnetization curve for Lohys steel');
At1=Li*bt1*S1/P;%Area ofStteeth per Pole (At1)
Bt1=FI*1e4/0.637/At1;%Flux density in St tooth (Btl)
if Bt1 <1.3||Bt1 >1.7; end;
att1=interp1(BB,HH,Bt1,'spline'); 
Lfpt1=h14+h11+h10;%Length of Flux Path in St tooth (Lfpt1)
ATT1=att1*Lfpt1/100;%Amp-Turns for St-Teeth (ATT1)
Ac1=Li*dc1;%Area for St.Core (Acl)
Bc1=FI*1e4/2/Ac1; %Flux density in St Core (Bc1) 
atc1=interp1(BB,HH,Bc1,'spline');
Lfpc1=pi*(DO-dc1)/2/P; %Length of Flux Path in St Core (Lfpc1)
ATC1=atc1*Lfpc1/100;%Amp-Turns for St-Core (ATCl)
At2=Li*bt2*S2/P;
Bt2=FI*1e4/0.637/At2;
att2=interp1(BB,HH,Bt2,'spline'); %AT/m (att2)
Lfpt2=2*r21+h20;%Length of Flux Path in Rot tooth (Lfpt2)
ATT2=att2*Lfpt2/100;%Amp-Turns for Rot-Teeth (A TT2)
Ac2=Li*dc2; %CS Area for Rot Core (Ac2)
Bc2=FI*1e4/2/Ac2; 
atc2=interp1(BB,HH,Bc2,'spline');%AT/m (atc2)
Lfpc2=pi*(2*r21+h20+dc2)/2/P; %Length of Flux Path in Rot Core (Lfpe2)
ATC2=atc2*Lfpc2/100;%Amp-Turns for Rot-Core (ATC2)
ATT=ATag+ATT1+ATC1+ATT2+ATC2; %Total AT required (ATT)
satf=ATT/ATag;%SaturatIon factor (staf )
%'<--Leakage Reactances(Part-5)------------->\n');
skew=15; 
Kp=0.97; %Assumption
sum6=0; 
for i=1:Ncpp;
sum6=sum6+Tc(i)^2; end;
Cx=sum6/Tppm^2*S1/(Kwm^2*4 *P);
B11byB13=[0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8];
CONSTANT=[0.63 0.53 0.46 0.41 0.36 0.33 0.3 0.27 0.25 0.23 0.21 0.2 0.18 0.17]; 
plot (B11byB13, CONSTANT); grid; xlabel ('b11/b13 -->'); 
ylabel ('Constant(A) -->'); 
title ('Ratio of b11/b13 vs Constant (A)');
%---------------Leakage Reactance Calculation (Part-5)------------------
b11byb13=b11/b13;%Ratio (bllb b13)
constA=interp1(B11byB13,CONSTANT,b11byb13,'spline');
Ks1=constA*h14/b13+h10/b10+2*h11/(b10+b11); %Stator Slot constant (Ks 1)
Ks2=h20/b20+0.623;%Rotor Slot constant (Ks2)
Ks=Ks1*Cx+S1/S2*Ks2; %Slot leakage Constant (Ks)
Z=Nm; 
Kx=2*pi*hz*(Z*Kwm)^2*1e-8;%Factor (Kx)
Xs=Kx*2.512*Ks*L/S1; %Slot Leakage Reactance (Xs)
Lmd1=pi*Di/S1;
Lmd2=pi*Dr/S2;
bt10=sp1-b10; %Stator tooth face (bt10)
bt20=sp2-b20; %Rotor tooth face (bt20)
Kzz=(bt10+bt20)^2/(4*(Lmd1+Lmd2));%ZIg Zag constant (Kzz)
Xzz=Kx*Kzz*0.838*L/(S1*Lg);%ZigZag Leakage Reactance (Xzz)
sum7=0; 
for i=1:Ncpp; 
sum7=sum7+Tc(i)*(SP-(i-1)*2);end;
ACT1=sum7/Tppm; 
ACT =floor(ACT1); %Average Coil Throw of the coils of stator winding (ACT)
De=Di+h14+2* (h10+h11) ;%Dia at centre ofSt slot (De)
Xe=Kx*1.236*De*ACT/S1/P; %End Leakage Reactance (Xe)
Km=Aga/(Lgd*satf*P);%Factor (Km)
AvSP=[4 8 12 16 20 24];
BLC=[3.2 1.8 1.4 1.25 1.15 1.1];
plot (AvSP, BLC); grid; xlabel ('Average Slot Pitch -->'); 
ylabel ('Belt Leakage constant) -->'); 
title('Av.Slot pitch Vs Belt Leakage Constant');
Nsp=(S1+S2)/2/P; %Corresponding to (Nsp)
Kb=interp1(AvSP,BLC,Nsp,'spline');%Belt Leakage constant (Kb)
Xb=0.000929*Km*Kb*Kx; %Belt Leakage Reactance (Xb)
Q=0.25*(skew/100)^2;
Xsk=0.2546*Km*Kp*Q*Kx; %Skew Leakage reactance (Xsk)
XLm=Xs+Xzz+Xe+Xb+Xsk;%Total Leakage Reactance of Main Wdg (XLm)
Csk=sin(skew/2*pi/180)/(pi*skew/360); %Skew factor (Csk)
Xm=Kx*0.2546*Km*Csk;%Magnetizing Reactance.(Xm)
X0=Xm+XLm/2;%Open Circuit Reactance (XO)
Imu=V/X0; %Magnetizing Current (lmu)
%'<-----------Design of Auxiliary Winding(Part-6)--------->\n');
Ta1=K1*Tm*Kwm/Kwa;
Ta=ceil(Ta1/2)*2; %For_Auxiliary_Winding_Number_of_Turns=[Ta]
Na=Ta*2;
Tppa=Ta/P;
sum11=0; 
sum12=0; 
sum13=0; 
sum14=0; 
sum15=0;
Na=Ta*2; 
Tppa=Ta/P;%Turns per pole In Aux.wdg (Tppa)
Ncpp1=S1/(P*2);%ROTOR No of Coils/pole Ncpp1
for i=1:Ncpp1;
y1=(SP+1-(i-1)*2)/(SP+1);
Kp(i)=sin(y1*pi/2);
sum11=sum11+Kp(i);end; 
sum12=0; 
for i=1:Ncpp1; 
Tca1(i)=Tppa*Kp(i)/sum11;
Tca(i)=round(Tca1(i));
sum12=sum12+Tca(i);end; 
corr=Tppa-sum12;
Tca(Ncpp1)=corr+Tca(Ncpp1); 
sum12=sum12+corr;
for i=1:Ncpp1; 
sum13=sum13+Kp(i)*Tca(i);end; 
Kwa=sum13/Tppa;%Winding factor (Kwa)
K=Ta*Kwa/Tm/Kwm; %ActuaI TransmisIn ratIo (K)
sum15=0;
for i=1:Ncpp1;
Lmta1(i)=8.4*(Di+Hs)/S1*(SP+1-(i-1)*2)+2*L;
sum15=sum15+Lmta1(i)*Tca(i);end; 
Lmta=sum15/Tppa;%Mean Length of turn of Auxiliary wdg (Lmta)
%Assuming area ofCS of conductor of Aux. 
%Wdg is 12% of that of main winding,(mf) = 0.12
Aac1=mf*Amc; %Area ofCS (Aac)
dac1=sqrt(4*Aac1/pi);%DIameter of conductor (dac 1)
DSWG1=[7.62 7.1 6.4 5.89 5.38 4.88 4.47 4.06 3.66 3.25 2.95 2.64 2.31 2.03 1.83 1.63 1.42 1.22 1.02 0.914 .813 .711 .610 .559 .508 .457 .417 .376 .345 .315];
for i=1:30; if dac1 >= DSWG1(i) continue; end;
dac=DSWG1(i);end;%suitable dia of bare conductor in aux.wdg (dac) 
Aac=pi*dac^2/4; %Area ofCS of copper in the conductor (Aac)
R1a=0.021*Lmta*Ta/(Aac*100);%Resistance of Aux. wdg at 75° (RIa)
Rdr=K^2*R2md; %Rotor Resistance in terms of Aux.Wdg (Rdr)
Rat=R1a+Rdr; %Total resistance in terms of Aux.wdg (Rat)
Rmt=Rm+R2md; %Total resistance in terms of Main.wdg(Rmt) 
XLa=K^2*XLm;%Total Leakage Reactance in terms of Aux. wdg (XLa)
ZLm=sqrt(Rmt^2+XLm^2); %Locked Impedance of main winding (ZLm)
ZLa=sqrt(Rat^2+XLa^2);%Locked Impedance of Aux winding (ZLa)
Tqst=P*K*R2md*V^2/(2*pi*hz)*(Rat*XLm-Rmt*XLa)/ZLm^2/ZLa^2;%St artm. g T orque (Tqst)
Isa=V/ZLa;%Locked Rotor Current in StartinglAux.Wdg (Isa)
Ism=V/ZLm; %Locked Rotor Current in Main. W dg (Ism)
Ist=Isa+Ism;
cda=Isa/Aac; %Current Density in Aux.Wdg (cda)
if cda >30; end; 
Wcua=Lmta*Aac*Ta*8.9e-5;%Weight of Aux Wdg copper (Wcua)
%'<-------Weights, LossesandPerformance using Eq.Ckt(Part-7)------->\n');
FD=[0.8 1.2 1.6 2 2.4];
WPKG=[7 15 23 34 50]; % for 0.5 mm
plot (FD, WPKG); grid; xlabel ('Flux.Density(T) -->'); 
ylabel ('Loss(W/Kg) -->'); 
title ('Core Loss for 0.5 mm Steels');
WpKgt=interp1(FD,WPKG,Bt1,'spline'); 
WtT=At1*P*Lfpt1*7.8*1e-3;%Wt. of teeth (WtT)
Pist=WpKgt*WtT;%Iron loss in Tooth (Pist)
WpKgc=interp1(FD,WPKG,Bc1,'spline');%Losses read from Fig. 8.5 (WpKgc)
Dmc=DO-dc1; %Mean Diameter of Core (Ornc)
WtC=pi*Dmc*Ac1*7.8*1e-3;%Wt of core (WtC)
Pisc=WpKgc*WtC; %Iron loss in Core (Pist)
Pi=1.9*(Pist+Pisc); 
Pfw=0.02*hp*746;%Assuming 2% of output, Friction and Windage Losses (Pfw)
TotWt=1.01*(Wcum+Wcua+WtT+WtC+Wcur+Wtr); 
KgPhp=TotWt/hp;%Specific wt. of active material (KgPhp)
%------Solution by Equivalent Circuit------->
Ns=120*hz/P; 
s=(Ns-N)/Ns;
Zl=Rm+XLm/2*j; 
Z2a=R2md/(2*s)+XLm/4*j; 
Z2b=Xm/2*j; 
Z3a=R2md/(2*(2-s))+XLm/4*j; 
Z3b=Xm/2*j;
Z2=Z2a*Z2b/(Z2a+Z2b); 
Z3=Z3a*Z3b/(Z3a+Z3b); 
Zeq=Zl+Z2+Z3;
I1=V/Zeq;
ang=angle(I1)*180/pi; 
pfx=cos(ang*pi/180); % Total Current (lIm) = 5.9409 A and Power factor (pfx)
I1m=abs(I1); 
If=I1*Z2b/(Z2a+Z2b); %Current in Forward rotor (If)
Ifm=abs(If);%Magnitude ofIf(Ifm)
Ib=I1*Z3b/(Z3a+Z3b); %Current in Back ward rotor (Ib)
Ibm=abs(Ib);%Magnitude ofIb (Ibm)
Tf=Ifm^2*R2md/(2*s); %Forward Torque (Tf)
Tb=Ibm^2*R2md/(2*(2-s)); %sync-watts Back-ward Torque (Tb)
Tr=Tf-Tb; % Resultant Torque (Tr)
TqFL=Tr-(Pi+Pfw); %Net motor Torque (TqFL)
Popt=TqFL*(1-s); %Motor Net output (Popt)
Pinp=V*I1m*pfx;
eff=Popt/Pinp*100;%Efficiency (eft)
%---Extra Program for Plotting Slip vs Torque ------------->

%<----------Calculation of Main Dimensions(Part-l )------------->
Output_Power_hp=[hp]
Voltage=[V]
Ampare=[I1m]
efisiensi=[effa]
power_Faktor=[pfa]
Frekuensi=[hz]
Rpm=[N]
No_of_Poles_P=[P]
Output_Coefft_CO=[CO]
DOsqL=[DOsqL]
asumsi_L_Do_Ratio_LbyDO=[LbyDO]
FluxI_Pole_Wb_FI=[FI]
Flux_Density_Air_Gap1=[0.637*Bag]
Flux_Density_Air_Gap2=[Bag]
Main_Dimensions_Freq_Constant_kf=[kf]
Main_Dimensions_Type_Constant_Split_phase_kt=[kt]
Main_Dimensions_Outer_dia_of_Stator_cm_DO=[DO]
Main_Dimensions_Inner_dia_of_Stator_cm_Di=[Di]
Main_Dimensions_Gross_Length_of_Stator_cm_L=[L]
Main_Dimensions_No_of_Stator_Slots_S1=[S1]
Main_Dimensions_Current_density_main_winding_cdm=[cdm]
Main_Dimensions_Area_of_copper_conductor_Amc=[Amc]
Main_Dimensions_Area_of_Slot_STab=[STab]
Main_Dimensions_Ht_Lip_hs0_cm=[h10]
Main_Dimensions_Ht_Wedge_hs1_cm=[h11]
Main_Dimensions_SLOT_Height_hs2_cm=[h14]
Main_Dimensions_TOP_WIDTH_Bs0_cm=[b10]
Main_Dimensions_SLOT_WIDTH_bs1_cm=[b11]
Main_Dimensions_SLOT_WIDTH_bs2_cm=[b13]
Main_Dimensions_Total_Depth_of_the_Slot=[Hs]
Main_Dimensions_Air_gap_Length_cm_Lg=[Lg]
%<-----------Design of Main Winding(Part -2 )-------------------->
For_Main_Winding_Number_of_Turns=[Tm]
Main_Phase_Winding_Factor=[Kwm]
For_Main_Winding_Parallel_Branches=[Par1]
Main_Winding_No_of_Coils_per_pole_Ncpp=[Ncpp]
Main_Winding_Pitch_Factors_of_6_coils_Ncpp_Kp=[Kp]
Main_Winding_Pecentage_Turns_of_6_coils_perc_Ncpp_PTm_sum2=[PTm sum2]
Main_Winding_Factor_Kwm=[Kwm]
Main_Winding_No_of_Turns_in_6_coils_Ncpp_Tc_Tppm=[Tc Tppm]
Main_Winding_Current_in_Main_Wdg_A_Im=[Im]
Main_Winding_Conductor_dia_cm_and_CS_area_total_dmc_Amc=[dmc Amc]
Main_Winding_Current_dens_in_Main_wdg_Alsq_mm_cmd=[cdm]
Main_Winding_Gross_Slot_Area_sq_cm_Asg=[Asg]
Main_Winding_Space_Occupied_in_Coil_by_44strands_sq_cm_Tc1_Socm=[Tc(1) Socm]
Main_Winding_Space_factor_of_the_slot_Sfsm=[Sfsm]
Main_Winding_Mean_Tum_Lengths_of_6_coils_cm_Ncpp_Lmt=[Ncpp Lmt]
Main_Winding_Mean_Tum_Lengths_of_Total_Wdg_cm_Lmtm=[Lmtm]
Main_Winding_Resistance_of_Main_Wdg_ohm_Rm=[Rm]
Main_Winding_Copper_Losses_of_Main_W_dg_W_Pcus=[Pcus]
Main_Winding_Wt_of_Main_W_dg_Copper_Kg_Wcum=[Wcum]
%<----------Design of Rotor(Part -3 )---------------------------->
DESIGN_ROTOR_Air_gap_Length_cm_Lg=[Lg]
DESIGN_ROTOR_Gross_Length_of_Rotor_cm_L=[L]
DESIGN_ROTOR_Outer_dia_of_Rotor_cm_Dr=[Dr]
DESIGN_ROTOR_Diameter_internal_of_Rotor=[Dri]
DESIGN_ROTOR_Core_depth_cm_dc2=[dc2]
DESIGN_ROTOR_No_of_Rotor_Slots_S2=[S2]
DESIGN_ROTOR_Tooth_width_at_min_section_cm_bt2=[bt2]
DESIGN_ROTOR_Radius_of_round_slot_cm_r21=[r21]
DESIGN_ROTOR_Conductor_diameter_Bar_of_Rotor_cm_drc=[drc]
DESIGN_ROTOR_Area_of_Bar_conductor_Ab=[Ab1]
DESIGN_ROTOR_Area_of_Slot_Rsab=[Rsab]
DESIGN_ROTOR_Ht_Lip_hs0_cm=[h20]
DESIGN_ROTOR_Ht_Wedge_hs1_cm=[h21]
DESIGN_ROTOR_SLOT_Height_hs2_cm=[Rh14]
DESIGN_ROTOR_TOP_WIDTH_Bs0_cm=[b20]
DESIGN_ROTOR_SLOT_WIDTH_bs1_cm=[Rb11]
DESIGN_ROTOR_SLOT_WIDTH_bs2_mm=[Rb13]
DESIGN_ROTOR_Total_Depth_of_the_Slot=[Rhs]
DESIGN_ROTOR_End_ring_Current_A_Ie=[Ie]
DESIGN_ROTOR_Assuming_Current_density_in_end_ring_Cde=[Cde]
DESIGN_ROTOR_Area_of_end_ring_cm2_Aer=[Aer1]
DESIGN_ROTOR_Length_of_Bar_cm_Lb=[Lb]
DESIGN_ROTOR_End_Ring_Width_ERW=[ERW]
DESIGN_ROTOR_End_Ring_Height_ERH=[ERH]
DESIGN_ROTOR_Resist_refered_to_Main_Wdg_ohm_R2md=[R2md]
DESIGN_ROTOR_Equivalent_Rot_Current_A_I2d=[I2d]
DESIGN_ROTOR_Copper_Losses_W_Pcur=[Pcur]
DESIGN_ROTOR_Wt_of_Rot_Copper_Kg_Wcur=[Wcur]
%<---------------Amp-Turns Calculation (Part-4 )---------------->
Amp_Turns_Calculation_Stator_Gap_Coefft_Kgs=[Kgs]
Amp_Turns_Calculation_Rotor_Gap_Coefft_Kgr=[Kgr]
Amp_Turns_Calculation_Air_Gap_Coefft_Kag=[Kag]
Amp_Turns_Calculation_Air_Gap_Effectivelength_cm_Lgd=[Lgd]
Main_Phase_Winding_Factor=[Kwm]
Aux_Phase_Winding_Factor=[Kwa]
Amp_Turns_Calculation_Air_Gap_Flux_density_T_Bag_ATag=[Bag ATag]
Amp_Turns_Calculation_Stator_tooth_Flux_density_T_and_AmpTurns_Bt1_ATT1=[Bt1 ATT1]
Amp_Turns_Calculation_Stator_Core_Flux_density_T_and_AmpTums_Bc1_ATC1=[Bc1 ATC1]
Amp_Turns_Calculation_Rotor_tooth_Flux_density_T_and_AmpTl_Lms_Bt1_ATT2=[Bt1 ATT2]
Amp_Turns_Calculation_Rotor_Core_Flux_density_T_and_AmpTums_Bc1_ATC2=[Bc1 ATC2]
Amp_Turns_Calculation_Total_AmpTums_and_Saturation_factor_ATT_satf=[ATT satf]
%<-----------------Leakage Reactances(Part -5 )------------------>
Slot_Leakage_Reactance_Xs_ohms=[Xs]
Zig_Zag_Reactance_Xzz_ohms=[Xzz]
End_Leakage_Reactance_Xe=[Xe]
Belt_Leakage_Reactanc_Xb=[Xb]
Skew_Leakage_Reactance_Xsk=[Xsk]
Total_LeakageReactance_XLm=[XLm]
Magnetizing_Reactance_Xm=[Xm]
Open_Circuit_Reactance_Xe=[Xe]
Magnetizing_Current_Imu=[Imu]
%<--------------Design of Auxiliary Winding(Part-6)------------>
For_Auxiliary_Winding_Number_of_Turns=[Ta]
For_Auxiliary_Winding_Parallel_Branches=[Par2]
Auxiliary_Phase_Winding_Factor=[Kwa]
Auxiliary_No_of_Coils_per_pole_Ncpp1=[Ncpp1]
Auxiliary_Pitch_Factors_of_coils_Ncpp_Kp=[Kp]
Auxiliary_No_of_Turns_in_coils_Ncpp_Tca_Tppa=[Tca Tppa]
Auxiliary_Winding_Factor_Kwa=[Kwa]
Auxiliary_Transformation_Ratio_K=[K]
Auxiliary_Mean_Turn_Lengths_of_coils_cm_Ncpp_Lmta1=[Lmta1]
Auxiliary_Mean_Turn_Lengths_of_Total_Wdg_cm_Lmta=[Lmta]
Auxiliary_Conductor_of_dia_and_CS_area_tota1_dac_Aac=[dac Aac]
Auxiliary_Resistance_of_Aux_Wdg_ohm_R1a=[R1a]
Auxiliary_Res_in_terms_of_aux_wdg_ohm_Rdr=[Rdr]
Auxiliary_Tot_Res_in_terms_of_aux_wdg_ohm_Rat=[Rat]
Auxiliary_Tot_Res_in_terms_of_Main_wdg_ohm_Rmt=[Rmt]
Auxiliary_Tot_Leak_React_in_terms_of_au_x_wdg_ohm_XLa=[XLa]
Auxiliary_Locked_Imped_of_main_Wdg_ohm_ZLm=[ZLm]
Auxiliary_Locked_Imped_of_Aux_Wdg_ohm_ZLa=[ZLa]
Auxiliary_Starting_Torque_N_m_Tqst=[Tqst]
Auxiliary_Locked_Rot_current_in_aux_wdg_A_Isa=[Isa]
Auxiliary_Locked_Rot_current_in_Main_wdg_A_Ism=[Ism]
Auxiliary_Total_Starting_Current_A_Ist=[Ist]
Auxiliary_Conductor_Dia_mm_dac=[dac]
Auxiliary_Current_dens_in_Aux_wdg_A_sq_mm_desirab1e_30_cda=[cda]
Auxiliary_Wt_of_Aux_Wdg_Copper_Kg_Wcua=[Wcua]
%<-------Weights,LossesandPerfonnance using Eq .Ckt(Part-7)------->
Stator_tooth_Weight_Kg_and_Iron_Losses_WtT_Pist=[WtT Pist]
Stator_Core_Weight_Kg_and_Iron_Losses_WtC_Pisc=[WtC Pisc]
Total_Iron_Losses_W_Pi=[Pi]
Friction_and_Windage_Losses_W_Pfw=[Pfw]
Total_Weight_Kg_and_Specific_Wt_Kg_HP_TotWt_KgPhp=[TotWt KgPhp]
Sync_Speed_RPM_and_Rated_Slip_pu_Ns_s=[Ns s]
Line_Current_Amps_I1m=[I1m]
Forward_Torque_syn_Watts_Tf=[Tf]
Backword_Torque_syn_Watts_Tb=[Tb]
Output_at_Rated_Speed_Watts_Popt=[Popt]
PF_at_Rated_Speed_pfx=[pfx]
Efficiency_at_Rated_Speed_perc_eff=[eff]
%<-------------------------End of output --------------------->

DESIGN TREE PHASA SLOT KOTAK

%Design of30KW, 440V, 50HZ,3-Ph Sq.Cage Ind Motor
%3ph,KW=30iV=440iP=6if=50Sq.Cage 1M with Sq.Cage rotor.
f2=fopen('Total_30KW_Output.m', 'w');
%------------Standard Curves/Tables for%Data-------------->
SKW=[1 2 5 10 20 50 100 300 500 1000];
SBav=[0.35 0.38 0.42 0.46 0.48 0.50 0.51 0.52 0.53 0.54];
Sq=[16e3 19e3 23e3 25e3 26e3 29e3 31e3 32e3 33e3 34e3];
SKWa=[1 5 10 20 50 100 200 400 500 1000];
SPF6P=[0.82 0.83 0.85 0.87 0.89 0.9 0.91 0.92 0.93 0.94];%Table for 1000RPM
SEFF6P=[0.83 0.85 0.87 0.89 0.91 0.92 0.925 0.93 0.94 0.95];%Table for 1000RPM
SPF4P=[0.85 0.86 0.88 0.9 0.91 .92 .93 0.94 0.95 0.96];%Table: for 1500RPM
SEFF4P=[.85 .87 .88 .9 .91 .93 .94 0.95 0.96 0.97];%Table for 1500RPM
%--------------carrent density------------->
SD=[0.1 0.15 0.2 0.3 0.4 0.5 0.75 1 1.5 2];
SCDSW=[4 3.8 3.6 3.5 3.5 3.5 3.5 3.5 3.5 3.5];
%-------------BH Curve for--0.5mm,LOHYS Quality--------->
BB= [ .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2];
H= [50 65 70 80 90 100 110 120 150 180 220 295 400 580 1000 2400 5000 8900 .15000 24000];
%-------Carters Coefft for Air Gap--->
Ratio=[0 1 2 3 4 5 6 7 8 9 10 11 12];
CC= [ 0 .18 .33 .45 .53 .6 .66 .71 .75 .79 .82 .86 .89] ;
CC1= [0 .14 .27 .37 .44 .5 .54 .58 .62 .65 .68 .69 .7];
%------------Iron loss in tooth (PitpKg)/Iron loss in Core (PicpKg)----->
B=[0.8 1.2 1.6 2 2.4]; 
WpKg=[7 15 24 34 50];
% (1) <-----------Main Dimensions----------------------->
KW=500;%rating
f=50;%frekuensi
V=660;%Volt delta
spp=5;%stator total slot/pole/phasa
P=4; %stator total pole/phasa
%D=244; %diameter stator
%L=230;%panjang stator
%q=30000;%electrical loading
LbyPP=0.9;%faktor length
CDSW=3.2;%carrent density
R1=1; %stator Assuming 82% of Total core length = Gross iron length (Ls)
bvd=1;%stator each of length
ki=0.95;%stator faktor staking
BtO=1.1;%stator Flux-density at Tooth tip at air gap (BtO)
HL=2.5;%Stator_Ht_Lip
Hw=3;% Stator_Ht_Wedge
WWHins = 0.045;% Wire Wrap isulation Width Height of Slot
CWHVins = 2;% Coil Wrap isulation HV Width Height of Slot
SWHins = 1;% Slot liner isulation Width Height of Slot
WEDGins =Hw;%Stator_Wedge_Thickness_isulation_of_Slot_WEDGins =[WEDGins]
LWHins = 2;% LAYER isulation Width Height of Slot
BWHins = 2;% Bottom isulation Width Height of Slot
Par=2;% pararel connection winding stator
nslot=2;% jumlah lilitan setengah lubang untuk seri pararel dan pararel penuh,..nilai nslot harus 2
Jac=2;%jalan kawat conduktor Width  winding stator
Jac0=7;%jalan kawat conduktor Height winding stator
ab= 1 ; %STATOR COil_spent
Bc=1.35;%Assuming density core stator
Brc=1.35;%Assuming density core rotor
RHL=1.5; % ROTOR lip bisa 0.8 sampai 1.5
RHw= 1.5; % ROTOR wedge bisa sampai 3
RBs0=1;%ROTOR top_width_atas_RBs0
Zr=1;% ROTOR TRUNS/slot of rotor
kwr=1;% ROTOR faktor winding bar rotor
Wb=14;%Width Thickness of bar rotor
cdb=6;% ROTOR Carrent density bar rotor
cde=6;% ROTOR Carrent density ring rotor
ERW=30;%End Ring Width
%---------------------------kw----------------------
Phase =3; % number o f phasa
Slots=spp*P*Phase;
n= Slots/P; % Slots per Pole and Coil_span
cp=n-3; % Coil_span
m= Slots/P/Phase; % Slot per Pole per Phase
beeta =180/ n; % Slot angle in degree
Kd = sind (m* beeta /2) /(m* sind ( beeta /2));
Coil_span =(cp/n) *180; % since winding coil spanis 13/15 of pole pitch
alpha =180 - Coil_span;
% Pitch factor for 1st, 3rd and 5 th harmonic
Kc1 = cosd ( alpha /2);
Kc3 = cosd (3* alpha /2);
Kc5 = cosd (5* alpha /2);
Kw= Kd*Kc1 ; %faktor winding
Bav=interp1(SKW,SBav,KW, 'spline');
q=interp1(SKW,Sq,KW,'spline');
pf=interp1(SKWa,SPF6P,KW,'spline');
eff=interp1(SKWa,SEFF6P,KW,'spline');
if P==4 pf=interp1(SKWa,SPF4P,KW, 'spline');end;
if P==4 eff=interp1(SKWa,SEFF4P,KW, 'spline');end;
Vph=V; 
KWinp=KW/eff;%KW input to motor
Ns=120*f/P;%Sync Speed RPM (Ns)putaran permenit
ns=Ns/60;%putaran perdetik
CO=11*Kw*Bav*q*eff*1e-3;%Output Coefft(CO)
DsqL=KW/(CO*ns); 
D=(DsqL*P/(pi*LbyPP))^(1/3)*1e3;
L1=DsqL/D^2;
L=ceil(L1*1e11)/100;
%L1=sqrt(DsqL/(0.135*P)^2);%Total Core Length (L1)
%L=floor(L1*100)*10;%yang dirubah aslinya L di ganti L2
%D1=sqrt(DsqL/(L/1000));
%D=ceil(D1*100)*10;%yang dirubah aslinya D diubah D1
%PP=pi*D/P;%Polepltch (PP)
vr=pi*D*ns/1000;    % Penphoral Veloclty(V) if v >30 continue;end;
FI=pi*D*L*Bav/(P*1e6); %Flux (FI)
% (2)<--------------Stator Slots and Winding----->
Tphi=V*Par/sqrt(3)/(4.44*f*FI*Kw);
CDSW1=interp1(SD,SCDSW,D/1000, 'spline');
S=spp*P*3;%Assuming Slots/pole/ph(spp)
SPitch=pi*D/S; %Slot pItch (sp) 
if SPitch <18||SPitch>=25  end;
Zphi=2*3*Tphi;%Conductors/ph (Zph)
Zsl=Zphi/S;%Conductors/slot (Zs)
%Zs=ceil(Zsl); 
Zs=floor (Zsl);% jumlah lilitan perslot
Zs0=Zs/nslot;% jumlah lilitan setengah lubang untuk seri pararel dan pararel penuh,..nilai nslot harus 2
Tph=Zs*S/(Par*6);%Corrected Turns/ph (Tph)
L= Vph*P*1e6/sqrt(3)/(4.44*f*Kw*Tph*D*Bav*pi);% Corrected panjang stator
q1 = KWinp/(11*Bav*Kw*L*D^2*ns*eff*1e-12);% Corrected Stator_Sp_Elec_Loading_Ac_m_q
KW2=11*Bav*Kw*L*D^2*ns*q*eff*pf*1e-12;% Corrected Rating KVA
KW=ceil(KW2*2)/2;
Iph = KW*1e3/ (1.7321 *Vph*eff); % Phase Current (Iph)
SLoad = Iph*Zs; % Slot Loading (SLoad)
LbyPP=L*P/(pi*D);% LengthlPole piteh corection
if LbyPP <0.8||LbyPP >2  end;
FI = V/sqrt(3)/(4.44*f*Kw*Tph);% Corrected Flux/Pole
Bav1=(FI*P*1000)/(pi*D*L);%Corrected Air Gap Flux Density
Bav0=(FI*P*Bav*1e6)/(pi*D*L*0.351);%Corrected Air Gap Flux Density

Ls1=R1*L; %Gross iron length (Ls)
Li=Ls1*ki; %Net Iron length of core (Li)
nv1=(L-Ls1)/bvd; %No. of Vent ducts (nv)
nvd=ceil(nv1); %No.of ventilating ducts
Ls=(L-nvd*bvd); %Gross iron length (Ls)
%Dpitch=(L - bvd*nvd)/nvd;%Duct pitch
PP =pi*D/P; % pole pitch
Asl=Iph/CDSW;
As=Iph/(CDSW*Par); %Cond Area of CS (As)
btO=FI*1e6/(BtO*Li*S/P);%Tooth width at air gap (btO)
Ws1 = SPitch-btO;% Slot Width
Wc1=((Ws1) - (2*WWHins*Jac) - (2*CWHVins) - (2*SWHins))/Jac;% Conductor Width
Wc=Wc1*Jac;
Hc1=As/(Wc*Jac0);% Cond Thk
Hc= As/(Wc);% Cond Thk
WbyT=Hc/Wc;
if WbyT <2.5 ||WbyT >=3.5 continue; end;
Ws = 1*Wc + (2*WWHins*Jac)+(2*CWHVins)+(2*SWHins);% Corrected Width of Slot
As = Wc*Hc; % Cond Area of CS (As)
%--------Design of Armature Winding and Core (Part-2)---------
cds = Iph/(As*Par); % Corrected current density
Hs0 = (Zs*Hc1*Jac0)+(Zs*2*WWHins*Jac0)+(4*CWHVins)+(3*SWHins)+LWHins+BWHins;% Height of Slot
Hs = (Zs*Hc1*Jac0)+(Zs*2*WWHins*Jac0)+(4*CWHVins)+(3*SWHins)+LWHins+BWHins+Hw+HL; % total Height of Slot
%WWHins =Wire Wrap isulation Width Height of Slot
%CWHVins = Coil Wrap HV isulation Width Height of Slot
%SWHins = Slot liner isulation Width Height of Slot
%LWHins =  LAYER isulation Width Height of Slot
%BWHins = Bottom isulation Width Height of Slot
rat1 = Hs/Ws; %
Btmax=BtO*1.5; %Max Flux density of the tooth (Btmax)
Bt1=FI*P*1e6/(Ws*Li*S);%St_Slot_Width_Flux_Dens_Bt1
D13=D+2/3*Hs;%Dia at Y3 ht from tooth tip
sp13=pi*D13/S;%Slot pItch at dla Dl3
Wt13=sp13-Ws;%Tooth width at dia D13
B13=FI*P*1e6/(Li*Wt13*S);%Flux densIty at Y3 ht from tooth tIp(
Btmax=1.5*B13;%Max Flux density of the tooth
Lmt=(2*L+2.3*PP+240)/1000; %Mean Length of tum (Lmt)
Rph=0.021*Lmt*Tph/As;%Resistance/ph at 20°C (Rph)
Pcus=3*Iph^2*Rph; %vCopper Loss (Pcus)
Wcus=Lmt*Tph*3*As*8.9e-3; %Weight of Copper (Wcus)
Flc=FI/2;%Flux in core (FIc)
Ac=Flc*1e6/Bc;%Area of core (Ac)
Hc=Ac/Li; %Height of the Core (Hc)
D01=D+2*(Hs+Hc);
DO=ceil(D01/10)*10;%Core Outer Dia (DO)
Hc=(DO-D)/2-Hs;%Corrected ht of core (Hc)
PitpKg=interp1(B,WpKg,Btmax, 'spline');%Iron loss in tooth (PitpKg)
PicpKg=interp1(B,WpKg,Bc, 'spline');%Iron loss in Core (PicpKg)
Wt=Li*Wt13*S*Hs*7.8e-6;% Wt of tooth (Wt)untuk berat slot persegi dan bulat
Dmcs=D+2*Hs+Hc; %Mean dia of the core (Dmcs)
Wc=Ac*pi*Dmcs*7.8e-6;%Weight of core (Wc)
Pit=PitpKg*Wt;%Iron Loss in Tooth (Pit)
Pic=PicpKg*Wc;%Iron Loss in Core (Pic)
%-----------------------ROTOR----------------------->
kws=Kw;%kws = Kw = Stator winding factor 
Ss=S;%Stator slots
Lg1=0.2+2*sqrt(D*L/1e6);%Air-gap length (Lg)
Lg=ceil(Lg1*100)/100;
Dr=D-2*Lg;%Rotor dia (Dr)
d1=Ss-3*P;
d2=Ss-P;
d3=Ss-2*P; 
d4=Ss-5*P;
d5=Ss-1;
d6=Ss-2;
d7=Ss-7;
d8=Ss-8;
Sr=Ss-9; 
sp2=pi*Dr/Sr; %Slot pItch (sp2)
Ir=0.85*Iph;%Equivalent_Rotor_Ct_A_Ir
Ib=Ir*kws*Ss*Zs/(kwr*Sr*Zr);%Bar Current (Ib)
Abi=Ib/cdb;%Area of cs of bar (Abi)
Tb=ceil(Abi/Wb);%Height of bar
Ab=Tb*Wb*0.98;%Corrected Area of cs of bar
Wsr=Wb+0.5;%Width of slot
Hsr=Tb+0.5;%Height of slot
Ie=Ib*Sr/P/pi; %End Ring Current (Ie)
Ae=Ie/cde; %Area of cs of end nng (Ae)
ERH=Ae/ERW;%End Ring Height
Lb=L+(ERH*2);%%Length of bar (Lb)
Rb=0.021*Lb/1e3/Ab; % Resistance of bar(Rb)
Pcub=Ib^2*Rb*Sr; %Copper loss in the bars (Pcub)
Dme=Dr-ERW;%Mean dia of end-ring (Dme) = Dr - 50
Lme=pi*Dme/1000;
Re=0.021*Lme/Ae;%ReSistance 0f end rimg (Re)
Pcue=2*Ie^2*Re;%Copperloss in the 2 End-rings (Pcue)
Pcur=Pcub+Pcue;%Total Rotor copper loss (Pcur)
Rr=Pcur/(3*Ir^2);%EqUivalent Rot res (Rr)
Dr13=Dr-2*2/3*Hsr;%Dia of rotor at Yltooth ht from tip (Dr 13)
spr13=pi*Dr13/Sr;%Rotor slot pitch at Orl3 (sprl3)
Wtr13=spr13-Wsr;%Width of tooth at Drl3 (WtrI3)
Atr=Wtr13*Li*Sr/P;%Area of tooth at Orl3 (Atr)
Brt=FI*1e6/Atr;%Flux density in tooth (Brt)
Brtmax=Brt*1.5;%Max Flux density in tooth (Brtmax)
Atr2=Wsr*Li*Sr/P;%Area of slot width at Orl3 (Atr)
Brt2=FI*1e6/Atr2;%Flux density in slot width  (Brt2)
Brtmax=Brt*1.5;%Max Flux density in tooth
Ac=FI*1e6/2/Brc;%Area of Core (Ac)
dcr=Ac/Li;%Depth of core (dcr)
Pfw=0.01*KW*1e3;%Assuming Friction and Windage Loss (Pfw) 1 %
PnL=Pit+Pic+Pfw;%Noload Loss (PnL)
Iw=PnL/3/V;%ActtvelWattful Component of No-load Current (lw)
Wcur=Lb*Sr*Ab*8.9e-6;%Wt of Rotor Copper
Wcue=Lme*2*Ae*8.9e-3;%Wt of Rotor End-Rings
%-----------Checking of Slot-Balances------>
%Stsbh=Hs0-(Zs*Hc*Jac0)-(Zs*2*WWHins*Jac0)-(4*CWHVins)-(3*SWHins)-LWHins-BWHins;%Rotor  Corrected stator Heigth of Slot
%Stsbw=Ws-Wc - (2*WWHins*Jac)-(2*CWHVins)-(2*SWHins);%Rotor  Corrected stator Width of Slot
%Rtsbh=Hs2-(Zs2*Hcu1*Jac01)-(Zs2*2*WWHins1*Jac01)-(4*CWHVins1)-(3*SWHins1)-BWHins1;%Rotor  Corrected rotor SLOT_Height_
%Rtsbw=Ws2 -Wcu2 - (2*WWHins1*Jac1)-(2*CWHVins1)-(2*SWHins1);%Rotor  Corrected rotor Width of Slot
%(4)<----AmpTurns and Magnetizing-Current----------------------
%-------------BH Curve for--0.5mm,LOHYS Quality--------->
BB= [ .1 .2 .3 .4 .5 .6 .7 .8 .9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2];
H= [50 65 70 80 90 100 110 120 150 180 220 295 400 580 1000 2400 5000 8900 15000 24000];
semilogx (H, BB); grid; xlabel ('AT/m -->'); 
ylabel('Flux density(T) -->'); 
title ('Magnetization Curve for Lohys Stamping Steel');
%-------Carters Coefft for Air Gap--->
Ratio=[0 1 2 3 4 5 6 7 8 9 10 11 12];
CC= [0 .18 .33 .45 .53 .6 .66 .71 .75 .79 .82 .86 .89 ];
CC1= [0 .14 .27 .37 .44 .5 .54 .58 .62 .65 .68 .69 .7 ];
plot (Ratio, CC, Ratio, CC1); grid ; xlabel ('Slot Opening/Airgap -->'); 
ylabel ('Carter Coefft -->'); title ('Carter Coefft for slots'); 
legend('Semiclosed', 'Open');
semilogx (H, BB); grid; xlabel ('AT/m -->'); 
ylabel ('Flux density(T) -->'); 
title ('Magnetization Curve for Lowhys Stamping Steel');
%Assumptions
atsc=interp1(BB,H,Bc, 'spline');
Dcav=D+2*Hs+Hc;%St-Core mean dia (Dcav)
ATSC=pi*Dcav/P/3*atsc/1e3; %AmpTurns for St-Core (ATSC)
Bt30=B13*1.36;%Flux density at 30° from the centre of the pole (Bt30)
atst=interp1(BB,H,Bt30, 'spline');
ATST=atst*Hs/1000;%AmpTurns for St-tooth (ATST)
WssO=4;%Assumptions Stator-Slot opening
WsrO=2;%Assumptions Rotor-Slot opening
y1 = WssO/(2*Lg); % Ratio for slots
Kcs = (2/pi )*( atan (y1)-log10 ( sqrt (1+ y1^2))/y1); % Carter's coefficientfor slots
SPitch=pi*D/S; 
Kgss =SPitch /(SPitch -( Kcs *WssO)); % Gap contraction for slots
y2 = WsrO/(2*Lg); % Ratio for slots
Kcsr = (2/pi )*( atan (y2)-log10 ( sqrt (1+ y2^2))/y2); % Carter's coefficientfor slots
sprO=pi*Dr/Sr;
Kgsr =sprO /(sprO -( Kcsr *WsrO)); % Gap contraction for slots
y3=bvd /(2*Lg); % Ratio for ducts
Kcd = (2/pi )*( atan (y3)-log10 ( sqrt (1+ y3^2))/y3); % Carter's coefficient for slots
Kgd =L *10^(3) /(L *10^(3) -( Kcd *nvd*bvd)); % Gap
ATS=ATSC+ATST;%Total AT for Stator (ATS)
rat1=WssO/Lg;%Assuming St-Slot opening (WssO)
k01=interp1(Ratio,CC,rat1, 'spline');
kgs=SPitch/(SPitch-WssO*k01); %Gap Coefft for St -Slots (kgs)
rat2=WsrO/Lg;
k02=interp1(Ratio,CC,rat2, 'spline'); 
sprO=pi*Dr/Sr;%Rotor Slotpitch near airgap (sprO)
kgr=sprO/(sprO-WsrO*k02);%Gap Coefft for Rt-Slots (kgr)
kg=kgs*kgr; %Air gap Coefft (kg)
Lgd=Lg*kg;%Effective air gap (Lgd)

rat3=bvd/Lg; %For Ventilating duct,
kv=interp1(Ratio,CC1,rat3, 'spline');
if rat3 >=12 kv=0.7;end;
Ld=L-kv*nvd*bvd;%Effective axial length (Ld)
Aag=pi*D/P*Ld;%AIr gap areaIPole (Aag)
Bg=FI*1e6/Aag;
B30d=1.36*Bg;%Gap flux density at 30° from the centre of the pole (B30d)
ATg= 0.796*B30d*Lgd*1e3;%Air gap AT (ATg)
Btr30=Brt*1.36;%Flux density In rotor tooth at 30°from the centre of the pole (Btr30)
atrt=interp1(BB,H,Btr30, 'spline');
ATRT=atrt*Hsr/1e3; %AmpTurns for Rt-tooth (ATRT)
Dcrav=Dr-2*Hsr-dcr;%Rt-Core mean dia (Dcrav)
atrc=interp1(BB,H,Brc, 'spline');
ATRC=pi*Dcrav/1e3/P/3*atrc;%AmpTurns for Rt-Core (ATRC)
ATR=ATRC+ATRT;%Total AT for Rotor (ATR)
ATT=ATS+ATR+ATg; %Total AT for the motor (ATT)
Im=P/2*ATT/(1.17*Kw*Tph);%MagnetiZing current (I m)
IO=sqrt(Iw^2+Im^2); %No load Phase current (10)
pfO=Iw/IO; %No load Power Factor (pfO)
IObyI=IO/Iph;

% (5) <-----------Short-Circuit-Current-------------------->');

ks=1; %Assumptions
Hs2 = (Zs*Hc1*Jac0)+(Zs*2*WWHins*Jac0)+(4*CWHVins)+(3*SWHins)+LWHins;
h1= Hs2;
h2=Hw;
h3=Hw*0.30;
h4=HL;
bs=Ws;
WsO=Ws+(HL*3); %Width at opening of slot (Wso)
bO=WsO;
Lmdss=h1/3/bs +h2/bs +2*h3/(bs+bO) +h4/bs;%SpeCIfic Permeance of Slot (lamdas)
h1r=Wb;
h2r=0; 
h3r=0;  
h4r=0.5;  
br=Wsr;
WssrO=Ws+(HL*3); %Width at opening of slot (Wsro)
brO=WssrO; 
Lmdsr=h1r/3/br+h2r/br+2*h3r/(br+brO)+h4r/br;%Specific Permeance of Rotor Slot (Lmdsr)
Lmddsr=Kw^2*S/Sr*Lmdsr;%and same referred to stator (Lmddsr)
ssp=Lmdss+Lmddsr;%Specific Slot Permeance (ssp)
gd=S/P/3;
p=P/2;
Xs=15.8*f*L*ssp*Tph^2/(p*gd)*1e9;%Slot Reactance (Xs)
LOLmdO=ks*PP^2/pi/SPitch/1000;%For Over hang (LOLmdO)
XO=15.8*f*LOLmdO*Tph^2/(p*gd)*1e6;%Overhang Reactance (XO)
gs=S/P;%St.SlotslPole(gs)
gr=Sr/P;
Xm=Vph/Im;%Magnetizing reactance (Xm)
Xz=5/6*Xm*(1/gs^2+1/gr^2);%Zig-Zag Reactance(Xz)
X=Xs+XO+Xz; %Total Reactance/ph(X)
R=Rph+Rr;%Resistance(R)
Z=sqrt(R^2+X^2); %Impedance/ph(Z)
Isc=Vph/Z;%Short CirCUit Current (lsc)
pfsc=R/Z;%Short Circuit PF (pfsc)
RAT=Isc/Iph;%Amps pu

%(6)<--------------Performance-------------------->');
Pt=PnL+Pcus+Pcur;%Total Losses (Pt)
EFF=KW/(KW+Pt/1000)*100;%Efficiency (EFF)
Rinp=KW*1000+Pfw+Pcur;%Rotor Input (Rinp)
SFL=Pcur/Rinp*100;%Slip at Full Load (SFL)
Tst=(Isc/Ir)^2*SFL/100;%Starting Tq (Tst)
Pmax=3*Vph*(Isc-IO)/2/(1+pfsc)*1e3;
Acool1=(pi*D*(L*2.5)+2*pi*(D+50)*0.04)/1e6;%Inner cooling area (Acooll)
Acoo12=Acool1*(1+0.1*vr);
Acoo13=pi*DO*L/1e6;%Outer cooling area (Acoo13)
AcoolT=Acoo12+Acoo13;%Total cooling area (AcoolT)
Pst=Pcus+Pit+Pic; %Total Stator Loss (Pst)
Tr=0.03*Pst/AcoolT;%Temp rise (Tr)
Ars=Wsr*Hsr*Sr; %Area of Rotor slots (Ars)
Dri=Dcrav-dcr;%Rotor inner dia (Dri)
Wri=(pi*(Dr^2-Dri^2)/4-Ars)*L*7.8e-6;%Weight of Rotor (Wri)
Wtot=1.01*(Wcus+Wt+Wc+Wri+Wcur+Wcue);%Total wt (Wtot)
KgPKw=Wtot/KW;

%--------------------End of Program-------------------------->


Rating_KW=[KW]
Volts_delta_Star_V=[V/1.73 V]
Phase_Current_Delta_Star_A_Iph=[Iph*1.73 Iph]
Phase_Current_A_Iph=[Iph]
Poles=[P]
Hz=[f]
Coil_spent_cp=[ab cp+1]
Chording_Pitch= [cp S/P]
winding_faktor_Kw=[Kw]
Bav= [Bav]
Corrected_Air_Gap_Flux_Density_Bav0=[Bav0]
electric_loading_q= [q]
Corrected_Stator_Sp_Elec_Loading_Ac_m_q1=[q1]
eff= [pf]
pf= [eff]
%----Output Results: Parameter-----
Output_Coefft_CO=[CO]
Sync_Speed_rps_ns=[ns]
DsqL=[DsqL]
No_of_Vent_ducts_nvd=[nvd]
each_of_length_mm_bvd=[bvd]
Length_toPP_ratio_PP=[LbyPP]
Gross_Length_mm_L=[L]
Gross_iron_Length_mm_Ls=[Ls]
Net_iron_Length_mm_Li=[Li]
Periphoral_Speed_m_pers_vr=[vr]
Turns_perPhasa_Tph=[Tph]
Conductor_perSlot_Zs=[Zs]
Conductor_setengah_Slot_Zs0=[Zs0]
Stator_pararel_Branches_connection_winding_Par=[Par]
Stator_Number_Of_Strands_conduktor_Width_winding_Jac=[Jac]
Stator_Number_Of_Strands_conduktor_Height_winding_Jac0=[Jac0]
Stator_Number_of_Wires_per_Conductor=[Jac*Jac0]
FluxI_Pole_Wb_FI=[FI]
Pole_Pitch_mm_pp=[PP]
Slot_Pitch_mm_SPitch=[SPitch]
St_Slot_Width_mm_Ws=[Ws Bt1]%Ws(slot width)(Bt1=St_Slot_Width_Flux_Dens_Bt1
St_toot_mm_btO=[btO BtO]%bto(tott width)(BtO=flux density)
St_Tooth_Flux_Dens_Max_T_Pen_nissible_16_to_18=B13*1.5
Stator_slot_width_stator_slot=[Ws]
Stator_toot_width_stator_slot=[btO]
Stator_Core_depth_mm= [Hc]

%------------   STATOR DATA ---------------
Number_of_Stator_Slots=[S]
Outer_Diameter_of_Stator_mm=[DO]
Inner_Diameter_of_Stator_mm=[D]
Type_of_Stator_Slot=[6*1]
%-------Stator_Slot----------
Stator_Ht_Lip_hs0_mm=[HL]
Stator_Ht_Wedge_hs1_mm=[Hw]
Stator_SLOT_Height_hs2_mm=[Hs0]
Stator_SLOT_WIDTH_bs1_mm=[WsO]
Stator_SLOT_WIDTH_bs2_mm=[Ws]
Stator_SLOT_Total_Height_Hs_mm= [Hs]
%Top_Tooth_Width_mm=
%Bottom_Tooth_Width_mm=

Length_of_Stator_Core_mm=[L]
Stacking_Factor_of_Stator_Core=[ki]

Stator_Conductor_Area_of_CS_Asl=[Asl]
Stator_Bare_cond_Wdth_Wc1_mm= [Wc1]
Stator_Bare_Cond_Ht_Hc1_mm= [Hc1]

Stator_Wire_Wrap_isulation=[WWHins*2]
Stator_Coil_Wrap_HV_isulation=[CWHVins]
Bottom_Insulation_mm=[BWHins]
Wedge_Thickness_mm=[WEDGins]
Slot_Liner_Thickness_mm= [SWHins]
Layer_Insulation_mm=[LWHins]

Stator_Conductor_Area_of_CS_Asl=[Asl]
Carrent_density_A_permm2_cds=[cds]
Stator_Bare_cond_Wdth_Wc1_mm= [Wc1]
Stator_Bare_Cond_Ht_Hc1_mm= [Hc1]
Width_to_Thickness_Ratio_WbyT=[WbyT]
Interpolated_values_of_W_Kg_of_St_Teeth_St_Teeth_Core_PitpKg_PicpKg=[PitpKg PicpKg]
Slot_Width_mm_Ws=[Ws]
Slot_Height_mm_Total_Hs=[Hs]
D13_SP13_Wt13_per3_m=[D13 sp13 Wt13]
St_Tooth_Flux_Dens_1_per3_B13=[B13]
St_Tooth_Flux_Dens_Max_T_Pen_nissible_16_to_18=B13*1.5
Length_of_mean_turn_m=[Lmt]
Resistance_perPhasa_ohm=[Rph]
Depth_of_St_Core_mm_Hc=[Hc]
Outer_Dia_of_St_Core_mm_Do=[DO]
St_Cu_Loss_W_Pcus=[Pcus]
Weight_of_Stator_Tooth_plus_Core_perKg_Wt_Wc_WtWc=[Wt Wc Wt+Wc]
Iron_Loss_Teeth_plus_Core_W_Pit_Pic_PitPic=[Pit Pic Pit+Pic]

%-------------------------ROTOR-----------------------------»
Length_of_Air_Gap_mm_Lg=[Lg]
Effective_axial_length_mm_Ld=[Ld]
Diameter_of_Rotor_mm_Dr=[Dr]
Rotor_internl_diameter_mm_Dri=[Dri]
Assuming_Current_density_in_bar_cdb=[cdb]
Assuming_Current_density_in_end_ring_cde=[cde]
No_of_Slots_Should_NE_to_d1_d2_d3_d4=[d1 d2 d3 d4]
Should_NE_to_d5_d6_d7_d8=[d5 d6 d7 d8]
No_of_Rotor_Slots_Selected_Sr=[Sr]
Rotor_Slot_Pitch_mm_sp2=[sp2]
Equivalent_Rotor_Ct_A_Ir=[Ir]
Rotor_bar_Current_A_Ib=[Ib]
Area_of_Rotor_bar_CS_mm_Ab=[Ab]
Width_of_bar_mm_Wb=[Wb]
Height_of_bar_mm_Tb=[Tb]
Rotor_Width_And_Height_of_bar_Wb_Tb_mm=[Wb Tb]
Rotor_Width_of_slot_mm_Wsr=[Wsr]
Rotor_Height_of_slot_mm_Hsr=[Hsr] 
Length_of_Bar_m_Lb=[Lb]

%---------ROTOR DATA ------------

Number_of_Rotor_Slots=[Sr]
Air_Gap_mm=[Lg]
Inner_Diameter_of_Rotor_mm=[Dri]
Type_of_Rotor_Slot=[3*1]
%----------Rotor_Slot----------
ROTOR_Ht_Lip_hs0_mm=[RHL]
ROTOR_Ht_Wedge_hs1_mm=[RHw]
ROTOR_SLOT_Height_hs2_mm=[Hsr]
ROTOR_TOP_WIDTH_Bs0_mm=[RBs0]
ROTOR_SLOT_WIDTH_bs1_mm=[Wsr]
ROTOR_SLOT_WIDTH_bs2_mm=[Wsr*0.85]

End_ring_Current_A_Ie=[Ie]
Assuming_Current_density_in_end_ring_cde=[cde]
Area_of_end_ring_mm2_Ae=[Ae]
ROTOR_Length_of_Bar_m_Lb=[Lb]
ROTOR_End_Ring_Width_ERW=[ERW]
ROTOR_End_Ring_Height_ERH=[ERH]
Mean_diameter_of_end_ring_m_Dme=[Dme]
Resistance_of_end_ring_m_ohm_Re_le3=[Re*1e3]
Resistance_bar_m_ohm_Rb_le3=[Rb*1e3]
Losses_in_Rot_Bars_W_Pcub=[Pcub]
Rot_Cu_Loss_Bars_plus_End_rings_W_Pcub_Pcue_Pcur=[Pcub Pcue Pcur]
Equivalent_Rotor_res_Ohm_Rr=[Rr]
Rotor_1per3_Slot_Pitch_mm_spr13=[spr13]
Rotor_1per3_tooth_width_mm_Wtr13=[Wtr13]
Rt_Tooth_Flux_Dens_1per3_T_Brt=[Brt]
Rt_Tooth_Flux_Dens_Max_T_Permissible_12_to_15=Brt*1.5
Assuming_Flux_density_in_Rotor_Core_T_Brc=[Brc]
Depth_of_Rotor_core_mm_dcr=[dcr]
%-----------Checking of Slot-Balances------>
%Stator_Slot_Balance_ht_mm= [Stsbh]
%Stator_Slot_Balance_wdth_mm= [Stsbw]
%Rotor_Slot_Balance_ht_mm= [Rtsbh]
%R0tor_Slot_Balance_wdth_mm= [Rtsbw]
%----------------------N O-Load-Losses---------------------->

Full_load_Phase_current_star_Iph=[Iph]
No_load_Phase_current_star_IO=[IO]
Full_load_Phase_current_Delta_Iph=[Iph*1.73]
No_load_Phase_current_Delta_IO=[IO*1.73]
No_load_Phase_current_star_Delta_persentasi=[IO/Iph*100]
No_load_Power_Factor_pfO=[pfO]
No_Load_Losses_Watt_Pnl=[PnL]
No_Load_Wattful_Current_A_Iw=[Iw]
No_Load_Magnetizing_Current_A_Im=[Im]
No_Load_Iph_ratio_IObyI=[IObyI]
%---------DETAILED DATA AT RATED OPERATION ----------
Stator_Teeth_Flux_Density_Tesla=[B13*1.5]
Rotor_Teeth_Flux_Density_Tesla=[Brt*1.5]
Stator_Yoke_Flux_Density_Tesla=[Bc]
Rotor_Yoke_Flux_Density_Tesla=[Brc]
Air_Gap_Flux_Density_Tesla=[Bav0]

Stator_Teeth_Ampere_Turns_AT=[ATST]
Rotor_Teeth_Ampere_Turns_AT=[ATRT]
Stator_Yoke_Ampere_Turns_AT=[ATSC]
Rotor_Yoke_Ampere_Turns_AT=[ATRC]
Air_Gap_Ampere_Turns_AT=[ATg]

Stator_Current_Density_A_mm=[cds]
Specific_Electric_Loading_A_mm=[q1]
Stator_Thermal_Load_A_2_mm=[Tr]

Rotor_Bar_Current_Density_A_mm=[cdb/1.7]
Rotor_Ring_Current_Density_A_mm=[cde/1.7]
%-------------------Magnetizing-Current -------------------->
Interpolated_values_of_at_m_of_St_Teeth_k01_k02_kv=[k01 k02 kv]
%-------------------Short -C ircuit -Current --------------------
Slot_Permeances_Stator_rotor_and_rotorreferren_to_rotor=[Lmdss Lmdsr Lmddsr]
Specific_Slot_Permeance_ssp=[ssp]
TotaIReactance_X_ohms_Slot_Overhang_Zig_Zag=[Xs XO Xz X]
Short_CircuitR_R_Z_Isc_pfsc_RAT=[R Z Isc pfsc RAT]
Total_Losses_PnL_Pcus_Pcu=[PnL Pcus Pcur Pt EFF]
Slip_at_SFL_Perc=[SFL]
Starting_Tq_x_FL_Tq=[Tst]
Max_Output_KW=[abs(Pmax)]
Temp_Rise_deg_C=[Tr]
Weight_Armature_Copper_Weight_kg=[Wcus]
Weight_Rotor_Bar_Material_Weight_kg=[Wcur]
Weight_Rotor_Ring_Material_Weight_kg=[Wcue]
Weight_Armature_Core_Steel_Weight_kg=[Wt+Wc]
Weight_Rotor_Core_Steel_Weight_kg=[Wri]
Total_Net_Weight_kg=[Wtot]
Total_Weight_Kg_perKW=[Wtot KgPKw]

Execute MATLAB/Octave Online

time = [0:2:20]

volts = [0.5 1.25 0.1 0.39 1.4 0 0.1 1.7 0.2 -0.3 1.3];

plot(time, volts)

time = [0:1:20]

turnning 1

%in the name of God
turn = 40;
format long

speed = randi(30)  + 1 / randi(5)+ 0.005*rand
tetha = 0:0.001:2*turn*pi;
r =7;

x = cos(tetha) * r + cos(speed*tetha) * 9;
y = sin(tetha) * r + sin(speed*tetha) * 9;
plot(x, y, 'r');
axis equal;
axis([-16.1 16.1 -16.1 16.1])
print -dpng figure.png

partha

x = [1 2 3 4 5 6 7 8 9 10];
y1 = [.16 .08 .04 .02 .013 .007 .004 .002 .001 .0008 ];
y2 = [.16 .07 .03 .01 .008 .003 .0008 .0003 .00007 .00002 ];

semilogy(x,y1,'-bo;y1;',x,y2,'-kx;y2;');
title('Plot title');
xlabel('X Axis');
ylabel('Y Axis');

print -dpng figure.png

Execute MATLAB/Octave Online

 date
 date
 date
 date
 date
 clock
 1:4:60
 t=0:1:7;
 x=exp(5*t);
 plot(x,t);
 xlabel('t');
 ylabel('x');

Execute MATLAB/Octave Online

clc;
clear all;
close all;
ac=10;%amplitude of carrier signal
fc=3;%frequency of carrier signal
am=5;%amplitude of message signal
fm=0.3;%frequency of message signal
t=0:pi:3*pi;
mu1=am/ac;
s1=(ac*cos(2*pi*fc*t)).*(1+mu1*cos(2*pi*fm*t));
plot(t,s1)
xlabel('time');
ylabel('s');
title('under modulation');

RS g=5 linear dependency

pkg load communications

A = gf([
    0 1 0 0 0;
    0 0 1 0 0;
    1 1 1 1 1;
    1 4 16 64 29;
    ]', 8); 
B = gf([1 32 116 38 180]', 8);
A
B
x = A \ B


a = gf([0 1 0 0 0], 8);
b = gf([0 0 1 0 0], 8);
c = gf([1 1 1 1 1], 8);
d = gf([1 4 16 64 29], 8);
e = gf([1 32 116 38 180], 8);
8 * a + 248 * b + 174 * c + 175 * d

Execute MATLAB/Octave Online

t = 0:0.01:360;
y1 = sind(t);
y2= cosd(t);

subplot(2,2,1);plot(t,y1);subplot(2,2,2);plot(t,y2);
subplot(2,1,1);plot(t,y1);subplot(2,1,2);plot(t,y2);
y3 = y1.^2;
y4= y2.^2;
subplot(2,2,1);plot(t,y1);subplot(2,2,2);plot(t,y2);subplot(2,2,3);
plot(t,y3);subplot(2,2,4);plot(t,y4);

subplot(4,1,1);plot(t,y1);subplot(4,1,2);plot(t,y2);subplot(4,1,3);
plot(t,y3);subplot(4,1,4);plot(t,y4);
xlabel('time');
ylabel('frequency');
title('Sinusoidal Wave');

print -dpng figure.png

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.