In [16]:

```
import math
# Comparing alternating voltage v = 35*sin(314.2*t) with the standard Eq.
# Part (a)
V_m = 35; # Maximum value of alternating voltage, volt
# Part (b)
#We know that v= vm8sin(2*pi*f*t)
#Comparing the alternating voltage equation with the above one, we get,
f = 314.2/(2*math.pi) # Frequency of waveform, Hz
# Part (c)
T = 1/f; # Time period of waveform, sec
# Part (d)
t = 3.5; # Time with reference to zero crossing, sec
v = 35*math.sin(2*math.pi*50*3.5*1e-03); # Volatge value after the waveform passes through zero, going positive
#Results
print "The maximum value of alternating voltage = %2d volt"%V_m
print "The frequency of alternating voltage = %2d Hz"%f
print "The time period of alternating voltage = %3.1f ms"%(T/1e-03);
print "The volatge value after the waveform passes through zero = %5.2f volt"%v
```

In [17]:

```
import math
# Part (a)
#I = Im*sin(2*pi*f*t)
# Given i = 75*sin(200*%pi*t) mA which on comparing with the general expression gives
#Comparing the above two equations, we get,
f = (200*math.pi)/(2*math.pi) # Frequency of alternating current, Hz
# Part(b)
i = 35.; # Alternating current after passing through zero, mA
t = math.asin(i/75)/(200*math.pi*1e-03); # Time taken for current to reach 35 mA, ms
#Results
print "The frequency of alternating current = %2d Hz"%f
print "The time taken for current to reach 35 mA = %5.3f mA"%t
```

In [3]:

```
#Variable declaration
V_av = 3.5; # Average value of sinusoidal alternating voltage, V
T = 6.67e-03; # Time period of alternating current, s
#Calculations
V_m = V_av/0.637; # Peak value of alternating current, V
f = 1/T; # Frequency of alternating volatge, Hz
#Result
print "The standard expression for %3.1f voltage = %3.1f sin(%3d*pi*t) volt"%(V_av, V_m,round(2*f))
```

In [18]:

```
import math
#Variable declaration
V_av = 3.5; # Average value of sinusoidal alternating voltage, V
T = 6.67e-03; # Time period of alternating voltage, s
#Calculations&Results
V_m = V_av/0.637; # Peak value of alternating voltage, V
f = 1/T; # Frequency of alternating volatge, Hz
# Part (a)
t = 0.5e-03; # Time taken by the waveform after passing through zero, s
v = V_m*math.sin(2*math.pi*f*t); # Instantaneous value of alternating voltage, s
print "The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt"%(t/1e-03, v)
# Part (b)
t = 4.5e-03; # Time taken by the waveform after passing through zero, s
v = V_m*math.sin(2*math.pi*f*t); # Instantaneous value of alternating voltage, s
print "The instantaneous value of alternating voltage after %3.1f ms = %3.1f volt"%(t/1e-03, v);
# Part (c)
v = 3; # Alternating voltage after passing through zero, mA
t = math.asin(v/V_m)/(2*math.pi*f); # Time taken for current to reach 3 V, s
print "The time taken for voltage to reach %1d volt = %5.3f ms"%(v, t/1e-03);
```

In [19]:

```
import math
#Variable declaration
V = 240; # Rms vlaue of alternating voltage, volt
#Calculations
V_m = math.sqrt(2)*V; # Peak value of alternating voltage, volt
#Result
print "The amplitude of household %3d volt supply = %5.1f volt"%(V, V_m);
```

In [6]:

```
#Variable declaration
pf = 2.5; # Peak factor of non-sinusoidal alternating voltage
V = 240; # Rms vlaue of alternating voltage, volt
#Calculations
V_m = pf*V; # Peak value of alternating voltage, volt
#Result
print "The absolute minimum working voltage = %3d volt"%V_m
```

In [20]:

```
import math
#Variable declaration
l = 0.25; # Length of the rectangular coil, m
d = 0.2; # Width of rectangular coil, m
N = 80; # Number of turns of the rectangular coil
B = 0.075; # Magnetic flux density, tesla
n = 3000/60; # Frequency of revolution of the coil, rev/s
v = n*math.pi*d; # Linear speed with which the coil sides move, m/s
t = 2e-03; # Time after the emf crosses zero, s
#Calculations
# Part (a)
# As e = 2*N*B*l*v*sin(2*pi*f*t) volt, and for maximum value of sin(2*pi*f*t) = 1
E_m = 2*N*B*l*v*(1); # Amplitude of emf, volt
E = 0.707*E_m; # rms value of emf, volt
E_av = 0.637*E_m; # Average value of emf, volt
# For a two pole field system,
f = n; # Frequency of generated waveform, Hz
# Part (b)
T = 1./f; # Time period of generated waveform, Hz
# Part (c)
e = E_m*math.sin(2*math.pi*f*t); # Instantaneous value at time 2 ms after zero, volt
#Results
print "The amplitude, rms and average value of emf = %5.2f V, %5.2f V and %5.2f V resp."%(E_m, E, E_av);
print "The frequency and time period of generated waveform = %2d Hz and %2d ms resp."%(f, T/1e-03);
print "The instantaneous value of emf at time 2 ms after crossing zero = %4.1f V"%e
```

In [21]:

```
import math
#Variable declaration
R_c = 50; # Resistance of the coil of meter, ohm
K = 10e+03; # Figure of merit of the moving coil meter, ohm per volt
V = 10; # d.c. range of coil meter, volt
#Calculations&Results
# Part (a)
I_fsd = 1/K; # Full scale deflection for moving coil meter, ampere
R = V/I_fsd; # Total meter resistance, ohm
# As R = R_m + R_c, solvign for R_m
R_m = R - R_c; # Multiplier resistance required by the meter, ohm
print "The multiplier resistance required for 10 V d.c. range = %5.2f k-ohm"%(R_m/1e+03)
# Part(b)
I_av = I_fsd; # Average value of ac current, A
I_rms = math.pi/(2*math.sqrt(2))*I_av; # rms value of ac current, A
V = 10 ; # a.c. range of coil meter, volt
R = V/I_rms; # Total meter resistance, ohm
# As R = R_m + R_c, solvign for R_m
R_m = R - R_c; # Multiplier resistance required by the meter, ohm
print "The multiplier resistance required for 10 V a.c. range = %5.2f k-ohm"%(R_m/1e+03);
```

In [9]:

```
# Case_I: Square_wave
ff = 1.11; # Form factor of calibrated meter
ff_square = 1; # Form factor for square wave
V_apparent = 5; # Meter reading for sqaure wave, volt
V_true = V_apparent*1*(ff_square/ff); # True rms value of square wave voltage, volt
print "The true rms value of square wave voltage = %5.3f V"%V_true
# Case_II: Triangular_wave
ff_triangle = 1.15; # Form factor for triangular wave
V_apparent = 5; # Meter reading for triangular wave, volt
V_true = V_apparent*(ff_triangle/ff); # True rms value of triangular wave voltage, volt
print "The true rms value of triangular wave voltage = %4.2f V"%V_true
```

In [22]:

```
import math
#Variable declaration
# The general expression for alternating current is I = Io*sin(2*pi*f*t + phi)
#Comparing the given equations with the above, we get,
f = (80*math.pi)/(2*math.pi) # Frequency of alternating current, Hz
#Calculations
# I2 is the reference waveform with zero phase angle, so that
phi2 = 0; # Phase angle for reference waveform I2, degrees
Im2 = 3; # Current amplitude of reference waveform I2, A
Im1 = 5; # Current amplitude of reference waveform I1, A
Im3 = 6; # Current amplitude of reference waveform I3, A
phi1 = math.pi/6*(180/math.pi); # Phase angle for reference waveform I1, degrees
phi3 = math.pi/4*(180/math.pi); # Phase angle for reference waveform I3, degrees
#Results
print "The frequency of all three waveforms = %2d Hz"%f
print "I1 leads I2 by = %2.0f degrees"%(phi1-phi2);
print "I3 lags I2 by = %2d degrees"%(phi3-phi2);
print "Current amplitude of reference waveform I1 = %1d A"%Im1
print "Current amplitude of reference waveform I2 = %1d A"%Im2
print "Current amplitude of reference waveform I3 = %1d A"%Im3
```

In [23]:

```
import math
#Variable declaration
Im1 = 7; # Current amplitude of reference waveform I1, A
Im2 = 6; # Current amplitude of reference waveform I2, A
Im3 = 5; # Current amplitude of reference waveform I3, A
Im4 = 4; # Current amplitude of reference waveform I4, A
#Calculations
phi1 = 70*math.pi/180; # Phase angle for reference waveform I1, rad
phi2 = 0*math.pi/180; # Phase angle for reference waveform I2, rad
phi3 = -50*math.pi/180; # Phase angle for reference waveform I3, rad
phi4 = -90*math.pi/180; # Phase angle for reference waveform I4, rad
#Results
print "i1 = %dsin(wt + %4.2f) amp"%(Im1, phi1)
print "i2 = %dsin wt amp"%Im2;
print "i3 = %dsin(wt + %4.2f) amp"%(Im3, phi3);
print "i4 = %dsin(wt + %4.2f) amp"%(Im4, phi4);
```

In [24]:

```
import math
#Variable declaration
omega = 314.; # Angular frequency of voltage, rad per sec
Vm1 = 25.; # Peak value of first phasor, V
Vm2 = 15.; # Peak value of second phasor, V
#Calculations
H_C = Vm1*math.cos(math.pi/3)+Vm2*math.cos(-math.pi/6); # Horizontal component of phasor sum, V
V_C = Vm1*math.sin(math.pi/3)+Vm2*math.sin(-math.pi/6); # Vertical component of phasor sum, V
Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V
phi = math.atan(V_C/H_C); # Phase angle, degrees
print "v = %5.2fsin(%3dt + %5.3f) volt"%(Vm, omega, phi);
```

In [25]:

```
import math
#Variable declaration
Im1 = 6; # Peak value of first phasor, A
Im2 = 8; # Peak value of second phasor, A
Im3 = 4; # Peak value of third phasor, A
#Calculations
H_C = Im1*math.cos(0)+Im2*math.cos(-math.pi/2)+Im3*math.cos(math.pi/6); # Horizontal component of phasor sum, A
V_C = Im1*math.sin(0)+Im2*math.sin(-math.pi/2)+Im3*math.sin(math.pi/6); # Vertical component of phasor sum, A
Im = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V
phi = math.atan(V_C/H_C); # Phase angle, rad
print "i = %4.1fsin(wt%5.3f) amp"%(Im, phi);
```

In [26]:

```
import math
# Part (a)
omega = 628; # Angular frequency of voltage, rad per sec
f = omega/(2*math.pi); # Frequency of the waveforms, Hz
Vm1 = 10.; # Peak value of first phasor, V
Vm2 = 8.; # Peak value of second phasor, V
Vm3 = 12.; # Peak value of third phasor, V
phi1 = -math.pi/6*180/math.pi; # Phase angle for first voltage, degrees
phi2 = math.pi/3*180/math.pi; # Phase angle for second voltage, degrees
phi3 = math.pi/4*180/math.pi; # Phase angle for third voltage, degrees
print "The frequency of all three waveforms = %3d Hz"%f
print "The phase angle and frequency of first voltage : %2d degrees, %2d V"%(phi1, Vm1);
print "The phase angle and frequency of second voltage : %2d degrees, %2d V"%(phi2, Vm2);
print "The phase angle and frequency of third voltage : %2d degrees, %2d V"%(phi3, Vm3);
# Part (b)
H_C = Vm1*math.cos(phi1)+Vm2*math.cos(phi2)+Vm3*math.cos(phi3); # Horizontal component of phasor sum, V
V_C = Vm1*math.sin(phi1)+Vm2*math.sin(phi2)+Vm3*math.sin(phi3); # Horizontal component of phasor sum, V
Vm = math.sqrt(H_C**2+V_C**2); # Peak value of phasor sum, V
phi = math.atan(V_C/H_C); # Phase angle, rad
print "v = %5.2fsin(%3dt + %5.3f) volt"%(Vm, omega, phi);
```

In [27]:

```
import math
#Variable declaration
tb1 = 0.1e-03; # Timebase of channel 1, s/cm
tb2 = 10e-06; # Timebase of channel 2, s/cm
Y_amp1 = 5.; # Y-amp setting for channel 1, V/cm
Y_amp2 = 0.5; # Y-amp setting for channel 2, V/cm
#Calculations&Results
# Channel 1
V_pp = 3*Y_amp1; # Peak-to-peak value of waveform in channel 1, V
Vm = V_pp/2; # Amplitude of waveform in channel 1, V
V = Vm/math.sqrt(2); # rms value of sine wave in channel 1, V
T = 4*tb1; # Time period of sine wave, second
f = 1./(T*1000); # Frequency of sine wave, kHz
print "The amplitude of sine waveform in channel 1 = %3.1f V"%Vm
print "The rms value of sine wave in channel 1 = %3.1f V"%V
print "The frequency of sine wave in channel 1 = %3.1f kHz"%f
# Channel 2
V_pp = 2*Y_amp2; # Peak-to-peak value of waveform in channel 2, V
Vm = V_pp/2; # Amplitude of waveform in channel 2, V
V = Vm; # rms value of square wave in channel 2, V
T = 2./3*tb2; # Time period of square wave, second
f = 1./(T*1000); # Frequency of square wave, kHz
print "The amplitude of square waveform in channel 2 = %3.1f V"%Vm
print "The rms value of square wave in channel 2 = %3.1f V"%V
print "The frequency of square wave in channel 2 = %3d kHz"%f
```