from __future__ import division
from math import asin, pi
print 'For spring controlled Tc is proportional to theta'
theta=90*(3/5)**2
print "Deflection for spring controlled instrument=%.2f degree"%(theta)
print 'For gravity controlled Tc is proportional to sin(theta)'
theta=asin((3/5)**2)*180/pi
print "Deflection for gravity controlled instrument=%.2f degree"%(theta)
I=1000
Ia=50*10**-3
Is=I-Ia
Ra=10
Va=Ia*Ra
Rs=10*Va/Is
print "The shunt resistance=%.2f ohm"%(Rs)
Is=150*10**-6
I=50*10**-6
R=4*10**3
Rt=R*I/Is
print "the value of total resistance=%.2f ohm"%(Rt)
V=1
R=2*10**3
I=(V/R)*1000
print "Actual current=%.2f mA"%(I)
Rm=1000
Rt=R+Rm
I=(V/Rt)*1000
print "Current when Rm is 1000 ohm =%.2f mA"%(I)
Rm=100
Rt=R+Rm
I=(V/Rt)*1000
print "Current when Rm is 100 ohm =%.2f mA"%(I)
I=20
E_expected=2.5*I/100
print "Expected error=+/-%.2f mA"%(E_expected)
print 'Actual reading for 5mA indication will be 4.5mA to 5.5mA'
print 'Actual reading for 15mA indication will be 14.5mA to 15.5mA'
E_5mA=(0.5/5)*100
print "Error for 5mA reading=%.2f percent"%(E_5mA)
E_15mA=(0.5/15)*100
print "Error for 15mA reading=%.2f percent"%(E_15mA)
V=20
A=20*10**-6
Ra=25*10**3
Rx=((V/A)-Ra)*10**-3
print "The resistance = %.0f Kohm"%(Rx)
E_voltmeter=(2/(100*20))*20*100
E_current=(2/(100*20))*50*100
E_total=E_voltmeter+E_current
print "Maximum possible error=%.1f percent"%(E_total)
V=20
A=20*10**-3
Rv=10*10**3*20
Rx=(V/(A-(V/Rv)))/1000
print "The resistance=%.2f Kohm"%(Rx)
E_total=2.5+2.5
print "Maximum possible error=%.0f percent"%(E_total)
Sp_constant=10.5*10**-6*pi/180
deflection=83
Td=Sp_constant*deflection
I1=10
K=0.078
I2=(Td/(K*I1))*10**6
print "Current in the voltage coil=%.2f uA"%(I2)
AH=5*1/2
print "AH passed in 30 minuties = %.1f percent"%(AH)
V_assumed=0.51*1000/AH
V_actual=200
Error=V_actual-V_assumed
Correction=-Error
Cor=Correction*100/V_actual
print "Correction required = %.1f percent"%(Cor)
E_unity_pf=230*6*4*1/1000
M_constant=2208/E_unity_pf
print "Meter constant=%.1f rev/kWh"%(M_constant)
E_consumed=1472/M_constant
pf=(E_consumed/(230*5*4))*1000
print "power factor=%.2f"%(pf)
from math import acos
phi=acos(0.8)*180/pi
alpha_actual=85-phi
alpha_true=90-phi
er=(alpha_true-alpha_actual)/(alpha_true)*100
print "percentage error at full load = %.2f"%(er)