ADDED Fourier analyses of .tran data.

This commit is contained in:
Jeff Young 2023-07-04 16:53:44 +01:00
parent e892405738
commit d563d66b86
9 changed files with 112 additions and 145 deletions

View File

@ -81,7 +81,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
bSizer82 = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 5, 0 );
gbSizer1 = new wxGridBagSizer( 4, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
@ -324,7 +324,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_pgNoise->SetSizer( bSizer15 );
m_pgNoise->Layout();
bSizer15->Fit( m_pgNoise );
m_simPages->AddPage( m_pgNoise, _("Noise"), true );
m_simPages->AddPage( m_pgNoise, _("Noise"), false );
m_pgOP = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
@ -361,79 +361,76 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
bSizer81 = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 0, 0 );
gbSizer2 = new wxGridBagSizer( 4, 0 );
gbSizer2->SetFlexibleDirection( wxBOTH );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer2->SetEmptyCellSize( wxSize( -1,8 ) );
m_timeLabel = new wxStaticText( m_pgTransient, wxID_ANY, _("Time step:"), wxDefaultPosition, wxDefaultSize, 0 );
m_timeLabel->Wrap( -1 );
gbSizer2->Add( m_timeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer2->Add( m_timeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transStep = new wxTextCtrl( m_pgTransient, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_transStep->SetMinSize( wxSize( 100,-1 ) );
gbSizer2->Add( m_transStep, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
gbSizer2->Add( m_transStep, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_timeUnits = new wxStaticText( m_pgTransient, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_timeUnits->Wrap( -1 );
gbSizer2->Add( m_timeUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer2->Add( m_timeUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transFinalLabel = new wxStaticText( m_pgTransient, wxID_ANY, _("Final time:"), wxDefaultPosition, wxDefaultSize, 0 );
m_transFinalLabel->Wrap( -1 );
gbSizer2->Add( m_transFinalLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transFinalLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transFinal = new wxTextCtrl( m_pgTransient, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_transFinal, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM, 5 );
gbSizer2->Add( m_transFinal, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_transFinalUnits = new wxStaticText( m_pgTransient, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_transFinalUnits->Wrap( -1 );
gbSizer2->Add( m_transFinalUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transFinalUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transInitialLabel = new wxStaticText( m_pgTransient, wxID_ANY, _("Initial time:"), wxDefaultPosition, wxDefaultSize, 0 );
m_transInitialLabel->Wrap( -1 );
gbSizer2->Add( m_transInitialLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transInitialLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transInitial = new wxTextCtrl( m_pgTransient, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_transInitial, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM, 5 );
gbSizer2->Add( m_transInitial, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_transInitialUnits = new wxStaticText( m_pgTransient, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_transInitialUnits->Wrap( -1 );
gbSizer2->Add( m_transInitialUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transInitialUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transInitialHelp = new wxStaticText( m_pgTransient, wxID_ANY, _("(optional; default 0)"), wxDefaultPosition, wxDefaultSize, 0 );
m_transInitialHelp->Wrap( -1 );
gbSizer2->Add( m_transInitialHelp, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transInitialHelp, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_maxStepLabel = new wxStaticText( m_pgTransient, wxID_ANY, _("Max time step:"), wxDefaultPosition, wxDefaultSize, 0 );
m_maxStepLabel->Wrap( -1 );
gbSizer2->Add( m_maxStepLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_maxStepLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transMaxStep = new wxTextCtrl( m_pgTransient, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_transMaxStep, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
gbSizer2->Add( m_transMaxStep, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_transMaxStepUnit = new wxStaticText( m_pgTransient, wxID_ANY, _("seconds"), wxDefaultPosition, wxDefaultSize, 0 );
m_transMaxStepUnit->Wrap( -1 );
gbSizer2->Add( m_transMaxStepUnit, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transMaxStepUnit, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_transMaxHelp = new wxStaticText( m_pgTransient, wxID_ANY, _("(optional; default min{tstep, (tstop-tstart)/50})"), wxDefaultPosition, wxDefaultSize, 0 );
m_transMaxHelp->Wrap( -1 );
gbSizer2->Add( m_transMaxHelp, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_transMaxHelp, wxGBPosition( 3, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_useInitialConditions = new wxCheckBox( m_pgTransient, wxID_ANY, _("Use initial conditions"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_useInitialConditions, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_useInitialConditionsHelp = new wxStaticText( m_pgTransient, wxID_ANY, _("(optional; default off)"), wxDefaultPosition, wxDefaultSize, 0 );
m_useInitialConditionsHelp->Wrap( -1 );
gbSizer2->Add( m_useInitialConditionsHelp, wxGBPosition( 4, 3 ), wxGBSpan( 1, 1 ), wxALL|wxALIGN_CENTER_VERTICAL, 5 );
gbSizer2->Add( m_useInitialConditions, wxGBPosition( 5, 0 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSizer81->Add( gbSizer2, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bSizer81->Add( gbSizer2, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_pgTransient->SetSizer( bSizer81 );
m_pgTransient->Layout();
bSizer81->Fit( m_pgTransient );
m_simPages->AddPage( m_pgTransient, _("Transient"), false );
m_simPages->AddPage( m_pgTransient, _("Transient"), true );
m_pgCustom = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );

View File

@ -847,7 +847,7 @@
<property name="name">gbSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="vgap">5</property>
<property name="vgap">4</property>
<object class="gbsizeritem" expanded="0">
<property name="border">5</property>
<property name="colspan">2</property>
@ -2505,7 +2505,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Noise</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -4023,7 +4023,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Transient</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -4082,24 +4082,24 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="empty_cell_size">-1,8</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">gbSizer2</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="vgap">0</property>
<property name="vgap">4</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4163,7 +4163,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@ -4230,7 +4230,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4294,7 +4294,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4358,7 +4358,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@ -4425,7 +4425,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4489,7 +4489,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4553,7 +4553,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="0">
@ -4620,7 +4620,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4684,7 +4684,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="0">
@ -4748,7 +4748,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
@ -4812,7 +4812,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="1">
@ -4879,7 +4879,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
@ -4943,7 +4943,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
@ -5007,8 +5007,8 @@
<property name="border">5</property>
<property name="colspan">3</property>
<property name="column">0</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">4</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="row">5</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -5070,70 +5070,6 @@
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">(optional; default off)</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_useInitialConditionsHelp</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
</object>

View File

@ -119,7 +119,6 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM
wxStaticText* m_transMaxStepUnit;
wxStaticText* m_transMaxHelp;
wxCheckBox* m_useInitialConditions;
wxStaticText* m_useInitialConditionsHelp;
wxPanel* m_pgCustom;
wxStaticText* m_staticText18;
wxTextCtrl* m_customTxt;

View File

@ -493,7 +493,7 @@ wxString SIM_PLOT_PANEL::GetUnitsY3() const
void SIM_PLOT_PANEL::updateAxes( int aNewTraceType )
{
switch( GetType() )
switch( GetSimType() )
{
case ST_AC:
if( !m_axis_x )
@ -755,7 +755,7 @@ TRACE* SIM_PLOT_PANEL::AddTrace( const wxString& aVectorName, int aType )
{
updateAxes( aType );
if( GetType() == ST_TRANSIENT || GetType() == ST_DC )
if( GetSimType() == ST_TRANSIENT || GetSimType() == ST_DC )
{
bool hasVoltageTraces = false;
@ -795,7 +795,7 @@ void SIM_PLOT_PANEL::SetTraceData( TRACE* trace, unsigned int aPoints, const dou
{
std::vector<double> tmp( aY, aY + aPoints );
if( GetType() == ST_AC )
if( GetSimType() == ST_AC )
{
if( trace->GetType() & SPT_AC_PHASE )
{

View File

@ -68,7 +68,7 @@ bool SIM_PLOT_PANEL_BASE::IsPlottable( SIM_TYPE aSimType )
}
SIM_TYPE SIM_PLOT_PANEL_BASE::GetType() const
SIM_TYPE SIM_PLOT_PANEL_BASE::GetSimType() const
{
return NGSPICE_CIRCUIT_MODEL::CommandToSimType( m_simCommand );
}

View File

@ -46,12 +46,12 @@ public:
virtual void OnLanguageChanged() = 0;
SIM_TYPE GetType() const;
SIM_TYPE GetSimType() const;
const wxString& GetSimCommand() const { return m_simCommand; }
void SetSimCommand( const wxString& aSimCommand )
{
wxCHECK_RET( GetType() == NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ),
wxCHECK_RET( GetSimType() == NGSPICE_CIRCUIT_MODEL::CommandToSimType( aSimCommand ),
"Cannot change the type of simulation of the existing plot panel" );
m_simCommand = aSimCommand;

View File

@ -384,7 +384,7 @@ void SIMULATOR_FRAME::StartSimulation()
{
m_circuitModel->SetSimCommandOverride( plotWindow->GetSimCommand() );
if( plotWindow->GetType() == schTextSimType
if( plotWindow->GetSimType() == schTextSimType
&& schTextSimCommand != m_circuitModel->GetLastSchTextSimCommand() )
{
if( IsOK( this, _( "Schematic sheet simulation command directive has changed. "
@ -554,7 +554,7 @@ bool SIMULATOR_FRAME::EditSimCommand()
}
// If it is a new simulation type, open a new plot. For the DC sim, check if sweep
// source type has changed (char 4 will contain 'v', 'i', 'r' or 't'.
else if( plotPanelWindow->GetType() != newSimType
else if( plotPanelWindow->GetSimType() != newSimType
|| ( newSimType == ST_DC
&& oldCommand.Lower().GetChar( 4 ) != newCommand.Lower().GetChar( 4 ) ) )
{

View File

@ -43,6 +43,7 @@
#include <sim/sim_plot_panel.h>
#include <sim/spice_simulator.h>
#include "fmt/format.h"
#include "dialogs/dialog_text_entry.h"
#include <dialogs/dialog_sim_format_value.h>
#include <eeschema_settings.h>
@ -94,6 +95,7 @@ enum
MYID_MEASURE_MIN_AT,
MYID_MEASURE_MAX_AT,
MYID_MEASURE_INTEGRAL,
MYID_FOURIER,
MYID_FORMAT_VALUE,
MYID_DELETE_MEASUREMENT
@ -144,6 +146,14 @@ void SIGNALS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
menu.Append( MYID_MEASURE_MAX_AT, _( "Measure Time of Max" ) );
menu.Append( MYID_MEASURE_INTEGRAL, _( "Measure Integral" ) );
SIM_PLOT_PANEL* panel = m_parent->GetCurrentPlot();
if( panel && panel->GetSimType() == ST_TRANSIENT )
{
menu.AppendSeparator();
menu.Append( MYID_FOURIER, _( "Perform Fourier Analysis..." ) );
}
menu.AppendSeparator();
}
@ -220,8 +230,31 @@ void SIGNALS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
for( const wxString& signal : signals )
m_parent->AddMeasurement( wxString::Format( wxS( "INTEG %s" ), signal ) );
}
else if( event.GetId() == MYID_FOURIER )
{
wxString title;
wxString fundamental = wxT( "1K" );
if( signals.size() == 1 )
title.Printf( _( "Fourier Analysis of %s" ), signals[0] );
else
title = _( "Fourier Analyses of Multiple Signals" );
WX_TEXT_ENTRY_DIALOG dlg( m_parent, _( "Fundamental frequency:" ), title, fundamental );
if( dlg.ShowModal() != wxID_OK )
return;
if( !dlg.GetValue().IsEmpty() )
fundamental = dlg.GetValue();
for( const wxString& signal : signals )
m_parent->DoFourier( signal, fundamental );
}
else
{
GRID_TRICKS::doPopupSelection( event );
}
}
@ -497,7 +530,7 @@ void SIMULATOR_PANEL::ShowChangedLanguage()
plot->OnLanguageChanged();
wxString pageTitle( simulator()->TypeToName( plot->GetType(), true ) );
wxString pageTitle( simulator()->TypeToName( plot->GetSimType(), true ) );
pageTitle.Prepend( wxString::Format( _( "Plot%u - " ), ii+1 /* 1-based */ ) );
m_plotNotebook->SetPageText( ii, pageTitle );
@ -1105,7 +1138,7 @@ void SIMULATOR_PANEL::UpdateMeasurement( int aRow )
return;
}
wxString simType = simulator()->TypeToName( plotPanel->GetType(), true );
wxString simType = simulator()->TypeToName( plotPanel->GetSimType(), true );
wxString resultName = wxString::Format( wxS( "meas_result_%u" ), aRow );
wxString result = wxS( "?" );
@ -1132,7 +1165,7 @@ void SIMULATOR_PANEL::UpdateMeasurement( int aRow )
units = wxS( "s" );
else if( func.StartsWith( wxS( "INTEG" ) ) )
{
switch( plotPanel->GetType() )
switch( plotPanel->GetSimType() )
{
case SIM_TYPE::ST_TRANSIENT:
if ( signalType == 'P' )
@ -1270,7 +1303,7 @@ void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd )
if( !plotPanel )
return;
wxString simType = simulator()->TypeToName( plotPanel->GetType(), true );
wxString simType = simulator()->TypeToName( plotPanel->GetSimType(), true );
int row;
for( row = 0; row < m_measurementsGrid->GetNumberRows(); ++row )
@ -1299,6 +1332,16 @@ void SIMULATOR_PANEL::AddMeasurement( const wxString& aCmd )
}
void SIMULATOR_PANEL::DoFourier( const wxString& aSignal, const wxString& aFundamental )
{
wxString cmd = wxString::Format( wxS( "fourier %s %s" ),
SPICE_VALUE( aFundamental ).ToSpiceString(),
aSignal );
simulator()->Command( cmd.ToStdString() );
}
const NGSPICE_CIRCUIT_MODEL* SIMULATOR_PANEL::GetExporter() const
{
return circuitModel().get();
@ -1362,7 +1405,7 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNew
if( aNewSignals.count( id ) == 0 )
{
if( plotPanel->GetType() == ST_AC )
if( plotPanel->GetSimType() == ST_AC )
{
for( int subType : { SPT_AC_MAG, SPT_AC_PHASE } )
plotPanel->DeleteTrace( vectorName, traceType | subType );
@ -1374,7 +1417,7 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNew
}
else
{
if( plotPanel->GetType() == ST_AC )
if( plotPanel->GetSimType() == ST_AC )
{
for( int subType : { SPT_AC_MAG, SPT_AC_PHASE } )
{
@ -1905,7 +1948,7 @@ bool SIMULATOR_PANEL::LoadWorkbook( const wxString& aPath )
{
auto* plot = dynamic_cast<const SIM_PLOT_PANEL_BASE*>( m_plotNotebook->GetPage( ii ) );
if( plot && plot->GetType() == schTextSimType )
if( plot && plot->GetSimType() == schTextSimType )
{
if( schTextSimType == ST_DC )
{
@ -1974,7 +2017,7 @@ bool SIMULATOR_PANEL::SaveWorkbook( const wxString& aPath )
continue;
}
file.AddLine( wxString::Format( wxT( "%d" ), basePanel->GetType() ) );
file.AddLine( wxString::Format( wxT( "%d" ), basePanel->GetSimType() ) );
wxString command = basePanel->GetSimCommand();
int options = basePanel->GetSimOptions();
@ -2177,7 +2220,7 @@ void SIMULATOR_PANEL::onPlotClosed( wxAuiNotebookEvent& event )
SIM_PLOT_PANEL_BASE* panel = GetCurrentPlotWindow();
if( !panel || panel->GetType() != ST_OP )
if( !panel || panel->GetSimType() != ST_OP )
{
SCHEMATIC& schematic = m_schematicFrame->Schematic();
schematic.ClearOperatingPoints();
@ -2383,7 +2426,7 @@ void SIMULATOR_PANEL::OnSimReport( const wxString& aMsg )
}
std::vector<wxString> SIMULATOR_PANEL::Signals()
std::vector<wxString> SIMULATOR_PANEL::Signals() const
{
std::vector<wxString> signals;
@ -2399,7 +2442,7 @@ void SIMULATOR_PANEL::OnSimRefresh( bool aFinal )
SIM_TYPE simType = circuitModel()->GetSimType();
SIM_PLOT_PANEL_BASE* plotPanelWindow = GetCurrentPlotWindow();
if( !plotPanelWindow || plotPanelWindow->GetType() != simType )
if( !plotPanelWindow || plotPanelWindow->GetSimType() != simType )
{
plotPanelWindow = NewPlotPanel( circuitModel()->GetSimCommand(),
circuitModel()->GetSimOptions() );

View File

@ -31,16 +31,10 @@
#include <sim/simulator_panel_base.h>
#include <sim/sim_types.h>
#include <kiway_player.h>
#include <dialogs/dialog_sim_command.h>
#include <sim/sim_plot_panel.h>
#include <wx/event.h>
#include <list>
#include <memory>
#include <map>
class SCH_EDIT_FRAME;
class SCH_SYMBOL;
@ -49,10 +43,6 @@ class SPICE_SIMULATOR_SETTINGS;
class EESCHEMA_SETTINGS;
class NGSPICE_CIRCUIT_MODEL;
#include <sim/sim_plot_panel.h>
#include <sim/sim_plot_panel_base.h>
#include "widgets/sim_notebook.h"
class SIM_THREAD_REPORTER;
class TUNER_SLIDER;
@ -91,7 +81,7 @@ public:
*/
SIM_PLOT_PANEL_BASE* NewPlotPanel( const wxString& aSimCommand, int aSimOptions );
std::vector<wxString> Signals();
std::vector<wxString> Signals() const;
const std::map<int, wxString>& UserDefinedSignals() { return m_userDefinedSignals; }
void SetUserDefinedSignals( const std::map<int, wxString>& aSignals );
@ -163,6 +153,8 @@ public:
*/
void UpdateMeasurement( int aRow );
void DoFourier( const wxString& aSignal, const wxString& aFundamental );
/**
* Return the netlist exporter object used for simulations.
*/
@ -217,8 +209,8 @@ public:
if( !plotWindow )
return nullptr;
return plotWindow->GetType() == ST_UNKNOWN ? nullptr
: dynamic_cast<SIM_PLOT_PANEL*>( plotWindow );
return plotWindow->GetSimType() == ST_UNKNOWN ? nullptr
: dynamic_cast<SIM_PLOT_PANEL*>( plotWindow );
}
int GetPlotIndex( SIM_PLOT_PANEL_BASE* aPlot ) const