Waveforms
The voltage across a load (in Volts) is$v(t)=220\sqrt 2\cos(\omega t)+50\sqrt 2\cos(3\omega t)+ 20\sqrt 2\cos(5\omega t)$,
and the current through the load (in Amps) is
$i(t)=10\sqrt 2\cos(\omega t +30^{\circ}) + 5\sqrt 2\cos(5\omega t+45^{\circ})+3\sqrt 2\cos(7\omega t+60^{\circ})$.
Determine the average power consumed by the load, in W. ($T=20\,$msec)
In [1]:
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
T = 20.0e-3
omg0 = 2.0*np.pi/T
deg_to_rad = np.pi/180.0
n_div = 2000
t = np.linspace(0.0, 2*T, (n_div+1))
sqrt2 = np.sqrt(2.0)
v_m_1 = 220.0*sqrt2
v_m_2 = 50.0*sqrt2
v_m_3 = 20.0*sqrt2
# uncomment for testing:
#v_m_2 = 0.0
#v_m_3 = 0.0
v_omg_1 = omg0
v_omg_2 = 3.0*omg0
v_omg_3 = 5.0*omg0
i_m_1 = 10.0*sqrt2
i_m_2 = 5.0*sqrt2
i_m_3 = 3.0*sqrt2
# uncomment for testing:
#i_m_2 = 0.0
#i_m_3 = 0.0
i_omg_1 = omg0
i_omg_2 = 5.0*omg0
i_omg_3 = 7.0*omg0
i_theta_1 = deg_to_rad*30.0
i_theta_2 = deg_to_rad*45.0
i_theta_3 = deg_to_rad*60.0
v = v_m_1*np.cos(v_omg_1*t) \
+ v_m_2*np.cos(v_omg_2*t) \
+ v_m_3*np.cos(v_omg_3*t)
i = i_m_1*np.cos(i_omg_1*t + i_theta_1) \
+ i_m_2*np.cos(i_omg_2*t + i_theta_2) \
+ i_m_3*np.cos(i_omg_3*t + i_theta_3)
p = v*i
l_v = calc.avg_rms_2(t, v, 0.0, 2.0*T, 1.0e-5*T)
l_i = calc.avg_rms_2(t, i, 0.0, 2.0*T, 1.0e-5*T)
l_p = calc.avg_rms_2(t, p, 0.0, 2.0*T, 1.0e-5*T)
print('v: rms value:', "%11.4E"%l_v[2][0])
print('i: rms value:', "%11.4E"%l_i[2][0])
print('p: average value:', "%11.4E"%l_p[1][0])
v1 = np.array(l_v)
i1 = np.array(l_i)
p1 = np.array(l_p)
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[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(v1[0]*1e3, v1[2], color=color1, linewidth=1.0, label="$v_{rms}$", linestyle='-.')
ax[1].plot(i1[0]*1e3, i1[2], color=color2, linewidth=1.0, label="$i_{rms}$", linestyle='-.')
ax[2].plot(p1[0]*1e3, p1[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.2650E+02 i: rms value: 1.1576E+01 p: average value: 1.9760E+03
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: