From 78526ee91313be14ee91bf4661519be58af76dda Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Aug 2016 14:41:36 +0200 Subject: [PATCH] Additional options for netlist exporter (fix passive values, library include paths) --- eeschema/dialogs/dialog_sim_settings.cpp | 16 + eeschema/dialogs/dialog_sim_settings.h | 8 + eeschema/dialogs/dialog_sim_settings_base.cpp | 7 + eeschema/dialogs/dialog_sim_settings_base.fbp | 394 +++++++++++++----- eeschema/dialogs/dialog_sim_settings_base.h | 2 + eeschema/sim/sim_plot_frame.cpp | 9 +- eeschema/sim/sim_plot_frame.h | 1 - 7 files changed, 321 insertions(+), 116 deletions(-) diff --git a/eeschema/dialogs/dialog_sim_settings.cpp b/eeschema/dialogs/dialog_sim_settings.cpp index 4f6b81441b..36b1b1d8cf 100644 --- a/eeschema/dialogs/dialog_sim_settings.cpp +++ b/eeschema/dialogs/dialog_sim_settings.cpp @@ -54,6 +54,8 @@ DIALOG_SIM_SETTINGS::DIALOG_SIM_SETTINGS( wxWindow* aParent ) m_transStep->SetValidator( m_posFloatValidator ); m_transFinal->SetValidator( m_posFloatValidator ); m_transInitial->SetValidator( m_posFloatValidator ); + + updateNetlistOpts(); } @@ -160,6 +162,8 @@ bool DIALOG_SIM_SETTINGS::TransferDataFromWindow() return false; } + updateNetlistOpts(); + return true; } @@ -236,3 +240,15 @@ void DIALOG_SIM_SETTINGS::onLoadDirectives( wxCommandEvent& event ) if( m_exporter ) m_customTxt->SetValue( m_exporter->GetSheetSimCommand() ); } + + +void DIALOG_SIM_SETTINGS::updateNetlistOpts() +{ + m_netlistOpts = NET_ALL_FLAGS; + + if( !m_fixPassiveVals->IsChecked() ) + m_netlistOpts &= ~NET_ADJUST_PASSIVE_VALS; + + if( !m_fixIncludePaths->IsChecked() ) + m_netlistOpts &= ~NET_ADJUST_INCLUDE_PATHS; +} diff --git a/eeschema/dialogs/dialog_sim_settings.h b/eeschema/dialogs/dialog_sim_settings.h index 0ee2101446..6c70baed1c 100644 --- a/eeschema/dialogs/dialog_sim_settings.h +++ b/eeschema/dialogs/dialog_sim_settings.h @@ -40,6 +40,11 @@ public: return m_simCommand; } + int GetNetlistOptions() const + { + return m_netlistOpts; + } + void SetNetlistExporter( NETLIST_EXPORTER_PSPICE_SIM* aExporter ) { m_exporter = aExporter; @@ -79,7 +84,10 @@ private: return wxEmptyString; } + void updateNetlistOpts(); + wxString m_simCommand; + int m_netlistOpts; NETLIST_EXPORTER_PSPICE_SIM* m_exporter; wxFloatingPointValidator m_posFloatValidator; diff --git a/eeschema/dialogs/dialog_sim_settings_base.cpp b/eeschema/dialogs/dialog_sim_settings_base.cpp index d08e53f430..b0821da179 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.cpp +++ b/eeschema/dialogs/dialog_sim_settings_base.cpp @@ -377,6 +377,13 @@ DIALOG_SIM_SETTINGS_BASE::DIALOG_SIM_SETTINGS_BASE( wxWindow* parent, wxWindowID bSizer1->Add( m_simPages, 1, wxEXPAND | wxALL, 5 ); + m_fixPassiveVals = new wxCheckBox( this, wxID_ANY, wxT("Adjust passive component values (e.g. M -> Meg; 100 nF -> 100n)"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer1->Add( m_fixPassiveVals, 0, wxALL, 5 ); + + m_fixIncludePaths = new wxCheckBox( this, wxID_ANY, wxT("Add full path for .include library directives"), wxDefaultPosition, wxDefaultSize, 0 ); + m_fixIncludePaths->SetValue(true); + bSizer1->Add( m_fixIncludePaths, 0, wxALL, 5 ); + m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1->AddButton( m_sdbSizer1OK ); diff --git a/eeschema/dialogs/dialog_sim_settings_base.fbp b/eeschema/dialogs/dialog_sim_settings_base.fbp index 773636a974..fa9be99fb1 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.fbp +++ b/eeschema/dialogs/dialog_sim_settings_base.fbp @@ -97,7 +97,7 @@ 5 wxEXPAND | wxALL 1 - + 1 1 1 @@ -175,11 +175,11 @@ - + AC 1 - + 1 1 1 @@ -253,7 +253,7 @@ - + bSizer3 wxVERTICAL @@ -368,11 +368,11 @@ 0 - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + 2 wxBOTH @@ -467,11 +467,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -641,11 +641,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -815,11 +815,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -921,11 +921,11 @@ - + DC Transfer 0 - + 1 1 1 @@ -999,16 +999,16 @@ - + bSizer4 wxVERTICAL none - + 5 wxEXPAND 1 - + wxID_ANY DC sweep source 1 @@ -1105,11 +1105,11 @@ - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + 2 wxBOTH @@ -1378,11 +1378,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -1552,11 +1552,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -1726,11 +1726,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -1821,11 +1821,11 @@ - + 5 wxEXPAND 1 - + wxID_ANY DC sweep source 2 @@ -1922,11 +1922,11 @@ - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + 2 wxBOTH @@ -2195,11 +2195,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -2369,11 +2369,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -2543,11 +2543,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -2641,11 +2641,11 @@ - + Distortion 0 - + 1 1 1 @@ -2721,11 +2721,11 @@ - + Noise 0 - + 1 1 1 @@ -2799,26 +2799,26 @@ - + bSizer15 wxVERTICAL none - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + 3 wxBOTH @@ -3004,11 +3004,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -3188,11 +3188,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -3445,11 +3445,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -3457,21 +3457,21 @@ - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALIGN_CENTER_HORIZONTAL|wxALL 0 - + 1 1 1 @@ -3557,21 +3557,21 @@ - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALIGN_CENTER_HORIZONTAL 1 - + 2 wxBOTH @@ -3666,11 +3666,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -3840,11 +3840,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -4014,11 +4014,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -4107,11 +4107,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -4120,11 +4120,11 @@ - + Operating Point 0 - + 1 1 1 @@ -4198,16 +4198,16 @@ - + bSizer8 wxVERTICAL none - + 5 wxEXPAND 1 - + 0 protected 0 @@ -4296,11 +4296,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -4309,11 +4309,11 @@ - + Pole-Zero 0 - + 1 1 1 @@ -4389,11 +4389,11 @@ - + Sensitvity 0 - + 1 1 1 @@ -4469,11 +4469,11 @@ - + Transfer Function 0 - + 1 1 1 @@ -4549,11 +4549,11 @@ - + Transient 0 - + 1 1 1 @@ -4627,26 +4627,26 @@ - + bSizer81 wxVERTICAL none - + 5 wxEXPAND 1 - + 0 protected 0 - + 5 wxALIGN_CENTER_HORIZONTAL|wxALL 1 - + 3 wxBOTH @@ -4741,11 +4741,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -4832,11 +4832,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -4925,11 +4925,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -5016,11 +5016,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -5109,11 +5109,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -5200,11 +5200,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 @@ -5285,11 +5285,11 @@ - + 5 wxEXPAND 1 - + 0 protected 0 @@ -5298,11 +5298,11 @@ - + Custom 0 - + 1 1 1 @@ -5376,16 +5376,16 @@ - + bSizer2 wxVERTICAL none - + 5 wxALL 0 - + 1 1 1 @@ -5464,11 +5464,11 @@ - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -5555,11 +5555,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -5648,6 +5648,182 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Adjust passive component values (e.g. M -> Meg; 100 nF -> 100n) + + 0 + + + 0 + + 1 + m_fixPassiveVals + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Add full path for .include library directives + + 0 + + + 0 + + 1 + m_fixIncludePaths + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxALL|wxEXPAND diff --git a/eeschema/dialogs/dialog_sim_settings_base.h b/eeschema/dialogs/dialog_sim_settings_base.h index 8c28b1d65d..6f7afad2a0 100644 --- a/eeschema/dialogs/dialog_sim_settings_base.h +++ b/eeschema/dialogs/dialog_sim_settings_base.h @@ -103,6 +103,8 @@ class DIALOG_SIM_SETTINGS_BASE : public wxDialog wxStaticText* m_staticText18; wxTextCtrl* m_customTxt; wxButton* m_loadDirectives; + wxCheckBox* m_fixPassiveVals; + wxCheckBox* m_fixIncludePaths; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 77c2a962ed..0561a1e9d6 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -105,8 +105,8 @@ void SIM_PLOT_FRAME::StartSimulation() m_simulator->Init(); updateNetlistExporter(); - m_exporter->SetSimCommand( m_simCommand ); - m_exporter->Format( &formatter, NET_ALL_FLAGS ); + m_exporter->SetSimCommand( m_settingsDlg.GetSimCommand() ); + m_exporter->Format( &formatter, m_settingsDlg.GetNetlistOptions() ); m_simulator->LoadNetlist( formatter.GetString() ); m_simulator->Run(); @@ -431,11 +431,8 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event ) { updateNetlistExporter(); m_exporter->ProcessNetlist( NET_ALL_FLAGS ); - m_settingsDlg.SetNetlistExporter( m_exporter.get() ); - - if( m_settingsDlg.ShowModal() == wxID_OK ) - m_simCommand = m_settingsDlg.GetSimCommand(); + m_settingsDlg.ShowModal(); } diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 0c12db8562..b0bbd86c58 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -124,7 +124,6 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE SCH_EDIT_FRAME* m_schematicFrame; std::unique_ptr m_exporter; std::unique_ptr m_simulator; - wxString m_simCommand; // Trick to preserve settings between runs DIALOG_SIM_SETTINGS m_settingsDlg;