Commit Graph

814 Commits

Author SHA1 Message Date
Jeff Young 2e5bf0210a Clear model name when switching to internal model.
Also fixes a bug to ensure that a modelLine gets written when using
an internal model.

Fixes https://gitlab.com/kicad/code/kicad/issues/14083
2023-02-25 15:22:20 +00:00
Jeff Young 9a0aeb4344 Adjust AC-small-signal plot names when saving placeholders.
Fixes https://gitlab.com/kicad/code/kicad/issues/14016
2023-02-25 13:26:33 +00:00
Jeff Young ee956673b1 Respect readOnly cells in GRID_TRICKS.
Also fixes setting colors in the signals grid as it allows us to make
it editable again.

Fixes https://gitlab.com/kicad/code/kicad/issues/14079
2023-02-25 11:02:12 +00:00
Jeff Young 5a12e5ee76 Only write included models if they have overridden parameters.
Fixes https://gitlab.com/kicad/code/kicad/issues/13953
2023-02-24 20:31:35 +00:00
Jeff Young c188318174 Change strategy for committing values from SIM_MODEL propGrid.
Note that the PCB editor's propGrid doesn't seem to need this workaround,
but I haven't yet figured out what's different between it and the sim model
propGrid.

Fixes https://gitlab.com/kicad/code/kicad/issues/13852
2023-02-24 14:22:00 +00:00
Jeff Young 200a06a677 Cleanup some dead code, and add a potentially needed fix for non-Mac.
(The Mac bug is fixed in 4e5b1da81fce7cd9ffedaec878ed07bfcfff4fe2 in
our wxWidgets fork.)
2023-02-24 12:44:55 +00:00
Jeff Young 8059edff0e Don't mess up user formatting if eval'ing didn't actually change value.
Fixes https://gitlab.com/kicad/code/kicad/issues/13989
2023-02-24 12:44:55 +00:00
Jeff Young 71df3f9edb Don't allow extra text in Sim.* fields.
(In particular, the field name.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13996
2023-02-24 12:44:55 +00:00
jean-pierre charras 2b3eb0b522 fix minor compil warnings 2023-02-23 09:50:28 +01:00
Jeff Young 4917abe655 Make sure whitespace at end of command doesn't mess up detection.
(Fixes the failing test case.)
2023-02-22 23:29:13 +00:00
Fabien Corona cdbb868198 sim - allow users to delete several measurements at once 2023-02-22 19:27:20 +01:00
Fabien Corona 9006f38e70 sim - Don't allow user to delete the type-in measure entry 2023-02-22 19:27:20 +01:00
Fabien Corona 1170fb2e18 sim - don't create measurement duplicates 2023-02-22 19:27:20 +01:00
Fabien Corona aa006e9b91 sim - allow to add several measurements at once. 2023-02-22 19:27:20 +01:00
Jeff Young 6fcae34f6b Clear operating points on all sim types.
(We'll fill them back in if we have data.)

Also improves handling when a plot tab is closed.

Also fixes dirtying of the view for op changes.

Fixes https://gitlab.com/kicad/code/kicad/issues/13990
2023-02-22 15:54:18 +00:00
Jeff Young fe2679d965 Implement default levels for JFETs, MOSFETs and MESFETs. 2023-02-22 15:54:18 +00:00
Fabien Corona ae3a5c1c5f sim - set the dialog list as read only 2023-02-22 15:54:49 +01:00
Fabien Corona f2419e9e9b sim - Fix power graphs 2023-02-22 13:18:12 +01:00
Jeff Young cb71ea872b Don't allow 0 field text size.
Fixes https://gitlab.com/kicad/code/kicad/issues/13987
2023-02-22 11:40:49 +00:00
Fabien Corona e24ddd0be4 ADDED: Measurement on power signals and integrals
Fixes #14028
2023-02-22 12:11:09 +01:00
Jeff Young f828d50cb0 Better processing of single-empty-row rule for measurements grid. 2023-02-22 10:45:27 +00:00
Jeff Young 5fa7be0320 Update signals after running a sim.
Fixes https://gitlab.com/kicad/code/kicad/issues/14016
2023-02-22 10:45:27 +00:00
Jeff Young a126d961d8 More dead code removal and a bit of formatting and const& for strings. 2023-02-22 10:45:27 +00:00
Jeff Young 68fe146861 Remove most of SIM_VALUE in favour of good old wxString.
This allows us to save the user's intent, including units, formatting,
and crucially variable references.
2023-02-22 10:45:27 +00:00
Jeff Young 29f21cdde6 Terminology and more dead code. 2023-02-22 10:45:27 +00:00
Jeff Young 90adc26b73 Remove dead and redundant code. 2023-02-22 10:45:27 +00:00
aris-kimi 543a3317b4 Fix typo 2023-02-21 18:01:13 +00:00
Jeff Young 761b59da90 Read and write user-defined signals and measurements to workbook file. 2023-02-21 13:32:01 +00:00
Jeff Young 7fd707952b Easier editing of new sim measurements. 2023-02-21 13:32:01 +00:00
Jeff Young 6fcb95b24e ADDED user-defined signals. 2023-02-21 13:32:01 +00:00
Jeff Young f6fcae479c Don't generate error messages fetching sim data we know isn't there. 2023-02-21 13:32:01 +00:00
jean-pierre charras b05b33a9ff Fix a compil issue with gcc12.2 and Coverity warnings. 2023-02-21 11:54:38 +01:00
jean-pierre charras 31be74b8b3 Fix a few Coverity warnings 2023-02-20 09:25:01 +01:00
Marek Roszko d55e2049e5 Silence some warnings with static_casts 2023-02-18 23:36:50 -05:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Fabien Corona facd50f4fd sim - missing assignment 2023-02-18 15:36:47 +00:00
jean-pierre charras 07f79208b9 Minor fixes: Coverity and compil minor warnings. 2023-02-18 13:04:43 +01:00
Fabien Corona 5482bc2905 sim - Check FindParam() results before using them 2023-02-18 12:54:55 +01:00
Fabien Corona f5902dad28 sim - don't write dc parameter twice 2023-02-18 10:07:29 +00:00
Fabien Corona fa0cc09917 sim - allow sources that are both AC and TRAN 2023-02-18 02:17:48 +00:00
Fabien Corona 39a1b14a0f sim: VSIN - allow user to specify a phase
TD is not the same as PHASE.
TD is the delay before the source turns on.
PHASE is ... the phase

If only TD is set, the signal starts later, but the phase is still 0 when compared to the t=0 of the simulation.
2023-02-18 00:38:46 +00:00
Jeff Young 8b1318c92f Update associated data structures after changing trace colour.
Also removes likely benign but never-the-less useless grid even processing
during rebuilding of the grids.

Fixes https://gitlab.com/kicad/code/kicad/issues/13956
2023-02-17 00:47:01 +00:00
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