Capacitor in periodic steady state
The steady state current $i_C(t)$ through a $20\,\mu$F capacitor is given below. The capacitor voltage is in cyclic steady state with a peak-to-peak variation of $1\,$V. If $I_2=0.8\,$A, find $I_1$ and $I_3$.In [1]:
from IPython.display import Image
Image(filename =r'misc_8_fig_1.png', width=280)
Out[1]:
In [2]:
import numpy as np
import matplotlib.pyplot as plt
import gseim_calc as calc
from setsize import set_size
I1 = 2.5 # to be changed by user
I2 = 0.8
I3 = -1.0 # to be changed by user
T = 20.0e-6
C = 20.0e-6
n_div = 5000
t = np.linspace(0.0, 2*T, (n_div+1))
Tby2 = T/2
slope = (I1-I2)/Tby2
l_ic = []
for i, u in enumerate(t):
t1 = u % T
if t1 < Tby2:
ic1 = I1 - slope*t1
else:
ic1 = I3
l_ic.append(ic1)
x_ic = np.array(l_ic)
l_x_ic = calc.avg_rms_2(t, x_ic, 0.0, 2.0*T, 1.0e-5*T)
t_ic = np.array(l_x_ic[0])
l_vc = []
vc = 0
l_vc.append(vc)
delt = 2.0*T/float(n_div)
c1 = delt/C
for k in range(1,len(t)):
vc += c1*l_ic[k]
l_vc.append(vc)
x_vc = np.array(l_vc)
vc_max = x_vc.max()
flag_correct = True
if abs(l_x_ic[1][0]) > (1.0e-2*I2):
flag_correct = False
print('average value of ic:', "%11.4E"%l_x_ic[1][0])
else:
if abs(vc_max-1.0) > 1.0e-2:
flag_correct = False
print('vc_max:', "%11.4E"%vc_max)
if flag_correct:
print('I1 =', I1, ', I3 =', I3, 'is correct')
else:
print('I1 =', I1, ', I3 =', I3, 'is not correct')
fig, ax = plt.subplots(2, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)
grid_color='#CCCCCC'
set_size(6, 5, ax[0])
color1 ='blue'
color2 ='crimson'
for k in range(2):
ax[k].set_xlim(left=0.0, right=2.0*T*1e6)
ax[k].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].set_ylabel('$i_C$',fontsize=13)
ax[1].set_ylabel('$v_C$',fontsize=13)
ax[0].tick_params(labelbottom=False)
ax[1].set_xlabel(r'$t$ ($\mu$sec)',fontsize=13)
ax[0].plot(t*1e6, x_ic, color=color1, linewidth=1.0, label="$i_C$")
ax[1].plot(t*1e6, l_vc, color=color2, linewidth=1.0, label="$v_C$")
ax[0].plot(t_ic*1e6, l_x_ic[1], color=color1, linewidth=1.0, label="$i_C^{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},)
#plt.tight_layout()
plt.show()
average value of ic: 3.2570E-01 I1 = 2.5 , I3 = -1.0 is not correct
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: