from __future__ import division
# Given data
Lm=30 #in mH
Iph=3 #in Ampere
Rm=15 #in Ohm
#Calculations
tau_ed=Lm/Rm #in ms
tdash=1/2*tau_ed #in ms
print "(i) Time taken by the phase current to decay to zero = %0.2f ms "%tdash
Energy=1/4*Lm*Iph**2 #in mW
print "(ii) Energy returned to supply = %0.2f mW "%Energy
# Given data
n=4 #no. of phase
Ns=12 #stator teeth
Nr=3 #rotor teeth
#Calculations
Beta=360/n/Nr #in degree
print "Step Angle = %0.2f degree "%Beta
# Given data
MainPoles=10 #no. of main poles
teeth=7 #no. of teeth/pole
Nr=60 #rotor teeth
#Calculations
Ns=MainPoles*teeth #stator teeth
Beta=(Ns-Nr)*360/Ns/Nr #in degree
print "Step Angle = %0.3f degree"%Beta
# Given data
Beta=3 #in degree
Revolution=25 #no. of revolutions
f=3600 #stepping frequency in pps
#Calculations
Resolution=360/Beta #in step/res
print "(a) Resolution = %0.2f step/res "%Resolution
steps=Resolution*Revolution #no. of steps
print "(b) No. of steps required : " ,steps
speed=Beta*f/360 #in nps
print "(c) Shaft speed = %0.2f nps "%speed
# Given data
Beta=1.8 #in degree
Revolution=25 #no. of revolutions
f=4000 #stepping frequency in pps
theta=54 #required shaft rotation in degree
#Calculations
Resolution=360/Beta #in step/res
print "(i) Resolution = %0.2f step/res "%Resolution
speed=Beta*f/360 #in rps
print "(ii) Motor speed = %0.2f rps "%speed
pulses=theta/Beta #pulses
print "(iii) No. of pulses required to rotate the shaft through 54 degree : " ,pulses
# Given data
Ns=8 #stator teeth
Nr=6 #rotor teeth
#Calculations
Beta=(Ns-Nr)/Ns/Nr*360 #in degree
print "Step angle = %0.2f degree "%Beta
Resolution=360/Beta #steps/revolution
print "Resolution = %0.2f steps/revolution "%Resolution
# Given data
Beta=15 #in degree
m=3 #no. of phase(1-Beta*Nr/360)
#Calculations
#Formula : Beta=360/m/Nr
Nr=360/m/Beta #no. of rotor teeth
print "No. of rotor teeth : " ,Nr
#Formula : Beta=(Ns~Nr)/Ns/Nr*360 #in degree
#When Ns>Nr
Ns=Nr/(1-Beta*Nr/360) #no. of stator teeth
print "When Ns>Nr, No. of stator teeth : " ,Ns
#When Nr>Ns
Ns=Nr/(1+Beta*Nr/360)
print "When Nr>Ns, No. of stator teeth : " ,Ns
# Given data
m=4 #phases
Beta=1.5 #in degree
#Calculations
#Formula : Beta=360/m/Nr
Nr=360/m/Beta #no. of rotor teeth
print "No. of rotor teeth :" ,Nr
Ns=Nr #no. of stator teeth
print "In multi stack motor, Stator teeth = rotor teeth = " ,Ns
# Given data
Speed=2400 #in rpm
Resolution=200 #steps/res
#Calculations
n=Speed/60 #in rps
Beta=360/Resolution #in degree
#Formula : n=Beta*f/360
f=n*360/Beta #in pps
print "Required pulse rate = %0.2f pps "%f
# Given data
Resolution=500 #steps/res
theta=72 #rotator turn angle in degree
#Calculations
Hmod_Res=Resolution*2 #half step mode resolution in steps/res
print "Half step mode resolution = %0.2f steps/res "%Hmod_Res
Beta=360/Hmod_Res #in degree
steps=theta/Beta #in steps
print "No. of steps required : " ,steps
# Given data
Beta=1.8 #in dcegree
revolution=10 #no. of revolution
#Calculations
resolution=360/Beta #in steps/rev
steps=resolution*revolution #no. of steps in 10 evolution
print "No. of steps =",(steps),"should be encoded."
# Given data
J=10**-4 #in Kgm**2
w1=200 #in rad/sec
w2=300 #in rad/sec
delf=0.2 #in sec
Tf=0.06 #in N-m
#Calculations
dwBYdf=(w2-w1)/delf #
Tm=J*dwBYdf+Tf #in N-m
print "Motor Torque = %0.2f N-m "%Tm
from math import pi
# Given data
J=3*10**-4 #in Kgm**2
f1=1000 #in Hz
f2=2000 #in Hz
delt=100 #in ms
Tf=0.05 #in N-m
Qs=1.8 #in degree
#Calculations
delt=100*10**-3 #in sec
Qs=Qs*pi/180 #in radian
w1=Qs*f1 #in rad/sec
w2=Qs*f2 #in rad/sec
dwBYdt=(w2-w1)/delt #
Tm=J*dwBYdt+Tf #in N-m
print "Motor Torque = %0.4f N-m "%Tm
# Given data
J=4*10**-4 #in Kgm**2
Tm=0.3 #in N-m
Qs=3 #in degree
#Calculations
Qs=Qs*pi/180 #in radian
#Formula : Tm=J*Qs*dfBYdt #in N-m
dfBYdt=Tm/J/Qs #in step/sec**2
print "Maximum acceleration = %0.3e steps/sec**2 "%dfBYdt
from math import pi
# Given data
Ns=12 #poles
q=3 #no. of phase
Nr=8 #poles
speed=6000 #speed in rpm
#Calculations
Beta=360/q/Nr #in degree
print "Step Angle = %0.2f degree "%Beta
fc=Nr*speed*2*pi/2/pi/60 #in Hz
print "Commutation frequency at each phase = %0.f Hz "%fc
# Given data
Ns=10 #poles
q=5 #no. of phase
Nr=4 #poles
w=600 #speed in rpm
#Calculations
Beta=360/q/Nr #in degree
print "Step Angle = %0.2f degree "%Beta
fc=Nr*w/60 #in Hz
print "Commutation frequency at each phase = %0.2f Hz" %fc
#Note : Answer is wrong in the book.
# Given data
Ns=6 #poles
Nr=4 #poles
Beta_s=30 #in degree
Beta_r=32 #in degree
La=10.7 #in mH
LU=1.5 #in mH
i=7 #in A
q=3 #phase
#Calculations
thetaK=2*180/4-(Beta_r+Beta_s)/2 #in degree
theta1=thetaK #in degree
thetaY=2*180/2-(Beta_r-Beta_s)/2 #in degree
theta2=thetaY #in degree
dTheta=theta2-theta1 #in degree
dL=La-LU #in mH
T=i**2/2*dL/dTheta #in N-m
lambda_a=La*i*10**-3 #in m
lambda_u=LU*i*10**-3 #in m
Wm=(lambda_a-lambda_u)/2*i #in joules
#Formula : Power transfered = Energy 1 sec
#Pm=2*pi*N*T/60=Wm*Nr*q*N/60
T=Wm*Nr*q/2/pi #in N-m
print "Averagge torque = %0.2f N-m "%T
# Given data
Nr=4 #poles
La=10.7 #in mH
Lu=1.5 #in mH
i=7 #in A
q=3 #phase
#Calculations
lambda_a=La*10**-3*i #in Wb/T
lambda_u=lambda_a #in Wb/T
i2=lambda_u/Lu/10**-3 #in Ampere
Wm=(i2-i)*lambda_u/2 #in Jooules
print "Energy conversion per stroke = %0.3f Joules "%Wm
T=Wm*q*Nr/2/pi #in N-m
print "Average Tourque = %0.2f N-m "%T