Commit Graph

379 Commits

Author SHA1 Message Date
jean-pierre charras 488a53e71b Fix a few minor Coverity warnings 2022-08-12 10:51:36 +02:00
Mikolaj Wielgus 6d59fef9a5 Sim: Fix reading the legacy Spice_Node_Sequence field (2nd attempt)
bd809bf31c was botched and broke QA tests,
this will fix the problem.
2022-08-11 15:50:16 +02:00
Mikolaj Wielgus bd809bf31c Sim: Fix reading the legacy Spice_Node_Sequence field 2022-08-11 02:42:16 +02:00
Mikolaj Wielgus a1a99b1ec2 Sim QA: Check NGSPICE's LoadNetlist() and Run() status code 2022-08-10 17:54:28 +02:00
Mikolaj Wielgus 0040ffc567 Convert strings to UTF8 before they are input to PEGTL
Otherwise there are QA failures under non-UTF-8 locales.
2022-08-10 14:20:52 +02:00
Mikolaj Wielgus 67476c330e Fix broken PEGTL include path 2022-08-08 17:50:42 +02:00
Mikolaj Wielgus 5096f5d8a9 Sim: Fix inference of RLC models with garbage suffixes
Garbage suffix is e.g. the "F" in "100uF".
2022-08-08 17:06:50 +02:00
Mikolaj Wielgus 24e7a8ac41 Commit missing eeschema/sim/sim_model_ngspice_data.cpp 2022-08-05 18:51:52 +02:00
Mikolaj Wielgus c9f3507ff7 Sim: Don't require ngspice.h for SIM_MODEL_NGSPICE 2022-08-05 18:26:09 +02:00
jean-pierre charras d667d9b464 Do not include and use sharedspice.h when KICAD_SPICE = OFF 2022-08-04 17:01:29 +02:00
Mikolaj Wielgus a14d3e74a8 Remove generate_ngspice_models.bash script 2022-08-02 14:50:02 +02:00
Mikolaj Wielgus 5d64fc12a1 Attempt to fix GCC MSYS2 build crash
Initialize ngspice_models.cpp structures at runtime on demand. Use
a sequence of std::vector::emplace_back() instead of
brace-initialization.
2022-08-02 14:47:28 +02:00
Seth Hillbrand e8627c89df Fix initial compile error on Linux.
Still getting link error with DIALOG_SIM_MODEL
2022-07-31 16:43:52 -07:00
jean-pierre charras fc849e3e0c sim_model.h: change order of includes to avoid conflicts with a windows header.
msys2 specific. No actual change in code.
2022-07-31 10:32:31 +02:00
Mikolaj Wielgus 7cf5138c63 Sim: Bugfixes, mostly for MS Windows compilation errors
Unfortunately, Windows headers define a lot of macros for common words,
so we had to rename some enums to not collide.

We also fix some of the many bugs related to the new simulation
architecture and the Spice Model Editor dialog.
2022-07-30 02:25:34 +00: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 6984f63af8 Sim: Transmission line models
Implement transmission line models and perform some adjustments to
the current models. Add some QA tests.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus fe38c622a9 Sim: Improvements to model serialization
Don't serialize parameters in certain models for default values. Infer
models from Value field for some kinds of models. Resolve synonyms when
loading models from Spice libraries.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 6450ec6b85 Sim: Spice netlist exporter rewrite
Rewrite the spice exporter to work with the new simulation model
architecture and data model, with many bugfixes related to the latter
two along the way.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus ce84a48037 Sim: Implement loading Spice library files
Implement parsing and loading Spice libraries into KiCad. This is done
without any involvement of Ngspice -- we create our own in-tree parser
using PEGTL -- because Ngspice doesn't offer any intermediate output we
could plug ourselves into. We don't parse everything -- just the library
content, so this won't be that much effort.

We implement some basic Spice code preview to give the user a hint what
Spice code eir model will correspond to.
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
Mikolaj Wielgus c5a256291e Sim Model Editor: Display model parameters
This commit adds parameter display functionality, via a wxPropertyGrid
widget, to the Sim Model Editor. To faciliate that, a SIM_VALUE class is
created to serialize, deserialize, and validate numeric values in the
new parameter grid.

SPICE_MODEL is renamed to SIM_MODEL and split into several subclasses
that correspond to different model kinds.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 229e5c9e0f Begin development of a new Sim Model Editor dialog
With that also begin reworking the internal structure of the simulation
model storage. Some models have parameter information extracted from
Ngspice, which was specially patched to faciliate that. The model is
stored and managed by the SPICE_MODEL class (later will be renamed to
SIM_MODEL).
2022-07-30 02:25:34 +00:00
Seth Hillbrand 93fb00d815 Protect the Kiway dereference
Also find a few more places where we are reaching into a new frame to
perform actions that need to have dialogs closed.

