import math
#INPUT DATA
N = 2000.; #no of turns
I = 10.; #current in A
Rm = 25.; #mean radius in cm
d = 6.; #diameter of each turn in cm
#CALCULATIONS
MMF = N*I; #magneto motive force in A
l = 2*math.pi*(Rm/100); #circumference of coli in m
u = (4*math.pi*10**-7); #permeability (U = Ur*U0)
a = (math.pi*d*d*10**-4)/4;
reluctance = (l/(a*u)); #reluctance in At/Wb
flux = (MMF)/(reluctance); #flux in Wb
fluxdensity = (flux/a); #flux density in Wb/m**2 or tesla
#OUTPUT
print "Thus MMF, flux, flux density are %d A, %g Wb , %g Wb/m**2 or Tesla respectively "%(MMF,flux,fluxdensity);
import math
#Chapter-2, Example 2.2, Page 90
#INPUT DATA
phi = 5*10**-2; #flux in wb
a = 0.2; #area of cross-section in m**2
lg = 1.2*10**-2; #length of air gap in m
ur = 1; #permeability
u = ur*4*math.pi*10**-7; #permeability
#CALCULATIONS
B = (phi/a); #flux density in wb/sq.m
H = (B/(4*math.pi*10**-7*ur)); #magnetic flux density in A/m
S = lg/(a*u); #reluctance of air gap in A/wb
permeance = 1/S; #permenace in A/wb
mmf_in_airgap = phi*S; #mmf in A
#OUTPUT
print "Thus B, H,S, permeance, MMF in air gap are %1.2f Wb/sq.m, %g A/m ,%f A/wb ,\
%g Wb/A %d A respectively "%(B,H,S,permeance,mmf_in_airgap);
import math
#INPUT DATA
phi = 0.1*10**-3; #flux in wb
a = 1.7*10**-4; #area of cross-section in m**2
lg = 0.5*10**-3; #length of air gap in m
Rm = 15./2; #radius of ring in cm
u0 = 4*math.pi*10**-7; #permeability in free space in henry/m
N = 1500.; #no of turns of ring
#CALCULATIONS
B = (phi/a); #flux density in wb/sq.m
H = (B/(4*math.pi*10**-7)); #magnetic flux density in A/m
ampere_turns_provided_fo = H*lg;
total_ampere_turns_provi = N*1;
Available_for_iron_path = N-(H*lg);
length_of_iron_path = (2*Rm*math.pi*10**-2)-(lg); #length of iron path in m
H_for_iron_path = ((N-(H*lg)))/(length_of_iron_path);
ur = (B/(u0*H_for_iron_path)); #relative permeability of iron
#OUTPUT
print "Thus relative permeability of iron is %d"%(ur);
import math
#INPUT DATA
li = 0.5; #iron path length in m
lg = 10.**-3; #length of air gap in m
phi = 0.9*10**-3; #flux in wb
a = 6.66*10**-4; #area of cross-section of iron in m**2
N = 400.; #no of turns
#CALCULATIONS
B = (phi/a); #flux density in wb/sq.m
Hg = (B/(4*math.pi*10**-7)); #magnetic flux density in A/m
AT_required = Hg*lg; #AT required for air path
Hi = 1000; #magnetic flux density in A/m
AT_required_for_iron_pat = Hi*li;
total_AT_required = (Hg*lg)+(Hi*li);
I = ((Hg*lg)+(Hi*li))/(N);
#OUTPUT
print "Thus exciting current required is %1.2f A"%(I);
import math
#Chapter-2, Example 2.5, Page 92
#INPUT DATA
r = 0.01; #radius in m
lg = 10.**-3; #length of air gap in m
Rm = (30./2)*10**-2; #mean radius in m
ur = 800.; #relative permeability of iron
ur2 = 1.; #relative permeability of air gap
N = 250.; #no of turns
phi = 20000.*10**-8; #flux in Wb
u0 = 4*math.pi*10**-7; #permeability in free space
a = math.pi*(r)**2; #area of cross-section in m
leakage_factor = 1.1
#CALCULATIONS
reluctance_of_air_gap = (lg/(u0*ur2*a)); #reluctance of air gap in A/wb
li = (math.pi*(2*r)-(lg)); #length of iron path in m
reluctance_of_iron_path = ((math.pi*0.3)-(lg))/(4*math.pi*10**-7*800*a); #in A/wb
total_reluctance = reluctance_of_air_gap+reluctance_of_iron_path; #in A/wb
MMF = phi*total_reluctance; #in Ampere turns
current_required = (MMF)/(N); #in A
#OUTPUT
print "Thus current required is %1.2f A "%(current_required);
#Including leakage
#CALCULATIONS
MMF_of_airgap = phi*reluctance_of_air_gap; #in A/wb
Total_flux_in_ironpath = leakage_factor*phi; #in Wb
MMF_of_ironpath = Total_flux_in_ironpath*reluctance_of_iron_path; #in A
Total_MMF = MMF_of_ironpath+MMF_of_airgap; #in A/wb
current_required2 = Total_MMF/(N); #in A
#OUTPUT
print "Thus current required is %1.3f A"%(current_required2);
import math
#INPUT DATA
l1 = 0.1; #length in m
l2 = 0.18; #length in m
l3 = 0.18; #length in m
lg = 1.*10**-3; #airgap length in mm
a1 = 6.25*10**-4; #area in m**2
a2 = 3.*10**-4; #area in m**2
ur = 800.; #relative permeability of iron path
ur2 = 1.; #relative permeability in free space
u0 = 4*math.pi*10**-7
N = 600.;
phi = 10.**-4; #airgap flux in Wb
#CALCULATIONS
#for the airgap
Bg = (phi/(a1)); #fluxdensity in Tesla
Hg = (Bg/(u0*ur2)); #magnetimath.sing force in A/m
MMF1 = Hg*lg; #in A
#for path I1
B1 = 0.16; # flux density in tesla
H1 = (B1/(ur*u0)); #magnetimath.sing force in A/m
MMF2 = H1*l1; #in A
#math.since paths l2 and l3 are similar,the total flux divide equally between these two paths.Since these paths are in parallel,consider only one of them
#for path l2
flux = 50*10**-6; #flux in wb
B2 = (flux/a2); #fluxdensity in tesla
H2 = (B2/(ur*u0)); #magnetimath.sing force in A/m
MMF3 = H2*l2; #in A
totalmmf = MMF1+MMF2+MMF3; #in A
I = (totalmmf/N); #current required in A
#OUTPUT
print "Thus current required is %1.3f A"%(I);
import math
#Chapter-2, Example 2.7, Page 95
#INPUT DATA
Dm = 0.1 #diameter in m
a = 10.**-3; #area of cross-section im m**2
N = 150.; #no of turns
ur = 800.; #permeability of iron ring
B = 0.1; #in Wb/m**2
u0 = 4*math.pi*10**-7; #permeability of free space
#CALCULATIONS
S = (math.pi*Dm)/(a*ur*u0); #reluctance
I = (B*a*S)/(N); #current in A
#OUTPUT
print "Thus current is %f A"%(I);
import math
#INPUT DATA
l = 0.3; #length in m
d = 1.5*10**-2; #diameter in m
N = 900; #no of turns
ur = 1; #relative permeability in free space
u0 = 4*math.pi*10**-7; #permeability in free space
I = 5; #current in A
#CALCULATIONS
a = (math.pi*(d)**2/4); #in m**2
S = (l)/(a*ur*u0); #reluctance
#OUTPUT
print "Thus reluctance is %f A/wb"%(S);
import math
#INPUT DATA
lg = 10**-3; #length of air gap in m
B = 0.9; #flux density in wb/m**2
li = 0.3; #length of ironpath in m
Hi = 800; #magnetic flux density in AT/m
u0 = 4*math.pi*10**-7; #permeabilty in free space
#CALCULATIONS
#for iron path
MMF_required1 = Hi*li; #magnetic motive force in AT
#for air gap
MMF_required2 = (B/u0)*lg; #magnetic motive force in AT
Totalmmf = MMF_required1+MMF_required2
#OUTPUT
print "Thus total MMF required is %d AT"%(Totalmmf);
import math
#INPUT DATA
li = 0.5; #length of iron ring mean length in m
N = 220; #no of turns
I = 1.2; #current in A
lg = 1.2*10**-3; #length of airgap in m
ur = 350; #relative permeability of iron
u0 = 4*math.pi*10**-7; #permeability in free space
#CALCULATIONS
MMF_produced = N*I;
Si = li/(u0*ur); #reluctance of iron path
Sg = lg/(u0); #reluctance of air gap
S = Si+Sg; #total reluctance
Flux_density = (MMF_produced)/(S);
#OUTPUT
print "Thus fluxdensity is %1.3f Wb/m**2"%(Flux_density);