Sort out terminology issues between vectors and plots.
This commit is contained in:
parent
443a5dc3bb
commit
d5d2800b03
|
@ -84,6 +84,12 @@ void NGSPICE::Init( const SPICE_SIMULATOR_SETTINGS* aSettings )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString NGSPICE::CurrentPlotName() const
|
||||||
|
{
|
||||||
|
return wxString( m_ngSpice_CurPlot() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::string> NGSPICE::AllVectors() const
|
std::vector<std::string> NGSPICE::AllVectors() const
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
|
@ -112,7 +118,7 @@ std::vector<std::string> NGSPICE::AllVectors() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<COMPLEX> NGSPICE::GetPlot( const std::string& aName, int aMaxLen )
|
std::vector<COMPLEX> NGSPICE::GetComplexVector( const std::string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
std::vector<COMPLEX> data;
|
std::vector<COMPLEX> data;
|
||||||
|
@ -139,7 +145,7 @@ std::vector<COMPLEX> NGSPICE::GetPlot( const std::string& aName, int aMaxLen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<double> NGSPICE::GetRealPlot( const std::string& aName, int aMaxLen )
|
std::vector<double> NGSPICE::GetRealVector( const std::string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
std::vector<double> data;
|
std::vector<double> data;
|
||||||
|
@ -169,7 +175,7 @@ std::vector<double> NGSPICE::GetRealPlot( const std::string& aName, int aMaxLen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<double> NGSPICE::GetImagPlot( const std::string& aName, int aMaxLen )
|
std::vector<double> NGSPICE::GetImaginaryVector( const std::string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
std::vector<double> data;
|
std::vector<double> data;
|
||||||
|
@ -191,7 +197,7 @@ std::vector<double> NGSPICE::GetImagPlot( const std::string& aName, int aMaxLen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<double> NGSPICE::GetMagPlot( const std::string& aName, int aMaxLen )
|
std::vector<double> NGSPICE::GetGainVector( const std::string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
std::vector<double> data;
|
std::vector<double> data;
|
||||||
|
@ -218,7 +224,7 @@ std::vector<double> NGSPICE::GetMagPlot( const std::string& aName, int aMaxLen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<double> NGSPICE::GetPhasePlot( const std::string& aName, int aMaxLen )
|
std::vector<double> NGSPICE::GetPhaseVector( const std::string& aName, int aMaxLen )
|
||||||
{
|
{
|
||||||
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
LOCALE_IO c_locale; // ngspice works correctly only with C locale
|
||||||
std::vector<double> data;
|
std::vector<double> data;
|
||||||
|
|
|
@ -80,23 +80,26 @@ public:
|
||||||
///< @copydoc SPICE_SIMULATOR::GetXAxis()
|
///< @copydoc SPICE_SIMULATOR::GetXAxis()
|
||||||
wxString GetXAxis( SIM_TYPE aType ) const override final;
|
wxString GetXAxis( SIM_TYPE aType ) const override final;
|
||||||
|
|
||||||
|
///< @copydoc SPICE_SIMULATOR::CurrentPlotName()
|
||||||
|
wxString CurrentPlotName() const override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::AllVectors()
|
///< @copydoc SPICE_SIMULATOR::AllVectors()
|
||||||
std::vector<std::string> AllVectors() const override final;
|
std::vector<std::string> AllVectors() const override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::GetPlot()
|
///< @copydoc SPICE_SIMULATOR::GetComplexVector()
|
||||||
std::vector<COMPLEX> GetPlot( const std::string& aName, int aMaxLen = -1 ) override final;
|
std::vector<COMPLEX> GetComplexVector( const std::string& aName, int aMaxLen = -1 ) override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::GetRealPlot()
|
///< @copydoc SPICE_SIMULATOR::GetRealVector()
|
||||||
std::vector<double> GetRealPlot( const std::string& aName, int aMaxLen = -1 ) override final;
|
std::vector<double> GetRealVector( const std::string& aName, int aMaxLen = -1 ) override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::GetImagPlot()
|
///< @copydoc SPICE_SIMULATOR::GetImaginaryVector()
|
||||||
std::vector<double> GetImagPlot( const std::string& aName, int aMaxLen = -1 ) override final;
|
std::vector<double> GetImaginaryVector( const std::string& aName, int aMaxLen = -1 ) override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::GetMagPlot()
|
///< @copydoc SPICE_SIMULATOR::GetGainVector()
|
||||||
std::vector<double> GetMagPlot( const std::string& aName, int aMaxLen = -1 ) override final;
|
std::vector<double> GetGainVector( const std::string& aName, int aMaxLen = -1 ) override final;
|
||||||
|
|
||||||
///< @copydoc SPICE_SIMULATOR::GetPhasePlot()
|
///< @copydoc SPICE_SIMULATOR::GetPhaseVector()
|
||||||
std::vector<double> GetPhasePlot( const std::string& aName, int aMaxLen = -1 ) override final;
|
std::vector<double> GetPhaseVector( const std::string& aName, int aMaxLen = -1 ) override final;
|
||||||
|
|
||||||
std::vector<std::string> GetSettingCommands() const override final;
|
std::vector<std::string> GetSettingCommands() const override final;
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ public:
|
||||||
|
|
||||||
mpFXYVector::SetName( aName );
|
mpFXYVector::SetName( aName );
|
||||||
|
|
||||||
if( m_type & SPT_AC_MAG )
|
if( m_type & SPT_AC_GAIN )
|
||||||
m_displayName = aName + _( " (gain)" );
|
m_displayName = aName + _( " (gain)" );
|
||||||
else if( m_type & SPT_AC_PHASE )
|
else if( m_type & SPT_AC_PHASE )
|
||||||
m_displayName = aName + _( " (phase)" );
|
m_displayName = aName + _( " (phase)" );
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum SIM_TRACE_TYPE
|
||||||
SPT_VOLTAGE = 0x0001,
|
SPT_VOLTAGE = 0x0001,
|
||||||
SPT_CURRENT = 0x0002,
|
SPT_CURRENT = 0x0002,
|
||||||
SPT_AC_PHASE = 0x0004,
|
SPT_AC_PHASE = 0x0004,
|
||||||
SPT_AC_MAG = 0x0008,
|
SPT_AC_GAIN = 0x0008,
|
||||||
SPT_POWER = 0x0010,
|
SPT_POWER = 0x0010,
|
||||||
SPT_SP_AMP = 0x0020,
|
SPT_SP_AMP = 0x0020,
|
||||||
SPT_Y_AXIS_MASK = 0x00FF,
|
SPT_Y_AXIS_MASK = 0x00FF,
|
||||||
|
|
|
@ -908,7 +908,7 @@ wxString SIMULATOR_PANEL::vectorNameFromSignalName( const wxString& aSignalName,
|
||||||
{
|
{
|
||||||
std::map<wxString, int> suffixes;
|
std::map<wxString, int> suffixes;
|
||||||
suffixes[ _( " (amplitude)" ) ] = SPT_SP_AMP;
|
suffixes[ _( " (amplitude)" ) ] = SPT_SP_AMP;
|
||||||
suffixes[ _( " (gain)" ) ] = SPT_AC_MAG;
|
suffixes[ _( " (gain)" ) ] = SPT_AC_GAIN;
|
||||||
suffixes[ _( " (phase)" ) ] = SPT_AC_PHASE;
|
suffixes[ _( " (phase)" ) ] = SPT_AC_PHASE;
|
||||||
|
|
||||||
if( aTraceType )
|
if( aTraceType )
|
||||||
|
@ -1234,7 +1234,7 @@ void SIMULATOR_PANEL::UpdateMeasurement( int aRow )
|
||||||
simulator()->Command( "echo " + cmd.ToStdString() );
|
simulator()->Command( "echo " + cmd.ToStdString() );
|
||||||
simulator()->Command( cmd.ToStdString() );
|
simulator()->Command( cmd.ToStdString() );
|
||||||
|
|
||||||
std::vector<double> resultVec = simulator()->GetMagPlot( resultName.ToStdString() );
|
std::vector<double> resultVec = simulator()->GetGainVector( resultName.ToStdString() );
|
||||||
|
|
||||||
if( resultVec.size() > 0 )
|
if( resultVec.size() > 0 )
|
||||||
result = SPICE_VALUE( resultVec[0] ).ToString( GetMeasureFormat( aRow ) );
|
result = SPICE_VALUE( resultVec[0] ).ToString( GetMeasureFormat( aRow ) );
|
||||||
|
@ -1410,12 +1410,12 @@ void SIMULATOR_PANEL::AddTrace( const wxString& aName, SIM_TRACE_TYPE aType )
|
||||||
|
|
||||||
if( simType == ST_AC )
|
if( simType == ST_AC )
|
||||||
{
|
{
|
||||||
updateTrace( aName, aType | SPT_AC_MAG, plotPanel );
|
updateTrace( aName, aType | SPT_AC_GAIN, plotPanel );
|
||||||
updateTrace( aName, aType | SPT_AC_PHASE, plotPanel );
|
updateTrace( aName, aType | SPT_AC_PHASE, plotPanel );
|
||||||
}
|
}
|
||||||
if( simType == ST_S_PARAM )
|
if( simType == ST_S_PARAM )
|
||||||
{
|
{
|
||||||
updateTrace( aName, aType | SPT_AC_MAG, plotPanel );
|
updateTrace( aName, aType | SPT_AC_GAIN, plotPanel );
|
||||||
updateTrace( aName, aType | SPT_AC_PHASE, plotPanel );
|
updateTrace( aName, aType | SPT_AC_PHASE, plotPanel );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1446,7 +1446,7 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNew
|
||||||
{
|
{
|
||||||
if( plotPanel->GetSimType() == ST_AC )
|
if( plotPanel->GetSimType() == ST_AC )
|
||||||
{
|
{
|
||||||
for( int subType : { SPT_AC_MAG, SPT_AC_PHASE } )
|
for( int subType : { SPT_AC_GAIN, SPT_AC_PHASE } )
|
||||||
plotPanel->DeleteTrace( vectorName, traceType | subType );
|
plotPanel->DeleteTrace( vectorName, traceType | subType );
|
||||||
}
|
}
|
||||||
else if( plotPanel->GetSimType() == ST_S_PARAM )
|
else if( plotPanel->GetSimType() == ST_S_PARAM )
|
||||||
|
@ -1463,7 +1463,7 @@ void SIMULATOR_PANEL::SetUserDefinedSignals( const std::map<int, wxString>& aNew
|
||||||
{
|
{
|
||||||
if( plotPanel->GetSimType() == ST_AC )
|
if( plotPanel->GetSimType() == ST_AC )
|
||||||
{
|
{
|
||||||
for( int subType : { SPT_AC_MAG, SPT_AC_PHASE } )
|
for( int subType : { SPT_AC_GAIN, SPT_AC_PHASE } )
|
||||||
{
|
{
|
||||||
if( TRACE* trace = plotPanel->GetTrace( vectorName, traceType | subType ) )
|
if( TRACE* trace = plotPanel->GetTrace( vectorName, traceType | subType ) )
|
||||||
trace->SetName( aNewSignals.at( id ) );
|
trace->SetName( aNewSignals.at( id ) );
|
||||||
|
@ -1529,24 +1529,24 @@ void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType,
|
||||||
std::vector<double> data_x;
|
std::vector<double> data_x;
|
||||||
std::vector<double> data_y;
|
std::vector<double> data_y;
|
||||||
|
|
||||||
data_x = simulator()->GetMagPlot( (const char*) xAxisName.c_str() );
|
data_x = simulator()->GetGainVector( (const char*) xAxisName.c_str() );
|
||||||
|
|
||||||
switch( simType )
|
switch( simType )
|
||||||
{
|
{
|
||||||
case ST_AC:
|
case ST_AC:
|
||||||
if( aTraceType & SPT_AC_MAG )
|
if( aTraceType & SPT_AC_GAIN )
|
||||||
data_y = simulator()->GetMagPlot( (const char*) simVectorName.c_str() );
|
data_y = simulator()->GetGainVector( (const char*) simVectorName.c_str() );
|
||||||
else if( aTraceType & SPT_AC_PHASE )
|
else if( aTraceType & SPT_AC_PHASE )
|
||||||
data_y = simulator()->GetPhasePlot( (const char*) simVectorName.c_str() );
|
data_y = simulator()->GetPhaseVector( (const char*) simVectorName.c_str() );
|
||||||
else
|
else
|
||||||
wxFAIL_MSG( wxT( "Plot type missing AC_PHASE or AC_MAG bit" ) );
|
wxFAIL_MSG( wxT( "Plot type missing AC_PHASE or AC_MAG bit" ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ST_S_PARAM:
|
case ST_S_PARAM:
|
||||||
if( aTraceType & SPT_SP_AMP )
|
if( aTraceType & SPT_SP_AMP )
|
||||||
data_y = simulator()->GetMagPlot( (const char*) simVectorName.c_str() );
|
data_y = simulator()->GetGainVector( (const char*) simVectorName.c_str() );
|
||||||
else if( aTraceType & SPT_AC_PHASE )
|
else if( aTraceType & SPT_AC_PHASE )
|
||||||
data_y = simulator()->GetPhasePlot( (const char*) simVectorName.c_str() );
|
data_y = simulator()->GetPhaseVector( (const char*) simVectorName.c_str() );
|
||||||
else
|
else
|
||||||
wxFAIL_MSG( wxT( "Plot type missing AC_PHASE or SPT_SP_AMP bit" ) );
|
wxFAIL_MSG( wxT( "Plot type missing AC_PHASE or SPT_SP_AMP bit" ) );
|
||||||
|
|
||||||
|
@ -1555,7 +1555,7 @@ void SIMULATOR_PANEL::updateTrace( const wxString& aVectorName, int aTraceType,
|
||||||
case ST_NOISE:
|
case ST_NOISE:
|
||||||
case ST_DC:
|
case ST_DC:
|
||||||
case ST_TRANSIENT:
|
case ST_TRANSIENT:
|
||||||
data_y = simulator()->GetMagPlot( (const char*) simVectorName.c_str() );
|
data_y = simulator()->GetGainVector( (const char*) simVectorName.c_str() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2524,11 +2524,14 @@ void SIMULATOR_PANEL::OnSimRefresh( bool aFinal )
|
||||||
m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) );
|
m_simConsole->AppendText( _( "\n\nSimulation results:\n\n" ) );
|
||||||
m_simConsole->SetInsertionPointEnd();
|
m_simConsole->SetInsertionPointEnd();
|
||||||
|
|
||||||
|
// The simulator will create noise1 & noise2 on the first run, noise3 and noise4
|
||||||
|
// on the second, etc. The first plot for each run contains the spectral density
|
||||||
|
// noise vectors and second contains the integrated noise.
|
||||||
simulator()->Command( "setplot noise2" );
|
simulator()->Command( "setplot noise2" );
|
||||||
|
|
||||||
for( const std::string& vec : simulator()->AllVectors() )
|
for( const std::string& vec : simulator()->AllVectors() )
|
||||||
{
|
{
|
||||||
std::vector<double> val_list = simulator()->GetRealPlot( vec, 1 );
|
std::vector<double> val_list = simulator()->GetRealVector( vec, 1 );
|
||||||
wxString value = SPICE_VALUE( val_list[ 0 ] ).ToSpiceString();
|
wxString value = SPICE_VALUE( val_list[ 0 ] ).ToSpiceString();
|
||||||
|
|
||||||
msg.Printf( wxS( "%s: %sV\n" ), vec, value );
|
msg.Printf( wxS( "%s: %sV\n" ), vec, value );
|
||||||
|
@ -2556,7 +2559,7 @@ void SIMULATOR_PANEL::OnSimRefresh( bool aFinal )
|
||||||
|
|
||||||
if( simType == ST_AC )
|
if( simType == ST_AC )
|
||||||
{
|
{
|
||||||
for( int subType : { SPT_AC_MAG, SPT_AC_PHASE } )
|
for( int subType : { SPT_AC_GAIN, SPT_AC_PHASE } )
|
||||||
{
|
{
|
||||||
if( TRACE* trace = plotPanel->GetTrace( vectorName, traceType | subType ) )
|
if( TRACE* trace = plotPanel->GetTrace( vectorName, traceType | subType ) )
|
||||||
traceMap[ trace ] = { vectorName, traceType };
|
traceMap[ trace ] = { vectorName, traceType };
|
||||||
|
@ -2608,7 +2611,7 @@ void SIMULATOR_PANEL::OnSimRefresh( bool aFinal )
|
||||||
|
|
||||||
for( const std::string& vec : simulator()->AllVectors() )
|
for( const std::string& vec : simulator()->AllVectors() )
|
||||||
{
|
{
|
||||||
std::vector<double> val_list = simulator()->GetRealPlot( vec, 1 );
|
std::vector<double> val_list = simulator()->GetRealVector( vec, 1 );
|
||||||
wxString value = SPICE_VALUE( val_list[ 0 ] ).ToSpiceString();
|
wxString value = SPICE_VALUE( val_list[ 0 ] ).ToSpiceString();
|
||||||
wxString signal;
|
wxString signal;
|
||||||
SIM_TRACE_TYPE type = circuitModel()->VectorToSignal( vec, signal );
|
SIM_TRACE_TYPE type = circuitModel()->VectorToSignal( vec, signal );
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
|
// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers
|
||||||
// (especially on msys2 + wxWidgets 3.0.x)
|
// (especially on msys2 + wxWidgets 3.0.x)
|
||||||
#include "ngspice.h"
|
#include "ngspice.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR::CreateInstance( const std::string& )
|
std::shared_ptr<SPICE_SIMULATOR> SIMULATOR::CreateInstance( const std::string& )
|
||||||
{
|
{
|
||||||
|
@ -53,44 +54,19 @@ wxString SPICE_SIMULATOR::TypeToName( SIM_TYPE aType, bool aShortName )
|
||||||
{
|
{
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
case ST_OP:
|
case ST_OP: return aShortName ? wxString( wxT( "OP" ) ) : _( "Operating Point" );
|
||||||
return aShortName ? wxString( wxT( "OP" ) )
|
case ST_AC: return aShortName ? wxString( wxT( "AC" ) ) : _( "AC" );
|
||||||
: _( "Operating Point" );
|
case ST_DC: return aShortName ? wxString( wxT( "DC" ) ) : _( "DC Sweep" );
|
||||||
|
case ST_TRANSIENT: return aShortName ? wxString( wxT( "TRAN" ) ) : _( "Transient" );
|
||||||
case ST_AC:
|
case ST_DISTORTION: return aShortName ? wxString( wxT( "DISTO" ) ) : _( "Distortion" );
|
||||||
return "AC";
|
case ST_NOISE: return aShortName ? wxString( wxT( "NOISE" ) ) : _( "Noise" );
|
||||||
|
case ST_POLE_ZERO: return aShortName ? wxString( wxT( "PZ" ) ) : _( "Pole-zero" );
|
||||||
case ST_DC:
|
case ST_SENSITIVITY: return aShortName ? wxString( wxT( "SENS" ) ) : _( "Sensitivity" );
|
||||||
return aShortName ? wxString( wxT( "DC" ) )
|
case ST_TRANS_FUNC: return aShortName ? wxString( wxT( "TF" ) ) : _( "Transfer function" );
|
||||||
: _( "DC Sweep" );
|
|
||||||
|
|
||||||
case ST_TRANSIENT:
|
|
||||||
return aShortName ? wxString( wxT( "TRAN" ) )
|
|
||||||
: _( "Transient" );
|
|
||||||
|
|
||||||
case ST_DISTORTION:
|
|
||||||
return aShortName ? wxString( wxT( "DISTO" ) )
|
|
||||||
: _( "Distortion" );
|
|
||||||
|
|
||||||
case ST_NOISE:
|
|
||||||
return aShortName ? wxString( wxT( "NOISE" ) )
|
|
||||||
: _( "Noise" );
|
|
||||||
|
|
||||||
case ST_POLE_ZERO:
|
|
||||||
return aShortName ? wxString( wxT( "PZ" ) )
|
|
||||||
: _( "Pole-zero" );
|
|
||||||
|
|
||||||
case ST_SENSITIVITY:
|
|
||||||
return aShortName ? wxString( wxT( "SENS" ) )
|
|
||||||
: _( "Sensitivity" );
|
|
||||||
|
|
||||||
case ST_TRANS_FUNC:
|
|
||||||
return aShortName ? wxString( wxT( "TF" ) )
|
|
||||||
: _( "Transfer function" );
|
|
||||||
case ST_S_PARAM: return aShortName ? wxString( wxT( "SP" ) ) : _( "S-Parameters" );
|
case ST_S_PARAM: return aShortName ? wxString( wxT( "SP" ) ) : _( "S-Parameters" );
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case ST_UNKNOWN:
|
case ST_UNKNOWN: return aShortName ? wxString( wxT( "??" ) ) : _( "Unknown" );
|
||||||
return aShortName ? _( "UNKNOWN!" ) : _( "Unknown" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a list with all vectors generated in current simulation.
|
* @return the current simulation plot name (tran1, tran2, etc.)
|
||||||
*
|
*/
|
||||||
* @return List of vector names. ?May not match to the net name elements.
|
virtual wxString CurrentPlotName() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list of simulation vector (signal) names.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<std::string> AllVectors() const = 0;
|
virtual std::vector<std::string> AllVectors() const = 0;
|
||||||
|
|
||||||
|
@ -102,7 +105,7 @@ public:
|
||||||
* if -1 (default) all available values are returned.
|
* if -1 (default) all available values are returned.
|
||||||
* @return Requested vector. It might be empty if there is no vector with requested name.
|
* @return Requested vector. It might be empty if there is no vector with requested name.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<COMPLEX> GetPlot( const std::string& aName, int aMaxLen = -1 ) = 0;
|
virtual std::vector<COMPLEX> GetComplexVector( const std::string& aName, int aMaxLen = -1 ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a requested vector with real values. If the vector is complex, then
|
* Return a requested vector with real values. If the vector is complex, then
|
||||||
|
@ -113,7 +116,7 @@ public:
|
||||||
* if -1 (default) all available values are returned.
|
* if -1 (default) all available values are returned.
|
||||||
* @return Requested vector. It might be empty if there is no vector with requested name.
|
* @return Requested vector. It might be empty if there is no vector with requested name.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<double> GetRealPlot( const std::string& aName, int aMaxLen = -1 ) = 0;
|
virtual std::vector<double> GetRealVector( const std::string& aName, int aMaxLen = -1 ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a requested vector with imaginary values. If the vector is complex, then
|
* Return a requested vector with imaginary values. If the vector is complex, then
|
||||||
|
@ -124,7 +127,7 @@ public:
|
||||||
* if -1 (default) all available values are returned.
|
* if -1 (default) all available values are returned.
|
||||||
* @return Requested vector. It might be empty if there is no vector with requested name.
|
* @return Requested vector. It might be empty if there is no vector with requested name.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<double> GetImagPlot( const std::string& aName, int aMaxLen = -1 ) = 0;
|
virtual std::vector<double> GetImaginaryVector( const std::string& aName, int aMaxLen = -1 ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a requested vector with magnitude values.
|
* Return a requested vector with magnitude values.
|
||||||
|
@ -134,7 +137,7 @@ public:
|
||||||
* if -1 (default) all available values are returned.
|
* if -1 (default) all available values are returned.
|
||||||
* @return Requested vector. It might be empty if there is no vector with requested name.
|
* @return Requested vector. It might be empty if there is no vector with requested name.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<double> GetMagPlot( const std::string& aName, int aMaxLen = -1 ) = 0;
|
virtual std::vector<double> GetGainVector( const std::string& aName, int aMaxLen = -1 ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a requested vector with phase values.
|
* Return a requested vector with phase values.
|
||||||
|
@ -144,7 +147,7 @@ public:
|
||||||
* if -1 (default) all available values are returned.
|
* if -1 (default) all available values are returned.
|
||||||
* @return Requested vector. It might be empty if there is no vector with requested name.
|
* @return Requested vector. It might be empty if there is no vector with requested name.
|
||||||
*/
|
*/
|
||||||
virtual std::vector<double> GetPhasePlot( const std::string& aName, int aMaxLen = -1 ) = 0;
|
virtual std::vector<double> GetPhaseVector( const std::string& aName, int aMaxLen = -1 ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return current SPICE netlist used by the simulator.
|
* Return current SPICE netlist used by the simulator.
|
||||||
|
|
|
@ -1195,14 +1195,20 @@ TOOL_ACTION EE_ACTIONS::simTune( "eeschema.Simulation.tune",
|
||||||
_( "Add Tuned Value..." ), _( "Select a value to be tuned" ),
|
_( "Add Tuned Value..." ), _( "Select a value to be tuned" ),
|
||||||
BITMAPS::sim_tune );
|
BITMAPS::sim_tune );
|
||||||
|
|
||||||
|
TOOL_ACTION EE_ACTIONS::editUserDefinedSignals( "eeschema.Simulation.editUserDefinedSignals",
|
||||||
|
AS_GLOBAL, 0, "",
|
||||||
|
_( "User-defined Signals..." ),
|
||||||
|
_( "Add, edit or delete user-defined simulation signals" ),
|
||||||
|
BITMAPS::sim_add_signal );
|
||||||
|
|
||||||
|
TOOL_ACTION EE_ACTIONS::showFFT( "eeschema.Simulation.showFFT",
|
||||||
|
AS_GLOBAL, 0, "",
|
||||||
|
_( "Show FFT" ),
|
||||||
|
_( "Show frequency distribution of transient analysis data using fast Fourier transform" ),
|
||||||
|
BITMAPS::mw_add_shape );
|
||||||
|
|
||||||
TOOL_ACTION EE_ACTIONS::showNetlist( "eeschema.Simulation.showNetlist",
|
TOOL_ACTION EE_ACTIONS::showNetlist( "eeschema.Simulation.showNetlist",
|
||||||
AS_GLOBAL, 0, "",
|
AS_GLOBAL, 0, "",
|
||||||
_( "Show SPICE Netlist" ), "",
|
_( "Show SPICE Netlist" ), "",
|
||||||
BITMAPS::netlist );
|
BITMAPS::netlist );
|
||||||
|
|
||||||
TOOL_ACTION EE_ACTIONS::editUserDefinedSignals( "eeschema.Simulation.editUserDefinedSignals",
|
|
||||||
AS_GLOBAL, 0, "",
|
|
||||||
_( "User-defined Signals" ),
|
|
||||||
_( "Add, edit or delete user-defined simulation signals" ),
|
|
||||||
BITMAPS::sim_add_signal );
|
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,7 @@ public:
|
||||||
static TOOL_ACTION runSimulation;
|
static TOOL_ACTION runSimulation;
|
||||||
static TOOL_ACTION stopSimulation;
|
static TOOL_ACTION stopSimulation;
|
||||||
static TOOL_ACTION editUserDefinedSignals;
|
static TOOL_ACTION editUserDefinedSignals;
|
||||||
|
static TOOL_ACTION showFFT;
|
||||||
static TOOL_ACTION showNetlist;
|
static TOOL_ACTION showNetlist;
|
||||||
|
|
||||||
// Net highlighting
|
// Net highlighting
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
{
|
{
|
||||||
NGSPICE* ngspice = static_cast<NGSPICE*>( m_simulator.get() );
|
NGSPICE* ngspice = static_cast<NGSPICE*>( m_simulator.get() );
|
||||||
|
|
||||||
std::vector<double> vector = ngspice->GetRealPlot( aVectorName );
|
std::vector<double> vector = ngspice->GetRealVector( aVectorName );
|
||||||
|
|
||||||
BOOST_REQUIRE_EQUAL( vector.size(), 1 );
|
BOOST_REQUIRE_EQUAL( vector.size(), 1 );
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ public:
|
||||||
{
|
{
|
||||||
NGSPICE* ngspice = static_cast<NGSPICE*>( m_simulator.get() );
|
NGSPICE* ngspice = static_cast<NGSPICE*>( m_simulator.get() );
|
||||||
|
|
||||||
std::vector<double> xVector = ngspice->GetRealPlot( aXVectorName );
|
std::vector<double> xVector = ngspice->GetRealVector( aXVectorName );
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
|
|
||||||
for(; i < xVector.size(); ++i )
|
for(; i < xVector.size(); ++i )
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
|
|
||||||
for( auto& [vectorName, refValue] : aTestVectorsAndValues )
|
for( auto& [vectorName, refValue] : aTestVectorsAndValues )
|
||||||
{
|
{
|
||||||
std::vector<double> yVector = ngspice->GetMagPlot( vectorName );
|
std::vector<double> yVector = ngspice->GetGainVector( vectorName );
|
||||||
|
|
||||||
BOOST_REQUIRE_GE( yVector.size(), i + 1 );
|
BOOST_REQUIRE_GE( yVector.size(), i + 1 );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue