Waveforms
The figure shows one period of the output voltage $V_o$ of an inverter. $\alpha$ should be chosen such that $30^{\circ} \le \alpha \le 90^{\circ}$. Determine $\alpha$ in degrees for $V_o$ to be free from the seventh harmonic.In [1]:
from IPython.display import Image
Image(filename =r'waveforms_4_fig_1.png', width=450)
Out[1]:
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
omg = 2.0*np.pi/T
deg_to_rad = np.pi/180.0
alpha = 50.0 # to be changed by user
n_div = 5000
t = np.linspace(0.0, T, (n_div+1))
alpha_rad = alpha*deg_to_rad
Vdc = 100.0
l_Vo = []
for i, t1 in enumerate(t):
omg_t1 = omg*t1
if omg_t1 < alpha_rad:
v1 = Vdc
elif omg_t1 < (np.pi-alpha_rad):
v1 = -Vdc
elif omg_t1 < (np.pi):
v1 = Vdc
elif omg_t1 < (np.pi+alpha_rad):
v1 = -Vdc
elif omg_t1 < (2.0*np.pi-alpha_rad):
v1 = Vdc
else:
v1 = -Vdc
l_Vo.append(v1)
Vo = np.array(l_Vo)
t_start = 0.0
t_end = T
n_fourier = 10
coeff_Vo, thd_Vo = calc.fourier_coeff_1C(t, Vo, t_start, t_end, 1.0e-8, n_fourier)
print('fourier coefficients (Vo):')
for i, c in enumerate(coeff_Vo):
print(" %3d %11.4E"% (i, c))
xf = np.linspace(0, n_fourier, n_fourier+1)
yf = np.array(coeff_Vo)
fig, ax = plt.subplots(2, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)
grid_color='#CCCCCC'
set_size(6, 4, ax[0])
xf_ticks = np.arange(0.0, (float(n_fourier+1)), 1.0)
ax[0].set_xlim(left=0.0, right=T*1e3)
ax[0].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].plot(t*1e3, Vo, color='blue', linewidth=1.0, label="$V_o$")
ax[1].set_xlim(left=-1.0, right=float(n_fourier))
ax[1].set_xticks(xf_ticks)
ax[1].grid(visible=True, which='major', axis='x', color=grid_color, linestyle='-', zorder=0)
ax[0].set_xlabel('$t$ (msec)',fontsize=13)
ax[0].set_ylabel('$V_o$',fontsize=13)
ax[1].set_xlabel('$N$',fontsize=13)
ax[1].set_ylabel('$V_o^{(k)}$',fontsize=13)
bars2 = ax[1].bar(xf, yf, width=0.3, color='red', label="$V_o^{(k)}$" , zorder=3)
plt.tight_layout()
plt.show()
fourier coefficients (Vo): 0 2.0000E-02 1 3.6347E+01 2 4.0000E-02 3 1.1596E+02 4 4.0000E-02 5 4.2867E+01 6 4.0000E-02 7 1.7640E+01 8 4.0000E-02 9 1.4165E+01 10 4.0000E-02
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: