Jeff Young
d5e50b70bb
Display a generic "Value" column label when there are no cursors.
2023-02-16 16:55:26 +00:00
Jeff Young
f50d114b27
Push gain & phase for .probe statements in AC analysis.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13941
2023-02-16 16:14:25 +00:00
Jeff Young
95232edd0d
Do a better job of looking for .probe commands in directives.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13941
2023-02-16 12:42:54 +00:00
Jeff Young
d8a4f9821e
Smarten regex to accept ':' in signal names.
...
(In fact, just accept anything up to the closing paren.)
Fixes https://gitlab.com/kicad/code/kicad/issues/13942
2023-02-16 12:20:55 +00:00
Jeff Young
c618bb7046
Correctly netlist a voltage source with both AC and DC values.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/13912
2023-02-15 14:50:31 +00:00
aris-kimi
dca1281263
Fix some typos
2023-02-14 23:47:05 +02:00
Jeff Young
9ce18dffdd
Better startup experience for simulator.
...
Pre-load signals list (and plot panel if there is an schText simulation
command).
Also fixes a bug where the workbook was getting dirtied on open because
the events would fire after the dirty flag had been cleared.
2023-02-14 11:59:17 +00:00
Jeff Young
df00585a55
ReadDataFields must be a separate step from Create.
...
Create() is done without execption processing, while ReadDataFields
should have exception processing.
(This also fixes a case where exception processing on ReadDataFields
was missing.)
Also fixes a bug where the pinSelect menu wasn't checked for -1 before
fetching.
Fixes https://gitlab.com/kicad/code/kicad/issues/13856
2023-02-13 12:43:25 +00:00
Marek Roszko
2cc3d8e9bc
Prevent a crash when a spice SW_I lacks two pin net names
...
Fixes KICAD-5D
2023-02-12 22:26:19 -05:00
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