from __future__ import division
from math import sqrt
V_rms=440#
P_o_fl=5*746# #full-load rated output power
I_rms_fl=6.8# #full-load line current
PF_fl=0.78# #full-load power factor
n_fl=1150# #full-load speed in rpm
I_rms_nl=1.2# #no-load line current
PF_nl=0.3# #no-load power factor
n_nl=1195# #no-load speed in rpm
P_in_fl=sqrt(3)*V_rms*I_rms_fl*PF_fl# #full-load input power
P_loss_fl=P_in_fl-P_o_fl# #full-load power loss
eff_fl=(P_o_fl/P_in_fl)*100# #full-load efficiency
P_in_nl=sqrt(3)*V_rms*I_rms_nl*PF_nl# #no-load input power
P_o_nl=0# #no-load output power
eff_nl=0# #no-load efficiency('0' as P_o_nl=0)
SR=(n_nl-n_fl)*100/n_fl# #speed regulation
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'Power loss with full-load = %0.2f watts'%P_loss_fl
print 'Efficiency with full-load = %0.2f'%eff_fl
print 'Input power with no-load = %0.2f watts'%P_in_nl
print 'speed regulation percentage for the motor : %0.2f'%SR
from __future__ import division
from math import pi
B=1# #magnetic flux density
l=0.3#
V_T=2#
R_A=0.05#
#CASE a
#bar is stationary at t=0
u_ini=0# #initial velocity of bar is 0
e_A=B*l*u_ini# #induced voltage
i_A_ini=(V_T-e_A)/R_A# #initial current
F_ini=B*l*i_A_ini# #initial force on the bar
#steady state condition with no-load e_A=B*l*u=V_T
u=V_T/(B*l)# #from steady state condition with no-load
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'CASE a:'
print 'initial current = %0.2f amperes'%i_A_ini
print 'initial force on the bar = %0.2f newtons'%F_ini
print 'steady-state final speed = %0.2f m/s'%u
#CASE b
F_load=4# #mechanical load
#steady state condition F=B*l*i_A=F_load
i_A=F_load/(B*l)# #from steady state condition
e_A=V_T-R_A*i_A# #induced voltage
u=e_A/(B*l)# #steady-state speed
P_m=F_load*u# #mechanical power
P_t=V_T*i_A# #power taken from battery
P_R=i_A**2*R_A# #power dissipated in the resistance
eff=P_m*100/P_t# #efficiency
print 'CASE b:'
print 'steady-state speed = %0.2f m/s'%u
print 'power delivered by V_t = %0.2f watts'%P_t
print 'power delivered to mechanical load = %0.2f watts'%P_m
print 'power lost to heat in the resistance = %0.2f watts'%P_R
print 'effciency of converting electrical power to mechanical power : %0.2f'%eff
#CASE c
#with the pulling force acting to the right, machine operates as a generator
F_pull=2# #pulling force
#steady-state condition F=B*l*i_A=F_pull
i_A=F_pull/(B*l)# #from steady-state condition
e_A=V_T+R_A*i_A# #induced voltage
u=e_A/(B*l)# #steady-state speed
P_m=F_pull*u# #mechanical power
P_t=V_T*i_A# #power taken by battery
P_R=i_A**2*R_A# #power dissipated in the resistance
eff=P_t*100/P_m# #efficiency
print 'CASE c:'
print 'steady-state speed = %0.2f m/s'%u
print 'power taken from mechanical source = %0.2f watts'%P_m
print 'power delivered to the battery = %0.2f watts'%P_t
print 'power lost to heat in the resistance = %0.2f watts'%P_R
print 'efficiency of converting mechanical power to electrical power : %0.2f'%eff
from __future__ import division
from math import pi
n_2=800# #speed in rpm
I_A=30# #armature current
I_F=2.5# #field current
R_A=0.3# #armature resistance
R_F=50# #field resistance
V_F=I_F*R_F# #field coil voltage
#E_A1 and n_1 from magnetization curve
E_A1=145# #induced voltage
n_1=1200# #speed in rpm
E_A2=n_2*E_A1/n_1#
W_m=n_2*2*pi/60# #speed in radians per second
K=E_A2/W_m# #K*phi is taken as K, machine constant
T_dev=K*I_A# #developed torque
P_dev=W_m*T_dev# #developed power
V_T=R_A*I_A+E_A2# #voltage applied to armature
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'Voltage applied to field circuit = %0.2f volts'%V_F
print 'Voltage applied to armature %0.2f volts'%V_T
print 'Developed torque = %0.2f Nm'%T_dev #Nm-newton meter
print 'Developed power = %0.2f watts'%P_dev
from __future__ import division
from math import pi
V_T=240# #dc supply voltage
R_A=0.065# #armature resistance
R_F=10# #field resistance
R_adj=14# #adjustable resistance
n=1200# #speed in rpm
P_rot=1450# #rotational power loss
T_out=250# #hoist torque
I_F=V_T/(R_F+R_adj)# #field current
#E_A at I_F and n from magnetization curve
E_A_1=280# #armature voltage
W_m_1=n*2*pi/60# #speed in radians per second
K=E_A_1/W_m_1# #machine constant
T_rot=P_rot/W_m_1# #rotational loss-torque
T_dev=T_rot+T_out# #developed torque
I_A=T_dev/K# #armature current
E_A_2=V_T-R_A*I_A# #applying KVL
W_m_2=E_A_2/K# #speed in radians per second
n_m=W_m_2*60/(2*pi)# #speed in rpm
P_out=T_out*W_m_2# #output power
I_L=I_F+I_A# #line current
P_in=V_T*I_L# #input power
eff=P_out*100/P_in# #efficiency
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'Motor speed = %0.2f rpm'%n_m
print 'Efficiency of the motor : %0.2f'%eff
from __future__ import division
from math import pi,sqrt
n_m_1=1200# #speed in rpm
T_out_1=12# #motor torque
W_m_1=n_m_1*2*pi/60# #angular speed
#As we are neglecting losses, the output torque and power are equal to the developed torque and power respectively
P_out_1=W_m_1*T_out_1# #output power
#For Torque=24
T_out_2=24#
T_dev_2=T_out_2#
#T_dev=K*K_F*V_T**2/(R_A+R_F+K*K_F*W_m**2)
#neglecting resistances and with the above equation for T_dev, we get inverse relation between torque and square of speed
W_m_2=W_m_1*sqrt(T_out_1)/sqrt(T_dev_2)#
n_m_2=W_m_2*60/(2*pi)#
P_out_2=T_dev_2*W_m_2#
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'Output power for load torque=12 = %0.2f watts'%P_out_1
print 'speed for torque=24 = %0.2f rpm'%n_m_2
print 'Output power for load torque=24 = %0.2f watts'%P_out_2
from __future__ import division
from math import pi,sqrt
V_F=140# #field voltage
R_F=10# #field resistance
R_adj=4# #adjusting resistance
R_A=0.065# #armature resistance
n_A=1000# #armature speed in rpm
I_fl=200# #full-load current
eff=0.85# #efficiency not including power supplied to field circuit
I_F=V_F/(R_adj+R_F)# #field current
#E, voltage from magnetization curve for speed of n=1200
n=1200#
E=280# #voltage of armature
#E_A is no-load voltage
E_A=E*n_A/n# #E_A is proportional to speed
V_FL=E_A-R_A*I_fl# #full-load voltage
VR=(E_A-V_FL)*100/V_FL# #voltage regulation
P_out=I_fl*V_FL# #output power
P_dev=P_out+(I_fl**2)*R_A# #developed power
W_m=n_A*2*pi/60# #angular speed
P_in=P_out/eff# #input power
P_loss=P_in-P_dev# #all power losses combined
T_in=P_in/W_m# #input torque
T_dev=P_dev/W_m# #developed torque
print " All the values in the textbook are approximated hence the values in this code differ from those of Textbook"
print 'Field current = %0.2f amperes'%I_F
print 'no-load voltage = %0.2f volts'%E_A
print 'full-load voltage = %0.2f volts'%V_FL
print 'percentage voltage regulation : %0.2f'%VR
print 'input torque = %0.2f Nm'%T_in
print 'developed torque = %0.2f Nm'%T_dev
print 'all types of power losses combined = %0.2f watts'%P_loss