Commit Graph

906 Commits

Author SHA1 Message Date
Jeff Young 30c2049977 Handle inference of V7 symbol lib DC voltage/current sources.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15127
2023-07-07 16:25:05 +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
Jeff Young 443a5dc3bb Syntax help for SPICE functions. 2023-07-07 12:33:49 +01:00
Jeff Young e494017b54 Fix merge error. 2023-07-04 18:53:15 +01:00
Fabien Corona 886a7c2c04 ADDED: S-parameters simulation 2023-07-04 16:01:12 +00:00
Jeff Young d563d66b86 ADDED Fourier analyses of .tran data. 2023-07-04 16:54:38 +01: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 80340c607c ADDED noise simulation GUI. 2023-07-03 16:26:20 +01:00
Seth Hillbrand 7779a01d48 SIM_VALUE stores significants in 64-bit
stol isn't neccesarily 64-bit though, so we use stoll and catch the
overflow if we have bad input data

Fixes KICAD-2EF
2023-06-29 09:50:27 -07:00
Fabien Corona 8abb701727 IBIS: model type should not be case sensitive
Fixes #15068
2023-06-28 22:49:41 +02:00
Ian McInerney 2fb6f19a84 Separate immediate and delayed action dispatch
Using a boolean argument just leads to a lot of trailing booleans in the
function calls and is not user friendly. Instead, introduce PostAction()
to send an action that runs after the coroutine (equivalent to passing
false or the default argument), and leave RunAction as the immediate
execution function.
2023-06-27 00:57:59 +01:00
Jeff Young 7138e8a62e Don't double-create pins when migrating old models. 2023-06-21 16:34:35 +01:00
jean-pierre charras a9fff82664 spice_library_parser: catch an exception thrown when a spice model cannot be built.
Fixes #15012
https://gitlab.com/kicad/code/kicad/-/issues/15012
2023-06-20 10:26:42 +02:00
Jeff Young 5b12b5d031 Cleanup. 2023-06-19 23:03:01 +01:00
Jeff Young 0b58fdb910 Use KIUI to specify the simulation plot axis fonts.
Also fixes a bug in generating the x-axis for the first trace.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14997
2023-06-19 22:53:08 +01:00
Jeff Young 9199d7a781 Update simulation results as the sim runs.
Also adds a time axis which grows by 2X at a time rather than to the
size of the current data.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11255
2023-06-18 16:52:11 +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 150e2b8a19 Separate BITMAP2CMP_PANEL from BITMAP2CMP_FRAME.
This is primarily to allow wxFormBuilder to create the panel without
the dangerous hack of passing a wxWindow ID into KIWAY_PLAYER's ctor.
2023-06-15 17:39:10 +01:00
Jeff Young abc0c19d64 Separate SIMULATOR_PANEL from SIMULATOR_FRAME.
This is primarily to allow wxFormBuilder to create the panel without
the dangerous hack of passing a wxWindow ID into KIWAY_PLAYER's ctor.
2023-06-15 17:39:10 +01:00
Jeff Young 5c4ca9f092 Renaming to support potential future usage of SIMULATOR_PANEL as a panel within SIMULATOR_FRAME. 2023-06-15 17:39:10 +01:00
Jeff Young 46564055f4 More protection around an exceedingly dangerous hack.
The API is needed for wxFormBuilder, and I couldn't figure out any
way around it, but we can at least reduce the risk of someone calling
it accidentally (again).
2023-06-14 12:52:49 +01:00
Jeff Young e698156975 Upgrade many editing actions to SCHEMATIC_COMMIT. 2023-06-09 22:41:47 +01:00
Jeff Young 5875f89531 Centralize text size clamping.
Also introduces alg::clamp to improve readability of
std::max( min, std::max( value, max ) )

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14876
2023-06-03 20:29:51 +01:00
Wayne Stambaugh bdee545841 Coverity warning fixes. 2023-06-03 07:28:17 -04:00
jean-pierre charras 68464a1993 Simulator: add missing ngspice models.
Fixes #14813
https://gitlab.com/kicad/code/kicad/-/issues/14813
2023-05-26 14:46:51 +02:00
Jeff Young 03486443c7 Fix more SPICE case-insensitivity bugs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793
2023-05-22 11:46:28 +01:00
Mark Visser 0d235ac64b fix bug whereby spice params with capital letters no longer cause an error and data loss
Spice parameters were converted to lower-case before comparison. This is incorrect, as it
is legal and common for spice parameters to contain capital letters (e.g. potentiometers
typically use Rt and SET as their parameters).
Spice parameters are not case sensitive, so the correct behaviour is to instead do a
case-insensitive comparison on the parameter name.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14793
2023-05-21 17:50:35 -04:00
Jeff Young 502da2d03c Performance improvements. 2023-05-21 11:23:56 +01:00
Marek Roszko aa230b4e08 Breakup sim_model_ngspice_data.cpp into multiple files to avoid unreasonable compiler link times 2023-05-20 19:58:46 -04:00
Jeff Young 58f4943597 ADDED voltage- & current-controlled voltage & current sources
Added GUI support for ngspice VCVS, VCCS, CCVS and CCCS.
2023-05-20 21:04:39 +01:00
Marek Roszko 7774b75172 Another set of C5266 warning fixes 2023-05-18 22:46:57 -04:00
Graham Keeth df3560ab8e sim: fixup some diode parameter units 2023-05-10 23:09:13 +00:00
Graham Keeth 2970d97bf2 sim: fix diode model default breakdown voltage 2023-05-10 23:09:13 +00:00
Jeff Young b41d446f58 Fix a bunch more issues with sheetpaths and allowExtraText.
A sheetpath is required to correctly resolve text variables.
Depending on currentSheet is rife with bugs.

