Commit Graph

409 Commits

Author SHA1 Message Date
Mikolaj Wielgus 978f01553b Sim Model Editor: Serialize models in fields
Implemented serialization and deserialization of models in symbol fields
through the SIM_VALUE class. We don't carry the Spice legacy of
case-insensitive suffixes, instead we conform to the SI standard (i.e. M
is Mega, not milli, P is peta, p is pico).

Parameter grid value validation is implemented by simply not allowing
any characters that will make the value invalid (instead of highlighting
the field in a red color). This will likely be changed at some point in
the future.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus c5a256291e Sim Model Editor: Display model parameters
This commit adds parameter display functionality, via a wxPropertyGrid
widget, to the Sim Model Editor. To faciliate that, a SIM_VALUE class is
created to serialize, deserialize, and validate numeric values in the
new parameter grid.

SPICE_MODEL is renamed to SIM_MODEL and split into several subclasses
that correspond to different model kinds.
2022-07-30 02:25:34 +00:00
Mikolaj Wielgus 229e5c9e0f Begin development of a new Sim Model Editor dialog
With that also begin reworking the internal structure of the simulation
model storage. Some models have parameter information extracted from
Ngspice, which was specially patched to faciliate that. The model is
stored and managed by the SPICE_MODEL class (later will be renamed to
SIM_MODEL).
2022-07-30 02:25:34 +00:00
Seth Hillbrand 93fb00d815 Protect the Kiway dereference
Also find a few more places where we are reaching into a new frame to
perform actions that need to have dialogs closed.

Running actions should also wait for the next cycle rather than being
immediately executed when we are calling into a new frame.  This allow
for the cleanup actions onClose() to happen prior to the next action
starting

Fixes https://gitlab.com/kicad/code/kicad/issues/11891
2022-07-14 11:37:45 -07:00
jean-pierre charras 9f38fa43cd Fix some minor compil and Coverity warnings. 2022-06-05 11:44:49 +02:00
Eduardo Behr f246646d7a Fix severe simulation memory leaks 2022-05-28 20:40:24 +00:00
Jeff Young cb15bd1635 Fix compile issue. 2022-05-26 10:54:54 +01:00
Seth Hillbrand 11ae5b75b7 Remove broken assert
Fixes compile issue for linux/gcc which expects a boolean in the assert
statement that it cannot find from std::map
2022-05-25 16:36:47 -07:00
Eduardo Behr 6aa50304d9 Eeschema: Fixing simulation plot CSV exporter 2022-05-25 15:00:03 +00:00
Sylwester Kocjan a9c61d21ca eeschema: fix crash when closing simulation frame
Destructor of SIM_PLOT_FRAME calls sim->Attach( nullptr ) in order to destroy
circuit model (former netlist exporter). If this is skipped, eeschema crashes
when program is closed. nullptr is a valid parameter for Attach()
2022-04-05 19:28:05 +00:00
Sylwester Kocjan 05fbe47a1b eeschema: two fixes for simulation tuners
- fix irrelevant warning message box when tuners moved
  too quickly and simulation was slow
- fix for rerun simulation when tuning and result tab was changed
2022-04-02 15:05:54 +00:00
Sylwester Kocjan 4719fdc9bf eeschema: rename m_exporter to m_circuitModel 2022-04-01 19:28:31 +00:00
Sylwester Kocjan f5dedd77c6 eeschema,sim: add SIMULATOR and SIM_MODEL interface
SIMULATOR has now an Attach() method, which should be called
with proper SIMULATION_MODEL that should be simulated, before calling Run()

Concrete class of SIMULATION_MODEL for ngspice is NGSPICE_CIRCUIT_MODEL,
renamed from NETLIST_EXPORTER_PSPICE_SIM. DIALOG_SIM_SETTINGS relies
on above mentioned object, so it was added as an argument of the constructor.
2022-04-01 19:28:31 +00:00
Sylwester Kocjan 53ccd8bd67 eeschema,sim: refactor NETLIST_EXPORTER_PSPICE_SIM creation 2022-03-26 15:50:15 +00:00
Sylwester Kocjan 2fed8aa4b8 eeschema: Add sync functions to SPICE_SIMULATOR
SPICE simulator can be called also during IBIS model determination,
and in the future in ERC. Therefore a necessity arises to implement
exclusive access.
2022-03-21 19:10:08 +00:00
Seth Hillbrand 098e8f7d9b Revert "cmake: adding KICAD_MACOSX_APP_BUNDLE option"
This reverts commit ea9f960cc1.

Reverted for updates as this currently breaks kicad-mac-builder
2022-01-31 15:57:56 -08:00
Davide Gerhard ea9f960cc1 cmake: adding KICAD_MACOSX_APP_BUNDLE option
ADDED: with cmake KICAD_MACOSX_APP_BUNDLE option the user can disable
the macOS app bundle creation when compiling on macOS. This permit to
use/install KiCad like any other *nix platform (/usr/bin, /usr/share,
ecc.). By default, cmake build the app bundle.
2022-01-28 15:49:37 -08:00
Mark Roszko 44dc602d6b Yeet wxPoint/wxSize out of PLOTTER 2021-12-29 19:02:50 +00:00
Frank Zeeman 8167c69508 Add transformation function for characteristic curves of tuners 2021-12-28 02:53:39 +01:00
Frank Zeeman f004665df8 Add tuner support for potentiometer code model 2021-12-28 02:53:39 +01:00
Mikolaj Wielgus 2dbc6ef6ca If present, tune Spice_Model instead of Value
Fixes https://gitlab.com/kicad/code/kicad/issues/9880
2021-12-14 14:02:25 +01:00
Seth Hillbrand 9e760512ac Update schematic when saving tuned value
Also avoids a known(!) crash when the existing item has been deleted
while tuning.

Fixes https://gitlab.com/kicad/code/kicad/issues/9502
2021-11-01 17:05:22 -07:00
Seth Hillbrand 9b4c293f14 Ensure that any excess spaces removed
The sim command may have additional whitespace between the type and
first char
2021-10-18 10:12:53 -07:00
Seth Hillbrand 82ba456567 Remove unnecessary RegEx
This broke for signals using underscores.  More critically, RegEx is
fragile and should not be used with user input if at all possible

Fixes https://gitlab.com/kicad/code/kicad/issues/9421
2021-10-18 10:08:29 -07:00
Jeff Young 5f5ee7335d Formatting. 2021-10-01 21:49:14 +01:00
Sylwester Kocjan fe608bfcef eeschema, sim: clean signal list when last panel is closed
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9119
2021-09-09 01:11:47 +00:00
Mikolaj Wielgus 1c9e10f34e Disable simulator notebook splitting
Using this feature freezes the simulator.
2021-09-09 01:07:23 +00:00
Sylwester Kocjan f9c5c97f74 eeschema, sim: fix wrong names of the signals
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9062
2021-09-08 23:15:29 +02:00
Mikolaj Wielgus 44ea3a75f2 Simulator: Use last workbook path stored in .kicad_pro as initial path in dialogs
Previously this was done using a static variable, which was not loaded
from .kicad_pro on simulator launch, causing unexpected behavior

