Browse Source

SPICE_SIMULATOR::GetXAxis()

pull/3/merge
Maciej Suminski 9 years ago
parent
commit
caef84d622
  1. 25
      eeschema/sim/ngspice.cpp
  2. 1
      eeschema/sim/ngspice.h
  3. 13
      eeschema/sim/sim_types.h
  4. 5
      eeschema/sim/spice_simulator.h

25
eeschema/sim/ngspice.cpp

@ -248,6 +248,31 @@ bool NGSPICE::Command( const string& aCmd )
}
string NGSPICE::GetXAxis( SIM_TYPE aType ) const
{
switch( aType )
{
case ST_AC:
case ST_NOISE:
return string( "frequency" );
break;
case ST_DC:
return string( "v-sweep" );
break;
case ST_TRANSIENT:
return string( "time" );
break;
default:
break;
}
return string( "" );
}
void NGSPICE::dump()
{
// m_ngSpice_Command("run\n");

1
eeschema/sim/ngspice.h

@ -42,6 +42,7 @@ public:
bool Stop() override;
bool IsRunning() override;
bool Command( const std::string& aCmd ) override;
std::string GetXAxis( SIM_TYPE aType ) const override;
std::vector<COMPLEX> GetPlot( const std::string& aName, int aMaxLen = -1 ) override;
std::vector<double> GetRealPlot( const std::string& aName, int aMaxLen = -1 ) override;

13
eeschema/sim/sim_types.h

@ -31,4 +31,17 @@ enum SIM_TYPE {
ST_POLE_ZERO, ST_SENSITIVITY, ST_TRANS_FUNC, ST_TRANSIENT
};
///> Possible plot types
enum SIM_PLOT_TYPE {
// Y axis
SPT_VOLTAGE = 0x01,
SPT_CURRENT = 0x02,
SPT_AC_PHASE = 0x04,
SPT_AC_MAG = 0x08,
SPT_TIME = 0x10,
SPT_FREQUENCY = 0x20,
SPT_SWEEP = 0x40
};
#endif /* SIM_TYPES_H */

5
eeschema/sim/spice_simulator.h

@ -25,6 +25,8 @@
#ifndef SPICE_SIMULATOR_H
#define SPICE_SIMULATOR_H
#include "sim_types.h"
#include <string>
#include <vector>
#include <complex>
@ -48,6 +50,9 @@ public:
virtual bool IsRunning() = 0;
virtual bool Command( const std::string& aCmd ) = 0;
///> Returns X axis name for a given simulation type
virtual std::string GetXAxis( SIM_TYPE aType ) const = 0;
virtual void SetReporter( SPICE_REPORTER* aReporter )
{
m_reporter = aReporter;

Loading…
Cancel
Save