32 #include <wx/dynlib.h> 33 #include <ngspice/sharedspice.h> 40 #ifndef NGSPICE_PACKAGE_VERSION 44 class wxDynamicLibrary;
56 bool LoadNetlist(
const std::string& aNetlist )
override;
68 bool Command(
const std::string& aCmd )
override;
74 std::vector<std::string>
AllPlots()
const override;
77 std::vector<COMPLEX>
GetPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
80 std::vector<double>
GetRealPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
83 std::vector<double>
GetImagPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
86 std::vector<double>
GetMagPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
89 std::vector<double>
GetPhasePlot(
const std::string& aName,
int aMaxLen = -1 )
override;
94 virtual const std::string
GetNetlist()
const override;
103 typedef void ( *
ngSpice_Init )( SendChar*, SendStat*, ControlledExit*, SendData*, SendInitData*,
104 BGThreadRunning*,
void* );
108 typedef char* ( *ngSpice_CurPlot )( void );
109 typedef char** ( *ngSpice_AllPlots )( void );
110 typedef char** ( *ngSpice_AllVecs )(
char* plotname );
127 bool loadSpinit(
const std::string& aFileName );
136 static int cbSendChar(
char* what,
int aId,
void* aUser );
137 static int cbSendStat(
char* what,
int aId,
void* aUser );
std::vector< std::string > AllPlots() const override
Return a requested vector with complex values.
static int cbBGThreadRunning(NG_BOOL aFinished, int aId, void *aUser)
bool Run() override
Halt the simulation.
void validate()
Error flag indicating that ngspice needs to be reloaded.
std::string findCmPath() const
Load codemodel files from a directory.
std::vector< double > GetRealPlot(const std::string &aName, int aMaxLen=-1) override
Return a requested vector with imaginary values.
char **(* ngSpice_AllVecs)(char *plotname)
wxDynamicLibrary m_dll
Execute commands from a file.
bool loadCodemodels(const std::string &aPath)
std::vector< double > GetImagPlot(const std::string &aName, int aMaxLen=-1) override
Return a requested vector with magnitude values.
ngSpice_Running m_ngSpice_Running
std::vector< double > GetMagPlot(const std::string &aName, int aMaxLen=-1) override
Return a requested vector with phase values.
static bool m_initialized
Current netlist.
void(* ngSpice_Init)(SendChar *, SendStat *, ControlledExit *, SendData *, SendInitData *, BGThreadRunning *, void *)
virtual const std::string GetNetlist() const override
Return current SPICE netlist used by the simulator.
ngGet_Vec_Info m_ngGet_Vec_Info
bool m_error
Ngspice should be initialized only once.
SIM_TYPE
< Possible simulation types
pvector_info(* ngGet_Vec_Info)(char *vecname)
char *(* ngSpice_CurPlot)(void)
std::vector< COMPLEX > GetPlot(const std::string &aName, int aMaxLen=-1) override
Return a requested vector with real values.
bool Stop() override
Check if simulation is running at the moment.
ngSpice_Init m_ngSpice_Init
std::string GetXAxis(SIM_TYPE aType) const override
Return a list with all vectors generated in current simulation.
std::vector< double > GetPhasePlot(const std::string &aName, int aMaxLen=-1) override
Return a requested vector with phase values.
int(* ngSpice_Command)(char *command)
void Init(const SPICE_SIMULATOR_SETTINGS *aSettings=nullptr) override
Load a netlist for the simulation.
bool LoadNetlist(const std::string &aNetlist) override
Execute the simulation with currently loaded netlist.
bool(* ngSpice_Running)(void)
Handle to DLL functions.
static int cbControlledExit(int aStatus, NG_BOOL aImmediate, NG_BOOL aExitOnQuit, int aId, void *aUser)
bool Command(const std::string &aCmd) override
Set a SPICE_REPORTER object to receive the simulation log.
static int cbSendStat(char *what, int aId, void *aUser)
bool IsRunning() override
Execute a Spice command as if it was typed into console.
ngSpice_AllVecs m_ngSpice_AllVecs
std::vector< std::string > GetSettingCommands() const override
Return current SPICE netlist used by the simulator.
ngSpice_Command m_ngSpice_Command
bool loadSpinit(const std::string &aFileName)
Check a few different locations for codemodel files and returns one if it exists.
static int cbSendChar(char *what, int aId, void *aUser)
ngSpice_Circ m_ngSpice_Circ
ngSpice_CurPlot m_ngSpice_CurPlot
ngSpice_AllPlots m_ngSpice_AllPlots
char **(* ngSpice_AllPlots)(void)
int(* ngSpice_Circ)(char **circarray)
Storage for simulator specific settings.