Fixes https://gitlab.com/kicad/code/kicad/issues/8799
2021-08-20 23:23:23 +00:00
Sylwester Kocjan 691b53d125 eeschema: add missing virtual destructors 2021-08-20 19:23:13 +00:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Wayne Stambaugh 37b200cb3e Pass wxString objects by reference instead of on the stack. 2021-07-27 08:41:27 -04:00
Wayne Stambaugh 1a301d8eea Stop using wxDialog::EndModal() from inside dialogs.
Calling wxDialog::EndModal() directly from inside the dialog is a
potential bug if the dialog is shown in the modeless or window modal
(quasi-modal).  Use the internal button events where possible and
check for the appropriate mode before calling the correct end dialog
function.
2021-07-21 17:38:14 -04:00
Wayne Stambaugh cb72da294a More NULL expunging. 2021-07-16 16:13:41 -04:00
Mikolaj Wielgus 395602b12a Use Bind() instead of Connect() for simulator events
Also fixed "Settings..." menu item not starting settings. I don't know
why it's called `m_boardAdapter`.
2021-07-13 11:52:09 +00:00
Mikolaj Wielgus c6a4f25538 Use wx events to update simulator title, start tools and menu items grayed out 2021-07-13 11:52:09 +00:00
Mikolaj Wielgus 3bafe6d6c9 Gray out unavailable simulator menu items, use wxUpdateUIEvent 2021-07-13 11:52:09 +00:00
Mikolaj Wielgus 4f2856b345 Gray out unavailable tools in simulator toolbar
Cures some of the dialogitis plaguing the simulator.
2021-07-13 11:52:09 +00:00
Mikolaj Wielgus 4f384085e2 Remove m_simulator null-check -- most of code already assumes it exists 2021-07-13 11:52:09 +00:00
Wayne Stambaugh dffe2661e6 Fix SPICE simulator plot bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1944
2021-07-09 16:20:35 -04:00
Wayne Stambaugh 65c7958293 Coverity issue fixes.
Issues #331869, #331875, #332203, #332159, #332171, #332180, and #332648.
2021-07-08 08:33:08 -04:00
Mikolaj Wielgus 43cce8b0b5 Remove automatic simulation start on simulator launch
Fixes https://gitlab.com/kicad/code/kicad/issues/8644
2021-07-06 10:08:19 +00:00
Mikolaj Wielgus 6dfd655a7f Save simulator checkbox settings in project file
Fixes https://gitlab.com/kicad/code/kicad/issues/8450
2021-07-06 10:06:51 +00:00
Mikolaj Wielgus 8b2b3ca797 Define .wbk in wildcards_and_files.{cpp,h}, cosmetic code changes 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus df2d4966b1 Do not set dirty bit on simulator launch, remove dead code 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus 9f1ecdd715 Give Spice simulator "Save As" option Shift+Ctrl+S shortcut key 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus 87441e256c Escape CR and LF in Spice simulation command when saved 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus bd1f3d85f4 Spice sim: Have more detailed error messages 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus 86c7db46b9 If there is no project name, default workbook name shall be "noname.wbk" 2021-07-04 14:04:03 +00:00
Mikolaj Wielgus 28531a982d Simulator: Use SIM_WORKBOOK in place of wxAuiNotebook
SIM_WORKBOOK is now a subclass of wxAuiNotebook, removing the problem of
having to maintain two separate workbook states.
2021-07-04 14:04:03 +00:00
Mikolaj Wielgus cd0c8a5676 Make panel sim command only accessible from outside through workbook object 2021-07-04 14:04:03 +00:00
Jeff Young c11ee69499 Save 3D prefs after editing, and load some of them into FP Props.
Fixes https://gitlab.com/kicad/code/kicad/issues/8712
2021-07-04 13:20:55 +01:00
Jeff Young c07367821e Fix compile error, and use more robust method of setting fonts. 2021-06-29 19:36:06 +01:00
Jeff Young 0c2ac9a711 Move GUI font code to common.
This also allows the Mac fixes for font facenames to be more
compartmentalized.

Fixes https://gitlab.com/kicad/code/kicad/issues/8657
2021-06-29 18:27:58 +01:00
Jeff Young 4aa8318dc2 More error message regularization. 2021-06-27 14:24:02 +01:00
Jeff Young 173c9a974c Formatting. 2021-06-25 20:49:38 +01:00
Jeff Young 685ee31c35 Workaround a few more OSX printf problems.
Also regularizes the frame title processing.

Also fixes a type where the library name wasn't processed for
variable expansion.

