104 Commits

Author SHA1 Message Date
Jeff Young
513bdadf81 Remove noisy assert. KICAD-6XH
We may need to support showing complex numbers at some
point, but as we don't today it's sort of moot.
2025-07-06 21:26:13 +01:00
Jeff Young
1bc60c32f0 Nullptr safety. 2025-06-15 21:45:09 +01:00
Mark Roszko
f3d445efc9 Prevent crash on failure to load ngspice's dll
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20695


(cherry picked from commit f35078cb293e44c81dfbf8563f01cfac4248e09a)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2025-05-24 04:17:28 +00:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Jon Evans
1198233464 Enable qa_ngspice to run from build dir on macOS 2024-12-01 15:50:40 -05:00
John Beard
3d6d8b9946 Strip richio.h from headers that don't need them
Like the DSNLEXER header, this has visibility in over 700
files, whereas well under half actually use any of it
(quite a bit, but not all, of it actually via DSNLEXER)

Many places already forward-declare the OUTPUTFORMATTER type,
by doing that for the others, it still possible to use the
non-IO methods without having to see richio.h.
2024-10-04 18:06:18 +01:00
Alex Shvartzkop
a1b4e09cec Don't limit ngspice netlist lines to 1024 bytes.
Otherwise the loop just makes infinite 1-byte allocations
and keeps appending \n.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18338
2024-07-05 06:55:46 +03:00
Jeff Young
e73d2a32dc ADDED checkbox for saving SPICE digital event data.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17828
2024-05-12 18:24:53 +01:00
Alex Shvartzkop
81281f7e74 Send project path to ngspice for code model input files.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16527

(cherry picked from commit eb7e781becf074556442b226833375ada07dbf19)
2024-05-08 23:41:05 +03:00
Jeff Young
12c8f5b14d Update compatibility mode and save flags in ngspice.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16955
2024-02-13 14:50:15 +00:00
Jeff Young
cdb99de862 Use HasSymbol() instead of a null logger. 2023-12-28 21:52:26 +00:00
Jeff Young
e59612d56c Add realloc locking calls for ngspice42.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15941
2023-12-28 19:36:18 +00:00
Alex Shvartzkop
71fb1afe4c Add ngspice lib paths for when running from build dir. 2023-10-22 19:58:17 +03:00
Jeff Young
2dfdf0682f Don't ask for empty data. 2023-10-03 12:59:49 +01:00
Jeff Young
ff044cd0cf Mostly a terminology update...
... but also makes DIALOG_SIM_COMMAND and SIMULATOR_REPORTER a bit
more simulator-agnostic.
2023-07-14 17:46:06 +01:00
Jeff Young
bde9c2cbc5 ADDED FFT analyses.
CHANGED abandon the unpredictable behaviour of the Simulation Command
dialog.  You now separately add simulation tabs (which have invariant
command types once created), and the dialog edits the current tab.

