Struggling with noise simulation

Okay so this time I face another problem but not sure how to go about it. So I been trying to do a noise simulation using the simulation toolkit based on the rectifier example from the official simulation demos. However my attempts so far using different example still result a simulation failures when I try to do noise analysis. Would appreciate any tips on how I can proceed here on topic of noise analysis.

Circuit: KiCad schematic
Error on line 5 :
d1 net-d1-pad2 /rect_out 1n4148
Unable to find definition of model 1n4148 - default assumed
Background thread stopped with timeout = 0
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000
Warning: v1: no DC value, transient time 0 value used
Warning: Noise input source v1 has no AC value
doAnalyses: Current and power not available for ac analysis detected in routine “RESask”
run simulation(s) aborted
Background thread stopped with timeout = 0
Error: no such vector 3
Error: no such vector 1
Error: no such vector 2

Using this version

Application: kicad
Version: (6.0.0-rc1-dev-237-gf75e9d4), debug build
Libraries:
wxWidgets 3.0.4
libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Platform: Mac OS X (Darwin 17.7.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
Boost: 1.67.0
OpenCASCADE Community Edition: 6.9.1
Curl: 7.51.0
Compiler: Clang 8.0.0 with C++ ABI 1002

Build settings:
USE_WX_GRAPHICS_CONTEXT=ON
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON

Several issues are to consider:

Unfortunately noise simulation is not yet implemented in KiCad/Eeschema. The tabs that indicate availability should have been made invisible. For each noise simulation ngspice creates four vectors in addition to the standard output vectors: inoise_total, onoise_total (each a single integral value), and inoise_spectrum, onoise_spectrum (to be plotted versus frequency). These vectors have to be printed or saved in addition to the standard vectors. This is not yet done in Eeschema, so the output data are not available.

You also have to prepare your input file for noise analysis. The ngspice warning messages tell us: The input source v1 needs a dc and an ac value. So you should add the terms DC 0 AC 1 to the VSOURCE values.

You also should search for a 1N4148 model in the web. Googling ‘1N4148 spice model’ will reveal a model offered by On-Semi.

So for now you might prepare the input, run the simulation, print the netlist from the ‘Spice Simulator’ window by ‘Simulation’->‘Show Spice Netlist’ and run this netlist in standard ngspice to obtain the results. I have attached my test input file rectifier.sch (3.5 KB).

I promised the KiCad maintainers to have a look into these issues, that however may require some more time.

1 Like

Thanks for explaining the current situation with the simulation situation in Kicad. Thanks for the useful tip of ‘show spice netlist’, did not realise I could do it this way. I think I will have a go at this on my own.

Hopefully my question and your answer here will be useful for anyone that tries the noise-analysis features.

Cheers,
danny

From the above Eeschema circuit I have extracted the attached netlist noise-test.cir (489 Bytes). Additionally I did some editing by removing all .save commands (prepended ‘*’). Only then the noise simulation yields the above mentioned output vectors. If .save commands are given, only the explicitedly named vectors are stored, thus skipping our noise output vectors.

The command sequence may be:

ngspice noise-test.cir
run
setplot noise1
plot inoise_spectrum onoise_spectrum xlog ylog
setplot noise2
print all

1 Like