Fixes https://gitlab.com/kicad/code/kicad/issues/7742
2021-06-20 22:48:19 +01:00
Wayne Stambaugh fb46cd8bc5 Expunge the use of the word component from Eeschema code.
The only exception to this is the SPICE simulator's use of component
when referring to physical component (R, L, C, etc.) values.
2021-06-14 14:00:21 -04:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Sylwester Kocjan b0e6bbb39c eeschema: remove m_simCommand from SIM_WORKBOOK 2021-06-07 20:00:48 +00:00
Sylwester Kocjan 917e329bdf eeschema: remove TRACE_DESC from SIM_WORKBOOK 2021-06-07 20:00:48 +00:00
jean-pierre charras 6919d12c70 Eeschema, Spice simulator: use Ctrl+letter as accelerator keys.
Using only a letter can conflict with widgets accepting letters to enter data.
Fixes #8537
https://gitlab.com/kicad/code/kicad/issues/8537
2021-06-02 19:45:30 +02:00
Mikolaj Wielgus 33c0bb78fd Use file absolute path when determining title bar indicators
Fixes https://gitlab.com/kicad/code/kicad/issues/8449
2021-06-01 17:03:20 +00:00
Mikolaj Wielgus 33c6bdd121 Preserve plot panel order in simulator notebook 2021-05-15 12:26:50 +00:00
Mikolaj Wielgus afc6d29fde Fix relative path used where absolute path should be 2021-05-15 12:26:50 +00:00
Mikolaj Wielgus b9fd18d150 Minor UI changes, display workbook in title and some fixes 2021-05-15 12:26:50 +00:00
Mikolaj Wielgus 5410510bd4 Spice sim: remember last simulation, remove welcome page
Fixes https://gitlab.com/kicad/code/kicad/issues/8019
2021-05-15 12:26:50 +00:00
jean-pierre charras d4e5861c62 Fix a few issue in simulation (noticeable only when the calculation time is high):
- Wait for end of simulation before return from "C" locale to current locale
(to avoid data files created by ngspice using curr locale instead of "C" locale)
- Do not allow changing signal list to plot during simulation calculation
(avoid crashes)
2021-05-05 20:28:46 +02:00
Seth Hillbrand 61289ab39a Cleanup ngspice calling signatures 2021-05-05 10:49:40 -07:00
Seth Hillbrand 36975c9cd0 Conditionally handle the SPICE signatures
ngspice updated their function signatures, requiring us to test.  They
also don't provide an indicator that the signature is changed, so we
need to test based on the existence of a new version define.

Fixes https://gitlab.com/kicad/code/kicad/issues/8358
2021-05-05 10:19:01 -07:00
Jeff Young c30102cd4f Don't crash when trying to save sim settings during shutdown.
Fixes https://gitlab.com/kicad/code/kicad/issues/8327
2021-05-01 21:49:40 +01:00
jean-pierre charras 0427bda768 Remove useless wx/wx.h include, that create sometimes compil warnings on msys.
wx/wx.h includes all wxWidgets .h files, and sometimes creates collision
names in #define between kicad and windows headers
Moreover, blindly including a lot of useless files is compil time consuming
2021-05-01 19:32:15 +02:00
Marek Roszko 8a8475630e Check wxHAS_NATIVE_TABART before using the simple tab art 2021-04-22 22:24:55 -04:00
Seth Hillbrand 2c2ac39990 Replace default aui art provide in sim
The default art provider was a gradient tab.  This does not match the
system elsewhere and is particularly bad for dark themes.

The simple art provide matches the background colors correctly.
Although the tab background is still white, this is quite a bit better
than before.

Fixes https://gitlab.com/kicad/code/kicad/issues/8280
2021-04-22 17:35:54 -07:00
Jeff Young 87ca59f52e One (correct) error message is sufficient.
Fixes https://gitlab.com/kicad/code/kicad/issues/8225
2021-04-22 12:38:29 +01:00
Jon Evans 511f4cd03c Simulator: don't try to access an invalid map entry
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8273
2021-04-21 22:09:40 -04:00
jean-pierre charras e5dd54e05a Eeschema, spice sim: fix a crash when no value is available.
onSimFinished() try to analyse the list of plots, but did not test
if there is available data before using it.
Fixes #8169
https://gitlab.com/kicad/code/kicad/issues/8169
2021-04-14 21:01:39 +02:00
jean-pierre charras 5bfda7f1f0 spice netlist generation: use utf8 format.
Using basic conversion from unicode to 8bits strings can break non ASCII7 strings
Fixes #8192
https://gitlab.com/kicad/code/kicad/issues/8192
2021-04-14 09:54:29 +02:00
Wayne Stambaugh dbb0a125ac Fix build error when spice simulator build option is disabled. 2021-03-19 09:04:28 -04:00
Wayne Stambaugh acec6ad7fc Spice simulator: add Ngspce model behavior mode settings.
ADDED: Ngspice simulator model behavior mode settings for PSpice, LTSpice,
       PSpice and LTSpice, and HSpice.

Fixes https://gitlab.com/kicad/code/kicad/issues/5810
2021-03-18 15:31:02 -04:00
Jon Evans 18037e2f65 Rework bitmap system to load from archived PNGs
Bitmaps are now identified by an enum class instead of by pointers.
Bitmap loading and caching is now handled by a class in common, and
we no longer compile most bitmaps into the binary, so there is no
longer a bitmaps static library.