There are many places where we do *not* want to be prepending
field names to the field values, such as netlisting,
building PDF hypertext menus, etc.

Also, Find/Replace needs to work on unresolved text, as
that's what we're going to display (and if replace nuked
your variable references you wouldn't be happy).
2023-05-05 17:23:52 +01:00
jean-pierre charras 2aa9ea87eb Simulator: when using Incremental Connectivity, ensure the netlist is up to date 2023-05-03 18:59:18 +02:00
Jeff Young d5cb100f72 Fix sheetPath handling in SPICE model generation. 2023-04-28 16:19:14 +01:00
Jeff Young 69500bfcaa LTSpice schematic import based on the work of Chetan Shinde. 2023-04-24 13:52:52 +01:00
Jeff Young 60b019591d Simulator fixes.
1) Don't read libraries multiple times
2) VDMOS default is nchan if not specified
3) In the absence of a workbook default to LTSpice compatability
4) Don't attempt to write out a model line for a subckt; it never has
a baseModel
2023-04-24 13:52:52 +01:00
Jeff Young c2cc27c25c Formatting. 2023-04-24 13:52:52 +01:00
Jeff Young c381b6d024 More robust file reading for simulator files. 2023-04-24 13:52:52 +01:00
Jeff Young 51b6ec0dce Don't exit KiCad when simulator window is closed. 2023-04-18 23:55:56 +01:00
Jeff Young 02c5a31b99 Fix close button on simulator frame.
Fixes https://gitlab.com/kicad/code/kicad/issues/14551
2023-04-16 23:45:18 +01:00
Jeff Young d01c023d5a Retire the lib-tree scoring algorithm.
It appears to cause more confusion than help.

Fixes https://gitlab.com/kicad/code/kicad/issues/13905
2023-04-14 23:35:27 +01:00
jean-pierre charras f56e569a25 Ensure we do not use a non existing pin in SIM_MODEL::MigrateSimModel()
Fixes #14522
https://gitlab.com/kicad/code/kicad/issues/14522
2023-04-12 09:37:59 +02:00
qu1ck 0c049eccc7 Fix a bunch of compiler warnings 2023-04-11 17:01:30 +00:00
Wayne Stambaugh 28776f5745 Text attributes object improvements.
* Add compare method to COLOR4D object.
* Add unit test to validate COLOR4D comparison method.
* Add missing color test in text attribute comparison method.
* Add unit test for text attribute object.
* Remove unnecessary headers from text attribute header.
* Move text attribute code into separate source file.
2023-03-29 12:53:45 -04:00
Jeff Young 1788db53e5 Don't complain about no sim model when running Sim Model Editor dialog.
Also removes some atrophied code, and makes sure changes to the parameter
grid for raw spice models gets saved.
2023-03-25 20:22:04 +00:00
Jeff Young 60aadfee40 Move separation of model name from params earlier in the process.
We need just the model name when we look for a match in the library file.
2023-03-25 12:45:36 +00:00
Wayne Stambaugh 244c37298f Fix Doxygen commenting issues. 2023-03-24 11:57:52 -04:00
Jeff Young b8cf7cc080 Split name from additional params only when model is a library reference. 2023-03-22 13:52:17 +00:00
Jeff Young 5bda3b99f9 Handle single-token flag parameters.
Also fixes a bug where all VDMOS instance parameters weren't marked as
instance parameters.

