Simulation for Simple RC Series Circuit - Problem

  • I have created a schematic for a simple RC Series circuit with a 5-Volt DC Voltage source and … R = 100k C = 10uf

  • All components are selected via pressing “A” and then entering the word “Spice” search field to restrict the list of components to those intended for simulation.

  • Transient Tab set to … Time Step = 1ms Final Time = 5 seconds

  • DC Transfer Tab untouched.
    The Time Constant for a 100k resistor in series with a 10uf cap is 1 second …
    as … 10^5 * 10^-5 = 1 … right?

So I expected an exponential rise of the voltage at the RC node … but no got !?

Note: If I replace the Cap with a resistor so I have two series resistors … the simulation yields the expected current and voltage.

FYI - I’m running a daily build as shown below and have zero problem with it since it was downloaded … and I’ve banged on it pretty hard … except for the simulation … this is my first time trying to use the simulation.

System: Windows 10 Pro 64-bit
Software: Application: KiCad Schematic Editor (64-bit)

Version: (6.99.0-942-g3129f96686), release build

Libraries:
wxWidgets 3.1.5
FreeType 2.11.1
libcurl/7.78.0-DEV Schannel zlib/1.2.11

Platform: Windows 10 (build 19043), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Feb 15 2022 03:53:16
wxWidgets: 3.1.5 (wchar_t,wx containers)
Boost: 1.76.0
OCC: 7.6.0
Curl: 7.78.0-DEV
ngspice: 36
Compiler: Visual C++ 1928 without C++ ABI

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

There are some silly small details that have to be set up right for a simulation to work properly, and it’s difficult to deduce errors from a description.
For example the are two “Spice” libraries, a legacy “pspice” library (with ugly big symbols) and a newer Simulation_Spice library, but for resistors and capacitors you can just as wel get them from the normal “Device” library.

To diagnose your error, it’s much easier if you just zip the project and upload it, but I can’t help with KiCad V5.99. It is not a stable version and anything can happen in it. Why are you using the nightlies? Apparently quite a lot of people download it from some mirror site and without ever seeing the warnings about the nightlies on the KiCad website.

Yes, that part is OK, and doing a transient analysis over 5s should then indeed also be OK.

Thanks paulvdh.

  • I recreated the project using Kicad 6,0 and it is attached.
    I look forward to your guidance.
    Thanks for the help!
    PS - I’m normally running Spice 6.99 because it had some features I wanted that were not in 6.0 … and I have had no problem with it so far. Wonder when v7.0 is coming out?

Lab RC Simulation v6-0.zip (16.9 KB)

The expectation is unfortunately wrong.

It has to do with how SPICE is working:
When a transient simulation is started, first the operating point is determined as a starting voltage configuration of any circuit. This is done by opening all capacitors and short circuiting all inductors, and then doing a dc simulation.
The result in your case is: output voltage equals the supply voltage, and it will stay there for ever during the transient.
What can you do to obtain an RC curve?

  1. Set an initial condition (text box)
.tran 5m 5
.ic v(Output)=0
  1. Use a step voltage (pulse source) at V1 starting a 0 and jumping after some time to 5, like

dc 0 pulse (0 5 1m 1u 1u 10 10)

That fixed it holger. Thanks.

Question 1 What do you call the “dot” commands you shared?
I need to learn more about how do this.
I’m guessing that …

  1. .tran 5m 5
    means set the Time Step = 5 ms and the Final Time = 5 seconds.

  2. .ic v(Output)=0
    means set the Initial Condition to zero volts.

  3. .dc 0 pulse (0 5 1m 1u 1u 10 10)
    I’m confused by this as all I could find about DC Analysis was …
    General form: .dc [source] [start] [final] [increment]
    Example 1: .dc vin 1.5 15 0.5

Question 2 Noting that your .dc statement has many more “switches/options” listed after the .dc

Maybe you or some other kind soul would help me get going with spice in Kicad.

Thanks for your help!

As you can tell I’m new to spice.
Thanks for the help.

Please have a look at the ngspice manual (http://ngspice.sourceforge.net/docs/ngspice-36-manual.pdf) chapters 2.2 and 4.1.1.

dc 0 pulse (0 5 1m 1u 1u 10 10) is not a dot command, but a replacement of dc 5 in voltage source V1 (from a constant voltage to a pulse voltage).

Holger, Thanks for referring me to the ngspice manual sections 2.2 Dot Commands and section 4.1.1 Pulse.

In the 4.1.1 example they show …
VIN 3 0 PULSE ( -1 1 2 NS 2 NS 2 NS 50 NS 100 NS )

Question 1 - “VIN 3 0” in the above example means VIN connected between node 3 and node 0 … right?

Question 2 - If so, I’m confused by the your syntax …
dc 0 pulse (0 5 1m 1u 1u 10 10)
As it appears to me that only one node is designated in the first part …“dc 0”

I think I under stand all the rest of the statement that defines the “PULSE” and its parameters in the parentheses …
but I need help understanding the first part … “dc 0

Thanks for any education you can provide as I’ve dug around in the manual and online for an example but to no avail.

There is no node assigned by this statement. The device name and the nodes are given by the symbol.
dc 0 gives a dc value for calculating the operating point, before transient simulation starts and the pulsed values take over. You may omit the statement, then the time 0 value is used for op (as in the manual’s example).

In your original post you have a dc 5 in the value field, which says 5 V is constantly applied. You may omit the dc, just stating 5.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.