Commit Graph

119 Commits

Author SHA1 Message Date
Jeff Young fdc8f9c59d Fix accidental deletion in "TEXT_ATTRIBUTES" commit. 2023-01-03 01:23:18 +00:00
Jeff Young 7f35323416 Re-enable sim model ERC testing. 2023-01-03 00:59:14 +00:00
Jeff Young 277cd73204 TEXT_ATTRIBUTES doesn't hold the position.
Fixes https://gitlab.com/kicad/code/kicad/issues/13350
2023-01-02 17:36:21 +00:00
jean-pierre charras e8114dc49a Minor compil and Coverity warnings fixes. 2023-01-02 10:21:42 +01: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 5deee405da Fill in built-in-model-type (which might not be the same as initial spice type).
Fixes https://gitlab.com/kicad/code/kicad/issues/13324
2022-12-31 01:07:46 +00:00
Jeff Young 62bec69d8c Migrate field text attrs from legacy fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/13323
2022-12-30 23:41:46 +00:00
Jeff Young 424cdf6699 Overflow safety.
Sentry issue https://sentry.io/organizations/kicad/issues/3419671947/events/11212297e66c47c7af7144b5f075e88c/
2022-12-26 20:33:04 +00:00
Jeff Young 3f49fa5361 Don't write sim.params for library model unless we actually have overrides. 2022-12-23 12:46:18 +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 7abfa46531 Inferred sim value improvements, and a unit test for them. 2022-12-21 17:03:49 +00:00
Jeff Young e64852c833 Clearer naming. 2022-12-21 17:03:46 +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 8db015bc0f Accept thousands separators in inferred values. 2022-12-19 20:05:54 +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 a3a2e2e5b1 Update demos and legacy qa files SpiceMapping -> Spice_Node_Sequence.
Also removes migration in the code as it will no longer be needed.
2022-12-19 12:04:53 +00:00
Jeff Young 04f50ce687 Generate default pinMap from symbol's pins when we don't know SIM_MODEL's pins. 2022-12-19 11:40:52 +00:00
Jeff Young df8eb59854 Don't use SPICE_MODEL_SUBCKT::CreatePins to crate a default pinMap.
(It creates a fully-unconnected map on the premise that it's easier
to add a pinMap than to edit one.  This is probably no longer true
now that you don't have to un-assign a pin before re-assigning it.)
2022-12-19 11:40:52 +00:00
Jeff Young 1ce6cd6d4d Naming clarity. 2022-12-19 01:51:24 +00:00
Jeff Young 7433322778 Handle a couple more legacy formats found in legacy_sallen_key demo. 2022-12-19 01:47:23 +00:00
Jeff Young 7192c565b8 Add simple VI model inference. 2022-12-18 22:54:12 +00:00
jean-pierre charras a9acb2e215 Fix incorrect format in a wxString::Format() 2022-12-18 20:30:15 +01: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 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 08a8a20794 Sort pins in numeric order before attempting to match to SPICE model.
Fixes https://gitlab.com/kicad/code/kicad/issues/13164
2022-12-16 14:18:44 +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 a41f27a022 Silence Coverity. 2022-12-15 18:14:19 +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 a2ba9137b8 Use only first letter of prefix for RLC primary value name.
Fixes https://gitlab.com/kicad/code/kicad/issues/13162
2022-12-14 23:23:41 +00:00
jean-pierre charras cdcf875ec0 sim_model: Fix another not handled exception that fully freeze Eeschema.
Can happens with schematics with old sim parameter syntax.
Fix also another crash in sim_model.
2022-12-14 17:47:20 +01:00
Jeff Young ce6378fed3 Use symbol pin names for left-hand-side of auto-generated pinMaps. 2022-12-14 15:13:29 +00:00
Jeff Young 6abdfc76da Replace 1:1 pin map on legacy conversion now that we can accept indexes.
Fixes https://gitlab.com/kicad/code/kicad/issues/13152
2022-12-14 14:22:35 +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
jean-pierre charras bbdb30135e sim_model: Fix a not handled exception that fully freeze Eeschema.
Can happens with schematics with old sim parameter syntax.
2022-12-13 11:15:02 +01: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 3ae404f764 Move model inference to SIM_MODEL so it can also be used for behavioral models.
Fixes https://gitlab.com/kicad/code/kicad/issues/12505
2022-12-09 20:24:25 +00:00
Jeff Young 8931e55dd2 Templatize MigrateSimModel() so it can be used on LIB_SYMBOLs as well.
Fixes https://gitlab.com/kicad/code/kicad/issues/13080
2022-12-08 23:57:43 +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
Mikolaj Wielgus 7d207c5d2f Sim Ibis: Change some strings for consistency 2022-11-30 17:38:09 +01:00
Mikolaj Wielgus e39c0b20ea Sim: Universally initialize enum parameters with their default values 2022-11-30 12:45:59 +01: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 d836fbaaaa Sim: Add VBIC model support
Update generate_sim_model_ngspice_data.bash a little, but it's still
outdated.
2022-11-28 04:45:36 +01:00
Mikolaj Wielgus a65b35107d Sim: Make Sim.Pins have key-value pairs instead of a sequence
Moreover, upgrade models on schematic load instead of on model load
2022-11-25 05:38:21 +01:00
jean-pierre charras b0b8a8dd67 Fix the order of some includes to avoid a conflict with a Windows header 2022-11-22 07:33:14 +01:00
Mikolaj Wielgus 23480cdee3 Sim: Make empty Sim.Params mean storing primary value in Value 2022-11-22 07:09:52 +01:00