Also fixes a bug where VDMOS thermal models weren't supported (they
have two extra pins: Tj and Tcase).
2023-03-22 13:52:17 +00:00
Jeff Young 9dc16eb014 Don't include non-overridden parameters in Sim.Params.
Fixes https://gitlab.com/kicad/code/kicad/issues/14369
2023-03-22 13:52:17 +00:00
Jeff Young 39a801423e Separate legacy model name from parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13988
2023-03-21 13:29:17 +00:00
Ian McInerney 016c958021 Always build spice simulator support
The simulator has advanced considerably, and it is seeing lots of active
development, so make it a required part of KiCad. Additionally, the
build without the simulator has actually been broken for a while, so no
one clearly is building without ngspice right now.
2023-03-20 16:54:32 +00:00
Jeff Young 5798b586f0 Ignore extraneous LTSpice parameters for VDMOS models.
Also adds special case handling of VDMOS syntax to allow parens (or extra
spaces, linebreaks, etc.) between "VDMOS" and "NCHAN"/"PCHAN".

Fixes https://gitlab.com/kicad/code/kicad/issues/14299
2023-03-20 16:16:44 +00:00
Jeff Young a14c017def Save location of legend in worksheet.
Also provides a different cursor when over a legend (to make it clearer
that you can drag it).
2023-03-20 09:51:41 +00:00
Jeff Young ec6d709929 Make sure legend reflects gain/phase for AC small signal analyses.
Fixes https://gitlab.com/kicad/code/kicad/issues/14301
2023-03-19 23:02:58 +00:00
Jeff Young 607622e8f8 Make the two Create() methods more parallel. 2023-03-17 15:58:28 +00:00
Jeff Young 222cd4d009 Handle underscore in parameter names.
Fixes https://gitlab.com/kicad/code/kicad/issues/14308
2023-03-16 23:40:52 +00:00
Jeff Young 6d296038f3 Improve simulation error reporting.
1) More REPORTER, less exception processing
2) Remove UI calls from SPICE_MODEL
3) Don't replace netlist with errors; show both
4) Don't bail out of netlist generation after single error

Fixes https://gitlab.com/kicad/code/kicad/issues/14295
2023-03-16 16:12:29 +00:00
Jeff Young 5041bddc3b Union workbook sim commands with any defined on schematic.
Fixes https://gitlab.com/kicad/code/kicad/issues/14215
2023-03-10 21:33:06 +00:00
Jeff Young 3bc5e3dd8a Added PSPICE/LTSPICE JFET model parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/12425
2023-03-10 21:33:06 +00:00
jean-pierre charras 6343147bb3 Fix Coverity warnings. 2023-03-08 11:37:56 +01:00
Jeff Young 630ff02369 Fix bone-headed logic.
(Else clause never gets called because 3 is always > 2.)
2023-03-06 10:26:59 +00:00
aris-kimi 5b43dc4e7b Simulator: Fix diode ibv unit 2023-03-05 19:23:33 +02:00
Alex d2bd7e33b9 Remove extra canvas redraws when changing sheets. 2023-03-05 04:33:07 +03:00
Jon Evans 610e787ada Move to requiring explicit action to save project settings 2023-03-04 14:25:07 -05:00
Wayne Stambaugh 4e99812145 Coverity fixes and code cleaning. 2023-03-04 13:02:05 -05:00
Jeff Young d714ff8549 Don't commit changes on paint events or updateUI events.
Also use std::numeric_limits::epsilon for comparing doubles.

Fixes https://gitlab.com/kicad/code/kicad/issues/13851
2023-03-04 00:10:01 +00:00
Jeff Young b6d0b65261 Naming conventions and commenting. No functional changes. 2023-03-04 00:10:01 +00:00
Jeff Young 14f1f3ec79 Convert inline models in Sim.Params fields to SPICE syntax.
Fixes https://gitlab.com/kicad/code/kicad/issues/14157
2023-03-03 18:18:03 +00:00
Jeff Young dcba555d44 Make SME prop-grid hack Mac-only.
Fixes https://gitlab.com/kicad/code/kicad/issues/13852
2023-03-02 10:42:13 +00:00
Jeff Young 63a545ebfd We don't need "(gain)" or "(phase)" in names any more.
Fixes https://gitlab.com/kicad/code/kicad/issues/14140
2023-03-02 00:38:39 +00:00
Jeff Young 190ee58ccf Don't deliver pedantic error messages to user. 2023-03-02 00:38:39 +00:00
aris-kimi db2780090c Simulator: Fix RLGC c unit 2023-03-01 23:03:54 +00:00
Jeff Young 9c68d4792f Fix bungle from earlier merge. 2023-03-01 13:43:46 +00:00
Jeff Young f5edcf82f2 Move only-write-model-if-it-contains-overrides up to base class.
It's necessary to keep us from writing out model lines for included
models and fall-backs of included models.
2023-03-01 13:31:57 +00:00
aris-kimi 4a761179d0 Simulator: Fix some cases with initial conditions 2023-02-28 21:31:04 +00:00
Jeff Young 281fde71b9 Make SIM_MODEL_SPICE_FALLBACK act more like the model it's a fallback for.
In particular, install/show the parameters, and keep the existing name
field.

