From caef84d62219c8f8bb93c59bce3aba23b35703b0 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Aug 2016 14:41:51 +0200 Subject: [PATCH] SPICE_SIMULATOR::GetXAxis() --- eeschema/sim/ngspice.cpp | 25 +++++++++++++++++++++++++ eeschema/sim/ngspice.h | 1 + eeschema/sim/sim_types.h | 13 +++++++++++++ eeschema/sim/spice_simulator.h | 5 +++++ 4 files changed, 44 insertions(+) diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index f05d17a9dd..6ca4f8c118 100644 --- a/eeschema/sim/ngspice.cpp +++ b/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"); diff --git a/eeschema/sim/ngspice.h b/eeschema/sim/ngspice.h index 975b62210d..0a38e25931 100644 --- a/eeschema/sim/ngspice.h +++ b/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 GetPlot( const std::string& aName, int aMaxLen = -1 ) override; std::vector GetRealPlot( const std::string& aName, int aMaxLen = -1 ) override; diff --git a/eeschema/sim/sim_types.h b/eeschema/sim/sim_types.h index 887eef887c..5a37278623 100644 --- a/eeschema/sim/sim_types.h +++ b/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 */ diff --git a/eeschema/sim/spice_simulator.h b/eeschema/sim/spice_simulator.h index 611a954c23..1231e042e1 100644 --- a/eeschema/sim/spice_simulator.h +++ b/eeschema/sim/spice_simulator.h @@ -25,6 +25,8 @@ #ifndef SPICE_SIMULATOR_H #define SPICE_SIMULATOR_H +#include "sim_types.h" + #include #include #include @@ -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;