Commit Graph

46 Commits

Author SHA1 Message Date
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 64f1808d60 Don't use the just-in-time model resolver when updating the dialog.
If it changes in the middle it will leave you in a world of hurt.

Also don't update the library after a loss-of-focus unless the path
really changed.

Fixes https://gitlab.com/kicad/code/kicad/issues/13869

Fixes https://gitlab.com/kicad/code/kicad/issues/13854
2023-02-15 00:31:04 +00:00
Jeff Young 87377d1aac Stop stepping on user's data.
Just because we can't find the file doesn't mean the path to it has
no value.  Don't delete it.  And don't crash afterwards either.

Fixes https://gitlab.com/kicad/code/kicad/issues/13578
2023-01-18 13:50:40 +00:00
Jeff Young 52163c7b31 Hold off on one-library-per-SIM_LIB_MGR. It's too risky for 7.0. 2023-01-12 16:29:51 +00:00
Jeff Young d839f11d49 Rip out parsing of SPICE libraries for netlisting.
We only need to parse the libraries for the Sim Model Editor dialog
(so that we can determine the models to put in the popup).  Doing it
for netlisting just opens us up to incorrectly parsing the SPICE, and
returns no value.

This also means that a SIM_LIB_MGR manages a single library, and
never multiple libraries.

This also allows the tidying-up of some error reporting structures to
better inform the user what went wrong.

Fixes https://gitlab.com/kicad/code/kicad/issues/13431
2023-01-12 14:51:03 +00:00
Jeff Young 9583b28063 Fix store-in-value bugs.
1) Always honour the dialog checkbox value.
2) Don't expect the absence of the primary parameter in Sim.Params to
   mean that Value stores it.  It might be the default parameter value.
3) Update spiceTypeInfo when matching legacy data to an internal model.
4) Initialize the store-in-value checkbox depending on whether or not
   we found the primary parameter in the Value field.
2023-01-03 17:20:23 +00:00
Jeff Young a3fcc8bbf7 Move Exclude from Simulation to Symbol Properties.
Also brings the layout of Symbol Properties for Symbol Editor more in
line with Symbol Properties for Schematic Editor.

Fixes https://gitlab.com/kicad/code/kicad/issues/13299
2022-12-28 13:44:13 +00:00
Jeff Young 8324c0b0cc Fix event order bugs in Sim Model Editor dialog.
onParamGridChanged was firing before CommitPendingChanges which meant
the edited value didn't get saved if the editor was still open when
OK was clicked.
2022-12-17 22:33:00 +00:00
Jeff Young 00a5fddda4 Simplify library model name from combobox to choice.
Fixes https://gitlab.com/kicad/code/kicad/issues/13168
2022-12-15 12:13:16 +00:00
Jeff Young e890986e01 Fix crash when grid tries to access deleted field. 2022-12-11 23:12:55 +00:00
Jeff Young 05b9836f60 Remove ugly hack of passing SCH_SYMBOL as parent of LIB_FIELD array.
Also adds simulation model inference to Symbol Editor's Simulation Model
Editor, and adds write-back from both Simulation Model Editors to their
parent Symbol Fields Editor dialogs.

Fixes https://gitlab.com/kicad/code/kicad/issues/12505
2022-12-09 20:24:25 +00:00
Jeff Young 107025322c Better column width handling for sim params grid. 2022-12-08 23:57:42 +00:00
Jeff Young b15913bd53 Support env variables in spice library paths.
Also removes a bunch of std::string stuff from the file handling in the
simulator.  All our file handling, env variable expansion, project path,
etc. stuff is wxString based, and jumping through std::string in between
just makes it more complex and increases the potential bug surface.

Also fixes a bug where you'd get two error messages when a spice model
library wasn't found.

Also fixes a bug where you'd get a spice model library not found error
when the text field was empty.

Also fixes a bug where we'd try to absolutize a path starting with an
unresolved text or environment variable.  If the path starts with a
variable it's probably absolute, and tacking on the project path in the
error message just obfuscates things.

Fixes https://gitlab.com/kicad/code/kicad/issues/13082
2022-12-07 15:07:25 +00:00
Jeff Young 39ad7c8205 Formatting and Kicad naming conventions. 2022-12-06 16:01:18 +00:00
Jeff Young b7d41e0e56 Update simulator with NUMERIC_EVAL, decimal separator processing, etc.
Also includes fixes for instance data and resolving of textvar
references.

Also includes virtual d'tors for IBIS parser to get rid of all the
compile warnings on CLang.

Fixes https://gitlab.com/kicad/code/kicad/issues/12357
2022-12-05 12:40:29 +00:00
Jeff Young 49abd2682a Simulation model properties dialog improvements.
1) Fix <TAB> processing
2) Don't hide/show controls where possible
3) Use a more concrete reference to primary parameter in Save to Value
checkbox
4) Move Save to Value checkbox into model section
2022-12-04 21:06:35 +00:00
Mikolaj Wielgus 6f630f7054 Sim: Make library path textbox editable
Load the library from the path if enter is pressed or focus is lost if
the library exists. If a library under the same path as previously is
to be loaded this way, don't do anything.

