Commit Graph

43 Commits

Author SHA1 Message Date
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 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 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 190ee58ccf Don't deliver pedantic error messages to user. 2023-03-02 00:38:39 +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
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 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 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 a22964a977 Prepend correct SPICE prefix when necessary for plotting currents.
Fixes https://gitlab.com/kicad/code/kicad/issues/13850
2023-02-12 21:17:45 +00:00
Jeff Young 959e20f52c A fall-back model for FOO should supply FOO's pin names.
Fixes https://gitlab.com/kicad/code/kicad/issues/13589
2023-01-19 12:14:50 +00:00
Jeff Young e7e3f3bced SIM_MODEL code simplification.
1) Reduce API surface.
2) Prefer for(int) loops when what we're looking for is the index of
   the item to be found
3) Move "_" escape processing to SIM_MODEL_NGSPICE (which is the only
   model which uses the escape mechanism)
2022-12-21 17:01:58 +00:00
Jeff Young dba3c589d0 More bug fixes for escaped model parameters.
Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....More bug fixes for escaped model parameters.

Note that this whole escaping thing seems like a bad idea to me, but
I don't fully understand the difference between model parameters and
instance parameters so I don't know if there's a better way to handle
it or not....

Fixes https://gitlab.com/kicad/code/kicad/issues/13179
2022-12-16 16:34:41 +00:00
Jeff Young 39ad7c8205 Formatting and Kicad naming conventions. 2022-12-06 16:01:18 +00:00
Mikolaj Wielgus b025b103de Sim Model Editor: Make the VBIC model the first BJT model to select 2022-11-29 10:13:20 +01:00
Mikolaj Wielgus 7b1a460649 Sim: Fix unhandled MODEL_TYPE in SIM_MODEL_NGSPICE 2022-11-28 07:59:24 +01:00
Mikolaj Wielgus 5eca8dd8de Undo hardcoding swapping of diode pins
Revert commits d1e2acd3 70b4d1aa cff508fb
2022-10-30 11:01:59 +01:00
Mikolaj Wielgus cff508fb3b Sim: Reverse diode model pin order to match diode symbols 2022-10-28 14:01:09 +02:00
Mikolaj Wielgus 7ad927671d Sim Ltspice compat: Narrow ignoring undocumented parameters 2022-10-20 04:00:33 +02:00
Mikolaj Wielgus 5878749ed2 Sim LTspice compat: Ignore undocumented LTspice diode parameters 2022-10-20 04:00:33 +02:00
Mikolaj Wielgus 7378aaae9d Sim: Ignore the "mfg" parameter in all models 2022-10-19 06:53:39 +02:00
Mikolaj Wielgus c857e533a9 Sim: Fix crash when a field tries to set an inexistent parameter
Refactored SetParamValue() and friends to use exceptions instead of
return values.
2022-10-12 04:27:48 +02:00
Mikolaj Wielgus d9eb76eae0 Sim: Refactor SPICE_GENERATOR methods to accept a single SPICE_ITEM 2022-10-11 02:22:59 +02:00
Mikolaj Wielgus e99d531c88 Sim: LTspice model compat: Ignore spurious values
Also fix parsing type in ako models
2022-10-04 22:44:26 +02:00
Mikolaj Wielgus 120b569048 Sim: Support ako models 2022-10-04 17:48:10 +02:00
Mikolaj Wielgus b3b2b8b3f0 Sim: Don't hold KIBIS in MODEL_TYPE enum
Fixes pipeline error.
2022-09-28 11:14:50 +02:00
Mikolaj Wielgus b7c8570b2a Sim: Fix infinite recursion 2022-09-28 11:14:50 +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 e4865ce543 Excise wxString from simulation 2022-09-22 07:41:52 +02:00
Mikolaj Wielgus 0efc1149af Sim: Create a common base class for models sourced from Spice libs 2022-09-18 21:25:28 +02:00
Mikolaj Wielgus 4128a5533f Sim LTspice compat: Ignore mfg, icrating, vceo, type params 2022-09-18 04:14:57 +02:00
Mikolaj Wielgus 907ad27e7f Sim: Move SPICE_GENERATOR class to a new file 2022-09-15 05:26:23 +02:00
Mikolaj Wielgus e4c5bc6c66 Sim: Refactor Spice code generation to a new SPICE_GENERATOR class 2022-09-14 09:36:49 +02:00
Mikolaj Wielgus f6b1ff821b Sim Model Editor: Improve raw model code preview
- Show whole file below the item line for reference
- Fix pin sequence in item line (was not displayed)
2022-09-03 16:20:41 +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 c9f3507ff7 Sim: Don't require ngspice.h for SIM_MODEL_NGSPICE 2022-08-05 18:26:09 +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 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