Waveforms

The waveform of the current $i$ drawn by a load from a sinusoidal AC voltage source is shown in the figure. The current waveform is a quasi-square wave and is free from the third harmonic component. The amplitude of voltage and current are $325\,$V and $10\,$A, respectively. Determine the following.
  1. the angle $\alpha$
  2. the RMS values of voltage and current
  3. the fundamental RMS of current
  4. the average power delivered to the load
  5. the load power factor
($T = 20\,$msec)
In [1]:
from IPython.display import Image
Image(filename =r'waveforms_7_fig_1.png', width=500)
Out[1]:
No description has been provided for this image
In [2]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

T = 20.0e-3
Vm = 325.0
Im = 10.0
omg = 2.0*np.pi/T

alpha = 45.0 # to be changed by user
alpha_rad = alpha*np.pi/180.0

n_div = 5000
t = np.linspace(0.0, 2*T, (n_div+1))
v = Vm*np.sin(omg*t)

T1 = np.pi - alpha_rad
T2 = np.pi
T3 = 2.0*np.pi - alpha_rad

l_i = []

for k, t1a in enumerate(t):
    t1 = t1a % T
    omg_t1 = omg*t1
    if omg_t1 < T1:
        i1 = Im
    elif omg_t1 < T2:
        i1 = 0.0
    elif omg_t1 < T3:
        i1 = -Im
    else:
        i1 = 0.0
    l_i.append(i1)

i = np.array(l_i)

p = v*i

l_v_1 = calc.avg_rms_2(t, v, 0.0, 2.0*T, 1.0e-5*T)
l_i_1 = calc.avg_rms_2(t, i, 0.0, 2.0*T, 1.0e-5*T)
l_p_1 = calc.avg_rms_2(t, p, 0.0, 2.0*T, 1.0e-5*T)

print('v: rms value:',     "%11.4E"%l_v_1[2][0])
print('i: rms value:',     "%11.4E"%l_i_1[2][0])
print('p: average value:', "%11.4E"%l_p_1[1][0])

v2 = np.array(l_v_1)
i2 = np.array(l_i_1)
p2 = np.array(l_p_1)

n_fourier_i = 10
coeff_i, thd_i = calc.fourier_coeff_1C(t, i, 
    T, 2.0*T, 1.0e-4*T, n_fourier_i)
print('fourier coefficients (load current):')
for k, c in enumerate(coeff_i):
    print("  %3d %11.4E"% (k, c))
print("load current fundamental: RMS value: ", "%11.4E"%(coeff_i[1]/np.sqrt(2.0)))

Irms = l_i_1[2][0]
Vrms = l_v_1[2][0]
pf = l_p_1[1][0]/(Vrms*Irms)
print('load power factor:', "%6.3f"%pf)

x_i = np.linspace(0, n_fourier_i, n_fourier_i+1)
y_i = np.array(coeff_i)

fig, ax = plt.subplots(3, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)
grid_color='#CCCCCC'

set_size(6, 6, ax[0])

color1 ='blue'
color2 ='olive'
color3 ='crimson'

for k in range(3):
    ax[k].set_xlim(left=0.0, right=2.0*T*1e3)
    ax[k].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)

ax[1].set_ylim(top=15.0, bottom=-15.0)

ax[0].set_ylabel('$v$',fontsize=13)
ax[1].set_ylabel('$i$',fontsize=13)
ax[2].set_ylabel('$p$',fontsize=13)

ax[0].tick_params(labelbottom=False)
ax[1].tick_params(labelbottom=False)
ax[2].set_xlabel('$t$ (msec)',fontsize=13)

ax[0].plot(t*1e3, v, color=color1, linewidth=1.0, label="$v$")
ax[1].plot(t*1e3, i, color=color2, linewidth=1.0, label="$i$")
ax[2].plot(t*1e3, p, color=color3, linewidth=1.0, label="$p$")

ax[0].plot(v2[0]*1e3, v2[2], color=color1, linewidth=1.0, label="$v_{rms}$", linestyle='-.')
ax[1].plot(i2[0]*1e3, i2[2], color=color2, linewidth=1.0, label="$i_{rms}$", linestyle='-.')
ax[2].plot(p2[0]*1e3, p2[1], color=color3, linewidth=1.0, label="$p_{avg}$", linestyle='-.')

ax[0].legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 12},)
ax[1].legend(loc = 'lower right',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 12},)
ax[2].legend(loc = 'upper right',frameon = True, fontsize = 10, title = None,
   markerfirst = True, markerscale = 1.0, labelspacing = 0.5, columnspacing = 2.0,
   prop = {'size' : 12},)

#plt.tight_layout()
plt.show()
v: rms value:  2.2981E+02
i: rms value:  8.6614E+00
p: average value:  1.7660E+03
fourier coefficients (load current):
    0  4.0000E-03
    1  1.1763E+01
    2  8.0000E-03
    3  1.6242E+00
    4  8.0000E-03
    5  9.7449E-01
    6  8.0000E-03
    7  1.6804E+00
    8  8.0000E-03
    9  1.3070E+00
   10  8.0000E-03
load current fundamental: RMS value:   8.3178E+00
load power factor:  0.887
No description has been provided for this image
In [3]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

# Note: we are using variables assigned in the previous cell;
# we need to execute the previous cell before this one.

fig, ax = plt.subplots()
grid_color='#CCCCCC'

set_size(6, 2, ax)

bars1 = ax.bar(x_i, y_i, width=0.3, color='red', label="$i_{load}$")

ax.set_xlabel('N', fontsize=11)
ax.set_ylabel('$i_{load}$', fontsize=11)
ax.set_xlim(left=0, right=n_fourier_i)
ax.xaxis.set_ticks(np.arange(0, n_fourier_i+1, 1))

plt.tight_layout()
plt.show()
No description has been provided for this image

This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.

In [ ]: