# Charging a capacitor in Eagle SPICE

I'm trying to learn the basics of Eagle SPICE simulation with a simple capacitor charging circuit. My netlist is as follows:

* SpiceNetList
*
* Exported from untitled.sch at 21/07/2019 1:17 PM
*
* EAGLE Version 9.4.0 Copyright (c) 1988-2019 Autodesk, Inc.
*
.TEMP=25.0

* --------- .OPTIONS ---------
.OPTIONS ABSTOL=1e-12 GMIN=1e-12 PIVREL=1e-3 ITL1=100 ITL2=50 PIVTOL=1e-13 RELTOL=1e-3 VNTOL=1e-6 CHGTOL=1e-15 ITL4=10 METHOD=TRAP SRCSTEPS=0 TRTOL=7 NODE

* --------- .PARAMS ---------

* --------- devices ---------
C_C1 N_3 0 1000uF
R_R1 N_2 N_1 10M
V_VCUR_1 N_2 N_3
V_V1 N_1 0 DC 10 AC 0

* --------- simulation ---------

.control
set filetype=ascii
TRAN 2e-7 0.0001 0 1e-5
write untitled.sch.sim V(N_1) V(N_2) I(V_VCUR_1) I(V_V1)
.endc

.END


I want to run a transient analysis that shows the current through the capacitor decreasing as the voltage increases. Instead I get this: What am I doing wrong?

Your basic problem is that SPICE assumes that your circuit has existed forever, so any transient effects have disappeared long ago. As far as the simulation is concerned, C1 is already charged to 10V at $$\t=0\$$. If you want to see the transient charging of the capacitor you have a couple choices:

1. Change V1 from a dc source to a pulse or PWL source, so that its value is 0V at $$\t=0\$$ and rises to 10V as quickly as the simulator will allow. You will probably need to specify the timestep for the transient simulaton to be as small or smaller than the risetime of the supply voltage.

2. Specify an initial condition for the voltage on the capacitor. I don't know if there is a GUI method for this in Eagle SPICE, but in plain vanilla SPICE you would say something like .ic V(C1)=0. You must also modify the .tran simulation command to add the UIC (use initial conditions) option

• Adding a pulse function to V1 fixed it! – Jeremiah Rose Jul 22 at 9:29

I think you should define the voltage of V_VCUR, like
V_VCUR_1 0 N_2 N_3
.........^........

Anyway, you can just remove the V_VCUR_1 N_2 N_3 and measure the current through R_R1.