Fixes https://gitlab.com/kicad/code/kicad/issues/14102
2023-02-28 12:26:04 +00:00
Jeff Young 766b1a1ca8 Continue rationalisation of vector, trace and signal names.
Also add a little bit more code so user-defined signals can be edited
without resetting their properties.

Fixes https://gitlab.com/kicad/code/kicad/issues/14072
2023-02-27 21:11:31 +00:00
Fabien Corona 5b2784f418 sim - switches: open <-> closed in description 2023-02-27 09:54:14 +00:00
Jeff Young 79f13ea9c7 Don't eval empty string.
Fixes https://gitlab.com/kicad/code/kicad/issues/13756
2023-02-26 23:14:09 +00:00
Jeff Young beb177fa79 Try and sort out the mess that is trace names and trace titles.
Fixes https://gitlab.com/kicad/code/kicad/issues/14016
2023-02-26 18:08:42 +00:00
Jeff Young 551773bf17 Save plot prefs (legend, grid, and dotted-secondary).
Fixes https://gitlab.com/kicad/code/kicad/issues/13940
2023-02-26 11:57:49 +00:00
Jeff Young 23c1a23faf Provide power axis for DC-sweep analyses.
Fixes https://gitlab.com/kicad/code/kicad/issues/14087
2023-02-25 23:11:29 +00: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 1fdc81e68d Make substrate and thermal junction nodes optional.
Fixes https://gitlab.com/kicad/code/kicad/issues/14083
2023-02-25 20:36:30 +00:00
Jeff Young 77ed53ab25 Nullptr safety. 2023-02-25 18:33:32 +00:00
jean-pierre charras 49a9fe38a0 Fix a compil warning 2023-02-25 19:06:46 +01:00
Jeff Young 4b427b2d0c Add second instance of "don't mess up user formatting" fix.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989
2023-02-25 16:31:16 +00:00
Jeff Young 2e5bf0210a Clear model name when switching to internal model.
Also fixes a bug to ensure that a modelLine gets written when using
an internal model.

Fixes https://gitlab.com/kicad/code/kicad/issues/14083
2023-02-25 15:22:20 +00:00
Jeff Young 9a0aeb4344 Adjust AC-small-signal plot names when saving placeholders.
Fixes https://gitlab.com/kicad/code/kicad/issues/14016
2023-02-25 13:26:33 +00:00
Jeff Young ee956673b1 Respect readOnly cells in GRID_TRICKS.
Also fixes setting colors in the signals grid as it allows us to make
it editable again.

Fixes https://gitlab.com/kicad/code/kicad/issues/14079
2023-02-25 11:02:12 +00:00
Jeff Young 5a12e5ee76 Only write included models if they have overridden parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13953
2023-02-24 20:31:35 +00:00
Jeff Young c188318174 Change strategy for committing values from SIM_MODEL propGrid.
Note that the PCB editor's propGrid doesn't seem to need this workaround,
but I haven't yet figured out what's different between it and the sim model
propGrid.

Fixes https://gitlab.com/kicad/code/kicad/issues/13852
2023-02-24 14:22:00 +00:00
Jeff Young 200a06a677 Cleanup some dead code, and add a potentially needed fix for non-Mac.
(The Mac bug is fixed in 4e5b1da81fce7cd9ffedaec878ed07bfcfff4fe2 in
our wxWidgets fork.)
2023-02-24 12:44:55 +00:00
Jeff Young 8059edff0e Don't mess up user formatting if eval'ing didn't actually change value.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989
2023-02-24 12:44:55 +00:00
Jeff Young 71df3f9edb Don't allow extra text in Sim.* fields.
(In particular, the field name.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13996
2023-02-24 12:44:55 +00:00