Waveforms
The voltage applied to a load is $v(t)=200\sin(300\pi t)$. The load current is a square wave with amplitude $10\,A$ and frequency $50\,$Hz. The voltage and current waveforms are given below. Determine the average power consumed by the load.In [1]:
from IPython.display import Image
Image(filename =r'waveforms_8_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
Vm = 200.0
Im = 10.0
omg = 2.0*np.pi/T
n_div = 5000
t = np.linspace(0.0, T, (n_div+1))
v = Vm*np.sin(3.0*omg*t)
l_i = []
for k, t1 in enumerate(t):
omg_t1 = omg*t1
if omg_t1 < np.pi:
i1 = Im
else:
i1 = -Im
l_i.append(i1)
i = np.array(l_i)
p = v*i
l_v_1 = calc.avg_rms_2(t, v, 0.0, T, 1.0e-5*T)
l_i_1 = calc.avg_rms_2(t, i, 0.0, T, 1.0e-5*T)
l_p_1 = calc.avg_rms_2(t, p, 0.0, T, 1.0e-5*T)
print('v: rms value:', "%11.4E"%l_v_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)
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=T*1e3)
ax[k].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[1].set_ylim(top=14.0, bottom=-14.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[2].plot(p2[0]*1e3, p2[1], color=color3, linewidth=1.0, label="$p_{avg}$", linestyle='-.')
ax[0].legend(loc = 'upper 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 = 'lower 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: 1.4142E+02 p: average value: 4.2441E+02
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: