Mostly a terminology update...

... but also makes DIALOG_SIM_COMMAND and SIMULATOR_REPORTER a bit
more simulator-agnostic.
This commit is contained in:
Jeff Young 2023-07-14 10:21:58 +01:00
parent f45883ac3d
commit ff044cd0cf
38 changed files with 374 additions and 409 deletions

View File

@ -223,11 +223,11 @@ set( EESCHEMA_SIM_SRCS
sim/kibis/ibis_parser.cpp
sim/kibis/kibis.cpp
sim/ngspice_circuit_model.cpp
sim/spice_circuit_model.cpp
sim/ngspice.cpp
sim/simulator_frame.cpp
sim/simulator_panel.cpp
sim/simulator_panel_base.cpp
sim/simulator_frame_ui.cpp
sim/simulator_frame_ui_base.cpp
sim/sim_plot_colors.cpp
sim/sim_tab.cpp
sim/sim_plot_tab.cpp

View File

@ -24,7 +24,7 @@
*/
#include "dialog_sim_command.h"
#include <sim/ngspice_circuit_model.h>
#include <sim/spice_circuit_model.h>
#include <sim/ngspice.h>
#include <sim/simulator_frame.h>
@ -58,8 +58,8 @@ static wxString getStringSelection( const wxChoice* aCtrl )
DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent,
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> aCircuitModel,
std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& aSettings ) :
std::shared_ptr<SPICE_CIRCUIT_MODEL> aCircuitModel,
std::shared_ptr<SPICE_SETTINGS>& aSettings ) :
DIALOG_SIM_COMMAND_BASE( aParent ),
m_simulatorFrame( aParent ),
m_circuitModel( aCircuitModel ),
@ -121,8 +121,8 @@ DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent,
m_noiseSrc->Append( item.refName );
}
if( !dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( aSettings.get() ) )
m_compatibilityMode->Show( false );
if( !dynamic_cast<NGSPICE_SETTINGS*>( aSettings.get() ) )
m_compatibilityModeSizer->Show( false );
SetupStandardButtons();
}
@ -135,23 +135,20 @@ bool DIALOG_SIM_COMMAND::TransferDataToWindow()
m_fixIncludePaths->SetValue( m_settings->GetFixIncludePaths() );
NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings =
dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_settings.get() );
NGSPICE_SETTINGS* ngspiceSettings = dynamic_cast<NGSPICE_SETTINGS*>( m_settings.get() );
if( ngspiceSettings )
{
switch( ngspiceSettings->GetModelMode() )
switch( ngspiceSettings->GetCompatibilityMode() )
{
case NGSPICE_MODEL_MODE::USER_CONFIG: m_compatibilityModeChoice->SetSelection( 0 ); break;
case NGSPICE_MODEL_MODE::NGSPICE: m_compatibilityModeChoice->SetSelection( 1 ); break;
case NGSPICE_MODEL_MODE::PSPICE: m_compatibilityModeChoice->SetSelection( 2 ); break;
case NGSPICE_MODEL_MODE::LTSPICE: m_compatibilityModeChoice->SetSelection( 3 ); break;
case NGSPICE_MODEL_MODE::LT_PSPICE: m_compatibilityModeChoice->SetSelection( 4 ); break;
case NGSPICE_MODEL_MODE::HSPICE: m_compatibilityModeChoice->SetSelection( 5 ); break;
default:
wxFAIL_MSG( wxString::Format( "Unknown NGSPICE_MODEL_MODE %d.",
ngspiceSettings->GetModelMode() ) );
break;
case NGSPICE_COMPATIBILITY_MODE::USER_CONFIG: m_compatibilityMode->SetSelection( 0 ); break;
case NGSPICE_COMPATIBILITY_MODE::NGSPICE: m_compatibilityMode->SetSelection( 1 ); break;
case NGSPICE_COMPATIBILITY_MODE::PSPICE: m_compatibilityMode->SetSelection( 2 ); break;
case NGSPICE_COMPATIBILITY_MODE::LTSPICE: m_compatibilityMode->SetSelection( 3 ); break;
case NGSPICE_COMPATIBILITY_MODE::LT_PSPICE: m_compatibilityMode->SetSelection( 4 ); break;
case NGSPICE_COMPATIBILITY_MODE::HSPICE: m_compatibilityMode->SetSelection( 5 ); break;
default: wxFAIL_MSG( wxString::Format( "Unknown NGSPICE_COMPATIBILITY_MODE %d.",
ngspiceSettings->GetCompatibilityMode() ) ); break;
}
}
@ -207,19 +204,16 @@ bool DIALOG_SIM_COMMAND::TransferDataFromWindow()
return false;
// The simulator dependent settings always get transferred.
NGSPICE_SIMULATOR_SETTINGS* ngspiceSettings =
dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_settings.get() );
if( ngspiceSettings )
if( NGSPICE_SETTINGS* ngspiceSettings = dynamic_cast<NGSPICE_SETTINGS*>( m_settings.get() ) )
{
switch( m_compatibilityModeChoice->GetSelection() )
switch( m_compatibilityMode->GetSelection() )
{
case 0: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::USER_CONFIG ); break;
case 1: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::NGSPICE ); break;
case 2: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::PSPICE ); break;
case 3: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LTSPICE ); break;
case 4: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE ); break;
case 5: ngspiceSettings->SetModelMode( NGSPICE_MODEL_MODE::HSPICE ); break;
case 0: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::USER_CONFIG ); break;
case 1: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::NGSPICE ); break;
case 2: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::PSPICE ); break;
case 3: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LTSPICE ); break;
case 4: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE ); break;
case 5: ngspiceSettings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::HSPICE ); break;
}
}
@ -490,7 +484,7 @@ void DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand )
return;
}
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aCommand );
SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aCommand );
SetTitle( SPICE_SIMULATOR::TypeToName( simType, true )
+ wxT( " \u2014 " )

View File

@ -33,16 +33,17 @@
#include <wx/valnum.h>
class NGSPICE_CIRCUIT_MODEL;
class SPICE_SIMULATOR_SETTINGS;
class SPICE_CIRCUIT_MODEL;
class SPICE_SETTINGS;
class SIMULATOR_FRAME;
class DIALOG_SIM_COMMAND : public DIALOG_SIM_COMMAND_BASE
{
public:
DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent, std::shared_ptr<NGSPICE_CIRCUIT_MODEL> aCircuitModel,
std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& aSettings );
DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent,
std::shared_ptr<SPICE_CIRCUIT_MODEL> aCircuitModel,
std::shared_ptr<SPICE_SETTINGS>& aSettings );
const wxString& GetSimCommand() const
{
@ -177,8 +178,8 @@ private:
private:
SIMULATOR_FRAME* m_simulatorFrame;
wxString m_simCommand;
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_SIMULATOR_SETTINGS> m_settings;
std::shared_ptr<SPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_SETTINGS> m_settings;
SPICE_VALIDATOR m_spiceValidator;
SPICE_VALIDATOR m_spiceEmptyValidator;
wxIntegerValidator<int> m_posIntValidator;

View File

@ -638,21 +638,21 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_saveAllDissipations = new wxCheckBox( this, wxID_ANY, _("Save all power dissipations"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer88->Add( m_saveAllDissipations, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_compatibilityMode = new wxBoxSizer( wxHORIZONTAL );
m_compatibilityModeSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText* compatibilityLabel;
compatibilityLabel = new wxStaticText( this, wxID_ANY, _("Compatibility mode:"), wxDefaultPosition, wxDefaultSize, 0 );
compatibilityLabel->Wrap( -1 );
m_compatibilityMode->Add( compatibilityLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
m_compatibilityModeSizer->Add( compatibilityLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 8 );
wxString m_compatibilityModeChoiceChoices[] = { _("User configuration"), _("Spice"), _("PSpice"), _("LTSpice"), _("PSpice and LTSpice"), _("HSpice") };
int m_compatibilityModeChoiceNChoices = sizeof( m_compatibilityModeChoiceChoices ) / sizeof( wxString );
m_compatibilityModeChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_compatibilityModeChoiceNChoices, m_compatibilityModeChoiceChoices, 0 );
m_compatibilityModeChoice->SetSelection( 0 );
m_compatibilityMode->Add( m_compatibilityModeChoice, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxString m_compatibilityModeChoices[] = { _("User configuration"), _("Spice"), _("PSpice"), _("LTSpice"), _("PSpice and LTSpice"), _("HSpice") };
int m_compatibilityModeNChoices = sizeof( m_compatibilityModeChoices ) / sizeof( wxString );
m_compatibilityMode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_compatibilityModeNChoices, m_compatibilityModeChoices, 0 );
m_compatibilityMode->SetSelection( 0 );
m_compatibilityModeSizer->Add( m_compatibilityMode, 0, wxALIGN_CENTER_VERTICAL, 5 );
bSizer88->Add( m_compatibilityMode, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bSizer88->Add( m_compatibilityModeSizer, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bSizer1->Add( bSizer88, 0, wxEXPAND|wxTOP|wxLEFT, 10 );

View File

@ -7346,7 +7346,7 @@
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_compatibilityMode</property>
<property name="name">m_compatibilityModeSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
@ -7450,7 +7450,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_compatibilityModeChoice</property>
<property name="name">m_compatibilityMode</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -156,8 +156,8 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM
wxCheckBox* m_saveAllVoltages;
wxCheckBox* m_saveAllCurrents;
wxCheckBox* m_saveAllDissipations;
wxBoxSizer* m_compatibilityMode;
wxChoice* m_compatibilityModeChoice;
wxBoxSizer* m_compatibilityModeSizer;
wxChoice* m_compatibilityMode;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;

View File

@ -135,7 +135,7 @@ void SCH_EDIT_FRAME::saveProjectSettings()
RecordERCExclusions();
if( Kiway().Player( FRAME_SIMULATOR, false ) )
Prj().GetProjectFile().m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile();
Prj().GetProjectFile().m_SchematicSettings->m_NgspiceSettings->SaveToFile();
// Save the page layout file if doesn't exist yet (e.g. if we opened a non-kicad schematic)

View File

@ -25,7 +25,7 @@
#include <sim/kibis/kibis.h>
#include <netlist_exporter_spice.h>
#include <sim/ngspice_circuit_model.h>
#include <sim/spice_circuit_model.h>
#include <sim/sim_library_spice.h>
#include <sim/sim_model_raw_spice.h>
#include <sim/sim_model_ideal.h>

View File

@ -71,7 +71,6 @@ static const wxChar* plot_sheet_list( HPGL_PAGE_SIZE aSize )
SCH_PLOTTER::SCH_PLOTTER( SCHEMATIC* aSchematic ) :
m_schFrame( nullptr ),
m_schematic( aSchematic )
{
m_colorSettings = nullptr;
@ -79,7 +78,6 @@ SCH_PLOTTER::SCH_PLOTTER( SCHEMATIC* aSchematic ) :
SCH_PLOTTER::SCH_PLOTTER( SCH_EDIT_FRAME* aFrame ) :
m_schFrame( aFrame ),
m_schematic( &aFrame->Schematic() )
{
m_colorSettings = nullptr;

View File

@ -211,11 +211,8 @@ protected:
REPORTER* aReporter = nullptr );
private:
SCH_EDIT_FRAME* m_schFrame;
SCHEMATIC* m_schematic;
COLOR_SETTINGS* m_colorSettings;
wxString m_lastOutputFilePath;
};

View File

@ -100,7 +100,7 @@ void SCHEMATIC::SetProject( PROJECT* aPrj )
project.m_SchematicSettings = new SCHEMATIC_SETTINGS( &project, "schematic" );
project.m_SchematicSettings->LoadFromFile();
project.m_SchematicSettings->m_NgspiceSimulatorSettings->LoadFromFile();
project.m_SchematicSettings->m_NgspiceSettings->LoadFromFile();
project.m_ErcSettings->LoadFromFile();
}
}

View File

@ -62,7 +62,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
m_SpiceSaveAllCurrents( false ),
m_SpiceSaveAllDissipations( false ),
m_SpiceModelCurSheetAsRoot( true ),
m_NgspiceSimulatorSettings( nullptr )
m_NgspiceSettings( nullptr )
{
EESCHEMA_SETTINGS* appSettings = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
@ -235,8 +235,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
m_params.emplace_back( new PARAM<int>( "annotate_start_num",
&m_AnnotateStartNum, 0 ) );
m_NgspiceSimulatorSettings =
std::make_shared<NGSPICE_SIMULATOR_SETTINGS>( this, "ngspice" );
m_NgspiceSettings = std::make_shared<NGSPICE_SETTINGS>( this, "ngspice" );
registerMigration( 0, 1,
[&]() -> bool
@ -253,8 +252,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
SCHEMATIC_SETTINGS::~SCHEMATIC_SETTINGS()
{
ReleaseNestedSettings( m_NgspiceSimulatorSettings.get() );
m_NgspiceSimulatorSettings.reset();
ReleaseNestedSettings( m_NgspiceSettings.get() );
m_NgspiceSettings.reset();
if( m_parent )
{

View File

@ -25,7 +25,7 @@
#include <settings/bom_settings.h>
#include <template_fieldnames.h>
class NGSPICE_SIMULATOR_SETTINGS;
class NGSPICE_SETTINGS;
/**
* These settings were stored in SCH_BASE_FRAME previously.
@ -96,7 +96,7 @@ public:
/**
* Ngspice simulator settings.
*/
std::shared_ptr<NGSPICE_SIMULATOR_SETTINGS> m_NgspiceSimulatorSettings;
std::shared_ptr<NGSPICE_SETTINGS> m_NgspiceSettings;
};
#endif

View File

@ -31,9 +31,9 @@
#include <fmt/core.h>
#include <paths.h>
#include "ngspice_circuit_model.h"
#include "spice_circuit_model.h"
#include "ngspice.h"
#include "spice_reporter.h"
#include "simulator_reporter.h"
#include "spice_settings.h"
#include <wx/stdpaths.h>
@ -72,7 +72,7 @@ NGSPICE::NGSPICE() :
NGSPICE::~NGSPICE() = default;
void NGSPICE::Init( const SPICE_SIMULATOR_SETTINGS* aSettings )
void NGSPICE::Init( const SPICE_SETTINGS* aSettings )
{
Command( "reset" );
@ -254,7 +254,7 @@ std::vector<double> NGSPICE::GetPhaseVector( const std::string& aName, int aMaxL
bool NGSPICE::Attach( const std::shared_ptr<SIMULATION_MODEL>& aModel, const wxString& aSimCommand,
unsigned aSimOptions, REPORTER& aReporter )
{
NGSPICE_CIRCUIT_MODEL* model = dynamic_cast<NGSPICE_CIRCUIT_MODEL*>( aModel.get() );
SPICE_CIRCUIT_MODEL* model = dynamic_cast<SPICE_CIRCUIT_MODEL*>( aModel.get() );
STRING_FORMATTER formatter;
if( model && model->GetNetlist( aSimCommand, aSimOptions, &formatter, aReporter ) )
@ -359,42 +359,22 @@ wxString NGSPICE::GetXAxis( SIM_TYPE aType ) const
std::vector<std::string> NGSPICE::GetSettingCommands() const
{
const NGSPICE_SIMULATOR_SETTINGS* settings =
dynamic_cast<const NGSPICE_SIMULATOR_SETTINGS*>( Settings().get() );
const NGSPICE_SETTINGS* settings = dynamic_cast<const NGSPICE_SETTINGS*>( Settings().get() );
std::vector<std::string> commands;
wxCHECK( settings, commands );
switch( settings->GetModelMode() )
switch( settings->GetCompatibilityMode() )
{
case NGSPICE_MODEL_MODE::USER_CONFIG:
break;
case NGSPICE_MODEL_MODE::NGSPICE:
commands.emplace_back( "unset ngbehavior" );
break;
case NGSPICE_MODEL_MODE::PSPICE:
commands.emplace_back( "set ngbehavior=psa" );
break;
case NGSPICE_MODEL_MODE::LTSPICE:
commands.emplace_back( "set ngbehavior=lta" );
break;
case NGSPICE_MODEL_MODE::LT_PSPICE:
commands.emplace_back( "set ngbehavior=ltpsa" );
break;
case NGSPICE_MODEL_MODE::HSPICE:
commands.emplace_back( "set ngbehavior=hsa" );
break;
default:
wxFAIL_MSG( wxString::Format( "Undefined NGSPICE_MODEL_MODE %d.",
settings->GetModelMode() ) );
break;
case NGSPICE_COMPATIBILITY_MODE::USER_CONFIG: break;
case NGSPICE_COMPATIBILITY_MODE::NGSPICE: commands.emplace_back( "unset ngbehavior" ); break;
case NGSPICE_COMPATIBILITY_MODE::PSPICE: commands.emplace_back( "set ngbehavior=psa" ); break;
case NGSPICE_COMPATIBILITY_MODE::LTSPICE: commands.emplace_back( "set ngbehavior=lta" ); break;
case NGSPICE_COMPATIBILITY_MODE::LT_PSPICE: commands.emplace_back( "set ngbehavior=ltpsa" ); break;
case NGSPICE_COMPATIBILITY_MODE::HSPICE: commands.emplace_back( "set ngbehavior=hsa" ); break;
default: wxFAIL_MSG( wxString::Format( "Undefined NGSPICE_COMPATIBILITY_MODE %d.",
settings->GetCompatibilityMode() ) ); break;
}
return commands;

View File

@ -56,7 +56,7 @@ public:
virtual ~NGSPICE();
///< @copydoc SPICE_SIMULATOR::Init()
void Init( const SPICE_SIMULATOR_SETTINGS* aSettings = nullptr ) override final;
void Init( const SPICE_SETTINGS* aSettings = nullptr ) override final;
///< @copydoc SPICE_SIMULATOR::Attach()
bool Attach( const std::shared_ptr<SIMULATION_MODEL>& aModel, const wxString& aSimCommand,

View File

@ -27,7 +27,7 @@
#include "sim_tab.h"
#include "simulator_frame.h"
#include "ngspice_circuit_model.h"
#include "spice_circuit_model.h"
SIM_TAB::SIM_TAB() :
@ -70,7 +70,7 @@ bool SIM_TAB::IsPlottable( SIM_TYPE aSimType )
SIM_TYPE SIM_TAB::GetSimType() const
{
return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand );
return SPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand );
}

View File

@ -27,7 +27,7 @@
#define __SIM_PLOT_PANEL_BASE_H
#include <sim/sim_types.h>
#include <sim/ngspice_circuit_model.h>
#include <sim/spice_circuit_model.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/stattext.h>

View File

@ -51,17 +51,17 @@
#include <pgm_base.h>
#include "ngspice.h"
#include <sim/simulator_frame.h>
#include <sim/simulator_panel.h>
#include <sim/simulator_frame_ui.h>
#include <sim/sim_plot_tab.h>
#include <sim/spice_simulator.h>
#include <sim/spice_reporter.h>
#include <sim/simulator_reporter.h>
#include <eeschema_settings.h>
#include <advanced_config.h>
#include <memory>
class SIM_THREAD_REPORTER : public SPICE_REPORTER
class SIM_THREAD_REPORTER : public SIMULATOR_REPORTER
{
public:
SIM_THREAD_REPORTER( SIMULATOR_FRAME* aParent ) :
@ -82,7 +82,7 @@ public:
return false; // Technically "indeterminate" rather than false.
}
void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override
void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) override
{
wxCommandEvent* event = nullptr;
@ -112,7 +112,7 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxDefaultSize, wxDEFAULT_FRAME_STYLE, wxT( "simulator" ), unityScale ),
m_schematicFrame( nullptr ),
m_toolBar( nullptr ),
m_panel( nullptr ),
m_ui( nullptr ),
m_simFinished( false ),
m_workbookModified( false )
{
@ -135,28 +135,27 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_toolBar->Realize();
mainSizer->Add( m_toolBar, 0, wxEXPAND, 5 );
m_panel = new SIMULATOR_PANEL( this, m_schematicFrame );
mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
m_ui = new SIMULATOR_FRAME_UI( this, m_schematicFrame );
mainSizer->Add( m_ui, 1, wxEXPAND, 5 );
m_simulator = SIMULATOR::CreateInstance( "ngspice" );
wxASSERT( m_simulator );
LoadSettings( config() );
NGSPICE_SIMULATOR_SETTINGS* settings =
dynamic_cast<NGSPICE_SIMULATOR_SETTINGS*>( m_simulator->Settings().get() );
NGSPICE_SETTINGS* settings = dynamic_cast<NGSPICE_SETTINGS*>( m_simulator->Settings().get() );
wxCHECK2( settings, /* do nothing in release builds*/ );
if( settings && settings->GetWorkbookFilename().IsEmpty() )
settings->SetModelMode( NGSPICE_MODEL_MODE::LT_PSPICE );
settings->SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE );
m_simulator->Init();
m_reporter = new SIM_THREAD_REPORTER( this );
m_simulator->SetReporter( m_reporter );
m_circuitModel = std::make_shared<NGSPICE_CIRCUIT_MODEL>( &m_schematicFrame->Schematic(), this );
m_circuitModel = std::make_shared<SPICE_CIRCUIT_MODEL>( &m_schematicFrame->Schematic(), this );
setupTools();
setupUIConditions();
@ -181,12 +180,12 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Otherwise, the changes made by setSubWindowsSashSize are overwritten by one these
// events
wxSafeYield();
m_panel->SetSubWindowsSashSize();
m_ui->SetSubWindowsSashSize();
// Ensure the window is on top
Raise();
m_panel->InitWorkbook();
m_ui->InitWorkbook();
UpdateTitle();
}
@ -226,7 +225,7 @@ void SIMULATOR_FRAME::ShowChangedLanguage()
UpdateTitle();
m_panel->ShowChangedLanguage();
m_ui->ShowChangedLanguage();
}
@ -238,7 +237,7 @@ void SIMULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
if( cfg )
{
EDA_BASE_FRAME::LoadSettings( cfg );
m_panel->LoadSettings( cfg );
m_ui->LoadSettings( cfg );
}
PROJECT_FILE& project = Prj().GetProjectFile();
@ -246,7 +245,7 @@ void SIMULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
NGSPICE* currentSim = dynamic_cast<NGSPICE*>( m_simulator.get() );
if( currentSim )
m_simulator->Settings() = project.m_SchematicSettings->m_NgspiceSimulatorSettings;
m_simulator->Settings() = project.m_SchematicSettings->m_NgspiceSettings;
}
@ -258,14 +257,14 @@ void SIMULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
if( cfg )
{
EDA_BASE_FRAME::SaveSettings( cfg );
m_panel->SaveSettings( cfg );
m_ui->SaveSettings( cfg );
}
PROJECT_FILE& project = Prj().GetProjectFile();
if( project.m_SchematicSettings )
{
bool modified = project.m_SchematicSettings->m_NgspiceSimulatorSettings->SaveToFile();
bool modified = project.m_SchematicSettings->m_NgspiceSettings->SaveToFile();
if( m_schematicFrame && modified )
m_schematicFrame->OnModify();
@ -284,8 +283,8 @@ WINDOW_SETTINGS* SIMULATOR_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
wxString SIMULATOR_FRAME::GetCurrentSimCommand() const
{
if( m_panel->GetCurrentSimTab() )
return m_panel->GetCurrentSimTab()->GetSimCommand();
if( m_ui->GetCurrentSimTab() )
return m_ui->GetCurrentSimTab()->GetSimCommand();
else
return m_circuitModel->GetSchTextSimCommand();
}
@ -293,13 +292,13 @@ wxString SIMULATOR_FRAME::GetCurrentSimCommand() const
SIM_TYPE SIMULATOR_FRAME::GetCurrentSimType() const
{
return NGSPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimCommand() );
return SPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimCommand() );
}
int SIMULATOR_FRAME::GetCurrentOptions() const
{
if( SIM_TAB* simTab = m_panel->GetCurrentSimTab() )
if( SIM_TAB* simTab = m_ui->GetCurrentSimTab() )
return simTab->GetSimOptions();
else
return NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS;
@ -361,7 +360,7 @@ bool SIMULATOR_FRAME::LoadSimulator( const wxString& aSimCommand, unsigned aSimO
void SIMULATOR_FRAME::StartSimulation()
{
SIM_TAB* simTab = m_panel->GetCurrentSimTab();
SIM_TAB* simTab = m_ui->GetCurrentSimTab();
if( !simTab )
return;
@ -370,7 +369,7 @@ void SIMULATOR_FRAME::StartSimulation()
{
wxString tranSpicePlot;
if( SIM_TAB* tranPlotTab = m_panel->GetSimTab( ST_TRAN ) )
if( SIM_TAB* tranPlotTab = m_ui->GetSimTab( ST_TRAN ) )
tranSpicePlot = tranPlotTab->GetSpicePlotName();
if( tranSpicePlot.IsEmpty() )
@ -391,7 +390,7 @@ void SIMULATOR_FRAME::StartSimulation()
}
simTab->SetSpicePlotName( m_simulator->CurrentPlotName() );
m_panel->OnSimRefresh( true );
m_ui->OnSimRefresh( true );
#if 0
m_simulator->Command( "setplot" ); // Print available plots to console
@ -403,7 +402,7 @@ void SIMULATOR_FRAME::StartSimulation()
}
else
{
if( m_panel->GetSimTabIndex( simTab ) == 0
if( m_ui->GetSimTabIndex( simTab ) == 0
&& m_circuitModel->GetSchTextSimCommand() != simTab->GetLastSchTextSimCommand() )
{
if( simTab->GetLastSchTextSimCommand().IsEmpty()
@ -424,7 +423,7 @@ void SIMULATOR_FRAME::StartSimulation()
if( simulatorLock.owns_lock() )
{
m_panel->OnSimUpdate();
m_ui->OnSimUpdate();
m_simulator->Run();
}
else
@ -436,61 +435,61 @@ void SIMULATOR_FRAME::StartSimulation()
void SIMULATOR_FRAME::NewPlotPanel( const wxString& aSimCommand, unsigned aOptions )
{
m_panel->NewSimTab( aSimCommand, aOptions );
m_ui->NewSimTab( aSimCommand, aOptions );
}
const std::vector<wxString> SIMULATOR_FRAME::SimPlotVectors()
{
return m_panel->SimPlotVectors();
return m_ui->SimPlotVectors();
}
const std::vector<wxString> SIMULATOR_FRAME::Signals()
{
return m_panel->Signals();
return m_ui->Signals();
}
const std::map<int, wxString>& SIMULATOR_FRAME::UserDefinedSignals()
{
return m_panel->UserDefinedSignals();
return m_ui->UserDefinedSignals();
}
void SIMULATOR_FRAME::SetUserDefinedSignals( const std::map<int, wxString>& aSignals )
{
m_panel->SetUserDefinedSignals( aSignals );
m_ui->SetUserDefinedSignals( aSignals );
}
void SIMULATOR_FRAME::AddVoltageTrace( const wxString& aNetName )
{
m_panel->AddTrace( aNetName, SPT_VOLTAGE );
m_ui->AddTrace( aNetName, SPT_VOLTAGE );
}
void SIMULATOR_FRAME::AddCurrentTrace( const wxString& aDeviceName )
{
m_panel->AddTrace( aDeviceName, SPT_CURRENT );
m_ui->AddTrace( aDeviceName, SPT_CURRENT );
}
void SIMULATOR_FRAME::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol )
{
m_panel->AddTuner( aSheetPath, aSymbol );
m_ui->AddTuner( aSheetPath, aSymbol );
}
SIM_TAB* SIMULATOR_FRAME::GetCurrentSimTab() const
{
return m_panel->GetCurrentSimTab();
return m_ui->GetCurrentSimTab();
}
bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath )
{
if( m_panel->LoadWorkbook( aPath ) )
if( m_ui->LoadWorkbook( aPath ) )
{
UpdateTitle();
@ -510,7 +509,7 @@ bool SIMULATOR_FRAME::LoadWorkbook( const wxString& aPath )
bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath )
{
if( m_panel->SaveWorkbook( aPath ) )
if( m_ui->SaveWorkbook( aPath ) )
{
UpdateTitle();
m_workbookModified = false;
@ -524,13 +523,13 @@ bool SIMULATOR_FRAME::SaveWorkbook( const wxString& aPath )
void SIMULATOR_FRAME::ToggleDarkModePlots()
{
m_panel->ToggleDarkModePlots();
m_ui->ToggleDarkModePlots();
}
bool SIMULATOR_FRAME::EditSimCommand()
{
SIM_TAB* simTab = m_panel->GetCurrentSimTab();
SIM_TAB* simTab = m_ui->GetCurrentSimTab();
DIALOG_SIM_COMMAND dlg( this, m_circuitModel, m_simulator->Settings() );
wxString errors;
WX_STRING_REPORTER reporter( &errors );
@ -552,7 +551,7 @@ bool SIMULATOR_FRAME::EditSimCommand()
{
simTab->SetSimCommand( dlg.GetSimCommand() );
simTab->SetSimOptions( dlg.GetSimOptions() );
m_panel->OnPlotSettingsChanged();
m_ui->OnPlotSettingsChanged();
OnModify();
return true;
}
@ -636,7 +635,7 @@ void SIMULATOR_FRAME::setupUIConditions()
auto darkModePlotCondition =
[this]( const SELECTION& aSel )
{
return m_panel->DarkModePlots();
return m_ui->DarkModePlots();
};
auto simRunning =
@ -727,7 +726,7 @@ void SIMULATOR_FRAME::onSimFinished( wxCommandEvent& aEvent )
m_simFinished = true;
m_panel->OnSimRefresh( true );
m_ui->OnSimRefresh( true );
m_schematicFrame->RefreshOperatingPointDisplay();
m_schematicFrame->GetCanvas()->Refresh();
@ -751,7 +750,7 @@ void SIMULATOR_FRAME::onUpdateSim( wxCommandEvent& aEvent )
if( simulatorLock.owns_lock() )
{
m_panel->OnSimUpdate();
m_ui->OnSimUpdate();
m_simulator->Run();
}
else
@ -765,7 +764,7 @@ void SIMULATOR_FRAME::onUpdateSim( wxCommandEvent& aEvent )
void SIMULATOR_FRAME::onSimReport( wxCommandEvent& aEvent )
{
m_panel->OnSimReport( aEvent.GetString() );
m_ui->OnSimReport( aEvent.GetString() );
}

View File

@ -29,7 +29,7 @@
#define SIMULATOR_FRAME_H
#include <sim/simulator_panel_base.h>
#include <sim/simulator_frame_ui_base.h>
#include <sim/sim_types.h>
#include <kiway_player.h>
@ -43,7 +43,7 @@
class SCH_EDIT_FRAME;
class SCH_SYMBOL;
class SIMULATOR_PANEL;
class SIMULATOR_FRAME_UI;
class SIM_THREAD_REPORTER;
class ACTION_TOOLBAR;
@ -161,7 +161,7 @@ public:
SCH_EDIT_FRAME* GetSchematicFrame() const { return m_schematicFrame; }
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> GetCircuitModel() const { return m_circuitModel; }
std::shared_ptr<SPICE_CIRCUIT_MODEL> GetCircuitModel() const { return m_circuitModel; }
std::shared_ptr<SPICE_SIMULATOR> GetSimulator() const { return m_simulator; }
@ -202,11 +202,11 @@ private:
private:
SCH_EDIT_FRAME* m_schematicFrame;
ACTION_TOOLBAR* m_toolBar;
SIMULATOR_PANEL* m_panel;
SIMULATOR_FRAME_UI* m_ui;
std::shared_ptr<SPICE_SIMULATOR> m_simulator;
SIM_THREAD_REPORTER* m_reporter;
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_CIRCUIT_MODEL> m_circuitModel;
bool m_simFinished;
bool m_workbookModified;

View File

@ -37,7 +37,7 @@
#include <eda_pattern_match.h>
#include <string_utils.h>
#include <pgm_base.h>
#include <sim/simulator_panel.h>
#include <sim/simulator_frame_ui.h>
#include <sim/simulator_frame.h>
#include <sim/sim_plot_tab.h>
#include <sim/spice_simulator.h>
@ -104,7 +104,7 @@ enum
class SIGNALS_GRID_TRICKS : public GRID_TRICKS
{
public:
SIGNALS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) :
SIGNALS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ),
m_parent( aParent ),
m_menuRow( 0 ),
@ -116,7 +116,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override;
protected:
SIMULATOR_PANEL* m_parent;
SIMULATOR_FRAME_UI* m_parent;
int m_menuRow;
int m_menuCol;
};
@ -263,7 +263,7 @@ void SIGNALS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class CURSORS_GRID_TRICKS : public GRID_TRICKS
{
public:
CURSORS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) :
CURSORS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ),
m_parent( aParent ),
m_menuRow( 0 ),
@ -275,7 +275,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override;
protected:
SIMULATOR_PANEL* m_parent;
SIMULATOR_FRAME_UI* m_parent;
int m_menuRow;
int m_menuCol;
};
@ -320,7 +320,7 @@ void CURSORS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class MEASUREMENTS_GRID_TRICKS : public GRID_TRICKS
{
public:
MEASUREMENTS_GRID_TRICKS( SIMULATOR_PANEL* aParent, WX_GRID* aGrid ) :
MEASUREMENTS_GRID_TRICKS( SIMULATOR_FRAME_UI* aParent, WX_GRID* aGrid ) :
GRID_TRICKS( aGrid ),
m_parent( aParent ),
m_menuRow( 0 ),
@ -332,7 +332,7 @@ protected:
void doPopupSelection( wxCommandEvent& event ) override;
protected:
SIMULATOR_PANEL* m_parent;
SIMULATOR_FRAME_UI* m_parent;
int m_menuRow;
int m_menuCol;
};
@ -421,7 +421,7 @@ void MEASUREMENTS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
class SUPPRESS_GRID_CELL_EVENTS
{
public:
SUPPRESS_GRID_CELL_EVENTS( SIMULATOR_PANEL* aFrame ) :
SUPPRESS_GRID_CELL_EVENTS( SIMULATOR_FRAME_UI* aFrame ) :
m_frame( aFrame )
{
m_frame->m_SuppressGridEvents++;
@ -433,7 +433,7 @@ public:
}
private:
SIMULATOR_PANEL* m_frame;
SIMULATOR_FRAME_UI* m_frame;
};
@ -441,9 +441,9 @@ private:
#define REFRESH_INTERVAL 50 // 20 frames/second.
SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame,
SIMULATOR_FRAME_UI::SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame,
SCH_EDIT_FRAME* aSchematicFrame ) :
SIMULATOR_PANEL_BASE( aSimulatorFrame ),
SIMULATOR_FRAME_UI_BASE( aSimulatorFrame ),
m_SuppressGridEvents( 0 ),
m_simulatorFrame( aSimulatorFrame ),
m_schematicFrame( aSchematicFrame ),
@ -493,8 +493,8 @@ SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame,
// Prepare the color list to plot traces
SIM_PLOT_COLORS::FillDefaultColorList( m_darkMode );
Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_PANEL::onPlotCursorUpdate, this );
Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_PANEL::onNotebookModified, this );
Bind( EVT_SIM_CURSOR_UPDATE, &SIMULATOR_FRAME_UI::onPlotCursorUpdate, this );
Bind( EVT_WORKBOOK_MODIFIED, &SIMULATOR_FRAME_UI::onNotebookModified, this );
Bind( wxEVT_TIMER,
[&]( wxTimerEvent& aEvent )
@ -513,7 +513,7 @@ SIMULATOR_PANEL::SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame,
}
SIMULATOR_PANEL::~SIMULATOR_PANEL()
SIMULATOR_FRAME_UI::~SIMULATOR_FRAME_UI()
{
// Delete the GRID_TRICKS.
m_signalsGrid->PopEventHandler( true );
@ -522,7 +522,7 @@ SIMULATOR_PANEL::~SIMULATOR_PANEL()
}
void SIMULATOR_PANEL::ShowChangedLanguage()
void SIMULATOR_FRAME_UI::ShowChangedLanguage()
{
for( int ii = 0; ii < (int) m_plotNotebook->GetPageCount(); ++ii )
{
@ -557,7 +557,7 @@ void SIMULATOR_PANEL::ShowChangedLanguage()
}
void SIMULATOR_PANEL::LoadSettings( EESCHEMA_SETTINGS* aCfg )
void SIMULATOR_FRAME_UI::LoadSettings( EESCHEMA_SETTINGS* aCfg )
{
// Read subwindows sizes (should be > 0 )
m_splitterLeftRightSashPosition = aCfg->m_Simulator.plot_panel_width;
@ -569,7 +569,7 @@ void SIMULATOR_PANEL::LoadSettings( EESCHEMA_SETTINGS* aCfg )
}
void SIMULATOR_PANEL::SaveSettings( EESCHEMA_SETTINGS* aCfg )
void SIMULATOR_FRAME_UI::SaveSettings( EESCHEMA_SETTINGS* aCfg )
{
aCfg->m_Simulator.plot_panel_width = m_splitterLeftRight->GetSashPosition();
aCfg->m_Simulator.plot_panel_height = m_splitterPlotAndConsole->GetSashPosition();
@ -580,7 +580,7 @@ void SIMULATOR_PANEL::SaveSettings( EESCHEMA_SETTINGS* aCfg )
}
void SIMULATOR_PANEL::InitWorkbook()
void SIMULATOR_FRAME_UI::InitWorkbook()
{
if( !simulator()->Settings()->GetWorkbookFilename().IsEmpty() )
{
@ -603,7 +603,7 @@ void SIMULATOR_PANEL::InitWorkbook()
}
void SIMULATOR_PANEL::SetSubWindowsSashSize()
void SIMULATOR_FRAME_UI::SetSubWindowsSashSize()
{
if( m_splitterLeftRightSashPosition > 0 )
m_splitterLeftRight->SetSashPosition( m_splitterLeftRightSashPosition );
@ -622,7 +622,7 @@ void SIMULATOR_PANEL::SetSubWindowsSashSize()
}
void SIMULATOR_PANEL::rebuildSignalsGrid( wxString aFilter )
void SIMULATOR_FRAME_UI::rebuildSignalsGrid( wxString aFilter )
{
SUPPRESS_GRID_CELL_EVENTS raii( this );
@ -730,7 +730,7 @@ void SIMULATOR_PANEL::rebuildSignalsGrid( wxString aFilter )
}
void SIMULATOR_PANEL::rebuildSignalsList()
void SIMULATOR_FRAME_UI::rebuildSignalsList()
{
m_signals.clear();
@ -870,10 +870,10 @@ void SIMULATOR_PANEL::rebuildSignalsList()
}
SIM_TAB* SIMULATOR_PANEL::NewSimTab( const wxString& aSimCommand, unsigned aSimOptions )
SIM_TAB* SIMULATOR_FRAME_UI::NewSimTab( const wxString& aSimCommand, unsigned aSimOptions )
{
SIM_TAB* simTab = nullptr;
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand );
SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand );
if( SIM_TAB::IsPlottable( simType ) )
{
@ -898,13 +898,13 @@ SIM_TAB* SIMULATOR_PANEL::NewSimTab( const wxString& aSimCommand, unsigned aSimO
}
void SIMULATOR_PANEL::OnFilterText( wxCommandEvent& aEvent )
void SIMULATOR_FRAME_UI::OnFilterText( wxCommandEvent& aEvent )
{
rebuildSignalsGrid( m_filter->GetValue() );
}
void SIMULATOR_PANEL::OnFilterMouseMoved( wxMouseEvent& aEvent )
void SIMULATOR_FRAME_UI::OnFilterMouseMoved( wxMouseEvent& aEvent )
{
wxPoint pos = aEvent.GetPosition();
wxRect ctrlRect = m_filter->GetScreenRect();
@ -929,8 +929,9 @@ wxString vectorNameFromSignalId( int aUserDefinedSignalId )
* For user-defined signals we display the user-oriented signal name such as "V(out)-V(in)",
* but the simulator vector we actually have to plot will be "user0" or some-such.
*/
wxString SIMULATOR_PANEL::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab,
const wxString& aSignalName, int* aTraceType )
wxString SIMULATOR_FRAME_UI::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab,
const wxString& aSignalName,
int* aTraceType )
{
std::map<wxString, int> suffixes;
suffixes[ _( " (amplitude)" ) ] = SPT_SP_AMP;
@ -985,7 +986,7 @@ wxString SIMULATOR_PANEL::vectorNameFromSignalName( SIM_PLOT_TAB* aPlotTab,
};
void SIMULATOR_PANEL::onSignalsGridCellChanged( wxGridEvent& aEvent )
void SIMULATOR_FRAME_UI::onSignalsGridCellChanged( wxGridEvent& aEvent )
{
if( m_SuppressGridEvents > 0 )
return;
@ -1043,7 +1044,7 @@ void SIMULATOR_PANEL::onSignalsGridCellChanged( wxGridEvent& aEvent )
}
void SIMULATOR_PANEL::onCursorsGridCellChanged( wxGridEvent& aEvent )
void SIMULATOR_FRAME_UI::onCursorsGridCellChanged( wxGridEvent& aEvent )
{
if( m_SuppressGridEvents > 0 )
return;
@ -1091,7 +1092,7 @@ void SIMULATOR_PANEL::onCursorsGridCellChanged( wxGridEvent& aEvent )
}
SPICE_VALUE_FORMAT SIMULATOR_PANEL::GetMeasureFormat( int aRow ) const
SPICE_VALUE_FORMAT SIMULATOR_FRAME_UI::GetMeasureFormat( int aRow ) const
{
SPICE_VALUE_FORMAT result;
result.FromString( m_measurementsGrid->GetCellValue( aRow, COL_MEASUREMENT_FORMAT ) );
@ -1099,14 +1100,14 @@ SPICE_VALUE_FORMAT SIMULATOR_PANEL::GetMeasureFormat( int aRow ) const
}
void SIMULATOR_PANEL::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat )
void SIMULATOR_FRAME_UI::SetMeasureFormat( int aRow, const SPICE_VALUE_FORMAT& aFormat )
{
m_measurementsGrid->SetCellValue( aRow, COL_MEASUREMENT_FORMAT, aFormat.ToString() );
m_simulatorFrame->OnModify();
}
void SIMULATOR_PANEL::DeleteMeasurement( int aRow )
void SIMULATOR_FRAME_UI::DeleteMeasurement( int aRow )
{
if( aRow < ( m_measurementsGrid->GetNumberRows() - 1 ) )
{
@ -1116,7 +1117,7 @@ void SIMULATOR_PANEL::DeleteMeasurement( int aRow )
}
void SIMULATOR_PANEL::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
void SIMULATOR_FRAME_UI::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
{
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
@ -1176,7 +1177,7 @@ void SIMULATOR_PANEL::onMeasurementsGridCellChanged( wxGridEvent& aEvent )
* we want to show:
* 15W
*/
void SIMULATOR_PANEL::UpdateMeasurement( int aRow )
void SIMULATOR_FRAME_UI::UpdateMeasurement( int aRow )
{
static wxRegEx measureParamsRegEx( wxT( "^"
" *"
@ -1271,7 +1272,7 @@ void SIMULATOR_PANEL::UpdateMeasurement( int aRow )
}
void SIMULATOR_PANEL::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol )
void SIMULATOR_FRAME_UI::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol )
{
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
@ -1308,7 +1309,7 @@ void SIMULATOR_PANEL::AddTuner( const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aS
}
void SIMULATOR_PANEL::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol,
void SIMULATOR_FRAME_UI::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const KIID& aSymbol,
const wxString& aRef, const wxString& aValue )
{
SCH_ITEM* item = aSheetPath.GetItem( aSymbol );
@ -1341,7 +1342,7 @@ void SIMULATOR_PANEL::UpdateTunerValue( const SCH_SHEET_PATH& aSheetPath, const
}
void SIMULATOR_PANEL::RemoveTuner( TUNER_SLIDER* aTuner )
void SIMULATOR_FRAME_UI::RemoveTuner( TUNER_SLIDER* aTuner )
{
m_tuners.remove( aTuner );
aTuner->Destroy();
@ -1350,7 +1351,7 @@ void SIMULATOR_PANEL::RemoveTuner( TUNER_SLIDER* aTuner )
}
void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd )
void SIMULATOR_FRAME_UI::AddMeasurement( const wxString& aCmd )
{
// -1 because the last one is for user input
for( int i = 0; i < m_measurementsGrid->GetNumberRows(); i++ )
@ -1393,7 +1394,7 @@ void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd )
}
void SIMULATOR_PANEL::DoFourier( const wxString& aSignal, const wxString& aFundamental )
void SIMULATOR_FRAME_UI::DoFourier( const wxString& aSignal, const wxString& aFundamental )
{
wxString cmd = wxString::Format( wxS( "fourier %s %s" ),
SPICE_VALUE( aFundamental ).ToSpiceString(),
@ -1403,13 +1404,13 @@ void SIMULATOR_PANEL::DoFourier( const wxString& aSignal, const wxString& aFunda
}
const NGSPICE_CIRCUIT_MODEL* SIMULATOR_PANEL::GetExporter() const
const SPICE_CIRCUIT_MODEL* SIMULATOR_FRAME_UI::GetExporter() const
{
return circuitModel().get();
}
void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
void SIMULATOR_FRAME_UI::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
{
if( !GetCurrentSimTab() )
{
@ -1418,7 +1419,7 @@ void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
return;
}
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimTab()->GetSimCommand() );
SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( GetCurrentSimTab()->GetSimCommand() );
if( simType == ST_UNKNOWN )
{
@ -1456,7 +1457,7 @@ void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
}
void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNewSignals )
void SIMULATOR_FRAME_UI::SetUserDefinedSignals( const std::map<int, wxString>& aNewSignals )
{
for( size_t ii = 0; ii < m_plotNotebook->GetPageCount(); ++ii )
{
@ -1527,10 +1528,10 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNew
}
void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType,
void SIMULATOR_FRAME_UI::updateTrace( const wxString& aVectorName, int aTraceType,
SIM_PLOT_TAB* aPlotTab )
{
SIM_TYPE simType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( aPlotTab->GetSimCommand() );
SIM_TYPE simType = SPICE_CIRCUIT_MODEL::CommandToSimType( aPlotTab->GetSimCommand() );
aTraceType &= aTraceType & SPT_Y_AXIS_MASK;
aTraceType |= getXAxisType( simType );
@ -1637,7 +1638,7 @@ void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType,
}
void SIMULATOR_PANEL::updateSignalsGrid()
void SIMULATOR_FRAME_UI::updateSignalsGrid()
{
SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() );
@ -1705,7 +1706,7 @@ void SIMULATOR_PANEL::updateSignalsGrid()
}
void SIMULATOR_PANEL::applyUserDefinedSignals()
void SIMULATOR_FRAME_UI::applyUserDefinedSignals()
{
auto quoteNetNames =
[&]( wxString aExpression ) -> wxString
@ -1726,7 +1727,7 @@ void SIMULATOR_PANEL::applyUserDefinedSignals()
}
void SIMULATOR_PANEL::applyTuners()
void SIMULATOR_FRAME_UI::applyTuners()
{
wxString errors;
WX_STRING_REPORTER reporter( &errors );
@ -1763,7 +1764,7 @@ void SIMULATOR_PANEL::applyTuners()
}
void SIMULATOR_PANEL::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace,
void SIMULATOR_FRAME_UI::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace,
const wxString& aSignalName, const wxString& aParams )
{
auto addCursor =
@ -1838,7 +1839,7 @@ void SIMULATOR_PANEL::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace,
}
bool SIMULATOR_PANEL::LoadWorkbook( const wxString& aPath )
bool SIMULATOR_FRAME_UI::LoadWorkbook( const wxString& aPath )
{
m_plotNotebook->DeleteAllPages();
@ -2092,7 +2093,7 @@ bool SIMULATOR_PANEL::LoadWorkbook( const wxString& aPath )
}
bool SIMULATOR_PANEL::SaveWorkbook( const wxString& aPath )
bool SIMULATOR_FRAME_UI::SaveWorkbook( const wxString& aPath )
{
wxFileName filename = aPath;
filename.SetExt( WorkbookFileExtension );
@ -2259,7 +2260,7 @@ bool SIMULATOR_PANEL::SaveWorkbook( const wxString& aPath )
}
SIM_TRACE_TYPE SIMULATOR_PANEL::getXAxisType( SIM_TYPE aType ) const
SIM_TRACE_TYPE SIMULATOR_FRAME_UI::getXAxisType( SIM_TYPE aType ) const
{
switch( aType )
{
@ -2275,7 +2276,7 @@ SIM_TRACE_TYPE SIMULATOR_PANEL::getXAxisType( SIM_TYPE aType ) const
}
wxString SIMULATOR_PANEL::getNoiseSource() const
wxString SIMULATOR_FRAME_UI::getNoiseSource() const
{
wxString output;
wxString ref;
@ -2296,7 +2297,7 @@ wxString SIMULATOR_PANEL::getNoiseSource() const
}
void SIMULATOR_PANEL::ToggleDarkModePlots()
void SIMULATOR_FRAME_UI::ToggleDarkModePlots()
{
m_darkMode = !m_darkMode;
@ -2318,12 +2319,12 @@ void SIMULATOR_PANEL::ToggleDarkModePlots()
}
void SIMULATOR_PANEL::onPlotClose( wxAuiNotebookEvent& event )
void SIMULATOR_FRAME_UI::onPlotClose( wxAuiNotebookEvent& event )
{
}
void SIMULATOR_PANEL::onPlotClosed( wxAuiNotebookEvent& event )
void SIMULATOR_FRAME_UI::onPlotClosed( wxAuiNotebookEvent& event )
{
CallAfter( [this]()
{
@ -2344,7 +2345,7 @@ void SIMULATOR_PANEL::onPlotClosed( wxAuiNotebookEvent& event )
}
void SIMULATOR_PANEL::onPlotChanging( wxAuiNotebookEvent& event )
void SIMULATOR_FRAME_UI::onPlotChanging( wxAuiNotebookEvent& event )
{
if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() ) )
{
@ -2366,7 +2367,7 @@ void SIMULATOR_PANEL::onPlotChanging( wxAuiNotebookEvent& event )
}
void SIMULATOR_PANEL::OnPlotSettingsChanged()
void SIMULATOR_FRAME_UI::OnPlotSettingsChanged()
{
rebuildSignalsList();
rebuildSignalsGrid( m_filter->GetValue() );
@ -2379,7 +2380,7 @@ void SIMULATOR_PANEL::OnPlotSettingsChanged()
}
void SIMULATOR_PANEL::onPlotChanged( wxAuiNotebookEvent& event )
void SIMULATOR_FRAME_UI::onPlotChanged( wxAuiNotebookEvent& event )
{
if( SIM_TAB* simTab = GetCurrentSimTab() )
simulator()->Command( "setplot " + simTab->GetSpicePlotName().ToStdString() );
@ -2390,7 +2391,7 @@ void SIMULATOR_PANEL::onPlotChanged( wxAuiNotebookEvent& event )
}
void SIMULATOR_PANEL::rebuildMeasurementsGrid()
void SIMULATOR_FRAME_UI::rebuildMeasurementsGrid()
{
m_measurementsGrid->ClearRows();
@ -2413,31 +2414,31 @@ void SIMULATOR_PANEL::rebuildMeasurementsGrid()
}
void SIMULATOR_PANEL::onPlotDragged( wxAuiNotebookEvent& event )
void SIMULATOR_FRAME_UI::onPlotDragged( wxAuiNotebookEvent& event )
{
}
void SIMULATOR_PANEL::onNotebookModified( wxCommandEvent& event )
void SIMULATOR_FRAME_UI::onNotebookModified( wxCommandEvent& event )
{
m_simulatorFrame->OnModify();
m_simulatorFrame->UpdateTitle();
}
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR_PANEL::simulator() const
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR_FRAME_UI::simulator() const
{
return m_simulatorFrame->GetSimulator();
}
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> SIMULATOR_PANEL::circuitModel() const
std::shared_ptr<SPICE_CIRCUIT_MODEL> SIMULATOR_FRAME_UI::circuitModel() const
{
return m_simulatorFrame->GetCircuitModel();
}
void SIMULATOR_PANEL::updatePlotCursors()
void SIMULATOR_FRAME_UI::updatePlotCursors()
{
SUPPRESS_GRID_CELL_EVENTS raii( this );
@ -2572,14 +2573,14 @@ void SIMULATOR_PANEL::updatePlotCursors()
}
void SIMULATOR_PANEL::onPlotCursorUpdate( wxCommandEvent& aEvent )
void SIMULATOR_FRAME_UI::onPlotCursorUpdate( wxCommandEvent& aEvent )
{
updatePlotCursors();
m_simulatorFrame->OnModify();
}
void SIMULATOR_PANEL::OnSimUpdate()
void SIMULATOR_FRAME_UI::OnSimUpdate()
{
if( SIM_PLOT_TAB* plotTab = dynamic_cast<SIM_PLOT_TAB*>( GetCurrentSimTab() ) )
plotTab->ResetScales( true );
@ -2593,14 +2594,14 @@ void SIMULATOR_PANEL::OnSimUpdate()
}
void SIMULATOR_PANEL::OnSimReport( const wxString& aMsg )
void SIMULATOR_FRAME_UI::OnSimReport( const wxString& aMsg )
{
m_simConsole->AppendText( aMsg + "\n" );
m_simConsole->SetInsertionPointEnd();
}
std::vector<wxString> SIMULATOR_PANEL::SimPlotVectors() const
std::vector<wxString> SIMULATOR_FRAME_UI::SimPlotVectors() const
{
std::vector<wxString> signals;
@ -2611,7 +2612,7 @@ std::vector<wxString> SIMULATOR_PANEL::SimPlotVectors() const
}
std::vector<wxString> SIMULATOR_PANEL::Signals() const
std::vector<wxString> SIMULATOR_FRAME_UI::Signals() const
{
std::vector<wxString> signals;
@ -2625,7 +2626,7 @@ std::vector<wxString> SIMULATOR_PANEL::Signals() const
}
void SIMULATOR_PANEL::OnSimRefresh( bool aFinal )
void SIMULATOR_FRAME_UI::OnSimRefresh( bool aFinal )
{
SIM_TAB* simTab = GetCurrentSimTab();

View File

@ -25,11 +25,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef SIMULATOR_PANEL_H
#define SIMULATOR_PANEL_H
#ifndef SIMULATOR_FRAME_UI_H
#define SIMULATOR_FRAME_UI_H
#include <sim/simulator_panel_base.h>
#include <sim/simulator_frame_ui_base.h>
#include <sim/sim_types.h>
#include <sim/sim_plot_tab.h>
@ -39,9 +39,9 @@ class SCH_EDIT_FRAME;
class SCH_SYMBOL;
class SPICE_SIMULATOR;
class SPICE_SIMULATOR_SETTINGS;
class SPICE_SETTINGS;
class EESCHEMA_SETTINGS;
class NGSPICE_CIRCUIT_MODEL;
class SPICE_CIRCUIT_MODEL;
class SIM_THREAD_REPORTER;
class TUNER_SLIDER;
@ -49,7 +49,7 @@ class TUNER_SLIDER;
/**
*
* The SIMULATOR_PANEL holds the main user-interface for running simulations.
* The SIMULATOR_FRAME_UI holds the main user-interface for running simulations.
*
* It contains a workbook with multiple tabs, each tab holding a SIM_PLOT_TAB, a specific
* simulation command (.TRAN, .AC, etc.), and simulation settings (save all currents, etc.).
@ -66,11 +66,11 @@ class TUNER_SLIDER;
*/
class SIMULATOR_PANEL : public SIMULATOR_PANEL_BASE
class SIMULATOR_FRAME_UI : public SIMULATOR_FRAME_UI_BASE
{
public:
SIMULATOR_PANEL( SIMULATOR_FRAME* aSimulatorFrame, SCH_EDIT_FRAME* aSchematicFrame );
~SIMULATOR_PANEL();
SIMULATOR_FRAME_UI( SIMULATOR_FRAME* aSimulatorFrame, SCH_EDIT_FRAME* aSchematicFrame );
~SIMULATOR_FRAME_UI();
/**
* Create a new simulation tab for a given simulation type.
@ -160,7 +160,7 @@ public:
/**
* Return the netlist exporter object used for simulations.
*/
const NGSPICE_CIRCUIT_MODEL* GetExporter() const;
const SPICE_CIRCUIT_MODEL* GetExporter() const;
bool DarkModePlots() const { return m_darkMode; }
void ToggleDarkModePlots();
@ -290,7 +290,7 @@ private:
const wxString& aParams );
std::shared_ptr<SPICE_SIMULATOR> simulator() const;
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> circuitModel() const;
std::shared_ptr<SPICE_CIRCUIT_MODEL> circuitModel() const;
// Event handlers
void onPlotClose( wxAuiNotebookEvent& event ) override;
@ -338,4 +338,4 @@ private:
wxTimer m_refreshTimer;
};
#endif // SIMULATOR_PANEL_H
#endif // SIMULATOR_FRAME_UI_H

View File

@ -7,18 +7,18 @@
#include "widgets/wx_grid.h"
#include "simulator_panel_base.h"
#include "simulator_frame_ui_base.h"
///////////////////////////////////////////////////////////////////////////
SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
SIMULATOR_FRAME_UI_BASE::SIMULATOR_FRAME_UI_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* sizerMain;
sizerMain = new wxBoxSizer( wxVERTICAL );
m_splitterLeftRight = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterLeftRight->SetSashGravity( 0.7 );
m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterLeftRightOnIdle ), NULL, this );
m_splitterLeftRight->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterLeftRightOnIdle ), NULL, this );
m_splitterLeftRight->SetMinimumPaneSize( 50 );
m_panelLeft = new wxPanel( m_splitterLeftRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -28,7 +28,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con
m_splitterPlotAndConsole = new wxSplitterWindow( m_panelLeft, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitterPlotAndConsole->SetSashGravity( 0.8 );
m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
m_splitterPlotAndConsole->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
m_splitterPlotAndConsole->SetMinimumPaneSize( 50 );
m_plotPanel = new wxPanel( m_splitterPlotAndConsole, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -75,7 +75,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con
m_splitterSignals = new wxSplitterWindow( m_sidePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitterSignals->SetSashGravity( 0.5 );
m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterSignalsOnIdle ), NULL, this );
m_splitterSignals->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterSignalsOnIdle ), NULL, this );
m_splitterSignals->SetMinimumPaneSize( 20 );
m_panelSignals = new wxPanel( m_splitterSignals, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -139,7 +139,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con
m_splitterCursors = new wxSplitterWindow( m_panelCMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterCursors->SetSashGravity( 0.2 );
m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterCursorsOnIdle ), NULL, this );
m_splitterCursors->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterCursorsOnIdle ), NULL, this );
m_splitterCursors->SetMinimumPaneSize( 20 );
m_panelCursors = new wxPanel( m_splitterCursors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -194,7 +194,7 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con
m_splitterMeasurements = new wxSplitterWindow( m_panelMT, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE|wxBORDER_NONE );
m_splitterMeasurements->SetSashGravity( 0.2 );
m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
m_splitterMeasurements->Connect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
m_splitterMeasurements->SetMinimumPaneSize( 20 );
m_panelMeasurements = new wxPanel( m_splitterMeasurements, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
@ -278,30 +278,30 @@ SIMULATOR_PANEL_BASE::SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id, con
sizerMain->Fit( this );
// Connect Events
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanging ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClosed ), NULL, this );
m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_PANEL_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_PANEL_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onMeasurementsGridCellChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanging ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClosed ), NULL, this );
m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onMeasurementsGridCellChanged ), NULL, this );
}
SIMULATOR_PANEL_BASE::~SIMULATOR_PANEL_BASE()
SIMULATOR_FRAME_UI_BASE::~SIMULATOR_FRAME_UI_BASE()
{
// Disconnect Events
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotChanging ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_PANEL_BASE::onPlotClosed ), NULL, this );
m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_PANEL_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_PANEL_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_PANEL_BASE::onMeasurementsGridCellChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotDragged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanged ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotChanging ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClose ), NULL, this );
m_plotNotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEventHandler( SIMULATOR_FRAME_UI_BASE::onPlotClosed ), NULL, this );
m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterMouseMoved ), NULL, this );
m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( SIMULATOR_FRAME_UI_BASE::OnFilterText ), NULL, this );
m_signalsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onSignalsGridCellChanged ), NULL, this );
m_cursorsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onCursorsGridCellChanged ), NULL, this );
m_measurementsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( SIMULATOR_FRAME_UI_BASE::onMeasurementsGridCellChanged ), NULL, this );
}

View File

@ -11,13 +11,13 @@
<property name="embedded_files_path">.</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">simulator_panel_base</property>
<property name="file">simulator_frame_ui_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">SIMULATOR_PANEL_BASE</property>
<property name="name">SIMULATOR_FRAME_UI_BASE</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -43,7 +43,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">SIMULATOR_PANEL_BASE</property>
<property name="name">SIMULATOR_FRAME_UI_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="subclass">; ; forward_declare</property>

View File

@ -30,9 +30,9 @@ class WX_GRID;
///////////////////////////////////////////////////////////////////////////////
/// Class SIMULATOR_PANEL_BASE
/// Class SIMULATOR_FRAME_UI_BASE
///////////////////////////////////////////////////////////////////////////////
class SIMULATOR_PANEL_BASE : public wxPanel
class SIMULATOR_FRAME_UI_BASE : public wxPanel
{
private:
@ -79,38 +79,38 @@ class SIMULATOR_PANEL_BASE : public wxPanel
public:
SIMULATOR_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
SIMULATOR_FRAME_UI_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~SIMULATOR_PANEL_BASE();
~SIMULATOR_FRAME_UI_BASE();
void m_splitterLeftRightOnIdle( wxIdleEvent& )
{
m_splitterLeftRight->SetSashPosition( 700 );
m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterLeftRightOnIdle ), NULL, this );
m_splitterLeftRight->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterLeftRightOnIdle ), NULL, this );
}
void m_splitterPlotAndConsoleOnIdle( wxIdleEvent& )
{
m_splitterPlotAndConsole->SetSashPosition( 500 );
m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
m_splitterPlotAndConsole->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterPlotAndConsoleOnIdle ), NULL, this );
}
void m_splitterSignalsOnIdle( wxIdleEvent& )
{
m_splitterSignals->SetSashPosition( 0 );
m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterSignalsOnIdle ), NULL, this );
m_splitterSignals->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterSignalsOnIdle ), NULL, this );
}
void m_splitterCursorsOnIdle( wxIdleEvent& )
{
m_splitterCursors->SetSashPosition( 0 );
m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterCursorsOnIdle ), NULL, this );
m_splitterCursors->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterCursorsOnIdle ), NULL, this );
}
void m_splitterMeasurementsOnIdle( wxIdleEvent& )
{
m_splitterMeasurements->SetSashPosition( 0 );
m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_PANEL_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
m_splitterMeasurements->Disconnect( wxEVT_IDLE, wxIdleEventHandler( SIMULATOR_FRAME_UI_BASE::m_splitterMeasurementsOnIdle ), NULL, this );
}
};

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -22,12 +23,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef SPICE_REPORTER_H
#define SPICE_REPORTER_H
#ifndef SIM_REPORTER_H
#define SIM_REPORTER_H
#include <reporter.h>
class SPICE_SIMULATOR;
class SIMULATOR;
enum SIM_STATE
{
@ -38,14 +39,14 @@ enum SIM_STATE
/**
* @brief Interface to receive simulation updates from SPICE_SIMULATOR class.
*/
class SPICE_REPORTER : public REPORTER
class SIMULATOR_REPORTER : public REPORTER
{
public:
virtual ~SPICE_REPORTER()
virtual ~SIMULATOR_REPORTER()
{
}
virtual void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) = 0;
virtual void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) = 0;
};
#endif /* SPICE_REPORTER_H */
#endif /* SIM_REPORTER_H */

View File

@ -23,14 +23,14 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "ngspice_circuit_model.h"
#include "spice_circuit_model.h"
#include <macros.h> // for TO_UTF8 def
#include <wx/regex.h>
#include <wx/tokenzr.h>
#include <locale_io.h>
SIM_TRACE_TYPE NGSPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector,
SIM_TRACE_TYPE SPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector,
wxString& aSignal ) const
{
static wxString BRANCH( wxS( "#branch" ) );
@ -72,7 +72,7 @@ SIM_TRACE_TYPE NGSPICE_CIRCUIT_MODEL::VectorToSignal( const std::string& aVector
}
wxString NGSPICE_CIRCUIT_MODEL::GetSchTextSimCommand()
wxString SPICE_CIRCUIT_MODEL::GetSchTextSimCommand()
{
wxString simCmd;
@ -88,7 +88,7 @@ wxString NGSPICE_CIRCUIT_MODEL::GetSchTextSimCommand()
}
SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd )
SIM_TYPE SPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd )
{
wxString cmd = aCmd.Lower().Trim();
@ -107,7 +107,7 @@ SIM_TYPE NGSPICE_CIRCUIT_MODEL::CommandToSimType( const wxString& aCmd )
}
bool NGSPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1,
bool SPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1,
SPICE_DC_PARAMS* aSource2 )
{
if( !aCmd.Lower().StartsWith( ".dc" ) )
@ -130,10 +130,9 @@ bool NGSPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAM
}
bool NGSPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* transferFunction,
wxString* input, wxString* inputRef,
wxString* output, wxString* outputRef,
SPICE_PZ_ANALYSES* analyses )
bool SPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* transferFunction,
wxString* input, wxString* inputRef, wxString* output,
wxString* outputRef, SPICE_PZ_ANALYSES* analyses )
{
if( !aCmd.Lower().StartsWith( wxS( ".pz" ) ) )
return false;
@ -172,7 +171,7 @@ bool NGSPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* tran
return true;
}
bool NGSPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOutput,
bool SPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOutput,
wxString* aRef, wxString* aSource, wxString* aScale,
SPICE_VALUE* aPts, SPICE_VALUE* aFStart,
SPICE_VALUE* aFStop, bool* aSaveAll )
@ -237,7 +236,7 @@ bool NGSPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* a
}
void NGSPICE_CIRCUIT_MODEL::WriteDirectives( const wxString& aSimCommand, unsigned aSimOptions,
void SPICE_CIRCUIT_MODEL::WriteDirectives( const wxString& aSimCommand, unsigned aSimOptions,
OUTPUTFORMATTER& aFormatter ) const
{
if( aSimCommand.IsEmpty() )

View File

@ -24,8 +24,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef NGSPICE_CIRCUIT_MODEL_H
#define NGSPICE_CIRCUIT_MODEL_H
#ifndef SPICE_CIRCUIT_MODEL_H
#define SPICE_CIRCUIT_MODEL_H
#include <netlist_exporters/netlist_exporter_spice.h>
#include <vector>
@ -51,14 +51,14 @@ struct SPICE_PZ_ANALYSES
};
/// Special netlist exporter flavor that allows one to override simulation commands
class NGSPICE_CIRCUIT_MODEL : public NETLIST_EXPORTER_SPICE, public SIMULATION_MODEL
class SPICE_CIRCUIT_MODEL : public NETLIST_EXPORTER_SPICE, public SIMULATION_MODEL
{
public:
NGSPICE_CIRCUIT_MODEL( SCHEMATIC_IFACE* aSchematic, wxWindow* aDialogParent = nullptr ) :
SPICE_CIRCUIT_MODEL( SCHEMATIC_IFACE* aSchematic, wxWindow* aDialogParent = nullptr ) :
NETLIST_EXPORTER_SPICE( aSchematic, aDialogParent )
{}
virtual ~NGSPICE_CIRCUIT_MODEL() {}
virtual ~SPICE_CIRCUIT_MODEL() {}
/**
* Return name of Spice dataset for a specific trace.
@ -70,11 +70,10 @@ public:
*/
SIM_TRACE_TYPE VectorToSignal( const std::string& aVector, wxString& aSignal ) const;
bool GetNetlist( const wxString& aSimCommand, unsigned aSimOptions,
OUTPUTFORMATTER* aFormatter, REPORTER& aReporter )
bool GetNetlist( const wxString& aCommand, unsigned aOptions, OUTPUTFORMATTER* aFormatter,
REPORTER& aReporter )
{
return NGSPICE_CIRCUIT_MODEL::DoWriteNetlist( aSimCommand, aSimOptions, *aFormatter,
aReporter );
return SPICE_CIRCUIT_MODEL::DoWriteNetlist( aCommand, aOptions, *aFormatter, aReporter );
}
/**
@ -117,4 +116,4 @@ protected:
OUTPUTFORMATTER& aFormatter ) const override;
};
#endif /* NGSPICE_CIRCUIT_MODEL_H */
#endif /* SPICE_CIRCUIT_MODEL_H */

View File

@ -31,8 +31,7 @@
const int spiceSettingsSchemaVersion = 0;
SPICE_SIMULATOR_SETTINGS::SPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent,
const std::string& aPath ) :
SPICE_SETTINGS::SPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
NESTED_SETTINGS( "simulator", spiceSettingsSchemaVersion, aParent, aPath ),
m_fixIncludePaths( true )
{
@ -41,32 +40,29 @@ SPICE_SIMULATOR_SETTINGS::SPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent,
}
bool SPICE_SIMULATOR_SETTINGS::operator==( const SPICE_SIMULATOR_SETTINGS &aRhs ) const
bool SPICE_SETTINGS::operator==( const SPICE_SETTINGS&aRhs ) const
{
return m_workbookFilename == aRhs.m_workbookFilename
&& m_fixIncludePaths == aRhs.m_fixIncludePaths;
}
NGSPICE_SIMULATOR_SETTINGS::NGSPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent,
const std::string& aPath ) :
SPICE_SIMULATOR_SETTINGS( aParent, aPath ),
m_modelMode( NGSPICE_MODEL_MODE::LT_PSPICE )
NGSPICE_SETTINGS::NGSPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
SPICE_SETTINGS( aParent, aPath ),
m_compatibilityMode( NGSPICE_COMPATIBILITY_MODE::LT_PSPICE )
{
m_params.emplace_back( new PARAM_ENUM<NGSPICE_MODEL_MODE>( "model_mode", &m_modelMode,
NGSPICE_MODEL_MODE::LT_PSPICE,
NGSPICE_MODEL_MODE::USER_CONFIG,
NGSPICE_MODEL_MODE::HSPICE ) );
m_params.emplace_back( new PARAM_ENUM<NGSPICE_COMPATIBILITY_MODE>( "model_mode",
&m_compatibilityMode, NGSPICE_COMPATIBILITY_MODE::LT_PSPICE,
NGSPICE_COMPATIBILITY_MODE::USER_CONFIG, NGSPICE_COMPATIBILITY_MODE::HSPICE ) );
}
bool NGSPICE_SIMULATOR_SETTINGS::operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const
bool NGSPICE_SETTINGS::operator==( const SPICE_SETTINGS& aRhs ) const
{
const NGSPICE_SIMULATOR_SETTINGS* settings =
dynamic_cast<const NGSPICE_SIMULATOR_SETTINGS*>( &aRhs );
const NGSPICE_SETTINGS* settings = dynamic_cast<const NGSPICE_SETTINGS*>( &aRhs );
wxCHECK( settings, false );
return ( *static_cast<const SPICE_SIMULATOR_SETTINGS*>( this ) ) == aRhs
&& m_modelMode == settings->m_modelMode;
return SPICE_SETTINGS::operator==( aRhs )
&& m_compatibilityMode == settings->m_compatibilityMode;
}

View File

@ -33,16 +33,16 @@
/**
* Storage for simulator specific settings.
*/
class SPICE_SIMULATOR_SETTINGS : public NESTED_SETTINGS
class SPICE_SETTINGS : public NESTED_SETTINGS
{
public:
SPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
SPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
virtual ~SPICE_SIMULATOR_SETTINGS() {}
virtual ~SPICE_SETTINGS() {}
virtual bool operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const = 0;
virtual bool operator==( const SPICE_SETTINGS& aRhs ) const = 0;
bool operator!=( const SPICE_SIMULATOR_SETTINGS& aRhs ) const { return !( *this == aRhs ); }
bool operator!=( const SPICE_SETTINGS& aRhs ) const { return !( *this == aRhs ); }
wxString GetWorkbookFilename() const { return m_workbookFilename; }
void SetWorkbookFilename( const wxString& aFilename ) { m_workbookFilename = aFilename; }
@ -59,11 +59,12 @@ private:
};
/**
* Ngspice simulator model compatibility modes.
* Ngspice simulator compatibility modes.
*
* @note The ngspice model modes are mutually exclusive.
*/
enum class NGSPICE_MODEL_MODE {
enum class NGSPICE_COMPATIBILITY_MODE
{
USER_CONFIG,
NGSPICE,
PSPICE,
@ -76,19 +77,19 @@ enum class NGSPICE_MODEL_MODE {
/**
* Container for Ngspice simulator settings.
*/
class NGSPICE_SIMULATOR_SETTINGS : public SPICE_SIMULATOR_SETTINGS
class NGSPICE_SETTINGS : public SPICE_SETTINGS
{
public:
NGSPICE_SIMULATOR_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
virtual ~NGSPICE_SIMULATOR_SETTINGS() {}
NGSPICE_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath );
virtual ~NGSPICE_SETTINGS() {}
bool operator==( const SPICE_SIMULATOR_SETTINGS& aRhs ) const override;
bool operator==( const SPICE_SETTINGS& aRhs ) const override;
NGSPICE_MODEL_MODE GetModelMode() const { return m_modelMode; }
void SetModelMode( NGSPICE_MODEL_MODE aMode ) { m_modelMode = aMode; }
NGSPICE_COMPATIBILITY_MODE GetCompatibilityMode() const { return m_compatibilityMode; }
void SetCompatibilityMode( NGSPICE_COMPATIBILITY_MODE aMode ) { m_compatibilityMode = aMode; }
private:
NGSPICE_MODEL_MODE m_modelMode;
NGSPICE_COMPATIBILITY_MODE m_compatibilityMode;
};

View File

@ -39,7 +39,7 @@
#include <wx/string.h>
class SPICE_REPORTER;
class SIMULATOR_REPORTER;
typedef std::complex<double> COMPLEX;
@ -61,7 +61,7 @@ public:
* @param aSettings [in] are the simulator specific settings. Can be null if no settings need
* to be initialized.
*/
virtual void Init( const SPICE_SIMULATOR_SETTINGS* aSettings = nullptr ) = 0;
virtual void Init( const SPICE_SETTINGS* aSettings = nullptr ) = 0;
/**
* Load a netlist for the simulation.
@ -80,8 +80,8 @@ public:
///< Return X axis name for a given simulation type
virtual wxString GetXAxis( SIM_TYPE aType ) const = 0;
///< Set a #SPICE_REPORTER object to receive the simulation log.
virtual void SetReporter( SPICE_REPORTER* aReporter )
///< Set a #SIMULATOR_REPORTER object to receive the simulation log.
virtual void SetReporter( SIMULATOR_REPORTER* aReporter )
{
m_reporter = aReporter;
}
@ -166,9 +166,9 @@ public:
*
* @return the simulator specific settings.
*/
std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& Settings() { return m_settings; }
std::shared_ptr<SPICE_SETTINGS>& Settings() { return m_settings; }
const std::shared_ptr<SPICE_SIMULATOR_SETTINGS>& Settings() const { return m_settings; }
const std::shared_ptr<SPICE_SETTINGS>& Settings() const { return m_settings; }
/**
* Return a string with simulation name based on enum.
@ -182,10 +182,10 @@ public:
protected:
///< Reporter object to receive simulation log.
SPICE_REPORTER* m_reporter;
SIMULATOR_REPORTER* m_reporter;
///< We don't own this. We are just borrowing it from the #SCHEMATIC_SETTINGS.
std::shared_ptr<SPICE_SIMULATOR_SETTINGS> m_settings;
std::shared_ptr<SPICE_SETTINGS> m_settings;
};
#endif /* SPICE_SIMULATOR_H */

View File

@ -28,7 +28,7 @@
#include <tool/tool_interactive.h>
class SIMULATOR_FRAME;
class NGSPICE_CIRCUIT_MODEL;
class SPICE_CIRCUIT_MODEL;
class SPICE_SIMULATOR;
class SIM_TAB;
@ -93,7 +93,7 @@ private:
private:
SIMULATOR_FRAME* m_simulatorFrame;
SCH_EDIT_FRAME* m_schematicFrame;
std::shared_ptr<NGSPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_CIRCUIT_MODEL> m_circuitModel;
std::shared_ptr<SPICE_SIMULATOR> m_simulator;
};

View File

@ -25,7 +25,7 @@
*/
#include <sim/simulator_panel.h>
#include <sim/simulator_frame_ui.h>
#include <sim/simulator_frame.h>
#include <sch_symbol.h>
#include <template_fieldnames.h>
@ -39,18 +39,18 @@
#include "tuner_slider.h"
#include "core/kicad_algo.h"
TUNER_SLIDER::TUNER_SLIDER( SIMULATOR_PANEL* aPanel, wxWindow* aParent,
TUNER_SLIDER::TUNER_SLIDER( SIMULATOR_FRAME_UI* aFrame, wxWindow* aParent,
const SCH_SHEET_PATH& aSheetPath, SCH_SYMBOL* aSymbol ) :
TUNER_SLIDER_BASE( aParent ),
TUNER_SLIDER_BASE( aFrame ),
m_symbol( aSymbol->m_Uuid ),
m_sheetPath( aSheetPath ),
m_ref( aSymbol->GetRef( &aSheetPath ) ),
m_min( 0.0 ),
m_max( 0.0 ),
m_value( 0.0 ),
m_panel( aPanel )
m_frame( aFrame )
{
const SPICE_ITEM* item = m_panel->GetExporter()->FindItem( std::string( m_ref.ToUTF8() ) );
const SPICE_ITEM* item = m_frame->GetExporter()->FindItem( std::string( m_ref.ToUTF8() ) );
if( !item )
throw KI_PARAM_ERROR( wxString::Format( _( "%s not found" ), m_ref ) );
@ -191,7 +191,7 @@ bool TUNER_SLIDER::SetMax( const SPICE_VALUE& aVal )
void TUNER_SLIDER::updateComponentValue()
{
wxQueueEvent( m_panel, new wxCommandEvent( EVT_SIM_UPDATE ) );
wxQueueEvent( m_frame, new wxCommandEvent( EVT_SIM_UPDATE ) );
}
@ -334,13 +334,13 @@ void TUNER_SLIDER::updateMin()
void TUNER_SLIDER::onClose( wxCommandEvent& event )
{
m_panel->RemoveTuner( this );
m_frame->RemoveTuner( this );
}
void TUNER_SLIDER::onSave( wxCommandEvent& event )
{
m_panel->UpdateTunerValue( m_sheetPath, m_symbol, GetSymbolRef(), m_value.ToOrigString() );
m_frame->UpdateTunerValue( m_sheetPath, m_symbol, GetSymbolRef(), m_value.ToOrigString() );
}

View File

@ -34,7 +34,7 @@
#include <wx/timer.h>
class SIMULATOR_PANEL;
class SIMULATOR_FRAME_UI;
class SCH_SYMBOL;
/**
@ -43,7 +43,7 @@ class SCH_SYMBOL;
class TUNER_SLIDER : public TUNER_SLIDER_BASE
{
public:
TUNER_SLIDER( SIMULATOR_PANEL *aPanel, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath,
TUNER_SLIDER( SIMULATOR_FRAME_UI* aPanel, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath,
SCH_SYMBOL* aSymbol );
wxString GetSymbolRef() const
@ -110,7 +110,7 @@ private:
SPICE_VALUE m_max;
SPICE_VALUE m_value;
SIMULATOR_PANEL* m_panel;
SIMULATOR_FRAME_UI* m_frame;
};
#endif /* TUNER_SLIDER_H */

View File

@ -24,7 +24,7 @@
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/results_collector.hpp> // To check if the current test failed (to be moved?).
#include <test_netlist_exporter_spice.h>
#include <sim/spice_reporter.h>
#include <sim/simulator_reporter.h>
#include <mock_pgm_base.h>
#include <locale_io.h>

View File

@ -27,7 +27,7 @@
#include <eeschema_test_utils.h>
#include <netlist_exporter_spice.h>
#include <sim/ngspice.h>
#include <sim/spice_reporter.h>
#include <sim/simulator_reporter.h>
#include <wx/ffile.h>
#include <mock_pgm_base.h>
#include <locale_io.h>

View File

@ -24,7 +24,7 @@
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <boost/test/results_collector.hpp> // To check if the current test failed (to be moved?).
#include <test_netlist_exporter_spice.h>
#include <sim/spice_reporter.h>
#include <sim/simulator_reporter.h>
#include <mock_pgm_base.h>
#include <locale_io.h>

View File

@ -26,7 +26,7 @@
#include <eeschema_test_utils.h>
#include <netlist_exporter_spice.h>
#include <sim/ngspice.h>
#include <sim/spice_reporter.h>
#include <sim/simulator_reporter.h>
#include <wx/ffile.h>
#include <mock_pgm_base.h>
#include <locale_io.h>
@ -38,7 +38,7 @@
class TEST_NETLIST_EXPORTER_SPICE_FIXTURE : public TEST_NETLIST_EXPORTER_FIXTURE<NETLIST_EXPORTER_SPICE>
{
public:
class SPICE_TEST_REPORTER : public SPICE_REPORTER
class SPICE_TEST_REPORTER : public SIMULATOR_REPORTER
{
public:
SPICE_TEST_REPORTER( std::shared_ptr<wxString> aLog ) :
@ -56,7 +56,7 @@ public:
bool HasMessage() const override { return false; }
void OnSimStateChange( SPICE_SIMULATOR* aObject, SIM_STATE aNewState ) override { }
void OnSimStateChange( SIMULATOR* aObject, SIM_STATE aNewState ) override { }
private:
std::shared_ptr<wxString> m_log;

View File

@ -24,7 +24,7 @@
/**
* @file
* Test suite for NGSPICE_CIRCUIT_MODEL
* Test suite for SPICE_CIRCUIT_MODEL
*/
#include <string.h>
@ -36,7 +36,7 @@
#include <project.h>
#include <schematic.h>
#include <settings/settings_manager.h>
#include <sim/ngspice_circuit_model.h>
#include <sim/spice_circuit_model.h>
class TEST_NGSPICE_HELPERS
{
@ -59,7 +59,7 @@ public:
SCHEMATIC m_schematic;
NGSPICE_CIRCUIT_MODEL m_exporter;
SPICE_CIRCUIT_MODEL m_exporter;
};
@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE( CommandToSimType )
for( auto& step : testData )
{
SIM_TYPE result = NGSPICE_CIRCUIT_MODEL::CommandToSimType( step.command );
SIM_TYPE result = SPICE_CIRCUIT_MODEL::CommandToSimType( step.command );
BOOST_CHECK_EQUAL( result, step.type );
}
@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( CommandToSimType )
for( auto& step : testData )
{
step.command.Append( "\n" );
SIM_TYPE result = NGSPICE_CIRCUIT_MODEL::CommandToSimType( step.command );
SIM_TYPE result = SPICE_CIRCUIT_MODEL::CommandToSimType( step.command );
BOOST_CHECK_EQUAL( result, step.type );
}