#Calculate shunt resistance and multiplying factor
#given
Im=5.*10.**-3.;#A
Rm=20.;#ohm
I=5.;#A
Rsh=Rm*Im/(I-Im);
n=I/Im;
print '%s %.5f %s' %("Shunt resistance =",Rsh,"ohm\n");
print '%s %.f %s' %("Multiplying factor =",n,"\n");
#Calculate shunt resistance
#given
#At I= 1 mA
I1=1.*10.**-3.;#A
Im=0.1*10.**-3.;#A
Rm=500.;#ohm
Rsh=Rm*Im/(I1-Im);
print '%s %.4f %s' %("Shunt resistance =",Rsh,"ohm\n");
#At I= 1 mA
I2=10.*10.**-3.;#A
Rsh=Rm*Im/(I2-Im);
print '%s %.4f %s' %("Shunt resistance =",Rsh,"ohm\n");
#At I= 1 mA
I3=100.*10.**-3.;#A
Rsh=Rm*Im/(I3-Im);
print '%s %.4f %s' %("Shunt resistance =",Rsh,"ohm\n");
#Caluclate the series resistance to convert it into voltmeter
#given
Im=100.*10.**-6.;#A
Rm=100.;#ohm
V=100.;#V
Rs=V/Im-Rm;
print '%s %.1f %s' %("The value of series resistance is",Rs/1000,"kohm");
#Calculate multiplier resistance and voltage multiplying factor
#given
Im=50.*10.**-6.;#A
Rm=1000.;#ohm
V=50.;#V
Rs=V/Im-Rm;
print '%s %.f %s' %("The value of multiplier resistance is",Rs/1000,"kohm\n");
Vm=Im*Rm;
n=V/Vm;
print '%s %.f %s' %("Voltage multiplying factor =",n,"\n");
#Calculate reading and error of each voltmeter
#given
def prll(r1,r2):
z=r1*r2/(r1+r2)#
return z
S_A=1000.;# ohm/V#sensitivity
S_B=20000.;# ohm/V#sensitivity
R=50.;#V#range of voltmeter
Vs=150.;#V#Supply
R1=100.*10.**3.;#ohm
R2=50.*10.**3.;#ohm
Vt=Vs*(R2/(R1+R2));
#Voltmeter A
Ri1=S_A*R;
Rxy_A=prll(Ri1,R2); #total resistance at X and Y
V1=Vs*(Rxy_A/(Rxy_A+R1));
print '%s %.f %s' %("The voltmeter indicates",V1,"V\n");
#Voltmeter B
Ri2=S_B*R;
Rxy_B=prll(Ri2,R2); #total resistance at X and Y
V2=Vs*(Rxy_B/(Rxy_B+R1));
print '%s %.2f %s' %("The voltmeter indicates",V2,"V\n");
e1=(Vt-V1)*100./Vt;
e2=(Vt-V2)*100./Vt;
print '%s %.f %s' %("The error in the reading of voltmeter A =",e1,"percent\n");
print '%s %.2f %s' %("The error in the reading of voltmeter A =",e2,"percent\n");
#Determine rms value of the ac voltage
#given
import math
l=8.3;#cm#length of the trace
D=5.;# V/cm#deflection sensitivity
Vpp=l*D;
Vrms=Vpp/(2.*math.sqrt(2.));
print '%s %.1f %s' %("The rms value of the ac voltage",Vrms,"V");
#Determine rms value and frequency of the sine voltage
#given
import math
l=3.5;#cm #length of the trace
D=2.;# V/cm #deflection sensitivity
Vpp=l*D;
Vrms=Vpp/math.sqrt(2.);
print '%s %.2f %s' %("The rms value of the sine voltage =",Vrms,"V\n");
x=4.;#cm #one cycle length on x axis
t=0.5*10.**-3.;# s/cm #timebase setting
T=x*t;
f=1./T;
print '%s %.1f %s' %("The frequency of the sine voltage =",f/1000,"kHz");