32 #include <wx/dynlib.h> 33 #include <ngspice/sharedspice.h> 35 class wxDynamicLibrary;
47 bool LoadNetlist(
const std::string& aNetlist )
override;
59 bool Command(
const std::string& aCmd )
override;
65 std::vector<std::string>
AllPlots()
const override;
68 std::vector<COMPLEX>
GetPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
71 std::vector<double>
GetRealPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
74 std::vector<double>
GetImagPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
77 std::vector<double>
GetMagPlot(
const std::string& aName,
int aMaxLen = -1 )
override;
80 std::vector<double>
GetPhasePlot(
const std::string& aName,
int aMaxLen = -1 )
override;
85 virtual const std::string
GetNetlist()
const override;
94 typedef void ( *
ngSpice_Init )( SendChar*, SendStat*, ControlledExit*, SendData*, SendInitData*,
95 BGThreadRunning*,
void* );
99 typedef char* ( *ngSpice_CurPlot )( void );
100 typedef char** ( *ngSpice_AllPlots )( void );
101 typedef char** ( *ngSpice_AllVecs )(
char* plotname );
117 bool loadSpinit(
const std::string& aFileName );
126 static int cbSendChar(
char* what,
int id,
void* user );
127 static int cbSendStat(
char* what,
int id,
void* user );
129 static int cbControlledExit(
int status,
bool immediate,
bool exit_upon_quit,
int id,
std::vector< std::string > AllPlots() const override
Return a requested vector with complex values.
bool Run() override
Halt the simulation.
static int cbBGThreadRunning(bool is_running, int id, void *user)
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.
static int cbControlledExit(int status, bool immediate, bool exit_upon_quit, int id, void *user)
char **(* ngSpice_AllVecs)(char *plotname)
static int cbSendChar(char *what, int id, void *user)
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.
bool Command(const std::string &aCmd) override
Set a SPICE_REPORTER object to receive the simulation log.
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.
ngSpice_Circ m_ngSpice_Circ
ngSpice_CurPlot m_ngSpice_CurPlot
ngSpice_AllPlots m_ngSpice_AllPlots
static int cbSendStat(char *what, int id, void *user)
char **(* ngSpice_AllPlots)(void)
int(* ngSpice_Circ)(char **circarray)
Storage for simulator specific settings.