diff --git a/eeschema/dialogs/dialog_sim_command.cpp b/eeschema/dialogs/dialog_sim_command.cpp
index 6b62c6c358..49d1839b83 100644
--- a/eeschema/dialogs/dialog_sim_command.cpp
+++ b/eeschema/dialogs/dialog_sim_command.cpp
@@ -106,6 +106,11 @@ DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent,
for( const std::string& net : m_circuitModel->GetNets() )
{
+ m_pzInput->Append( net );
+ m_pzInputRef->Append( net );
+ m_pzOutput->Append( net );
+ m_pzOutputRef->Append( net );
+
m_noiseMeas->Append( net );
m_noiseRef->Append( net );
}
@@ -287,6 +292,31 @@ bool DIALOG_SIM_COMMAND::TransferDataFromWindow()
m_simCommand = wxT( "fft" ) + vectors;
}
+ else if( page == m_pgPZ ) // Pole-zero analyses
+ {
+ wxString input = m_pzInput->GetStringSelection();
+ wxString inputRef = m_pzInputRef->GetStringSelection();
+ wxString output = m_pzOutput->GetStringSelection();
+ wxString outputRef = m_pzOutputRef->GetStringSelection();
+ wxString transferFunction = wxS( "vol" );
+ wxString analyses = wxS( "pz" );
+
+ if( m_pzFunctionType->GetSelection() == 1 )
+ transferFunction = wxS( "cur" );
+
+ if( m_pzAnalyses->GetSelection() == 1 )
+ analyses = wxS( "pol" );
+ else if( m_pzAnalyses->GetSelection() == 2 )
+ analyses = wxS( "zer" );
+
+ m_simCommand.Printf( ".pz %s %s %s %s %s %s",
+ input,
+ inputRef,
+ output,
+ outputRef,
+ transferFunction,
+ analyses );
+ }
else if( page == m_pgNOISE ) // Noise analysis
{
wxString output = m_noiseMeas->GetStringSelection();
@@ -447,7 +477,7 @@ void DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand )
m_commandType->Clear();
- for( SIM_TYPE type : { ST_AC, ST_DC, ST_NOISE, ST_OP, ST_TRAN, ST_SP, ST_FFT } )
+ for( SIM_TYPE type : { ST_OP, ST_DC, ST_AC, ST_TRAN, ST_PZ, ST_NOISE, ST_SP, ST_FFT } )
{
m_commandType->Append( SPICE_SIMULATOR::TypeToName( type, true )
+ wxT( " \u2014 " )
@@ -552,6 +582,35 @@ void DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand )
break;
}
+ case ST_PZ:
+ {
+ m_simPages->SetSelection( m_simPages->FindPage( m_pgPZ ) );
+
+ wxString transferFunction;
+ wxString input, inputRef;
+ wxString output, outputRef;
+ SPICE_PZ_ANALYSES analyses;
+
+ m_circuitModel->ParsePZCommand( aCommand, &transferFunction, &input, &inputRef, &output,
+ &outputRef, &analyses );
+
+ m_pzInput->SetStringSelection( input );
+ m_pzInputRef->SetStringSelection( inputRef );
+ m_pzOutput->SetStringSelection( output );
+ m_pzOutputRef->SetStringSelection( outputRef );
+
+ m_pzFunctionType->SetSelection( transferFunction.Lower() == "cur" ? 1 : 0 );
+
+ if( analyses.m_Poles && analyses.m_Zeros )
+ m_pzAnalyses->SetSelection( 0 );
+ else if( analyses.m_Poles )
+ m_pzAnalyses->SetSelection( 1 );
+ else
+ m_pzAnalyses->SetSelection( 2 );
+
+ break;
+ }
+
case ST_NOISE:
{
m_simPages->SetSelection( m_simPages->FindPage( m_pgNOISE ) );
@@ -653,6 +712,7 @@ void DIALOG_SIM_COMMAND::OnCommandType( wxCommandEvent& event )
case ST_AC: m_simPages->SetSelection( m_simPages->FindPage( m_pgAC ) ); break;
case ST_SP: m_simPages->SetSelection( m_simPages->FindPage( m_pgSP ) ); break;
case ST_DC: m_simPages->SetSelection( m_simPages->FindPage( m_pgDC ) ); break;
+ case ST_PZ: m_simPages->SetSelection( m_simPages->FindPage( m_pgPZ ) ); break;
case ST_NOISE: m_simPages->SetSelection( m_simPages->FindPage( m_pgNOISE ) ); break;
case ST_TRAN: m_simPages->SetSelection( m_simPages->FindPage( m_pgTRAN ) ); break;
case ST_OP: m_simPages->SetSelection( m_simPages->FindPage( m_pgOP ) ); break;
diff --git a/eeschema/dialogs/dialog_sim_command_base.cpp b/eeschema/dialogs/dialog_sim_command_base.cpp
index 60542c08ab..c2f74c25e6 100644
--- a/eeschema/dialogs/dialog_sim_command_base.cpp
+++ b/eeschema/dialogs/dialog_sim_command_base.cpp
@@ -540,6 +540,85 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_pgCustom->Layout();
bSizer2->Fit( m_pgCustom );
m_simPages->AddPage( m_pgCustom, _("a page"), false );
+ m_pgPZ = new wxPanel( m_simPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ wxBoxSizer* bSizer821;
+ bSizer821 = new wxBoxSizer( wxVERTICAL );
+
+ wxGridBagSizer* gbSizer11;
+ gbSizer11 = new wxGridBagSizer( 6, 0 );
+ gbSizer11->SetFlexibleDirection( wxBOTH );
+ gbSizer11->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+
+ m_pzFunctionTypeLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Transfer function:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzFunctionTypeLabel->Wrap( -1 );
+ gbSizer11->Add( m_pzFunctionTypeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ wxString m_pzFunctionTypeChoices[] = { _("(output voltage) / (input voltage)"), _("(output voltage) / (input current)") };
+ int m_pzFunctionTypeNChoices = sizeof( m_pzFunctionTypeChoices ) / sizeof( wxString );
+ m_pzFunctionType = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzFunctionTypeNChoices, m_pzFunctionTypeChoices, 0 );
+ m_pzFunctionType->SetSelection( 0 );
+ gbSizer11->Add( m_pzFunctionType, wxGBPosition( 0, 1 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
+
+ m_pzInputLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Input:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzInputLabel->Wrap( -1 );
+ gbSizer11->Add( m_pzInputLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ wxArrayString m_pzInputChoices;
+ m_pzInput = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzInputChoices, 0 );
+ m_pzInput->SetSelection( 0 );
+ gbSizer11->Add( m_pzInput, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
+
+ m_pzInputRefLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Ref:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzInputRefLabel->Wrap( -1 );
+ gbSizer11->Add( m_pzInputRefLabel, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
+
+ wxArrayString m_pzInputRefChoices;
+ m_pzInputRef = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzInputRefChoices, 0 );
+ m_pzInputRef->SetSelection( 0 );
+ gbSizer11->Add( m_pzInputRef, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 10 );
+
+ m_pzOutputLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Output:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzOutputLabel->Wrap( -1 );
+ gbSizer11->Add( m_pzOutputLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ wxArrayString m_pzOutputChoices;
+ m_pzOutput = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzOutputChoices, 0 );
+ m_pzOutput->SetSelection( 0 );
+ gbSizer11->Add( m_pzOutput, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 10 );
+
+ m_pzOutputRefLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Ref:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzOutputRefLabel->Wrap( -1 );
+ gbSizer11->Add( m_pzOutputRefLabel, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
+
+ wxArrayString m_pzOutputRefChoices;
+ m_pzOutputRef = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzOutputRefChoices, 0 );
+ m_pzOutputRef->SetSelection( 0 );
+ gbSizer11->Add( m_pzOutputRef, wxGBPosition( 2, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxEXPAND, 10 );
+
+
+ bSizer821->Add( gbSizer11, 0, wxALL, 10 );
+
+ wxBoxSizer* bSizer17;
+ bSizer17 = new wxBoxSizer( wxHORIZONTAL );
+
+ m_pzAnalysesLabel = new wxStaticText( m_pgPZ, wxID_ANY, _("Find:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_pzAnalysesLabel->Wrap( -1 );
+ bSizer17->Add( m_pzAnalysesLabel, 0, wxALL, 5 );
+
+ wxString m_pzAnalysesChoices[] = { _("Poles and Zeros"), _("Poles"), _("Zeros"), wxEmptyString };
+ int m_pzAnalysesNChoices = sizeof( m_pzAnalysesChoices ) / sizeof( wxString );
+ m_pzAnalyses = new wxChoice( m_pgPZ, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_pzAnalysesNChoices, m_pzAnalysesChoices, 0 );
+ m_pzAnalyses->SetSelection( 0 );
+ bSizer17->Add( m_pzAnalyses, 0, wxALL, 5 );
+
+
+ bSizer821->Add( bSizer17, 1, wxEXPAND|wxTOP|wxLEFT, 5 );
+
+
+ m_pgPZ->SetSizer( bSizer821 );
+ m_pgPZ->Layout();
+ bSizer821->Fit( m_pgPZ );
+ m_simPages->AddPage( m_pgPZ, _("a page"), false );
bSizer1->Add( m_simPages, 1, wxEXPAND | wxALL, 5 );
@@ -604,6 +683,7 @@ DIALOG_SIM_COMMAND_BASE::DIALOG_SIM_COMMAND_BASE( wxWindow* parent, wxWindowID i
m_inputSignalsFilter->Connect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_SIM_COMMAND_BASE::OnFilterMouseMoved ), NULL, this );
m_inputSignalsFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::OnFilterText ), NULL, this );
m_loadDirectives->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onLoadDirectives ), NULL, this );
+ m_pzFunctionType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onDCSource1Selected ), NULL, this );
}
DIALOG_SIM_COMMAND_BASE::~DIALOG_SIM_COMMAND_BASE()
@@ -618,5 +698,6 @@ DIALOG_SIM_COMMAND_BASE::~DIALOG_SIM_COMMAND_BASE()
m_inputSignalsFilter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_SIM_COMMAND_BASE::OnFilterMouseMoved ), NULL, this );
m_inputSignalsFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::OnFilterText ), NULL, this );
m_loadDirectives->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onLoadDirectives ), NULL, this );
+ m_pzFunctionType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_COMMAND_BASE::onDCSource1Selected ), NULL, this );
}
diff --git a/eeschema/dialogs/dialog_sim_command_base.fbp b/eeschema/dialogs/dialog_sim_command_base.fbp
index a828e01bb1..e9749776ed 100644
--- a/eeschema/dialogs/dialog_sim_command_base.fbp
+++ b/eeschema/dialogs/dialog_sim_command_base.fbp
@@ -203,7 +203,7 @@
5
wxEXPAND | wxALL
1
-
+
+ a page
+ 0
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+ 0
+
+ 1
+ m_pgPZ
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ 0
+
+
+
+ wxTAB_TRAVERSAL
+
+
+ bSizer821
+ wxVERTICAL
+ none
+
+ 10
+ wxALL
+ 0
+
+
+ wxBOTH
+
+
+ 0
+
+ gbSizer11
+ wxFLEX_GROWMODE_SPECIFIED
+ none
+ 6
+
+ 5
+ 1
+ 0
+ wxALIGN_CENTER_VERTICAL|wxRIGHT
+ 0
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+ Transfer function:
+ 0
+
+ 0
+
+
+ 0
+
+ 1
+ m_pzFunctionTypeLabel
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+
+ 0
+
+
+
+
+ -1
+
+
+
+ 10
+ 3
+ 1
+ wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT
+ 0
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ "(output voltage) / (input voltage)" "(output voltage) / (input current)"
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+ 0
+
+ 1
+ m_pzFunctionType
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 0
+ 1
+
+
+ ; ; forward_declare
+ 0
+
+
+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
+
+
diff --git a/eeschema/dialogs/dialog_sim_command_base.h b/eeschema/dialogs/dialog_sim_command_base.h
index 76fe44efc5..a7f164acb6 100644
--- a/eeschema/dialogs/dialog_sim_command_base.h
+++ b/eeschema/dialogs/dialog_sim_command_base.h
@@ -139,6 +139,19 @@ class DIALOG_SIM_COMMAND_BASE : public DIALOG_SHIM
wxStaticText* m_staticText18;
wxTextCtrl* m_customTxt;
wxButton* m_loadDirectives;
+ wxPanel* m_pgPZ;
+ wxStaticText* m_pzFunctionTypeLabel;
+ wxChoice* m_pzFunctionType;
+ wxStaticText* m_pzInputLabel;
+ wxChoice* m_pzInput;
+ wxStaticText* m_pzInputRefLabel;
+ wxChoice* m_pzInputRef;
+ wxStaticText* m_pzOutputLabel;
+ wxChoice* m_pzOutput;
+ wxStaticText* m_pzOutputRefLabel;
+ wxChoice* m_pzOutputRef;
+ wxStaticText* m_pzAnalysesLabel;
+ wxChoice* m_pzAnalyses;
wxCheckBox* m_fixIncludePaths;
wxCheckBox* m_saveAllVoltages;
wxCheckBox* m_saveAllCurrents;
diff --git a/eeschema/sim/ngspice_circuit_model.cpp b/eeschema/sim/ngspice_circuit_model.cpp
index 42aa8d3671..b2db460f30 100644
--- a/eeschema/sim/ngspice_circuit_model.cpp
+++ b/eeschema/sim/ngspice_circuit_model.cpp
@@ -130,6 +130,48 @@ 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 )
+{
+ if( !aCmd.Lower().StartsWith( wxS( ".pz" ) ) )
+ return false;
+
+ *transferFunction = "vol";
+ analyses->m_Poles = true;
+ analyses->m_Zeros = true;
+
+ wxStringTokenizer tokens( aCmd.Mid( 3 ), wxS( " \t" ), wxTOKEN_STRTOK );
+
+ if( tokens.HasMoreTokens() )
+ *input = tokens.GetNextToken();
+
+ if( tokens.HasMoreTokens() )
+ *inputRef = tokens.GetNextToken();
+
+ if( tokens.HasMoreTokens() )
+ *output = tokens.GetNextToken();
+
+ if( tokens.HasMoreTokens() )
+ *outputRef = tokens.GetNextToken();
+
+ if( tokens.HasMoreTokens() )
+ *transferFunction = tokens.GetNextToken();
+
+ if( tokens.HasMoreTokens() )
+ {
+ wxString token = tokens.GetNextToken().Lower();
+
+ if( token == wxS( "pol" ) )
+ analyses->m_Zeros = false;
+ else if( token == wxS( "zer" ) )
+ analyses->m_Poles = false;
+ }
+
+ return true;
+}
+
bool NGSPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOutput,
wxString* aRef, wxString* aSource, wxString* aScale,
SPICE_VALUE* aPts, SPICE_VALUE* aFStart,
diff --git a/eeschema/sim/ngspice_circuit_model.h b/eeschema/sim/ngspice_circuit_model.h
index 79945d21de..b7cf4ef47f 100644
--- a/eeschema/sim/ngspice_circuit_model.h
+++ b/eeschema/sim/ngspice_circuit_model.h
@@ -43,6 +43,13 @@ struct SPICE_DC_PARAMS
SPICE_VALUE m_vincrement;
};
+
+struct SPICE_PZ_ANALYSES
+{
+ bool m_Poles;
+ bool m_Zeros;
+};
+
/// Special netlist exporter flavor that allows one to override simulation commands
class NGSPICE_CIRCUIT_MODEL : public NETLIST_EXPORTER_SPICE, public SIMULATION_MODEL
{
@@ -84,6 +91,10 @@ public:
bool ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* aSource1,
SPICE_DC_PARAMS* aSource2 );
+ bool ParsePZCommand( const wxString& aCmd, wxString* transferFunction, wxString* input,
+ wxString* inputRef, wxString* output, wxString* outputRef,
+ SPICE_PZ_ANALYSES* analyses );
+
bool ParseNoiseCommand( const wxString& aCmd, wxString* aOutput, wxString* aRef,
wxString* aSource, wxString* aScale, SPICE_VALUE* aPts,
SPICE_VALUE* aFStart, SPICE_VALUE* aFStop, bool* aSaveAll );