RC&RL circuits
The
fundamental passive linear
circuit elements are
the resistor
(R), capacitor
(C) and inductor
(L) or coil. These circuit elements can be combined to form an electrical circuit in four distinct ways: the RC circuit, the RL circuit, the LC circuit and the RLC circuit with the abbreviations indicating which components are used.
RC and RL are one of the most basics examples of electric circuits and
yet they are very rich in content.
The major difference between RC and RL circuits is that the RC circuit
stores energy in the form of the electric field while the RL circuit
stores energy in the form of magnetic field. Another significant
difference between RC and RL circuits is that RC circuit initially
offers zero resistance to the current flowing through it and when the
capacitor is fully charged, it offers infinite resistance to the
current. While the RL Circuit initially opposes the current flowing
through it but when the steady state is reached it offers zero
resistance to the current across the coil.
Let’s examine each one carefully.
A resistor–inductor circuit (or RL circuitfor short) is a series combination of resistance and inductance
which stores energy in the form of magnetic energy. RL circuit containss an inductor, which creates hysteresis and noise in the circuit.
Since inductors are large in size, the corresponding RL circuits are bulky and
expensive. They are appropriate for filtering of high power signals
because of low power dissipation. An inductor or coil represents the
‘electrical inertia’ of the circuit. As currents flows into the
circuit, it generates a magnetic field, that change in the magnetic
field causes a change in the flux of the field concatenated to the
circuit, this in turn, by the Faraday-Neumann-Lenz law generates a
voltage in the circuit that is opposite to the voltage that is
generating the magnetic field. This is the reason because the current in the circuit will not jump immediately to its full value of V/R given by Ohm’s law.
What we would expect is that the current will obey the following
differential equation given by Ohm’s law at each point in time:
\[
V - L\, \frac{{\text d}I}{{\text d}t} = R\,I(t) ,
\]
where I is current (in ampers), V is voltage supply (in
volts), L (in henries) is
inductance, and R is resitence (in ohms). If V is constant, we
solve the above differential equation to obtain
\[
I(t) = \frac{V}{R} \left( 1 - e^{- \t/tau} \right) ,
\]
where time constant τ = L/R.
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
l = 0.0229 #Inductance (H)
r = 3.34 #Resistance (Ohm)
v = 5 #Voltage (V) DC
i = v/r #Peak current (A)
tau = l/r #Tau time constant
a = tau * 4.4 #critical time value at which current is switched (switching occurs every a seconds)
t = np.linspace(0,2*a,2000) #Time vector
-------------------------------------------------------------------------------
#1st on-cycle current
def initialCurrent():
current = []
for i in t:
if i <= a:
current.append((v/r)*(1-np.exp((-r/l)*i))) #I(t) = v/r*[1-exp((-r/l)*t)]
else:
current.append(0)
return np.array(current)
#Plot Icurrent
Icurrent = initialCurrent()
plt.plot(t,Icurrent,label='current',color='blue')
#------------------------------------------------------------------------------
#1st off-cycle current
def laterCurrent():
current = []
for i in t:
if i >= a:
current.append(Icurrent[-1001]*np.exp((-r/l)*(i-a))) #I(t) = Ir * exp((-r/l)*(t-t0))
else:
current.append(0)
return np.array(current)
#Plot current after switch off
current_off = laterCurrent()
plt.plot(t,current_off,color='blue')
#-------------------------------------------------------------------------------
#Current on and off cycle: on and off at the zeros of the it function
f = 1/(2*a) #frequency f = 1/T
w = np.pi/a #w = 2pi * f
it = i*np.sin(w*t)
plt.plot(t,it,label='On/off cycle',color='green')
#Plot zeros (switching points)
zeros = np.array([0,a,2*a])
zeros_i = i*np.sin(w*zeros)
plt.plot(zeros,zeros_i,marker='x',markersize=10,label='On and off',color='red')
plt.annotate('On',xy=(zeros[0]+0.0005,zeros_i[0]))
plt.annotate('Off',xy=(zeros[1]+0.0005,zeros_i[1]))
plt.annotate('On',xy=(zeros[2]+0.0005,zeros_i[2]))
#Critical value plot
plt.plot((a,a+0.00001),(max(it),min(it)),'r',alpha=0.9,label='Critical value')
#-------------------------------------------------------------------------------
#Print some data
print('Inductance (H):','\t'+str(l))
print('Resistance (Ohm):','\t'+str(r))
print('DC voltage (V):','\t'+str(v))
print('Current (A):','\t\t'+str(i))
print('Tau:','\t\t\t'+str(tau))
print('Critical time (s):','\t'+str(a))
print('\n')
print('Switch frequency (Hz):','\t'+str(f))
print('w coefficient (2*pi*f)','\t'+str(w))
#-------------------------------------------------------------------------------
#Plot settings
#x axis line
plt.plot((0,2*a+0.0005),(0,0),'k',alpha=0.9,markersize=10)
#Axis labels
plt.xlabel('time (s)')
plt.ylabel('current (A)')
#Legend and limits
plt.legend(loc=3,fancybox=True,shadow=True)
plt.xlim(-0.002,2*a+0.003)
plt.ylim(min(it)-0.05,max(it)+0.05)
plt.show()
#-------------------------------------------------------------------------------
# Output
# Inductance (H): 0.0229
# Resistance (Ohm): 3.34
# DC voltage (V): 5
# Current (A): 1.4970059880239521
# Tau: 0.006856287425149701
# Critical time (s): 0.03016766467065869
# Switch frequency (Hz): 16.57403731639539
# w coefficient (2*pi*f) 104.1377477470217