Jeff Young
74eb587291
Better sorting within sections (voltage, current, power).
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13846
2023-02-12 23:16:45 +00:00
Marek Roszko
4665823089
Turn on and fix MSVC compliance mode issues
...
We want /permissive- to enable debug performance improvements in MSVC 17.5+.
This flag is also default under C++20 so we'll have to deal with these compile issues anyway at some point in the future.
In particular, MSVC becomes pedantic about ternary types.
See https://learn.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-170#ambiguous-conditional-operator-arguments
MSFT cites https://cplusplus.github.io/CWG/issues/1805.html
2023-02-12 16:30:37 -05:00
Graham Keeth
6af3dadaee
Fix SPICE pins for BJTs and MESFETs
...
- MESFETs don't have a substrate/bulk pin
- BJTs have a substrate pin, and HICUM/VBIC have TJ
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13848
2023-02-12 21:20:02 +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
1e756dbdd8
Save cursor positions in sim workbook.
2023-02-12 20:40:23 +00:00
Jeff Young
83dd06e5d1
Allow opening of workbook when simulation frame is opened.
...
This involved splitting creation of traces from setting of trace
data.
Also renamed SIM_WORKBOOK to SIM_NOTEBOOK. This class is a subclass
of wxAiuNotebook and represents the collection of simulation plot tabs.
It is NOT the same thing as a simulation workbook, which contains other
stuff such as measurements, plotted signals, colours, etc.
This also removes a bunch of "friend" declarations.
2023-02-12 20:40:23 +00:00
Jeff Young
78746b77c6
Save trace colors and cursor value formatting in sim workbook.
2023-02-12 20:40:23 +00:00
Jeff Young
84c72b087c
Simplify (and fix) logic for starting new simulations.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13853
2023-02-12 20:40:23 +00:00
jean-pierre charras
1fb2d138b4
Fix a compil issue.
2023-02-12 09:16:42 +01:00
Jeff Young
9d3a3d705d
ADDED simulation measurements.
2023-02-11 21:11:07 +00:00
Jeff Young
e5176ff4d6
ADDED power dissipation plotting and cursors.
...
Also fixes a bug so that voltages, currents and power dissipations are
only probed if the flag is set -- this keeps ngspice from throwing an
error if you probe something twice (for instance, if you have .probe
commands in text and turn off the auto-probing).
2023-02-11 21:11:07 +00:00
Jeff Young
bc108023b3
ADDED operating point overlay for SCH_EDIT_FRAME.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/11253
2023-02-11 21:11:07 +00:00
Jeff Young
2a5bb71fbd
ADDED operating point text variables for labels and symbols.
...
ADDED formatting for cursors and operationg points
Also fixes a bunch of bugs to make the new cursors work with .ac sims.
Fixes https://gitlab.com/kicad/code/kicad/issues/11253
Fixes https://gitlab.com/kicad/code/kicad/issues/6965
2023-02-11 21:11:07 +00:00
Jeff Young
b3ffbd6258
Don't include unconnected nets in signals list.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/4961
2023-02-11 21:11:07 +00:00
Jeff Young
39d35a8bec
Better cursor feedback for plot window.
2023-02-11 21:11:07 +00:00
Jeff Young
9a99106981
Cleanup.
2023-02-11 21:11:07 +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
09822c7f18
ADDED direct access to signals & cursors.
...
ADDED differential cursors.
Fixes https://gitlab.com/kicad/code/kicad/issues/4447
Fixes https://gitlab.com/kicad/code/kicad/issues/6221
2023-02-11 21:11:07 +00:00
Jeff Young
6bc89ee180
Don't disable run when there's no command: just ask for a command.
2023-02-11 21:11:07 +00:00
Jeff Young
7d7a48070e
Separate error messages when sim model and project paths are the same.
2023-02-11 21:11:07 +00:00
Jeff Young
a1a1a49729
On-the-fly language updates for simulator window.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13357
2023-02-11 21:11:07 +00:00
Jeff Young
b000d68def
Move simulator to tool framework.
2023-02-11 21:11:07 +00:00
Jeff Young
946e0a4b98
ADDED support for e-series based tuning.
2023-02-11 21:11:07 +00:00
Alex
81a55c42a1
Fix unintentional string change in IBIS parser.
2023-02-11 02:19:06 +03:00
jean-pierre charras
3d23d0e16a
Fix compatibility with wxWidgets 3.0.5
...
Fixes #13808
https://gitlab.com/kicad/code/kicad/issues/13808
2023-02-07 21:09:03 +01:00
jean-pierre charras
4065e413ea
Ibis parser: do not report activity when there are no errors.
...
The dialog to add a library expects no message when there are no error.
Fixes #13794
https://gitlab.com/kicad/code/kicad/issues/13794
2023-02-06 12:55:52 +01:00
Jeff Young
d1f6ba77e8
Better error reporting, and don't infer models with library references.
2023-02-04 20:55:52 +00:00
Jeff Young
56a1cdb4dc
Allow a limited set of un-braced expressions in SPICE model values.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13768
2023-02-04 19:49:48 +00:00
Jeff Young
e8397a33bb
Refrain from copying SPICE_INFO.
2023-02-04 00:05:50 +00:00
Graham Keeth
a51dc8c9de
HiSIM_HV MOSFET models are *not* the default type
...
The ngspice manual does not indicate that there is any default
model type. This change ensures we get a `level=xy` written out to the
.model line when we select a HiSIM_HV model.
2023-02-04 00:03:25 +00:00
Graham Keeth
5abe1a201b
spice: generate .model lines for all device types
...
- generate .model lines in spice netlist for all device types that need
one
- add "level=<n>" to .model line for non-default model levels. This is
necessary to allow more sophisticated models to be used, and some
devices *always* need a level specified (e.g. JFETs)
- add "version=<n>" to .model line for models that have multiple
versions available (AFAIK only affects HiSIM_HV MOSFET models)
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13775
2023-02-04 00:03:25 +00:00
Graham Keeth
41c4ee2245
ngspice requires J prefix for JFETs in netlist
...
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13774
2023-02-04 00:03:25 +00:00
Jeff Young
ed5fb2769f
Allow more characters (in particular '_') in code model names.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13769
2023-02-03 23:49:53 +00:00
Jeff Young
8b03c093f9
Move potentiometer pin model to r0, wiper, r1, and remove flipping code.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13741
2023-02-02 16:22:13 +00:00
Jeff Young
ab0c4dd292
Must do pin swap in model pins, not item pins.
...
Item pins might not be in the same order.
Fixes https://gitlab.com/kicad/code/kicad/issues/13741
2023-02-02 12:44:55 +00:00
Jeff Young
b4a75cd1d5
Write out a diode .model for built-in diodes.
2023-02-01 12:36:27 +00:00
Jeff Young
123467c8dd
Don't throw up debug message when signal is deleted.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13711
2023-01-30 21:32:18 +00:00
Jeff Young
c939b1ef76
Followed-by-3-digits doesn't guarantee a thousands separator.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13708
2023-01-30 21:22:48 +00:00
Jeff Young
4e50c5313d
More safety for array access.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13583
2023-01-24 00:07:40 +00:00
Seth Hillbrand
00f93db2ff
Convert wide chars before reading model
...
The PEGTL parser used by KiCad for SPICE models only handles ASCII
characters. Despite the docs stating that you can, in theory, parse a
UTF-8 character by reading the base string, in pratice this does not
work as the UTF-8 string is represented by unsigned chars and the PEGTL
string is based on signed char.
To work around this, we need to convert micro and mu to the ASCII 'u'
equivalent
Fixes https://gitlab.com/kicad/code/kicad/issues/13642
2023-01-23 15:23:41 -08:00
Jeff Young
542719c753
Add "all" mode to HSPICE emulation.
2023-01-21 19:32:25 +00:00
Seth Hillbrand
4d7ddf619a
Remove unused var and cleanup
2023-01-20 13:26:11 -08:00
Jeff Young
f7ebaf1bab
Add compatibility mode for netlist code.
...
(The non-A compatibility modes only run on included files.)
Fixes https://gitlab.com/kicad/code/kicad/issues/13589
2023-01-20 18:06:17 +00:00
Wayne Stambaugh
ee3e285393
Correctly parent simulator netlist error dialogs.
2023-01-19 07:59:30 -05:00
Jeff Young
0e778f17db
Add context menu for simulation cursors.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13580
2023-01-19 12:50:21 +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
Stefan Brüns
1df81b10e6
Explicitly convert std::string to wxString
...
In wxWidgets STL builds the compiler has multiple, ambigous choices
for converting - both arguments to std::string first, or just the
first to wxString.
Fixes #13432 .
2023-01-14 22:58:54 +00:00
Jeff Young
4c5a344629
Allow editing of raw SPICE models through code tab.
2023-01-14 02:43:34 +00:00
Jeff Young
098d2b30a2
Support for simulation options in workbook and simulation command dlg.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13524
Fixes https://gitlab.com/kicad/code/kicad/issues/13523
Fixes https://gitlab.com/kicad/code/kicad/issues/13431
2023-01-14 00:21:45 +00:00
Jeff Young
e7e2085b2a
Allow vector param values.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13431
2023-01-13 21:59:06 +00:00
Jeff Young
7fbad183db
Gracefully handle Quit when simulator window is open.
2023-01-13 16:35:45 +00:00
Jeff Young
4391fc7a7a
Don't be annoying about refusing to create traces when there's no data.
2023-01-13 16:35:45 +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
c43050b91b
Remove safety around reading default parameter from Value field.
...
This should be OK now because we should be writing out all parameters
now (even if they're default value).
But perhaps more to the point, if we have the safety in there then
we miss cases where we really can't parse the model (value of "{VCC}")
and we need to fall back to a raw spice model.
Fixes https://gitlab.com/kicad/code/kicad/issues/13444
2023-01-09 15:24:45 +00:00
Jeff Young
d65cf1b457
Check parameters before assuming we can handle the model.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13444
2023-01-08 18:00:22 +00:00
Jeff Young
4d7642a26c
Add number of pulses parameter to pulsed voltage/current sources.
...
Also don't suppress writing "0" valued parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13401
Fixes https://gitlab.com/kicad/code/kicad/issues/13402
2023-01-06 13:45:56 +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
Seth Hillbrand
cbe6cd3048
Don't move local vars
...
Copy ellision allows optimization if we don't explicitly move a local
variable in the return
2023-01-03 10:20:18 -08:00
Jeff Young
baa13b885f
Don't add Sim.Params unless it contains data, and update sallen key demo.
2023-01-03 17:20:23 +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
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
62f0843579
Fix grammar error in warning string.
2022-12-31 18:54:36 +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
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
d50b3550af
Signals header is repetitive.
2022-12-28 10:40:23 +00:00
Jeff Young
ef6001bfe6
Use consistent terminology: opposite of Add is Remove.
...
Note: violating string freeze because this change should ease translation,
not make it harder.
2022-12-28 10:40:23 +00:00
Jeff Young
e11d39b0f2
If magnitude or phase is specified, don't add both.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13202
2022-12-28 10:40:23 +00:00
Jeff Young
3767716f20
Menu IDs of 0 don't work on Mac.
2022-12-28 10:40:23 +00:00
Jeff Young
572c10b2c4
If we don't recognize a var then it's an error, not 0.0.
2022-12-27 13:50:44 +00:00
Jeff Young
39a23fa9bc
Only eval numeric properties.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13201
2022-12-27 13:50:44 +00:00
Jeff Young
80f3abe082
Event safety.
...
Sentry crash probably happens when an update title event fires either
too early or too late to have a simulator or simulator settings.
Sentry issue https://sentry.io/organizations/kicad/issues/3669444623/events/fce0179f7d5e4ff3a7dbb0d90a0570b4/
2022-12-26 20:33:04 +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
bf1c4e7bcd
Allow translation of simulation error messages.
2022-12-24 11:30:56 +00:00
Jeff Young
6f44468385
Fix more lifetime issues in simulator tuning.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13257
2022-12-23 22:03:24 +00:00
Jeff Young
981254543a
Allow line-continuations in name=value parameters.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13255
2022-12-23 20:05:16 +00:00
Jeff Young
8069e5d5d6
Fix sim bug running a command the first time when no command in doc.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/11366
2022-12-23 18:21:26 +00:00
Jeff Young
bfd3b40672
Bug fixes for tuning.
...
1) Don't save SCH_ITEM pointers in long-lived structures. Use KIIDs
instead.
2) Use the correct sheet for the referenced item, not the current sheet.
2022-12-23 17:40:36 +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
3f49fa5361
Don't write sim.params for library model unless we actually have overrides.
2022-12-23 12:46:18 +00:00
Jeff Young
cd7be966c0
Fix typo when un-escaping parameter name.
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
jean-pierre charras
8e4911bba2
Simulation: make a few errors thrown from PEGTL a bit more understandable.
2022-12-20 18:54:14 +01: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
cbb70f0da1
Formatting and CLang-Tidy warning reduction.
2022-12-19 13:51:49 +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
b06c245b8f
Don't double-add DC parameters.
...
(Remember that DC's inlineTypeString used to be "".)
2022-12-19 01:19:55 +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
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
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
Seth Hillbrand
6d5a9153ab
Move resolve function to general usage
...
Libraries are created multiple times, so we need to resolve the library
locations each time
Fixes https://gitlab.com/kicad/code/kicad/issues/13083
2022-12-15 15:34:48 -08:00
Jeff Young
a41f27a022
Silence Coverity.
2022-12-15 18:14:19 +00:00
Seth Hillbrand
bb7682f913
Resolve using env/project if lib isn't found
...
Relative include commands resolve in the following order:
1. local to the file from which they are included
2. local to the project
3. local to the SPICE_LIB_DIR directory
Fixes https://gitlab.com/kicad/code/kicad/issues/13083
2022-12-15 09:41:25 -08:00
Seth Hillbrand
f0a8182532
Update for wx3.0 compatibility
2022-12-14 16:41:52 -08: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
Seth Hillbrand
10a3d57193
Add sim_lib callback to resolve embeded libs
...
Also teach parser to look for include directives in libraries
We get KiCad variable resolution in include pathnames for free.
Fixes https://gitlab.com/kicad/code/kicad/issues/13083
2022-12-14 13:31:41 -08: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
77998d7c51
Better fix for not selecting all of netlist.
2022-12-14 14:13:25 +00:00
Jeff Young
13d9b061ee
Don't select all of netlist when showing it in simulator.
2022-12-14 13:36:29 +00:00
Jeff Young
e41b0775db
Fix a bug with underscores being appended to spice param names.
2022-12-14 13:36:29 +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
ca5c0e2ac5
Fix typo.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13137
2022-12-12 14:42:45 +00:00
Jeff Young
419fe236ad
Fix logic error in parsing sim command, and DC source types in dialog.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/9064
2022-12-11 23:12:55 +00:00
Jeff Young
b2498f5673
Coding standards & formatting.
2022-12-11 23:12:55 +00:00
jean-pierre charras
bdf13ade7a
Fix a compil issue on linux, round 2
2022-12-11 20:43:10 +01:00
jean-pierre charras
32995a31c6
Fix a compil issue
2022-12-11 20:19:56 +01:00
Jeff Young
5c53daadb0
Mostly coding standards, but also quote codemodel names before passing to spice.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12687
2022-12-11 18:42:57 +00:00
Jeff Young
9c129ed03f
More dialog adjustments for wx 3.2. Also renames files to match dialog.
2022-12-11 15:49:29 +00:00
Jeff Young
56aae7a147
Reduce compiler warnings.
2022-12-11 13:39:59 +00:00
Jeff Young
3581a9773f
Move simulator settings disposal earlier so it happens before parent.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12370
2022-12-11 01:32:20 +00:00
jean-pierre charras
be8f99e8fe
Another fix to avoid conflict names issues with mingw + pegtl.
...
Fixes #13118
https://gitlab.com/kicad/code/kicad/issues/13118
2022-12-10 14:28:05 +01:00
jean-pierre charras
e74654a20f
Minor fix to avoid conflict names issues with mingw + pegtl.
2022-12-10 08:21:35 +01:00
Jeff Young
1599490197
Formatting.
2022-12-09 22:25:14 +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
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
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
bb6544914e
Bring simulator file menu commands more in line with rest of Kicad.
2022-12-08 23:57:42 +00:00
Jon Evans
5251ea6f27
Prevent crash on exit due to simulator settings being double freed
2022-12-07 21:04:49 -05: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
4872dd7238
Don't put empty lines in the workbook.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12299
2022-12-07 11:39:47 +00:00
Jeff Young
69448afb47
Don't run simulation twice when the sim command is overridden.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12731
2022-12-07 01:34:56 +00:00
Jeff Young
3836ec481f
Add fixups for legacy syntax used during 7.0 development.
2022-12-06 16:01:18 +00:00
Jeff Young
39ad7c8205
Formatting and Kicad naming conventions.
2022-12-06 16:01:18 +00:00
Jeff Young
38906397d2
Move V6->V7 sim model migration from sheets to screens.
...
Also moves passive RLC inference out from migration to just-in-time
creation for the simulator or netlisting.
Also fixes a version guard mismatch because the spice migration was
done inside UpdateSymbolInstances (which has its own version guard).
Also changed UpdateSymbolInstances to UpdateSymbolInstanceData so
someone else in the future doesn't think it's a general-purpose symbol
instance updater.
2022-12-06 16:01:18 +00:00
Jeff Young
f8e0a272c0
Remove a bunch of 'auto'.
2022-12-06 16:01:18 +00:00
Fabien Corona
4c76082f77
"Sim Params/Settings" -> "Sim Command"
...
The window only really sets the simulation command.
In the future, we might want a simulation setting window with things such as SPICE optimizations.
2022-12-05 23:12:04 +00:00
Jeff Young
8e4cd1e1a6
Check for sheet directive changes when running simulations.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/10486
2022-12-05 20:03:42 +00:00
Jeff Young
7e1fecaf2e
Formatting.
2022-12-05 20:03:42 +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
Jeff Young
1855885d1e
Gracefully handle spice models not recognized by KiCad.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12689
2022-12-04 21:06:35 +00:00
Jeff Young
f29f0c5c0a
Don't push a model that didn't load.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12689
2022-12-04 21:06:35 +00:00
Jeff Young
672927e183
Clearer error message.
2022-12-04 21:06:35 +00:00
Jeff Young
bed22272e5
Supply default values for random uniform voltage sources.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12861
2022-12-04 21:06:35 +00:00
jean-pierre charras
8ab8a48657
fix order of includes to avoid conflicts with a Windows header.
2022-12-03 10:59:46 +01:00
Fabien Corona
bd235048f9
sim GUI: remove "Adjust value" checkbox.
...
We had a change in notation and this checkbox became useless.
2022-12-03 08:28:43 +00:00
Fabien Corona
6e45987005
fix build warning
2022-12-01 20:33:51 +00:00
Mikolaj Wielgus
f38c5d8cd0
Sim: Add virtual destructor to SIM_SERDE
2022-12-01 17:18:55 +01:00
Mikolaj Wielgus
4ec7ea376e
Sim Ibis: Minor code style changes
2022-12-01 17:13:37 +01:00
kliment
0f09172902
Eeschema: ibis_parser - Fix undefined behavior due to pointer aliasing in isNumberNA
2022-12-01 15:44:38 +00:00
Mikolaj Wielgus
d2adcdfde0
Sim: Add "number of bits" parameter to KIBIS PRBS model and some more fixes
...
The other fixes:
- PRBS's `m_bits` should be an integer.
- Fix some references to outdated parameter names.
2022-12-01 09:19:41 +01: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
39cd9f8980
Sim: Fix Sim.Params field generation logic
...
Don't generate the first parameter (e.g. for KIBIS it was 'vcc=""') when
it is empty in models without primary value.
2022-11-30 12:45:58 +01:00
jean-pierre charras
f3aff63726
Fix minor compil warnings
2022-11-29 20:05:58 +01:00
Mikolaj Wielgus
ab6caca384
Sim: Remove duplicate parameters
2022-11-29 15:02:45 +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
8143522371
Sim: Fix VDMOS model parsing
2022-11-29 09:48:01 +01:00
Fabien Corona
6510afe699
Ibis: Show the parser log if the parser fails
2022-11-28 17:46:42 +00:00
Mikolaj Wielgus
20ea191f66
Sim: Fix model param vs. instance param duplicates in diode model
2022-11-28 08:00:49 +01:00
Mikolaj Wielgus
7b1a460649
Sim: Fix unhandled MODEL_TYPE in SIM_MODEL_NGSPICE
2022-11-28 07:59:24 +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
bbcb0c04fc
Sim: Don't crash when parsing unknown model in a Spice file
2022-11-27 08:59:54 +01:00
Mikolaj Wielgus
71d194071b
Sim: Allow Numparam expressions in models inside subckts
...
Global-level numparam expressions are not properly supported yet.
Fixes https://gitlab.com/kicad/code/kicad/issues/12953
2022-11-27 06:32:17 +01:00
Mikolaj Wielgus
0b5814f98f
Sim: Allow .subckt parameter lists without "params:"
...
And fix .subckt parameter list parsing, because it was broken.
Fixes https://gitlab.com/kicad/code/kicad/issues/12779
2022-11-26 10:24:11 +01:00
Mikolaj Wielgus
6f630f7054
Sim: Make library path textbox editable
...
Load the library from the path if enter is pressed or focus is lost if
the library exists. If a library under the same path as previously is
to be loaded this way, don't do anything.
Fixes https://gitlab.com/kicad/code/kicad/issues/12970
2022-11-26 03:55:20 +01:00
Mikolaj Wielgus
acc760dc25
Sim: Fix generation of Sim.Pins field in multipart models
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12372
2022-11-26 01:34:10 +01:00
Mikolaj Wielgus
6d5cc9e606
Sim: Sort the generated Sim.Pins by symbol pin numbers
...
They were sorted by model pin numbers, which weren't the keys in the
key=value pairs generated into Sim.Pins.
2022-11-26 01:34:10 +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
Fabien Corona
226dc9de78
Ibis: Don't create unnecessary B source
2022-11-22 21:09:08 +00:00
Fabien Corona
5d4b323009
Ibis : correct net name for device generation
2022-11-22 21:08:26 +00: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
Mikolaj Wielgus
1550a1e3a4
Sim Model Editor: Add "Save {} in Value field as "{}"" checkbox
2022-11-22 07:09:52 +01:00
Mikolaj Wielgus
d63eac9778
Sim: s/SIM_MODEL_MUTUAL_INDUCTOR/SIM_MODEL_L_MUTUAL/
2022-11-21 05:01:12 +01:00
Mikolaj Wielgus
e9fe59a28c
Sim: Rename the missed Sim_* fields to Sim.*
2022-11-21 03:33:11 +01:00
Mikolaj Wielgus
6969362813
Sim Model Editor: Don't provide library-only models as builtins
2022-11-20 22:07:39 +01:00
Fabien Corona
8498630876
Ibis: correctly load QA files up to v2.1
2022-11-20 19:10:46 +00:00
Mikolaj Wielgus
59501dfa15
Sim: Rename Ibis_* fields to Sim.Ibis.*
2022-11-20 03:53:10 +01:00
Mikolaj Wielgus
059ca8fc48
Sim: Rename Sim_* fields to Sim.*
2022-11-20 03:37:54 +01:00
Mikolaj Wielgus
9b6f7d5db7
Sim Model Editor: Use SIM_LIB_MGR class to manage library models
2022-11-19 01:55:38 +01:00
Mikolaj Wielgus
21ae2dd1c0
Sim Model Editor: Initialize all IBIS models as IBIS devices
2022-11-19 01:55:38 +01:00
Jeff Young
e09e521162
Remove GUI calls from netlisting.
2022-11-18 15:29:16 +00:00
Mikolaj Wielgus
0f4cc2450d
Sim Model Editor: Don't throw an error on opening a NONE model
2022-11-18 09:06:55 +01:00
Mikolaj Wielgus
e7c43ca20a
Sim: Remove inference from Reference and Value
2022-11-18 08:39:15 +01:00
jean-pierre charras
b9ac486000
simulator: remove unused includes, and reorder a few includes to fix conflicts
...
Conflicts happen only on msys2 with wxWidgets 3.0. But this minor reorder
allows me to test Kicad compilation with "old" wxWidgets, used on Linux.
2022-11-16 10:09:54 +01:00
Mikolaj Wielgus
ce3362ee12
Sim: Don't write inherited model params to symbol fields
2022-11-12 23:50:11 +01:00
Mikolaj Wielgus
d66d810edc
Sim Model Editor: Use SIM_LIB_MGR to store instance models
2022-11-12 23:27:22 +01:00
jean-pierre charras
7c9f3981ef
Revert "Reorder includes is some simulator files to fix issues on msys2 (no code change)"
...
This reverts commit 78e45fa1b9
.
Looks like it creates a compil issue on MSVC
2022-11-12 20:47:36 +01:00
jean-pierre charras
78e45fa1b9
Reorder includes is some simulator files to fix issues on msys2 (no code change)
...
Due to pegtl.hpp included in some files, reordering include fix some conflicts:
wxWidgets files must be included before pegtl.hpp, to compile with wxWidgets 3.0
I sometimes use wxWidgets 3.0 for debugging purposes.
2022-11-12 19:54:26 +01:00
Mikolaj Wielgus
0d42003247
Sim: Create missing SIM_MODEL factories in SIM_LIB_MGR
2022-11-12 18:20:56 +01:00
Fabien Corona
0d78ca8b1a
Ibis: GUI fixes
2022-11-12 14:39:36 +00:00
Mikolaj Wielgus
fef6eaa8ba
Sim Model Editor: Don't use shared_ptr to hack around lifetimes
2022-11-12 03:15:27 +01:00
Mikolaj Wielgus
95b6cc80f5
Sim: PULSE source y2 param is "Pulsed value", not "Initial value"
2022-11-11 05:19:53 +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
jean-pierre charras
ffd578ef70
Ibis parser: fix a collision name with a windows header (msys2 specific)
...
This is recurrent conflict. (fixed by changing INPUT to INPUT_SDT).
2022-11-08 17:35:57 +01:00
Jeff Young
ece752d5a2
Move annotation error reporting to preflight before simulation.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/9220
2022-11-08 12:13:15 +00:00
Jeff Young
5af506777c
Formatting and wxT
2022-11-08 12:13:15 +00: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
Alex
c279a2e696
Hotfix build when KICAD_SPICE=OFF
2022-11-02 11:03:09 +05:00
Jeff Young
9eef638f0b
Don't validate on keystrokes.
...
KiCad policy is to validate on focus-loss so that you can make changes
which have intermediate states that are not valid.
2022-10-31 14:09:30 +00:00
Mikolaj Wielgus
5eca8dd8de
Undo hardcoding swapping of diode pins
...
Revert commits d1e2acd3
70b4d1aa
cff508fb
2022-10-30 11:01:59 +01:00
jean-pierre charras
50d2237f06
command_export_pcb_dxf.cpp: switch to "C" locale before exporting the file
...
Fix also a minor Coverity warning
2022-10-29 09:45:45 +02:00
Mikolaj Wielgus
d1e2acd3d8
Sim: Reverse Cathode and Anode strings in diode model data
2022-10-28 15:16:34 +02:00
Mikolaj Wielgus
70b4d1aac8
Commit sim_model_diode.{cpp,h}
2022-10-28 14:29:32 +02:00
Mikolaj Wielgus
cff508fb3b
Sim: Reverse diode model pin order to match diode symbols
2022-10-28 14:01:09 +02:00
Mikolaj Wielgus
20ffb7d334
Sim: Don't throw exception for certain garbage characters in Value field
2022-10-27 06:42:43 +02:00
Jeff Young
a9a2cc3e84
Enhance readability of Simulation Model dialog.
2022-10-27 00:01:38 +01:00
Wayne Stambaugh
6a0db3e7e2
Fix Coverity warnings.
2022-10-26 14:39:44 -04: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
Mikolaj Wielgus
01c69f1066
Sim: Swap pins instead of inverting position variable in potentiometers
2022-10-26 03:57:53 +02:00
Jeff Young
445657022b
Don't attempt to read simulation model if symbol isn't included.
...
Also collect up all errors for one dialog when preparing simulation.
Also translate error messages.
Fixes https://gitlab.com/kicad/code/kicad/issues/12686
2022-10-26 00:41:31 +01:00
Jeff Young
5f3d440ce3
Fix compile error.
2022-10-25 13:29:38 +01: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
80c426f577
Sim: Fix writing inferred model for tlines
2022-10-25 08:52:12 +02:00
Mikolaj Wielgus
d10fd7bb09
Sim: Remove tuner (log) scale choice button
...
We probably won't be using it for now.
2022-10-25 04:38:09 +02:00
Mikolaj Wielgus
0399d08aaa
Sim: Fix potentiometers
2022-10-24 11:04:47 +02:00
Mikolaj Wielgus
9b6cc6c505
Sim: Fix tuners
2022-10-24 11:04:47 +02: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
jean-pierre charras
63002cec57
Do not add a title/comment in mandatory field strings when writting netlists.
...
This is mainly for "Sheetfile" property because current it is the only one
that has a title when plotting/drawing it.
2022-10-22 12:50:26 +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
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
d01dcc1c51
Sim: Interpret anything starting with .inc as .include
2022-10-20 05:13:32 +02:00
Mikolaj Wielgus
662f6c7d83
Sim: Don't match newlines in model names
...
This caused errors in AKO models with no overrides.
2022-10-20 04:00:33 +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
952f3da53f
Sim: Only set sim command if the sheet sim command is different
2022-10-19 03:02:32 +02:00
Mikolaj Wielgus
f68df09696
Sim: Fix analysis set from GUI
2022-10-19 02:32:50 +02:00
Mikolaj Wielgus
1965411bf5
Sim: Remove the parsing exception for LTspice compat
...
Silently ignoring this may be a cure worse than disease.
2022-10-18 23:19:48 +02:00
Mikolaj Wielgus
6e874f4c1e
Ngspice: Preload a basically empty circuit to avoid error messages
...
Fixes https://gitlab.com/kicad/code/kicad/issues/12481
2022-10-18 05:48:01 +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
6ae333a116
Sim Model Editor: Fix crash when opening sources
2022-10-12 04:27:48 +02:00
Mikolaj Wielgus
d47752ad75
Sim Model Editor: Fix displaying Ibis pin list
2022-10-11 02:22:59 +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
6d958c5a3b
Sim: Remove some superfluous class members
2022-10-10 13:49:43 +02:00
Mikolaj Wielgus
4931b80066
Sim: Resolve name collisions for generated model names
2022-10-10 13:38:35 +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
994274fe9f
Move IBIS model Spice code generation to SIM_MODEL_KIBIS
...
IBIS drivers are temporarily broken. Will fix is subsequent commits.
2022-10-08 03:01:52 +02:00
jean-pierre charras
01a1d148e6
Make a sentence understandable and translatable.
...
Fix a minor compil warning
2022-10-07 10:11:02 +02:00
Mikolaj Wielgus
6f2b2d7e19
Sim: Minor SIM_LIBRARY cleanup
2022-10-06 14:08:01 +02:00
Mikolaj Wielgus
b95f4ec6bb
Sim: Use the new library manager class in Spice netlist exporter
...
Temporarily comment out IBIS processing.
2022-10-06 09:49:29 +02:00
Alex
c019ae3b89
Add missing include
2022-10-05 20:21:38 +03:00
Mikolaj Wielgus
6df774a62f
Commit missing sin_lib_mgr.{cpp,h}
2022-10-05 18:08:25 +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
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
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
jean-pierre charras
dcc325b3b2
More about fix compil issues and warnings, especially in ibis code.
...
A few are msys2 specific and due to include files order.
2022-09-28 11:26:07 +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
jean-pierre charras
7584ccc758
Fix duplicate variable member m_userUnits, creating issues depending on
...
the way it was acceded (by name or by accessor).
2022-09-26 19:47:28 +02:00
Ian McInerney
1683e552f7
Add/fix some variable initializations
2022-09-25 00:48:38 +01:00
Ian McInerney
fdb97a46c1
Don't copy items in for loops when not needed
2022-09-24 03:46:06 +01:00
Mikolaj Wielgus
e27969217c
Add missing virtual destructor in SPICE_GENERATOR
2022-09-22 11:17:07 +02:00
Mikolaj Wielgus
e4865ce543
Excise wxString from simulation
2022-09-22 07:41:52 +02:00
jean-pierre charras
b6663a1c41
minor fixes.
2022-09-21 15:49:50 +02:00
jean-pierre charras
78087597cd
Avoid including plotters/plotter.h in many files.
...
It avoid a large rebuild when modifying the plot code.
2022-09-21 08:52:34 +02:00
Mikolaj Wielgus
2bf6791352
Sim: Move SIM_LIBRARY_SPICE parsing facilities to a new class
...
This leaves SIM_LIBRARY_SPICE very small, but it will grow larger later.
2022-09-20 08:17:51 +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
3b94624e90
Commit forgotten files
...
I must stop forgetting to commit new and renamed files.
2022-09-18 07:27:47 +02:00
Mikolaj Wielgus
a8d7a845b6
Sim: Rename SIM_MODEL_SPICE to SIM_MODEL_RAW_SPICE
2022-09-18 07:25:56 +02:00
Mikolaj Wielgus
4128a5533f
Sim LTspice compat: Ignore mfg, icrating, vceo, type params
2022-09-18 04:14:57 +02:00
Mikolaj Wielgus
dcb3f16fbc
Sim: Don't use long type in SIM_VALUE
2022-09-18 02:25:40 +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
d48ec3aa8c
Sim: Slightly simplify grammars
2022-09-17 02:18:23 +02:00
Mikolaj Wielgus
545212eb13
Sim Window: Support dark theme
2022-09-16 06:57:27 +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
ce3fe46751
Sim Window: Display latest netlist without having to run sim
...
Fixes https://gitlab.com/kicad/code/kicad/issues/11787
2022-09-16 03:12:28 +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
91358dfcac
Sim Model Editor: Fix Enable/Disable of parameters
...
Only SIM_STRING_PROPERTY-based parameters were updated.
2022-09-11 15:24:16 +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
300a1c4144
Add a new schematic exporter to Spice .subckt model
...
An option to use the current sheet as root is added to both the original
and new (.subckt model) exporters.
2022-09-09 16:18:48 +02:00
Marek Roszko
9f522e1343
Forgot to actually change the fmt specifiers...
2022-09-08 07:17:58 -04:00
Marek Roszko
5b96736059
LOCALE_IO is expensive to hammer, use fmt
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12377
2022-09-08 07:04:45 -04:00
Mikolaj Wielgus
72651dffe8
Sim Model Editor: Fix crash on selecting behavioral models
...
Accidentally there was an infinite recursion.
2022-09-03 20:06:14 +02:00
Mikolaj Wielgus
70ab5db0e9
Sim Model Editor: Fix crash on selecting tline models
...
Dereferencing std::optional<T> objects was undefined behavior.
Change some forgotten SIM_VALUE_INST<T> usages to their corresponding
typedefs.
2022-09-03 19:52:24 +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
jean-pierre charras
f679400e91
simulator: fix a issue when the simulation ends, but ngspice is still running.
...
For instance if a lot of simulation results must be written to a file (using wrdata).
In this case the tools in simulator frame toolbar were never enabled.
2022-08-31 12:07:05 +02:00
Mikolaj Wielgus
39ac58ea33
Use the PEGTL grammar for detecting .control and .subckt text directives
2022-08-30 17:27:58 +02:00
Marek Roszko
ae637296cd
Fix MSVC compile
2022-08-30 07:24:58 -04:00
Mikolaj Wielgus
2bcfe5e42c
Fix Spice subcircuit parsing
...
When parsing a subcircuit, the parser was incorrectly identifying
parameters of models inside it as belonging to the subcircuit.
2022-08-30 12:09:10 +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
716b60c20d
Commit forgotten sim_model_switch.{cpp,h} files
2022-08-29 04:28:56 +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
Seth Hillbrand
f1261e71d4
Replace boost::optional with std::optional
2022-08-25 15:50:47 -07: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
Seth Hillbrand
35ac39844f
Clean up some auto usage
...
Don't make new copies of shared_ptr if we can use references. Keep auto
usage down to hard-to-type-out sequences
2022-08-15 11:29:45 -07:00
Wayne Stambaugh
898ec0d094
Fix wxWidgets 3.1 and later deprecated build warnings.
...
wxWidgets 3.1 has deprecated wxPATH_NORM_ALL when normalizing file
paths when calling wxFileName::Normalize(). This change keeps the
existing behavior except in places where our own internal
ExpandEnvVarSubstitutions() to expand environment variables.
2022-08-15 08:00:40 -04:00
jean-pierre charras
488a53e71b
Fix a few minor Coverity warnings
2022-08-12 10:51:36 +02:00
Mikolaj Wielgus
6d59fef9a5
Sim: Fix reading the legacy Spice_Node_Sequence field (2nd attempt)
...
bd809bf31c
was botched and broke QA tests,
this will fix the problem.
2022-08-11 15:50:16 +02:00
Mikolaj Wielgus
bd809bf31c
Sim: Fix reading the legacy Spice_Node_Sequence field
2022-08-11 02:42:16 +02:00
Mikolaj Wielgus
a1a99b1ec2
Sim QA: Check NGSPICE's LoadNetlist() and Run() status code
2022-08-10 17:54:28 +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
Mikolaj Wielgus
67476c330e
Fix broken PEGTL include path
2022-08-08 17:50:42 +02:00
Mikolaj Wielgus
5096f5d8a9
Sim: Fix inference of RLC models with garbage suffixes
...
Garbage suffix is e.g. the "F" in "100uF".
2022-08-08 17:06:50 +02:00
Mikolaj Wielgus
24e7a8ac41
Commit missing eeschema/sim/sim_model_ngspice_data.cpp
2022-08-05 18:51:52 +02:00
Mikolaj Wielgus
c9f3507ff7
Sim: Don't require ngspice.h for SIM_MODEL_NGSPICE
2022-08-05 18:26:09 +02:00
jean-pierre charras
d667d9b464
Do not include and use sharedspice.h when KICAD_SPICE = OFF
2022-08-04 17:01:29 +02:00
Mikolaj Wielgus
a14d3e74a8
Remove generate_ngspice_models.bash script
2022-08-02 14:50:02 +02:00
Mikolaj Wielgus
5d64fc12a1
Attempt to fix GCC MSYS2 build crash
...
Initialize ngspice_models.cpp structures at runtime on demand. Use
a sequence of std::vector::emplace_back() instead of
brace-initialization.
2022-08-02 14:47:28 +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
jean-pierre charras
fc849e3e0c
sim_model.h: change order of includes to avoid conflicts with a windows header.
...
msys2 specific. No actual change in code.
2022-07-31 10:32:31 +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
739b9255d9
Sim Model Editor improvements
...
- Tab-switching,
- Automatic expansion of categories on tab-switch,
- Various minor simulation improvements,
- Various new simulation-related bugfixes.
2022-07-30 02:25:34 +00:00