58 Commits

Author SHA1 Message Date
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
Jeff Young
a9a2cc3e84 Enhance readability of Simulation Model dialog. 2022-10-27 00:01:38 +01: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
3e0f4a47b0 Sim: Remove pins field in all inferred models with linear pin mapping 2022-10-25 08:52:12 +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
f95e77499b Sim: Make exception messages slightly more verbose 2022-10-21 08:15:29 +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
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
jean-pierre charras
46b0c116cd fix a compil warning. 2022-09-29 13:06:50 +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
8599323dce Sim: Move Spice model parsing to a separate class hierarchy
Roughly analogous to the SPICE_GENERATOR hierarchy.
2022-09-19 07:24:46 +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
Marek Roszko
63295cfb9e Remove unused vars 2022-09-18 08:49:07 -04:00
Mikolaj Wielgus
a8d7a845b6 Sim: Rename SIM_MODEL_SPICE to SIM_MODEL_RAW_SPICE 2022-09-18 07:25:56 +02:00
Mikolaj Wielgus
15b5b48992 Sim: More descriptive parsing errors in all Spice parsers
In my previous commit, which changed Spice parsing errors to be more
descriptive, I forgot to apply this to all invocations of the Spice
parser. This commit corrects that.
2022-09-17 08:46:45 +02:00
Mikolaj Wielgus
5fa0a1a064 Sim: Output more descriptive parsing errors 2022-09-17 08:29:18 +02:00
Mikolaj Wielgus
4ae2225b6d Sim: Replace all wxStrings with std::strings in SIM_VALUE 2022-09-16 06:11:14 +02:00
Mikolaj Wielgus
d19b2dbfe4 Sim Model Editor: Display error when failing to set parameter 2022-09-16 05:44: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
0e0d1a34f5 Sim: Spice grammar fixes
- Fix parsing .model lines with model names containingnon-alphanumeric
  characters like - and _,
- Fix parsing libraries in which EOF is not preceded by a newline.

Fixes https://gitlab.com/kicad/code/kicad/issues/12394
2022-09-12 04:05:17 +02:00
Mikolaj Wielgus
e56635a02b Sim: Add mutual inductor model 2022-09-11 19:23:01 +02:00
Mikolaj Wielgus
1b7ff376b0 Sim: Simplify generated .model cards
One parameter per line instead of wrapping after a certain line width.
Consistent with the formatting in the recently added generation of
.subckt cards from the schematic.
2022-09-10 02:45:48 +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
cfdf6c097d Sim: Fix crash due to accessing param 0 of TYPE::NONE model 2022-09-02 20:21:09 +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
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
a0400791c0 Fix exporting Spice instance lines for multi-part symbols
Only pins from the current symbol part were used: the rest was
incorrectly set to Not Connected.

Also slightly change generation of names for Not Connected nets.
2022-08-25 08:47:31 +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
ffab57ffd0 Fix default pin assignment for subcircuit sim models
Instead of using a linear order that incorrectly starts from 0, have all
pins unassigned by default.
2022-08-24 00:09:05 +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
jean-pierre charras
34b38eb95b Sim: on parameters parsing error, give a better info than tao::pegtl::eof error. 2022-08-17 11:11:36 +02:00
Roberto Fernandez Bautista
3e11506fa2 Fix a few unused variable warnings on msvc 2022-08-15 20:47:21 +01: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
Seth Hillbrand
e8627c89df Fix initial compile error on Linux.
Still getting link error with DIALOG_SIM_MODEL
2022-07-31 16:43:52 -07:00