In [2]:

```
# To find deflection caused by the given unbalance
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 5-1 in Page 101
# Given data
# Resistances of the 4 arms in ohm
R_1 = 1000.0
R_2 = 100.0
R_3 = 200.0
R_4 = 2005.0
E = 5 # battery EMF in volt
S_I = 10*(10**-3)/(10**-6) #Current sensitivity in m/A
R_g = 100.0 #Internal resistance of galvanometer in ohm
#Calculations
#Calculations are made wrt fig 5-3 in page 103
#Bridge balance occurs if arm BC has a resistance of 2000 ohm. The diagram shows arm BC has as a resistance of 2005 ohm
#To calculate the current in the galvanometer, the ckt is thevenised wrt terminals B and D.
#The potenttial from B to D, with the galvanometer removed is the Thevenin voltage
# E_TH = E_AD - E_AB
E_TH = E * ((R_2/(R_2+R_3)) - (R_1/ (R_1+R_4)))
R_TH = ((R_2 * R_3/(R_2+R_3)) + (R_1 * R_4/ (R_1+R_4)))
#When the galvanometer is now connected to the output terminals, The current through the galvanometer is
I_g = E_TH /(R_TH +R_g)
d = I_g * S_I
print "The deflection of the galvanometer = ",round(d*1000,2)," mm"
#Result
# The deflection of the galvanometer = 33.26 mm
```

In [4]:

```
# To check the capability of detecting unbalance
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 5-2 in Page 102
# Given data
# Resistances of the 4 arms in ohm
R_1 = 1000.0
R_2 = 100.0
R_3 = 200.0
R_4 = 2005
E = 5 # battery EMF in volt
S_I = 1*(10**-3)/(10**-6) #Current sensitivity in m/A
R_g = 500 #Internal resistance of galvanometer in ohm
#Calculations
#Calculations are made wrt fig 5-3 in page 103
#Bridge balance occurs if arm BC has a resistance of 2000 ohm. The diagram shows arm BC has as a resistance of 2005 ohm
#To calculate the current in the galvanometer, the ckt is thevenised wrt terminals B and D.
#The potenttial from B to D, with the galvanometer removed is the Thevenin voltage
# E_TH = E_AD - E_AB
E_TH = E * ((R_2/(R_2+R_3)) - (R_1/ (R_1+R_4)))
R_TH = ((R_2 * R_3/(R_2+R_3)) + (R_1 * R_4/ (R_1+R_4)))
#When the galvanometer is now connected to the output terminals, The current through the galvanometer is
I_g = E_TH /(R_TH +R_g)
d = I_g * S_I
print "The deflection of the galvanometer = ",round(d*1000,2)," mm"
print 'Given that galvanometer is capable of detecting a deflection of 1mm'
print 'Hence looking at the result,it can be seen that this galvanometer produces a deflection that can be easily observed'
#Result
# The deflection of the galvanometer = 2.247 mm
# Given that galvanometer is capable of detecting a deflection of 1mm
# Hence looking at the result,it can be seen that this galvanometer produces a deflection that can be easily observed
```

In [8]:

```
# To find the unknown impedence
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 5-3 in Page 111
# Given data
# The given polar forms in textbook is represented in rect form
Z_1 = 17.36482 +1j *98.48078
Z_2 = 250
Z_3 = 346.4102 +1j *200
#Calculations
#The first condition for bridge balance is Z_1*Z_4 = Z_2*Z_3
mod_Z_4 = (abs(Z_2)*abs(Z_3))/abs(Z_1)
#The second condition for bridge balance requires that sum of the phase angles of opposite arms be equal
theta_Z_4 = math.atan(Z_2.imag)+math.atan(Z_3.imag)-math.atan(Z_1.imag)*180/math.pi
print "The impedence of the unknown arm =",round(mod_Z_4)," ohm /_ ",round(theta_Z_4)," deg\n"
print "Here the magnitude of impedence is 1000 and phase angle is 50 in degrees\n"
print "The above value indicates that we are dealing with a capacitive element, possibly consisting of a series combination of a resistor and capacitance"
#Result
# The impedence of the unknown arm = 1000 ohm /_ -50 deg
# Here the magnitude of impedence is 1000 and phase angle is 50 in degrees
# The above value indicates that we are dealing with a capacitive element, possibly consisting of a series combination of a resistor and capacitance
```

In [11]:

```
# To find the unknown impedence
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 5-4 in Page 112
# Given data
# The notations are wrt to the figure 5-10 in page 109
#Arm AB
R_1 = 450
#Arm BC
R_2 = 300
C = 0.265 *(10**-6)
#Arm DA
R_3 = 200
L = 15.9*(10**-3)
f = 1000
#Calculations
w = 2*math.pi*f
Z_1 = 450
Z_2 = R_2 - 1j *floor(1/(w*C))
Z_3 = R_3 + 1j*ceil(w*L)
Z_4 = Z_1*Z_3/Z_2
print "The impedence of the unknown arm = ",round(imag(Z_4))," ohm\n"
print "The result indicates that Z_4 is a pure inductance with an inductive reactance of 150 ohm at a frequency of 1 khz.\n"
L_ans = imag(Z_4)/w
print "The inductance present in the arm CD = ",round(L_ans*1000,1),"m H"
#Result
# The impedence of the unknown arm = 150i ohm
# The result indicates that Z_4 is a pure inductance with an inductive reactance of 150 ohm at a frequency of 1 khz.
# The inductance present in the arm CD = 23.9m H
```

In [5]:

```
# To balance the unbalanced bridge
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 5-5 in Page 119
# Given data
Z_1 = -1000j
Z_2 = 500
Z_3 = 1000
Z_4 = 100+500j
# The balance is not possible with this condition as theta_1+theta_4 will be slightly negative than theta_2+theta3
# Balance can be achieved by 2 methods:
print "First option is to modify Z_1 so that its phase angle is decreased to less than 90deg by placing a resistor in parallel with the capacitor."
# The resistance R_1 can be determined by the standard approach
#Calculations
Y_1 = Z_4/(Z_2*Z_3)
#Also,
# Y_1 = (1/R) + %i/1000
# equating both the equations and solving for R_1
R_1 = 1/(Y_1-(1j/1000 ))
print "The value of the resistor R_1 in parallel with capacitor = ",R_1.real," ohm\n",
# It should be noted that the addition of R_1 upsets the first balance condition as the magnitude of Z_1 is changed
# Hence the variable R_3 should be adjusted to compensate this effect
print 'The second option is to modify the phase angle of arm 2 or arm 3 by adding series capacitor'
Z_3_1 = Z_1 *Z_4/Z_2
# substituting for the component values and solving for X_C yeilds
X_C = abs(1000- Z_3_1)/-1j
print "The value of the reactance of the capacitor used, X_C = ",X_C.imag," ohm"
#In this case the magnitude of the Z_3 is increased so that the first balance condition is changed
#A small adjustment of R_3 is necessary to restore balance
#Result
# First option is to modify Z_1 so that its phase angle is decreased to less than 90deg by placing a resistor in parallel with the capacitor.
# The value of the resistor R_1 in parallel with capacitor = 5000 ohm
# The second option is to modify the phase angle of arm 2 or arm 3 by adding series capacitor
# The value of the reactance of the capacitor used, X_C = 200 ohm
```