Fixes https://gitlab.com/kicad/code/kicad/issues/12970
2022-11-26 03:55:20 +01:00
Mikolaj Wielgus acc760dc25 Sim: Fix generation of Sim.Pins field in multipart models
Fixes https://gitlab.com/kicad/code/kicad/issues/12372
2022-11-26 01:34:10 +01:00
Mikolaj Wielgus 1550a1e3a4 Sim Model Editor: Add "Save {} in Value field as "{}"" checkbox 2022-11-22 07:09:52 +01:00
Mikolaj Wielgus 9b6f7d5db7 Sim Model Editor: Use SIM_LIB_MGR class to manage library models 2022-11-19 01:55:38 +01:00
Mikolaj Wielgus e7c43ca20a Sim: Remove inference from Reference and Value 2022-11-18 08:39:15 +01:00
Mikolaj Wielgus b288e162d2 Sim Model Editor: Remove Override checkbox 2022-11-13 02:13:44 +01:00
Mikolaj Wielgus d66d810edc Sim Model Editor: Use SIM_LIB_MGR to store instance models 2022-11-12 23:27:22 +01:00
Mikolaj Wielgus 4caa65d100 Sim Model Editor: Don't use shared_ptr 2022-11-12 04:29:07 +01:00
Jeff Young 6390c28737 Don't conflate instance and ibis widgets. 2022-10-31 14:09:30 +00:00
Mikolaj Wielgus 355d5014f5 Revert changing inference checkbox to radio button
Reverts 5e1561fc22
and 6c84e0c2f0.
2022-10-31 07:29:38 +01:00
Jeff Young 5e1561fc22 Some bug fixes for inferred models. 2022-10-29 18:44:49 +01:00
Jeff Young 6c84e0c2f0 Dialog changes for inferred models. 2022-10-29 17:08:06 +01:00
Jeff Young fb8493d0bc Move model pin editor to GRID_CELL_ICON_TEXT_POPUP.
wxChoice is hopeless on Mac (it still doesn't highlight on rollover),
and using a char for the "assigned" graphic isn't great.
2022-10-28 15:27:00 +01:00
Jeff Young f3ba10ac67 Usability improvements to Pin Assignments in Sim Model dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/12720

Fixes https://gitlab.com/kicad/code/kicad/issues/12721
2022-10-28 00:34:24 +01:00
Jeff Young a9a2cc3e84 Enhance readability of Simulation Model dialog. 2022-10-27 00:01:38 +01:00
Fabien Corona 20b63f305e Sim: Ibis improvements and fixes
Follow-up after the KIBIS and KIBIS GUI merge requests.

- Move KIBIS from Pcbnew to Eeschema space,
- Make KIBIS obtain the Ku/Kd coefficients via the `SPICE_SIMULATOR` class instead of calling the `ngspice` executable via `system()`,
- Allow to toggle between differential and single-ended model in the GUI,
- Various GUI fixes and improvements.
2022-10-25 09:45:40 +00:00
Mikolaj Wielgus 2475a703d6 Sim Model Editor: Checkbox for toggling inference 2022-10-16 05:10:57 +02:00
Mikolaj Wielgus c8e13813d9 Sim: Rename Sim_Disabled field to Sim_Enable 2022-10-16 00:49:44 +02:00
Mikolaj Wielgus 6d958c5a3b Sim: Remove some superfluous class members 2022-10-10 13:49:43 +02:00
Mikolaj Wielgus 2f756d9d23 Sim Model Editor: Fix Model panel sizing 2022-10-04 23:47:52 +02:00
jean-pierre charras dcc325b3b2 More about fix compil issues and warnings, especially in ibis code.
A few are msys2 specific and due to include files order.
2022-09-28 11:26:07 +02:00
Fabien Corona 528fe4d371 Add Ibis to spice model editor
ADDED: IBIS models are now supported in Sim Model Editor
2022-09-27 20:47:00 +00:00
Mikolaj Wielgus bd6c153ad9 Sim: Implement "enum" model parameters for switches
Displayed in Sim Model Dialog parameter grid as a dropdown
(wxEnumProperty).
2022-08-30 09:45:49 +02:00
Mikolaj Wielgus 3b3131ad74 Create class for voltage and current -controlled switches
Unfortunately, along the way it turned out that Ngspice's .probe alli
breaks current-controlled switches. So they won't work in that case for
now.
2022-08-29 03:49:41 +02:00
Mikolaj Wielgus 963900ab83 Sort sim model pins by symbol pin number in sim model dialog 2022-08-26 04:36:48 +02:00
Mikolaj Wielgus 6fad25f8ed Allow mapping sim model pins to arbitrary string symbol pin numbers
This change removes the incorrect assumption that symbol pin numbers are
integers and are the same as indexes in the vector storing the symbol
pins.

"~" is now used to denote a floating sim model pin.
2022-08-22 08:13:26 +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 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
Renamed from eeschema/dialogs/dialog_spice_model.h (Browse further)