Running actions should also wait for the next cycle rather than being
immediately executed when we are calling into a new frame.  This allow
for the cleanup actions onClose() to happen prior to the next action
starting

Fixes https://gitlab.com/kicad/code/kicad/issues/11891
2022-07-14 11:37:45 -07:00
jean-pierre charras 9f38fa43cd Fix some minor compil and Coverity warnings. 2022-06-05 11:44:49 +02:00
Eduardo Behr f246646d7a Fix severe simulation memory leaks 2022-05-28 20:40:24 +00:00
Jeff Young cb15bd1635 Fix compile issue. 2022-05-26 10:54:54 +01:00
Seth Hillbrand 11ae5b75b7 Remove broken assert
Fixes compile issue for linux/gcc which expects a boolean in the assert
statement that it cannot find from std::map
2022-05-25 16:36:47 -07:00
Eduardo Behr 6aa50304d9 Eeschema: Fixing simulation plot CSV exporter 2022-05-25 15:00:03 +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 05fbe47a1b eeschema: two fixes for simulation tuners
- fix irrelevant warning message box when tuners moved
  too quickly and simulation was slow
- fix for rerun simulation when tuning and result tab was changed
2022-04-02 15:05:54 +00:00
Sylwester Kocjan 4719fdc9bf eeschema: rename m_exporter to m_circuitModel 2022-04-01 19:28:31 +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
Sylwester Kocjan 53ccd8bd67 eeschema,sim: refactor NETLIST_EXPORTER_PSPICE_SIM creation 2022-03-26 15:50:15 +00:00
Sylwester Kocjan 2fed8aa4b8 eeschema: Add sync functions to SPICE_SIMULATOR
SPICE simulator can be called also during IBIS model determination,
and in the future in ERC. Therefore a necessity arises to implement
exclusive access.
2022-03-21 19:10:08 +00:00
Seth Hillbrand 098e8f7d9b Revert "cmake: adding KICAD_MACOSX_APP_BUNDLE option"
This reverts commit ea9f960cc1.

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
Mark Roszko 44dc602d6b Yeet wxPoint/wxSize out of PLOTTER 2021-12-29 19:02:50 +00:00
Frank Zeeman 8167c69508 Add transformation function for characteristic curves of tuners 2021-12-28 02:53:39 +01:00
Frank Zeeman f004665df8 Add tuner support for potentiometer code model 2021-12-28 02:53:39 +01:00
Mikolaj Wielgus 2dbc6ef6ca If present, tune Spice_Model instead of Value
Fixes https://gitlab.com/kicad/code/kicad/issues/9880
2021-12-14 14:02:25 +01:00
Seth Hillbrand 9e760512ac Update schematic when saving tuned value
Also avoids a known(!) crash when the existing item has been deleted
while tuning.

Fixes https://gitlab.com/kicad/code/kicad/issues/9502
2021-11-01 17:05:22 -07:00
Seth Hillbrand 9b4c293f14 Ensure that any excess spaces removed
The sim command may have additional whitespace between the type and
first char
2021-10-18 10:12:53 -07:00
Seth Hillbrand 82ba456567 Remove unnecessary RegEx
This broke for signals using underscores.  More critically, RegEx is
fragile and should not be used with user input if at all possible

Fixes https://gitlab.com/kicad/code/kicad/issues/9421
2021-10-18 10:08:29 -07:00
Jeff Young 5f5ee7335d Formatting. 2021-10-01 21:49:14 +01:00
Sylwester Kocjan fe608bfcef eeschema, sim: clean signal list when last panel is closed
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9119
2021-09-09 01:11:47 +00:00
Mikolaj Wielgus 1c9e10f34e Disable simulator notebook splitting
Using this feature freezes the simulator.
2021-09-09 01:07:23 +00:00
Sylwester Kocjan f9c5c97f74 eeschema, sim: fix wrong names of the signals
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9062
2021-09-08 23:15:29 +02:00
Mikolaj Wielgus 44ea3a75f2 Simulator: Use last workbook path stored in .kicad_pro as initial path in dialogs
Previously this was done using a static variable, which was not loaded
from .kicad_pro on simulator launch, causing unexpected behavior

Fixes https://gitlab.com/kicad/code/kicad/issues/8799
2021-08-20 23:23:23 +00:00
Sylwester Kocjan 691b53d125 eeschema: add missing virtual destructors 2021-08-20 19:23:13 +00:00