Serial RLC Circuit

- 447 words - 3 minutes

We will use a simulator to analyze the response over time of a simple series RLC circuit [1] with three components: R1, L1 and C1 and three nodes: 0, 1 and 2.

Diagram of serial RLC circuit

We want to know the value of the current i(t) in the circuit, starting with a current of 20mA and a voltage of 2V in the capacitor at time 0, and until 2 milliseconds.

Tools

These are tools that we will use and their purpose:

  • gnucap

    1. Reads a .ckt text file with the circuit definition, the simulation commands and the name of a .dat output file.

    2. Performs the simulation and writes the results into the .dat text file.

  • gnuplot

    1. Reads a .plt text file that includes the name of an input .dat file, the name of the output image .png file and the plot options.

    2. Reads the .dat file and creates .png output image file.

The circuit file

The first step is to manually create the text file serial-RLC.ckt with this content:

Serial RLC circuit
*----------------------------------------------
R1 0 1 2k
L1 1 2 1 IC=2mA
C1 2 0 {1uF/401} IC=2V
*----------------------------------------------
.print transient i(R1)
.transient 0 .002 .000001 uic skip 30 > dat/serial-RLC.dat

The lines starting with * are comments, they are ignored. They help to separate these three parts of the file:

  1. A title in the first row.

  2. Three rows defining the network, each row has:

    1. A letter and a number for the component: R1, L1, C1.

    2. The numbers of the two nodes where the component is connected: 0 1, 1 2, 2 0.

    3. The value of the device. Ohm, Henry or Farad units are assumed according to the device.

    4. The initial conditions of IC=2mA in the inductor and IC=2V for the capacitor.

  3. Two simulation commands:

    • .print specifies to include the current in the results file.

    • .transient specifies to simulate over time, starting at 0 seconds and ending in 2 miliseconds (.002 seconds). 30 calculations will be done every microsecond (.000001 and skip 30), the output will include one of every 30 results. uic means Include initial conditions.

The simulation

The following command runs the simulation:

gnucap -b serial-RLC.ckt

which produces the data file dat/serial-RLC.dat:

#Time       i(R1)     
 0.         0.        
 1.E-6      0.0019936 
 2.E-6      0.0019864 
 3.E-6      0.0019785 
 4.E-6      0.0019697 
 ...
 0.001997  -189.88E-6 
 0.001998  -193.57E-6 
 0.001999  -197.17E-6 
 0.002     -200.69E-6 

The file contains a row for each iteration of the simulation.

Making the graph

This command runs gnuplot:

gnuplot -s plt/serial-RLC.plt

which produces the image file png/serial-RLC.png

Results of transient simulation of serial RLC circuit

The result shows an underdamped response.

References

  1. The values for R, L and C are the same as in the example in Section 7-6 The source-free series RLC circuit, page 217 in Engineering Circuit Analysis, Hyat, William and Kemmerly, Jack, 1971