Also a bunch of bug fixes to make multiple simulation plots actually
work.
2023-07-07 12:33:50 +01:00
Jeff Young
d5d2800b03 Sort out terminology issues between vectors and plots. 2023-07-07 12:33:50 +01:00
Fabien Corona
886a7c2c04 ADDED: S-parameters simulation 2023-07-04 16:01:12 +00:00
Jeff Young
492ef62053 ADDED support to save contributions from all noise generators.
You must first check the checkbox in the Simulation Command dialog,
after which the signals will appear in the User Defined Signals
autocomplete lists.
2023-07-04 11:05:10 +01:00
Jeff Young
7d3fa8fb4e Plotting for noise simulations.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2369
2023-07-03 23:12:28 +01:00
Jeff Young
b1d5da3da3 Allow ngspice to run in the background.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14085
2023-06-17 23:54:33 +01:00
Jeff Young
8c8c5e1824 Provide a default xaxis for DC-sweep so we can add traces before sim is run. 2023-02-25 22:42:52 +00:00
Jeff Young
6fcb95b24e ADDED user-defined signals. 2023-02-21 13:32:01 +00:00
Jeff Young
542719c753 Add "all" mode to HSPICE emulation. 2023-01-21 19:32:25 +00:00
Jeff Young
f7ebaf1bab Add compatibility mode for netlist code.
(The non-A compatibility modes only run on included files.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13589
2023-01-20 18:06:17 +00:00
jean-pierre charras
bdf13ade7a Fix a compil issue on linux, round 2 2022-12-11 20:43:10 +01:00
jean-pierre charras
32995a31c6 Fix a compil issue 2022-12-11 20:19:56 +01:00
Jeff Young
5c53daadb0 Mostly coding standards, but also quote codemodel names before passing to spice.
Fixes https://gitlab.com/kicad/code/kicad/issues/12687
2022-12-11 18:42:57 +00:00
Jeff Young
69448afb47 Don't run simulation twice when the sim command is overridden.
Fixes https://gitlab.com/kicad/code/kicad/issues/12731
2022-12-07 01:34:56 +00:00
Jeff Young
7e1fecaf2e Formatting. 2022-12-05 20:03:42 +00:00
Jeff Young
e09e521162 Remove GUI calls from netlisting. 2022-11-18 15:29:16 +00:00
Mikolaj Wielgus
6e874f4c1e Ngspice: Preload a basically empty circuit to avoid error messages
Fixes https://gitlab.com/kicad/code/kicad/issues/12481
2022-10-18 05:48:01 +02:00
Seth Hillbrand
35ac39844f Clean up some auto usage
Don't make new copies of shared_ptr if we can use references.  Keep auto
usage down to hard-to-type-out sequences
2022-08-15 11:29:45 -07:00
Mikolaj Wielgus
a1a99b1ec2 Sim QA: Check NGSPICE's LoadNetlist() and Run() status code 2022-08-10 17:54:28 +02:00
Mikolaj Wielgus
739b9255d9 Sim Model Editor improvements
- Tab-switching,
- Automatic expansion of categories on tab-switch,
- Various minor simulation improvements,
- Various new simulation-related bugfixes.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus
978f01553b Sim Model Editor: Serialize models in fields
Implemented serialization and deserialization of models in symbol fields
through the SIM_VALUE class. We don't carry the Spice legacy of
case-insensitive suffixes, instead we conform to the SI standard (i.e. M
is Mega, not milli, P is peta, p is pico).

Parameter grid value validation is implemented by simply not allowing
any characters that will make the value invalid (instead of highlighting
the field in a red color). This will likely be changed at some point in
the future.
2022-07-30 02:25:34 +00:00
Eduardo Behr
f246646d7a Fix severe simulation memory leaks 2022-05-28 20:40:24 +00:00
Sylwester Kocjan
a9c61d21ca eeschema: fix crash when closing simulation frame
Destructor of SIM_PLOT_FRAME calls sim->Attach( nullptr ) in order to destroy
circuit model (former netlist exporter). If this is skipped, eeschema crashes
when program is closed. nullptr is a valid parameter for Attach()
2022-04-05 19:28:05 +00:00
Sylwester Kocjan
f5dedd77c6 eeschema,sim: add SIMULATOR and SIM_MODEL interface
SIMULATOR has now an Attach() method, which should be called
with proper SIMULATION_MODEL that should be simulated, before calling Run()

Concrete class of SIMULATION_MODEL for ngspice is NGSPICE_CIRCUIT_MODEL,
renamed from NETLIST_EXPORTER_PSPICE_SIM. DIALOG_SIM_SETTINGS relies
on above mentioned object, so it was added as an argument of the constructor.
2022-04-01 19:28:31 +00:00
Seth Hillbrand
098e8f7d9b Revert "cmake: adding KICAD_MACOSX_APP_BUNDLE option"
This reverts commit ea9f960cc15d9383ac88bd7fa499f28ebda096b3.

Reverted for updates as this currently breaks kicad-mac-builder
2022-01-31 15:57:56 -08:00
Davide Gerhard
ea9f960cc1 cmake: adding KICAD_MACOSX_APP_BUNDLE option
ADDED: with cmake KICAD_MACOSX_APP_BUNDLE option the user can disable
the macOS app bundle creation when compiling on macOS. This permit to
use/install KiCad like any other *nix platform (/usr/bin, /usr/share,
ecc.). By default, cmake build the app bundle.
2022-01-28 15:49:37 -08:00
jean-pierre charras
d4e5861c62 Fix a few issue in simulation (noticeable only when the calculation time is high):
- Wait for end of simulation before return from "C" locale to current locale
(to avoid data files created by ngspice using curr locale instead of "C" locale)
- Do not allow changing signal list to plot during simulation calculation
(avoid crashes)
2021-05-05 20:28:46 +02:00
Seth Hillbrand
61289ab39a Cleanup ngspice calling signatures 2021-05-05 10:49:40 -07:00
Seth Hillbrand
36975c9cd0 Conditionally handle the SPICE signatures
ngspice updated their function signatures, requiring us to test.  They
also don't provide an indicator that the signature is changed, so we
need to test based on the existence of a new version define.

Fixes https://gitlab.com/kicad/code/kicad/issues/8358
2021-05-05 10:19:01 -07:00
jean-pierre charras
e5dd54e05a Eeschema, spice sim: fix a crash when no value is available.
onSimFinished() try to analyse the list of plots, but did not test
if there is available data before using it.
Fixes #8169
https://gitlab.com/kicad/code/kicad/issues/8169
2021-04-14 21:01:39 +02:00
Wayne Stambaugh
dbb0a125ac Fix build error when spice simulator build option is disabled. 2021-03-19 09:04:28 -04:00
Wayne Stambaugh
acec6ad7fc Spice simulator: add Ngspce model behavior mode settings.
ADDED: Ngspice simulator model behavior mode settings for PSpice, LTSpice,
       PSpice and LTSpice, and HSpice.

Fixes https://gitlab.com/kicad/code/kicad/issues/5810
2021-03-18 15:31:02 -04:00
jean-pierre charras
14b1d36b38 Simulator: Fix a ugly bug that happens is some simulations
TRhe initial code was broken.
2021-03-08 20:01:36 +01:00
Marek Roszko
b609c7dcd6 Kick the osx specific path helpers into PATHS 2021-02-16 23:29:26 -05:00
Marek Roszko
f9c7eae63a Avoid null access in NGSPICE::AllPlots 2021-02-16 18:37:57 -05:00