Commit Graph

114 Commits

Author SHA1 Message Date
Wayne Stambaugh 4e99812145 Coverity fixes and code cleaning. 2023-03-04 13:02:05 -05:00
Jeff Young d1b7fa6b0f Slight improvement to property grid col widths in SME. 2023-03-04 00:10:01 +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 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 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 68fe146861 Remove most of SIM_VALUE in favour of good old wxString.
This allows us to save the user's intent, including units, formatting,
and crucially variable references.
2023-02-22 10:45:27 +00:00
Jeff Young 90adc26b73 Remove dead and redundant code. 2023-02-22 10:45:27 +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 df00585a55 ReadDataFields must be a separate step from Create.
Create() is done without execption processing, while ReadDataFields
should have exception processing.

(This also fixes a case where exception processing on ReadDataFields
was missing.)

Also fixes a bug where the pinSelect menu wasn't checked for -1 before
fetching.

Fixes https://gitlab.com/kicad/code/kicad/issues/13856
2023-02-13 12:43:25 +00:00
Jeff Young f0bd25b397 ADDED use-settable simulation trace colors.
Fixes https://gitlab.com/kicad/code/kicad/issues/2536
2023-02-11 21:11:07 +00:00
Jeff Young 9be872a85a Better bounds checking for DIALOG_SIM_MODEL::curModel().
Fixes https://gitlab.com/kicad/code/kicad/issues/13767
2023-02-04 20:16:50 +00:00
Jeff Young f588da2bef Bounds checking for DIALOG_SIM_MODEL::curModel(). 2023-02-04 19:17:13 +00:00
Jeff Young 27109bfc8a MRU path for simulation model libraries.
Fixes https://gitlab.com/kicad/code/kicad/issues/13581
2023-01-20 00:18:55 +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 3af9c658e6 Don't specify fonts in wxFormBuilder. It only leads to pain.
Fixes https://gitlab.com/kicad/code/kicad/issues/13547
2023-01-18 12:28:07 +00:00
Marek Roszko d2c0f5fc2a More wxSing 2023-01-16 23:14:38 -05:00
Jeff Young 4c5a344629 Allow editing of raw SPICE models through code tab. 2023-01-14 02:43:34 +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 7af718f1a5 Don't use std::string for things with wxString APIs.
It's too bug-prone.

Fixes https://gitlab.com/kicad/code/kicad/issues/13380
2023-01-05 14:16:39 +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 9b9795a87d Reduce reliance on exception processing -- it's waay too bugy at present.
This moves some stuff to REPORTER APIs.  Moving more stuff would be good,
but it probably too high-risk at present.  We'll wait for 8.0 for that....

Fixes https://gitlab.com/kicad/code/kicad/issues/13359
2023-01-03 17:20:23 +00:00
Jeff Young 55b8f0bc00 Gracefully fall back to raw spice when we can't parse the data.
Fixes https://gitlab.com/kicad/code/kicad/issues/13329
2022-12-31 18:52:26 +00:00
Jeff Young 77b361a077 Add reference material to SPICE model pin assignment tab.
Fixes https://gitlab.com/kicad/code/kicad/issues/13309
2022-12-31 18:52:26 +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 604d7a72d6 Fix bug in tuning when value is stored in Value field. 2022-12-23 17:40:36 +00:00
Jeff Young 7f60b87d1d Implement fallback models for SPICE .lib models that we can't parse. 2022-12-22 22:35:09 +00:00
Jeff Young e64852c833 Clearer naming. 2022-12-21 17:03:46 +00:00
Jeff Young 58ce0bb804 Simulation bug fixes.
1) Use C-locale when converting output of parsers to strings.

2) InferSimModel() must run on local copy of fields, not the fields in
the symbol (which might be different if they've already been edited in
the Symbol Properties Dialog, for instance).

3) InferSimModel() should accept a deviceType already set to RLC.

4) Don't output trailing decimal separators if there's no fraction.
2022-12-19 18:14:13 +00:00
Jeff Young 7192c565b8 Add simple VI model inference. 2022-12-18 22:54:12 +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 321de57d7c Bug fixes for simulator.
1) Finish removing pin-count based APIs.  We need to know the pin names
as well, not just the count.

2) Fix a bug in the regexp for SPICE functions to allow both lowercase
and uppercase function names

3) Move CreatePins() overrides to the new API so that we get pins on
raw SPICE models.

Fixes https://gitlab.com/kicad/code/kicad/issues/13190
2022-12-17 20:29:24 +00:00
Jeff Young 6b70c679cf Migrate more V6 SPICE syntax to V7.
Also fixes various bugs if symbols contained non-indexed pin numbers.
We really need to know the actual pin names when creating models, rather
than just assuming 1, 2... etc.

Fixes https://gitlab.com/kicad/code/kicad/issues/13183
2022-12-17 15:23:51 +00:00
Jeff Young 24786fe0e9 Fix multi-unit symbol bugs.
1) SPICE pins need to include all units
2) Already-seen-unit-x needs to be reset when getting netlist again.

Fixes https://gitlab.com/kicad/code/kicad/issues/13164
2022-12-16 13:57:46 +00:00
Jeff Young a8e73cf92c Check for model existence in library. 2022-12-15 14:25:25 +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 b2e512bfab We must infer a pinMap when inferring other fields for RLC passives.
Fixes https://gitlab.com/kicad/code/kicad/issues/13162
2022-12-14 23:23:41 +00:00
Jeff Young 50ccc4e6da Fix issue converting legacy SPICE models.
1) if a legacy model references a library then we need to see if said
   libraray exists and read model from it if so
2) legacy node ordering is by index, not pin name
3) we can't auto-generate a pin map when we don't know the pin names,
   so don't try
2022-12-14 13:36:28 +00:00
Jeff Young c0872364d4 Get rid of bloated bitmap buttons on wxWidgets 3.2. 2022-12-13 20:48:02 +00:00
Seth Hillbrand 413637b732 Add missing translation string 2022-12-12 13:07:53 -08:00
Jeff Young e890986e01 Fix crash when grid tries to access deleted field. 2022-12-11 23:12:55 +00:00
Jeff Young 1baec20cf6 Handle SPICE <-> SI conversions in inferred models.
Fixes https://gitlab.com/kicad/code/kicad/issues/13112
2022-12-09 22:02:52 +00:00
Jeff Young 60c937186a When migrating simulation models update value to a reference. 2022-12-09 20:24:25 +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 e8980e9024 Centralize SPICE lib path resolution and support SPICE_LIB_DIR.
Fixes https://gitlab.com/kicad/code/kicad/issues/13081
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