# Torque
#given data :
N=10 # turns
L=1.5*10**-2 # in m
I=1 # in mA
I*=10**-3 #A
B=0.5 # T
d=1*10**-2 # in m
Td=B*I*L*d*N # Nm
print "Torque, Td = ", Td,"Nm"
# number of turns
#given data :
import math
theta=math.pi/2
I=5*10**-3 # in A
B=1.8*10**-3 # in Wb/m2
C=0.14*10**-6 # in Nm/rad
L=15*10**-3 # in m
d=12*10**-3 # in m
N=(C*theta)/(B*I*L*d)
print "Number of turns, N = ", round(N),"turns"
# resistance
#given data :
Tc=240*10**-6 #in Nm
N=100 # Turns
L=40*10**-3 # in m
d=30*10**-3 # in m
B=1 #in Wb/m2
TdBYI=N*B*L*d
I=Tc/TdBYI
#voltage per division=I*(R/100)
R=100/I # ohm
R*=10**-3 # kohm
print "Resistance, R = ", R,"kohm"
#UNIT IS GIVEN WRONG FOR THE ANSWER IN THE BOOK.
# flux density and diameter
import math
#given data :
p=1.7*10**-8 #in ohm-m
V=100*10**-3 #in V
R=50 # in ohm
theta=120 #in degree
L=30 # in mm
d=25 # in mm
N=100
C=0.375*10**-6 # in Nm/degree
I=V/R # A
Td_By_B=I*L*10**-3*d*10**-3*N
Tc=C*theta # N-m
B=Tc/Td_By_B # in Wb/m2
print "The flux density, B = ", B,"Wb/m2"
Rc=0.3*R
Lmt=2*(L+d)
a=(N*p*Lmt*10**-3*10**6)/Rc
D=(4/(math.pi*a))**(1.0/2)
print "Diameter, D = ", round(D,1),"m"
# shunt resistor
#given data :
Im=3*10**-3 # in A
Rm=100 # in ohm
I=150*10**-3 #in A
Rsh=(Im*Rm)/(I-Im)
print "Shunt resistor, Rsh = ", round(Rsh,2),"ohm"
# shunt resistormultiplying factor and resistance
#given data :
Rsh=300 #in ohm
Rm=1500 #in ohm
m=1+(Rm/Rsh)
print "Multiplying factor, m = ",m
m1=40.0
Rsh1=Rm/(m1-1)
print "The shunt resistor, Rsh1 = ", round(Rsh1,2),"ohm"
#given data :
Rm=100.0 # in ohm
Im=1.0
#for range 0-20 mA
I1=20.0
m=I1/Im
Rsh1=Rm/(m-1)
print "The shunt resistor, Rsh1 = ", round(Rsh1,2),"ohm"
#for the range of 0-100 mA
I2=100.0
m=I2/Im
Rsh2=Rm/(m-1)
print "The shunt resistor, Rsh2 = ", round(Rsh2,2),"ohm"
#for the range 0-200 mA
I3=200.0
m=I3/Im
Rsh3=Rm/(m-1)
print "The shunt resistor, Rsh3 = ", round(Rsh3,2),"ohm"
import numpy
from numpy.linalg import inv
#design
Rm=50.0 #in ohm
Im=2.0 #in mA
Im*=10**-3 # A
I1=2.0 #in A
I2=10.0 #in A
I3=15.0 #in A
#Let Rs=R1+R2+R3
A=numpy.array([[I1,I1,I1],[-Im,I2,I2],[Im,Im,-I3]])
B=numpy.array([[Im*Rm],[Im*Rm],[-Im*Rm]])
Ainv=inv(A)
X=numpy.dot(Ainv,B)
R1=X[0]
R2=X[1]
R3=X[2]
print "Value of shunt resistors are : "
print "R1 is %f ohm, R2 is %.1e ohm & R3 is %.2e ohm" %(round(R1,5), R2, R3)
# Answer is wrong in the textbook.
# Multiplier
#Given data :
Vin=20.0 #in volts
I_fsd=50.0*10 **-6 # in Farad
Rm=200.0 # in ohm
Rs=(Vin/I_fsd)-Rm # in ohm
Rs=Rs/10**3 # kohm
print "The multiplier, Rs = ", Rs, " kohm"
# Full scale deflection current
#given data :
Vin=10.0 # in V
Rs=200.0 #in kohm
Rm=400.0 # in ohm
I_fsd=Vin/((Rs*10 **3)+Rm) # A
I_fsd*=10**6 # micro A
print "Full scale deflection current, I_fsd = ", round(I_fsd,1), " micro A"
# Multiplier
#given data :
V1=200.0 #in V
V2=100.0 #in V
V3=10.0 # in V
Rm=100.0 #in ohm
I_fsd=50*10 **-3
#for the range 0-10V
Rt3=V3/I_fsd
Rs3=Rt3-Rm # ohm
print "The multiplier, Rs3 = ", Rs3, " ohm."
#for the range 0-100V
Rt2=V2/I_fsd
Rs2=Rt2-(Rm+Rs3) # ohm
print "The multiplier, Rs2 = ", Rs2, " ohm."
Rt1=V1/I_fsd
Rs1=Rt1-(Rm+Rs3+Rs2)
print "The multiplier, Rs1 = ", Rs1, " ohm."
# Multiplier
#given data :
Rm=200.0 #in ohm
I_fsd=150.0*10 **-6 # in A
S=1/I_fsd
V=50 #in V
Rs=(S*V)-Rm # ohm
Rs*=10**-3 # kohm
print "Multiplier, Rs = ", round(Rs,2), " kohm."
#Accurate voltmeter reading
r1=50.0 # in kohms
r2=50.0 #in kohms
v=100.0 #in V
vr2=(r1/(r1+r2))*v # voltage in V
#case 1
s1=12000.0 #sensivity in ohm/V
rm1=r1*s1*10**-3 # in kohm
req=((rm1*r1)/(rm1+r1)) #equivalent resistance in ohm
v1=((req/(r1+req)))*v # voltmeter reading when sensivity is 12000 ohm/V
#case 2
s2=15000 #sensivity in ohm/V V
rm2=r1*s2*10**-3 # in kohm
req1=((rm2*r1)/(rm2+r1)) #equivalent resistance in ohm
v2=((req1/(r1+req1)))*v # voltmeter reading when sensivity is 15000 ohm/V
print "Voltmeter reading when sensivity is 12000 ohm/V is ", round(v1,2), " V"
print "Voltmeter reading when sensivity is 15000 ohm/V is ", round(v2,2), " V. This voltmeter will measure the correct value."
# Answer in the textbook is not accurate
#voltage
r1=25.0 # kohms
r2=5.0 #in kohms
v=30.0 #in V
# part(i)
vr2=(r2/(r1+r2))*v # voltage in V across 5 kohms resistance
Vactual=vr2 # V
print "Voltage across 5 kohm Resistance is ", vr2, " V."
#part (ii)
vr2=(r1/(r1+r2))*v # voltage in V across 5 kohm resistance
#case 1
s1=1.0 #sensivity in kohm/V
v1=10.0 # in V
rm1=v1*s1 #in kohm
req=((rm1*r2)/(rm1+r2)) # equivalent resistance in ohm
vrb1=((req/(r1+req)))*v # voltmeter reading when sensivity is 1 kohm/V
print "Voltmeter reading when sensivity is 1 kohm/V is ",round(vrb1,2), " V."
# part(iii)
#case 2
s2=20 #sensivity in kohm/V
v1=10 # in V
rm2=v1*s2 #in kohm
req1=((rm2*r2)/(rm2+r2)) #equivalent resistance in ohm
vrb2=((req1/(r1+req1)))*v # voltmeter reading when sensivity is 1 kohm/V
print "Voltmeter reading when sensivity is 1 kohm/V is ",round(vrb2,2), " V."
#part(iii) #error
er1=(Vactual-vrb1)/Vactual*100 #voltmeter 1 error in %
er2=(Vactual-vrb2)/Vactual*100 #voltmeter 2 error in %
print "Voltmeter 1 error is ",round(er1,2)," %"
print "Voltmeter 2 error is ",round(er2,1)," %"
#Answer is wrong in the textbook
#Shunt resistance
#Given data :
Im=1.0 # in mA
Rm=100.0 # in ohm
I=100.0 # in mA
Rsh=(Im*10**-3*Rm)/((I-Im)*10**-3)
print "Shunt resistance, Rsh = ",round(Rsh,3)," ohm."
#Shunt resistance
#Given data :
Im=1.0 # in mA
P=100.0 # in kW
I=100.0 # in mA
Rm=(P)/(Im)**2 # ohm
Rsh=((Im*10**-3*Rm*10**3)/((I-Im)*10**-3))*10**-3 # ohm
print "Shunt resistance, Rsh = ",round(Rsh,3), " kohm"
# Shunt resistance
#given data :
Rsh=200.0 # in ohm
Rm=100.0 # in ohm
m=50.0
Rsh=Rm/(m-1) # ohm
print "The shunt resistance, Rsh = ", round(Rsh,2), " ohm."
# shunt resistance
#Given data :
Im=1.0 # in mA
Rm=100.0 # in ohm
I=100.0 # in mA
Rsh=(Im*10**-3*Rm)/((I-Im)*10**-3) # ohm
print "Shunt resistance, Rsh = ", round(Rsh,3), " kohm."