
A simple series RLC circuit with a voltage source Vs.
The RLC Circuit with Battery model simulates a resistor R, a capacitor C, and an inductor L in series with a battery and plots the time dependence of the voltage drops across these elements. The resistance R reflects all sources of energy losses in the circuit. The differential equation for the charge on the capacitor Q can be found by applying Kirchhoff's loop rule.

Because we are solving a dynamical model, transients are observed when the simulation is running and the battery voltage is changed. The time step parameter Δt sets the time increment between voltage measurements and the number of points parameter n sets the amount of data that will be displayed. The plot scrolls after n data points have been saved because data taken at earlier times is dropped.
Robert A. Morse, "Conceptualizing ideal circuit elements in the AP Physics C syllabus," The Physics Teacher 43 (8), pages 540-543 (2005)
Yaakov Kraftmakher, "Demonstrations with an LCR Circuit," The Physics Teacher, 49(3) pages 168-170 (2011).
The RLC Circuit with Battery model was developed by Wolfgang Christian using version 4.3 of the Easy Java Simulations (EJS) authoring and modeling tool. You can examine and modify a compiled EJS model if you run the program by double clicking on the model's jar file. Right-click within the running program and select "Open EJS Model" from the pop-up menu to copy the model's XML description into EJS. You must, of course, have EJS installed on your computer.
Information about EJS is available at: <http://www.um.es/fem/Ejs/> and in the OSP ComPADRE collection <http://www.compadre.org/OSP/>.