Instead, bitmaps are archived to a .tar.gz file which is installed
in ${KICAD_DATA}/resources/images.tar.gz

The source PNGs are checked in to Git as the original CPP files were,
so that people can build without the required dependencies to convert
SVGs to PNGs.

Initial support is also added for dark theme icons, although this
is not yet exposed in the GUI.

Stubs are present for multi-resolution image resources, but this is
not fully-baked yet and could use some refinement.
2021-03-11 08:37:35 -05:00
jean-pierre charras 14b1d36b38 Simulator: Fix a ugly bug that happens is some simulations
TRhe initial code was broken.
2021-03-08 20:01:36 +01:00
jean-pierre charras 638a9b693d SIM_PLOT_FRAME_BASE: minor cosmetic enhancements and fix a incorrect wxmenu
name in the .fbp file that prevent to rebuild working .cpp and .h files.
2021-03-08 16:33:08 +01:00
jean-pierre charras c1003e2ddd Fix missing call to Layout() in SIM_PLOT_FRAME after adding widgets.
Fix a minor wxWidgets warning.
2021-03-08 13:49:45 +01:00
Sylwester Kocjan 959ae73a01 Eeschema,sim: extract plot colors to new class 2021-03-01 18:50:37 +00:00
Marek Roszko b80fdad511 Don't generate a format specifier length of ":"
It's ambiguous, are we talking the length of a human colon or a pigs?

Fix #7556
2021-02-17 18:53:07 -05:00
Marek Roszko b609c7dcd6 Kick the osx specific path helpers into PATHS 2021-02-16 23:29:26 -05:00
Sylwester Kocjan 114043fe93 eeschema: add interface to SCHEMATIC for better testability
- added abstract class SCHEMATIC_IFACE
- added missing 'virtual' keyword at destructor
2021-02-17 00:59:44 +00:00
Marek Roszko f9c7eae63a Avoid null access in NGSPICE::AllPlots 2021-02-16 18:37:57 -05:00
Jeff Young 4408897b87 Formatting. 2021-02-16 16:24:37 +00:00
Marek Roszko 1608282a57 Remove msys2 search paths for ngspice under msvc 2021-02-13 20:08:31 -05:00
Michael Kavanagh 97775aa50b Icons: redo missed simulator icon in new style 2021-02-06 22:51:56 +00:00
jean-pierre charras c155218582 Sim plot: fix a rounding issue that can create a missing point in a plot.
Due to a truncation when converting a value to integer, the first point was
sometimes missing because it looked like out of plot range.
Fix also a cosmetic issue in dialog.
Fixes #7345
https://gitlab.com/kicad/code/kicad/issues/7345
2021-01-31 10:36:26 +01:00
Mikolaj Wielgus babda304d9 Prevent addition of false plot when current plot panel is not in m_plots
Without this commit, when `currentPlotWindow()` returned a valid
pointer, but one that is not used as a key in `m_plots`, it would get
inserted to the `m_plots` map. Because this pointer was not properly
initialized, a crash would later occur. I think this problem was
triggered by the pointer to welcome page, but I haven't checked.

Fixes https://gitlab.com/kicad/code/kicad/issues/7324
2021-01-30 02:04:57 +01:00
Wayne Stambaugh 6a39b81647 Fix the last of broken Doxygen comment specifiers. 2021-01-27 17:39:44 -05:00
Sylwester Kocjan df62adf901 eeschema,sim: fix crash at simulation start
fixes: https://gitlab.com/kicad/code/kicad/-/issues/7277
2021-01-26 23:29:05 +00:00
Wayne Stambaugh 4619d5e112 Fix more broken Doxygen comment specifiers. 2021-01-26 12:17:52 -05:00
Sylwester Kocjan 6a48e21eb2 simulator: update dialog to handle R, I & TEMP DC sweeps
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2370
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6195
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2386
2021-01-25 21:29:13 +00:00
jean-pierre charras 60152bc00e Spice sim: fix incorrect (very large) dialog size displaying the netlist.
It was previously fixed to 1500x900 pixels, that can be too large.
The window size and position is also now retained during a session.
Fixes #7043
https://gitlab.com/kicad/code/kicad/issues/7043
2021-01-11 10:06:33 +01:00