Commit Graph

61 Commits

Author SHA1 Message Date
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 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
Mikolaj Wielgus 1550a1e3a4 Sim Model Editor: Add "Save {} in Value field as "{}"" checkbox 2022-11-22 07:09:52 +01:00
Mikolaj Wielgus 6969362813 Sim Model Editor: Don't provide library-only models as builtins 2022-11-20 22:07:39 +01:00
Mikolaj Wielgus 059ca8fc48 Sim: Rename Sim_* fields to Sim.* 2022-11-20 03:37:54 +01:00
Mikolaj Wielgus e7c43ca20a Sim: Remove inference from Reference and Value 2022-11-18 08:39:15 +01:00
Mikolaj Wielgus f33cd3e383 Sim: Remove vestiges of (de)serialization from SIM_MODEL 2022-11-11 05:17:26 +01:00
Mikolaj Wielgus 490069c5e6 Move (de)serialization of models into fields to new SIM_SERDE class 2022-11-11 03:08:32 +01:00
Mikolaj Wielgus e8762da4f4 Revert "Support for variable references in SPICE models."
This reverts commit 95ebfeeed1.
This reverts commit 672ce650a9.
2022-11-07 19:37:40 +01:00
Jeff Young 95ebfeeed1 Support for variable references in SPICE models.
Also fixes a couple of bugs where sheet instance data wasn't being
handled correctly.
2022-11-07 10:57:34 +00:00
Mikolaj Wielgus 20ffb7d334 Sim: Don't throw exception for certain garbage characters in Value field 2022-10-27 06:42:43 +02:00
Mikolaj Wielgus aa0e3666d1 Sim: Skip param name when writing primary param in model's Value field 2022-10-26 09:03:02 +02: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 78b193af5f Sim: Add tuner param virtual getter 2022-10-24 11:04:47 +02:00
Mikolaj Wielgus d14de1ce78 Sim: Rename Value field's "principal value" to "primary value" 2022-10-24 11:04:47 +02:00
Mikolaj Wielgus 958bd1897d Sim: Add potentiometer model 2022-10-22 04:33:52 +02:00
Mikolaj Wielgus 2a5bc9f87e Sim: Don't accept lone '.' as Value principal value 2022-10-22 04:33:52 +02:00
Mikolaj Wielgus 209ff933e7 Sim: Ignore everything between principal value and parameter-value pairs 2022-10-21 18:55:40 +02:00
Mikolaj Wielgus 9819fa43dd Sim: Allow principal value in Value field to be followed by regular params 2022-10-21 08:14:13 +02: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 c3d5b3b3e5 Sim: Only store device type in reference, not full model type
Instead of Reference="VSIN1", Value="dc=1 ampl=2 f=3", it's now
Reference="V1", Value="SIN dc=1 ampl=2 f=3".
2022-10-15 19:36:26 +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 72402cf687 Sim: Override base model type if there's a Sim_Type field 2022-10-09 20:46:05 +02:00
Mikolaj Wielgus 120b569048 Sim: Support ako models 2022-10-04 17:48:10 +02:00
Mikolaj Wielgus c464c5b87b Sim: cleanup: use unique_ptr for PARAM::value 2022-10-03 22:15:14 +02:00
Mikolaj Wielgus 0d369f700f Sim: Basic cleanup after KIBIS merge
- Some preliminary refactoring,
- Use multiple types for IBIS drivers instead of a wftype variable,
- Remove the m_requiresUIUpdate variable and its accessors.
2022-09-30 16:17:00 +02:00
Fabien Corona 7e486327d9 Ibis differential and PRBS models 2022-09-29 08:35:01 +00: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 5fa0a1a064 Sim: Output more descriptive parsing errors 2022-09-17 08:29:18 +02:00
Mikolaj Wielgus d48ec3aa8c Sim: Slightly simplify grammars 2022-09-17 02:18:23 +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 ba723d36c9 Sim: Don't generate .model line when there's no instance param overrides 2022-09-14 03:16:53 +02:00
Mikolaj Wielgus e56635a02b Sim: Add mutual inductor model 2022-09-11 19:23:01 +02:00
Mikolaj Wielgus 94bbb2e267 Sim: Skip NC pins of raw Spice models when generating netlist
Unconnected pins were erroreously placed in raw Spice item
instantiations, resulting in passing more pins than model had.
2022-09-01 11:41:43 +02:00
Mikolaj Wielgus 748324f4cd Sim: Use O-devices to simulate all tlines (much faster than T-devices) 2022-08-31 15:50:11 +02: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 8a6a0ff7dc Allow inferred voltage/current sources to have a single float in Value
Update Opamp test to use this feature.
2022-08-24 06:19:38 +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 bd809bf31c Sim: Fix reading the legacy Spice_Node_Sequence field 2022-08-11 02:42:16 +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