KiCad PCB EDA Suite
netlist_exporter_pspice_sim.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * https://www.gnu.org/licenses/gpl-3.0.html
20  * or you may search the http://www.gnu.org website for the version 3 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef NETLIST_EXPORTER_PSPICE_SIM_H
26 #define NETLIST_EXPORTER_PSPICE_SIM_H
27 
29 #include <vector>
30 
31 #include "sim_types.h"
32 
35 {
36 public:
38  SEARCH_STACK* aPaths = NULL ) :
39  NETLIST_EXPORTER_PSPICE( aMasterList, aLibs, aPaths )
40  {
41  }
42 
52  wxString GetSpiceVector( const wxString& aName, SIM_PLOT_TYPE aType,
53  const wxString& aParam = wxEmptyString ) const;
54 
60  wxString GetSpiceDevice( const wxString& aComponent ) const;
61 
65  static const std::vector<wxString>& GetCurrents( SPICE_PRIMITIVE aPrimitive );
66 
70  void SetSimCommand( const wxString& aCmd )
71  {
72  m_simCommand = aCmd;
73  }
74 
78  const wxString& GetSimCommand() const
79  {
80  return m_simCommand;
81  }
82 
87  {
88  m_simCommand.Clear();
89  }
90 
97 
101  wxString GetSheetSimCommand();
102 
106  static bool IsSimCommand( const wxString& aCmd )
107  {
108  return CommandToSimType( aCmd ) != ST_UNKNOWN;
109  }
110 
114  static SIM_TYPE CommandToSimType( const wxString& aCmd );
115 
116 protected:
117  void writeDirectives( OUTPUTFORMATTER* aFormatter, unsigned aCtl ) const override;
118 
119 private:
120 
122  wxString m_simCommand;
123 };
124 
125 #endif /* NETLIST_EXPORTER_PSPICE_SIM_H */
wxString m_simCommand
Custom simulation command (has priority over the schematic sheet simulation commands) ...
wxString GetSpiceDevice(const wxString &aComponent) const
Returns name of Spice device corresponding to a schematic component.
wxString GetSpiceVector(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam=wxEmptyString) const
Returns name of Spice dataset for a specific plot.
Class OUTPUTFORMATTER is an important interface (abstract class) used to output 8 bit text in a conve...
Definition: richio.h:327
Class SEARCH_STACK looks for files in a number of places.
Definition: search_stack.h:41
static bool IsSimCommand(const wxString &aCmd)
Determines if a directive is a simulation command.
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Returns simulation type basing on a simulation command directive.
Class NETLIST_OBJECT_LIST is a container holding and owning NETLIST_OBJECTs, which are connected item...
void writeDirectives(OUTPUTFORMATTER *aFormatter, unsigned aCtl) const override
Saves the Spice directives.
static const std::vector< wxString > & GetCurrents(SPICE_PRIMITIVE aPrimitive)
Returns a list of currents that can be probed in a Spice primitive.
wxString GetSheetSimCommand()
Returns simulation command directives placed in schematic sheets (if any).
SIM_TYPE
Possible simulation types
Definition: sim_types.h:29
void SetSimCommand(const wxString &aCmd)
Overrides the simulation command directive.
void ClearSimCommand()
Clears the simulation command directive.
NETLIST_EXPORTER_PSPICE_SIM(NETLIST_OBJECT_LIST *aMasterList, PART_LIBS *aLibs, SEARCH_STACK *aPaths=NULL)
Class PART_LIBS is a collection of PART_LIBs.
SPICE_PRIMITIVE
Basic Spice component primitives
Class NETLIST_EXPORTER_PSPICE generates a PSPICE compatible netlist.
const wxString & GetSimCommand() const
Returns the simulation command directive.
SIM_PLOT_TYPE
Possible plot types
Definition: sim_types.h:35
SIM_TYPE GetSimType()
Returns simulation type basing on the simulation command directives.
Special netlist exporter flavor that allows to override simulation commands.