[Solved] No power sources in the netlist, no voltage in simulation [Newbie][Kicad 7.0]

I’m new both in electronics, Kicad and ngspice, so forgive me, if I’m doing something stupid. I created some simple schemes just for testing it with ngspice, but got netlist without any power source, hence simulation is useless. I’m unable to figure out what’s wrong. I wanted to upload my current scheme but I’m too new for it (forum rules), so here is an external link. Generated (exported) spice netlist is:

*

.subckt Projekt testowy 2

R1 VCC GND 10k

.ends

Version generated for ngspice simulation is similar, but I post it anyway:

.title KiCad schematic
.save all
.probe alli
.tran 10m 1 0
R1 VCC GND 10k
.end

And generated output for transient simulation (step = 0.01, end = 1):

Note: No compatibility mode selected!
Circuit: KiCad schematic
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Initial Transient Solution
--------------------------
Node Voltage
---- -------
vcc 0
probe_int_gnd_r1 0
r1#branch 0
Reference value : 0.00000e+00
No. of Data Rows : 108

Below is my Kicad version info:

Application: KiCad Schematic Editor x86_64 on x86_64

Version: 7.0.5, release build

Libraries:
wxWidgets 3.2.2
FreeType 2.13.0
HarfBuzz 7.3.0
FontConfig 2.14.2
libcurl/8.1.2 OpenSSL/3.1.1 zlib/1.2.13 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.54.0

Platform: Linux 6.3.7-arch1-1 x86_64, 64 bit, Little endian, wxGTK, LXQt, x11

Build Info:
Date: May 29 2023 21:15:26
wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.81.0
OCC: 7.6.3
Curl: 8.1.1
ngspice: 40
Compiler: GCC 13.1.1 with C++ ABI 1018

Build settings:
KICAD_USE_EGL=ON
KICAD_SPICE=ON

Try to add a DC source for simulator (I use VDC from Simulation_SPICE)

1 Like

I don’t know, why, but it works, thank you!

For a little bit of an attempt to explain the why:

In your schematic linked in your first post above, you have the symbols “VCC” and “GND”, and the power flags on both nets.

The VCC and GND are just symbols for the schematic. You can have multiple symbols with the same name in various places in the schematic, and it will tell the schematic editor that these points are connected together, without having to draw a wire.

Power flags are inserted for the Design Rules Check, to indicate where power is fed into the schematic from a nexternal source. Note that these labels are not power sources, just an indication for the DRC where the power source is going to be connected.

For SPICE simulation, neither of the above are considered to be power sources. You have to select a power source of your choice from the Simulation_SPICE library, for example “VDC”, insert that symbol into the schematic, connect it and set its properties (voltage, for example).
You also need to insert the “0” symbol from the same library and connect it in the schematic as a ground reference point for the simulation.

Hope this helps a little to clarify the different functions of the various elements related to power sources and simulation.

(It looks like you assumed initially that the VCC / GND and/or Power flags would be considered by SPICE as a voltage source, but this is not the case.)

1 Like

After some thinking I realised that have already known most of it. That’s why I always use “Properties” → “Simulation Model” to set proper type and parameters of each element, including power sources. I’m even able to see spice code for it (I think it’s so). Current symbol code is “V NC–0 NC–1 DC 4”, while previous symbol is “V NC–0 NC–1 DC 8 AC 7” so very similar. Both are set to “DC” in the model type menu. I thought that it’s virtually the same except for simulation type. But, maybe… For transient simulation mayby it’s hard to determine for ngspice if it’s DC or AC source. But if so, then why there are options for both AC and DC, independent from main source type? And what’s the role of other power source symbols? Just for schema description?

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