KiCad PCB EDA Suite
NETLIST_EXPORTER_PSPICE_SIM Class Reference

Special netlist exporter flavor that allows one to override simulation commands. More...

#include <netlist_exporter_pspice_sim.h>

Inheritance diagram for NETLIST_EXPORTER_PSPICE_SIM:
NETLIST_EXPORTER_PSPICE NETLIST_EXPORTER_BASE

Public Types

typedef std::list< SPICE_ITEMSPICE_ITEM_LIST
 Net name to circuit node number mapping. More...
 
typedef std::map< wxString, int > NET_INDEX_MAP
 

Public Member Functions

 NETLIST_EXPORTER_PSPICE_SIM (SCHEMATIC *aSchematic)
 
wxString ComponentToVector (const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam=wxEmptyString) const
 Return name of Spice dataset for a specific plot. More...
 
SIM_PLOT_TYPE VectorToSignal (const std::string &aVector, wxString &aSignal) const
 Return name of Spice dataset for a specific plot. More...
 
void SetSimCommand (const wxString &aCmd)
 Override the simulation command directive. More...
 
const wxString & GetSimCommand () const
 Return the simulation command directive. More...
 
void ClearSimCommand ()
 Clear the simulation command directive. More...
 
wxString GetUsedSimCommand ()
 Return the command directive that is in use (either from the sheet or from m_simCommand. More...
 
SIM_TYPE GetSimType ()
 Return simulation type basing on the simulation command directives. More...
 
wxString GetSheetSimCommand ()
 Return simulation command directives placed in schematic sheets (if any). More...
 
bool ParseDCCommand (const wxString &aCmd, SPICE_DC_PARAMS *aSource1, SPICE_DC_PARAMS *aSource2)
 Parse a two-source .dc command directive into its components. More...
 
const SPICE_ITEM_LISTGetSpiceItems () const
 Return list of items representing schematic components in the Spice world. More...
 
wxString GetSpiceDevice (const wxString &aComponent) const
 Return name of Spice device corresponding to a schematic component. More...
 
bool WriteNetlist (const wxString &aOutFileName, unsigned aNetlistOptions) override
 Write to specified output file. More...
 
bool Format (OUTPUTFORMATTER *aFormatter, unsigned aCtl)
 
bool ProcessNetlist (unsigned aCtl)
 Process the netlist to create net mapping and a list of SPICE_ITEMs. More...
 
const NET_INDEX_MAPGetNetIndexMap () const
 Return a map of circuit nodes to net names. More...
 
void UpdateDirectives (unsigned aCtl)
 Update the vector of Spice directives placed in the schematics. More...
 
const std::vector< wxString > GetDirectives () const
 Return a vector of Spice directives found in the schematics. More...
 

Static Public Member Functions

static const std::vector< wxString > & GetCurrents (SPICE_PRIMITIVE aPrimitive)
 Return a list of currents that can be probed in a Spice primitive. More...
 
static bool IsSimCommand (const wxString &aCmd)
 Determine if a directive is a simulation command. More...
 
static SIM_TYPE CommandToSimType (const wxString &aCmd)
 Return simulation type basing on a simulation command directive. More...
 
static void ReplaceForbiddenChars (wxString &aNetName)
 Replace illegal spice net name characters with an underscore. More...
 
static const std::vector< wxString > & GetSpiceFields ()
 Return a vector of component field names related to Spice simulation. More...
 
static const wxString & GetSpiceFieldName (SPICE_FIELD aField)
 Return a string used for a particular component field related to Spice simulation. More...
 
static wxString GetSpiceField (SPICE_FIELD aField, SCH_COMPONENT *aComponent, unsigned aCtl)
 Retrieve either the requested field value or the default value. More...
 
static wxString GetSpiceFieldDefVal (SPICE_FIELD aField, SCH_COMPONENT *aComponent, unsigned aCtl)
 Retrieve the default value for a given field. More...
 
static bool StringToBool (const wxString &aStr)
 Convert typical boolean string values (no/yes, true/false, 1/0) to a boolean value. More...
 
static wxString MakeCommandLine (const wxString &aFormatString, const wxString &aNetlistFile, const wxString &aFinalFile, const wxString &aProjectDirectory)
 Function MakeCommandLine builds up a string that describes a command line for executing a child process. More...
 

Protected Member Functions

void writeDirectives (OUTPUTFORMATTER *aFormatter, unsigned aCtl) const override
 Save the Spice directives. More...
 
void CreatePinList (SCH_COMPONENT *aSymbol, SCH_SHEET_PATH *aSheetPath)
 Function findNextSymbolAndCreatePinList finds a symbol from the DrawList and builds its pin list in m_sortedSymbolPinList. More...
 
SCH_COMPONENTfindNextSymbol (EDA_ITEM *aItem, SCH_SHEET_PATH *aSheetPath)
 Checks if the given symbol should be processed for netlisting. More...
 
void eraseDuplicatePins ()
 Function eraseDuplicatePins erase duplicate Pins from m_sortedSymbolPinList (i.e. More...
 
void findAllUnitsOfSymbol (SCH_COMPONENT *aSymbol, LIB_PART *aPart, SCH_SHEET_PATH *aSheetPath)
 Function findAllUnitsOfSymbol is used for "multiple parts per package" symbols. More...
 

Protected Attributes

std::vector< PIN_INFOm_sortedSymbolPinList
 Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic symbol data in netlist (comp section). More...
 
UNIQUE_STRINGS m_referencesAlreadyFound
 Used for "multiple parts per package" symbols to avoid processing a lib part more than once. More...
 
std::set< LIB_PART *, LIB_PART_LESS_THANm_libParts
 unique library parts used. LIB_PART items are sorted by names More...
 
SCHEMATICm_schematic
 The schematic we're generating a netlist for. More...
 
SCH_SHEET_PATH m_savedCurrentSheet
 The schematic's CurrentSheet when we entered. Restore on exiting. More...
 

Private Attributes

wxString m_simCommand
 < Custom simulation command (has priority over the schematic sheet simulation commands) More...
 

Detailed Description

Special netlist exporter flavor that allows one to override simulation commands.

Definition at line 46 of file netlist_exporter_pspice_sim.h.

Member Typedef Documentation

◆ NET_INDEX_MAP

typedef std::map<wxString, int> NETLIST_EXPORTER_PSPICE::NET_INDEX_MAP
inherited

Definition at line 116 of file netlist_exporter_pspice.h.

◆ SPICE_ITEM_LIST

Net name to circuit node number mapping.

Definition at line 113 of file netlist_exporter_pspice.h.

Constructor & Destructor Documentation

◆ NETLIST_EXPORTER_PSPICE_SIM()

NETLIST_EXPORTER_PSPICE_SIM::NETLIST_EXPORTER_PSPICE_SIM ( SCHEMATIC aSchematic)
inline

Definition at line 49 of file netlist_exporter_pspice_sim.h.

49  :
50  NETLIST_EXPORTER_PSPICE( aSchematic )
51  {
52  }
NETLIST_EXPORTER_PSPICE(SCHEMATIC *aSchematic)

Member Function Documentation

◆ ClearSimCommand()

void NETLIST_EXPORTER_PSPICE_SIM::ClearSimCommand ( )
inline

Clear the simulation command directive.

Definition at line 101 of file netlist_exporter_pspice_sim.h.

102  {
103  m_simCommand.Clear();
104  }
wxString m_simCommand
< Custom simulation command (has priority over the schematic sheet simulation commands)

References m_simCommand.

◆ CommandToSimType()

SIM_TYPE NETLIST_EXPORTER_PSPICE_SIM::CommandToSimType ( const wxString &  aCmd)
static

Return simulation type basing on a simulation command directive.

Definition at line 167 of file netlist_exporter_pspice_sim.cpp.

168 {
169  const std::vector<std::pair<wxString, SIM_TYPE>> simCmds = {
170  { "^.ac\\M.*", ST_AC },
171  { "^.dc\\M.*", ST_DC },
172  { "^.tran\\M.*", ST_TRANSIENT },
173  { "^.op\\M.*", ST_OP },
174  { "^.disto\\M.*", ST_DISTORTION },
175  { "^.noise\\M.*", ST_NOISE },
176  { "^.pz\\M.*", ST_POLE_ZERO },
177  { "^.sens\\M.*", ST_SENSITIVITY },
178  { "^.tf\\M.*", ST_TRANS_FUNC } };
179  wxRegEx simCmd;
180 
181  for( const auto& c : simCmds )
182  {
183  simCmd.Compile( c.first, wxRE_ADVANCED | wxRE_NOSUB | wxRE_ICASE );
184 
185  if( simCmd.Matches( aCmd ) )
186  return c.second;
187  }
188 
189  return ST_UNKNOWN;
190 }

References ST_AC, ST_DC, ST_DISTORTION, ST_NOISE, ST_OP, ST_POLE_ZERO, ST_SENSITIVITY, ST_TRANS_FUNC, ST_TRANSIENT, and ST_UNKNOWN.

Referenced by BOOST_AUTO_TEST_CASE(), GetSimType(), SIM_PANEL_BASE::GetType(), IsSimCommand(), SIM_PLOT_FRAME::NewPlotPanel(), and SIM_PLOT_FRAME::onSettings().

◆ ComponentToVector()

wxString NETLIST_EXPORTER_PSPICE_SIM::ComponentToVector ( const wxString &  aName,
SIM_PLOT_TYPE  aType,
const wxString &  aParam = wxEmptyString 
) const

Return name of Spice dataset for a specific plot.

Parameters
aNameis name of the measured net or device
aTypedescribes the type of expected plot
aParamis an optional parameter for devices, if absent it will return current (only for passive devices).
Returns
Empty string if query is invalid, otherwise a plot name that can be requested from the simulator.

Definition at line 30 of file netlist_exporter_pspice_sim.cpp.

32 {
33  wxString res;
34 
35  // Some of the flags should exclude mutually
36  assert( ( ( aType & SPT_VOLTAGE ) == 0 ) != ( ( aType & SPT_CURRENT ) == 0 ) );
37  assert( ( ( aType & SPT_AC_PHASE ) == 0 ) || ( ( aType & SPT_AC_MAG ) == 0 ) );
38 
39  if( aType & SPT_VOLTAGE )
40  {
41  // netnames are escaped (can contain "{slash}" for '/') Unscape them:
42  wxString spicenet = UnescapeString( aName );
43 
44  // Spice netlist netnames does not accept some chars, which are replaced
45  // by eeschema netlist generator.
46  // Replace these forbidden chars to find the actual spice net name
48 
49  return wxString::Format( "V(%s)", spicenet );
50  }
51 
52  else if( aType & SPT_CURRENT )
53  {
54  wxString device = GetSpiceDevice( aName ).Lower();
55  wxString param = aParam.Lower();
56 
57  if( device.length() > 0 && device[0] == 'x' )
58  {
59  return "current probe of .subckt not yet implemented";
60  }
61  else
62  {
63  return wxString::Format( "@%s[%s]",
64  device,
65  param.IsEmpty() ? "i" : param );
66  }
67  }
68 
69  return res;
70 }
static void ReplaceForbiddenChars(wxString &aNetName)
Replace illegal spice net name characters with an underscore.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
wxString GetSpiceDevice(const wxString &aComponent) const
Return name of Spice device corresponding to a schematic component.

References Format(), NETLIST_EXPORTER_PSPICE::GetSpiceDevice(), NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars(), SPT_AC_MAG, SPT_AC_PHASE, SPT_CURRENT, SPT_VOLTAGE, and UnescapeString().

Referenced by writeDirectives().

◆ CreatePinList()

void NETLIST_EXPORTER_BASE::CreatePinList ( SCH_COMPONENT aSymbol,
SCH_SHEET_PATH aSheetPath 
)
protectedinherited

Function findNextSymbolAndCreatePinList finds a symbol from the DrawList and builds its pin list in m_sortedSymbolPinList.

This list is sorted by pin num. The symbol is the next actual symbol after aSymbol.

Power symbols and virtual symbols that have their reference designators starting with '#' are skipped.

Definition at line 122 of file netlist_exporter_base.cpp.

123 {
124  wxString ref( aSymbol->GetRef( aSheetPath ) );
125 
126  // Power symbols and other symbols which have the reference starting with "#" are not
127  // included in netlist (pseudo or virtual symbols)
128 
129  if( ref[0] == wxChar( '#' ) )
130  return;
131 
132  // if( aSymbol->m_FlagControlMulti == 1 )
133  // continue; /* yes */
134  // removed because with multiple instances of one schematic (several sheets pointing to
135  // 1 screen), this will be erroneously be toggled.
136 
137  if( !aSymbol->GetPartRef() )
138  return;
139 
140  m_sortedSymbolPinList.clear();
141 
142  // If symbol is a "multi parts per package" type
143  if( aSymbol->GetPartRef()->GetUnitCount() > 1 )
144  {
145  // Collect all pins for this reference designator by searching the entire design for
146  // other parts with the same reference designator.
147  // This is only done once, it would be too expensive otherwise.
148  findAllUnitsOfSymbol( aSymbol, aSymbol->GetPartRef().get(), aSheetPath );
149  }
150 
151  else // GetUnitCount() <= 1 means one part per package
152  {
154 
155  for( const SCH_PIN* pin : aSymbol->GetPins( aSheetPath ) )
156  {
157  if( SCH_CONNECTION* conn = pin->Connection( aSheetPath ) )
158  {
159  const wxString& netName = conn->Name();
160 
161  // Skip unconnected pins
162  CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, *aSheetPath );
163 
164  if( !sg || sg->m_no_connect || sg->m_items.size() < 2 )
165  continue;
166 
167  m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName );
168  }
169  }
170  }
171 
172  // Sort pins in m_SortedComponentPinList by pin number
174 
175  // Remove duplicate Pins in m_SortedComponentPinList
177 
178  // record the usage of this library component entry.
179  m_libParts.insert( aSymbol->GetPartRef().get() ); // rejects non-unique pointers
180 }
CONNECTION_SUBGRAPH * FindSubgraphByName(const wxString &aNetName, const SCH_SHEET_PATH &aPath)
Returns the subgraph for a given net name on a given sheet.
std::vector< PIN_INFO > m_sortedSymbolPinList
Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic...
CONNECTION_GRAPH * ConnectionGraph() const
Definition: schematic.h:137
Calculates the connectivity of a schematic and generates netlists.
void eraseDuplicatePins()
Function eraseDuplicatePins erase duplicate Pins from m_sortedSymbolPinList (i.e.
static bool sortPinsByNum(PIN_INFO &aPin1, PIN_INFO &aPin2)
Comparison routine for sorting by pin numbers.
void findAllUnitsOfSymbol(SCH_COMPONENT *aSymbol, LIB_PART *aPart, SCH_SHEET_PATH *aSheetPath)
Function findAllUnitsOfSymbol is used for "multiple parts per package" symbols.
std::set< LIB_PART *, LIB_PART_LESS_THAN > m_libParts
unique library parts used. LIB_PART items are sorted by names
A subgraph is a set of items that are electrically connected on a single sheet.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
std::vector< SCH_ITEM * > m_items
std::unique_ptr< LIB_PART > & GetPartRef()
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieves a list of the SCH_PINs for the given sheet path.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
SCH_ITEM * m_no_connect
No-connect item in graph, if any.
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.

References SCHEMATIC::ConnectionGraph(), NETLIST_EXPORTER_BASE::eraseDuplicatePins(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), CONNECTION_GRAPH::FindSubgraphByName(), SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetPins(), SCH_COMPONENT::GetRef(), CONNECTION_SUBGRAPH::m_items, NETLIST_EXPORTER_BASE::m_libParts, CONNECTION_SUBGRAPH::m_no_connect, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_BASE::m_sortedSymbolPinList, and sortPinsByNum().

Referenced by NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().

◆ eraseDuplicatePins()

void NETLIST_EXPORTER_BASE::eraseDuplicatePins ( )
protectedinherited

Function eraseDuplicatePins erase duplicate Pins from m_sortedSymbolPinList (i.e.

set pointer in this list to NULL). (This is a list of pins found in the whole schematic, for a single symbol.) These duplicate pins were put in list because some pins (power pins...) are found more than once when in "multiple parts per package" symbols. For instance, a 74ls00 has 4 parts, and therefore the VCC pin and GND pin appears 4 times in the list. Note: this list MUST be sorted by pin number (.m_PinNum member value) Also set the m_Flag member of "removed" NETLIST_OBJECT pin item to 1

Definition at line 183 of file netlist_exporter_base.cpp.

184 {
185  for( unsigned ii = 0; ii < m_sortedSymbolPinList.size(); ii++ )
186  {
187  if( m_sortedSymbolPinList[ii].num.empty() ) /* already deleted */
188  continue;
189 
190  /* Search for duplicated pins
191  * If found, remove duplicates. The priority is to keep connected pins
192  * and remove unconnected
193  * - So this allows (for instance when using multi op amps per package
194  * - to connect only one op amp to power
195  * Because the pin list is sorted by m_PinNum value, duplicated pins
196  * are necessary successive in list
197  */
198  int idxref = ii;
199 
200  for( unsigned jj = ii + 1; jj < m_sortedSymbolPinList.size(); jj++ )
201  {
202  if( m_sortedSymbolPinList[jj].num.empty() ) // Already removed
203  continue;
204 
205  // if other pin num, stop search,
206  // because all pins having the same number are consecutive in list.
207  if( m_sortedSymbolPinList[idxref].num != m_sortedSymbolPinList[jj].num )
208  break;
209 
210  m_sortedSymbolPinList[jj].num.clear();
211  }
212  }
213 }
std::vector< PIN_INFO > m_sortedSymbolPinList
Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic...

References NETLIST_EXPORTER_BASE::m_sortedSymbolPinList.

Referenced by NETLIST_EXPORTER_BASE::CreatePinList().

◆ findAllUnitsOfSymbol()

void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol ( SCH_COMPONENT aSymbol,
LIB_PART aPart,
SCH_SHEET_PATH aSheetPath 
)
protectedinherited

Function findAllUnitsOfSymbol is used for "multiple parts per package" symbols.

Search the entire design for all units of aSymbol based on matching reference designator, and for each unit, add all its pins to the temporary sorted pin list, m_sortedSymbolPinList.

Definition at line 216 of file netlist_exporter_base.cpp.

218 {
219  wxString ref = aSymbol->GetRef( aSheetPath );
220  wxString ref2;
221 
222  SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
224 
225  for( unsigned i = 0; i < sheetList.size(); i++ )
226  {
227  for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
228  {
229  SCH_COMPONENT* comp2 = static_cast<SCH_COMPONENT*>( item );
230 
231  ref2 = comp2->GetRef( &sheetList[i] );
232 
233  if( ref2.CmpNoCase( ref ) != 0 )
234  continue;
235 
236  for( const SCH_PIN* pin : comp2->GetPins( aSheetPath ) )
237  {
238  if( SCH_CONNECTION* conn = pin->Connection( aSheetPath ) )
239  {
240  const wxString& netName = conn->Name();
241 
242  // Skip unconnected pins
243  CONNECTION_SUBGRAPH* sg = graph->FindSubgraphByName( netName, *aSheetPath );
244 
245  if( !sg || sg->m_no_connect || sg->m_items.size() < 2 )
246  continue;
247 
248  m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName );
249  }
250  }
251  }
252  }
253 }
CONNECTION_SUBGRAPH * FindSubgraphByName(const wxString &aNetName, const SCH_SHEET_PATH &aPath)
Returns the subgraph for a given net name on a given sheet.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
std::vector< PIN_INFO > m_sortedSymbolPinList
Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic...
CONNECTION_GRAPH * ConnectionGraph() const
Definition: schematic.h:137
Calculates the connectivity of a schematic and generates netlists.
A subgraph is a set of items that are electrically connected on a single sheet.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
std::vector< SCH_ITEM * > m_items
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieves a list of the SCH_PINs for the given sheet path.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Schematic symbol object.
Definition: sch_component.h:79
SCH_ITEM * m_no_connect
No-connect item in graph, if any.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:194
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.

References SCHEMATIC::ConnectionGraph(), CONNECTION_GRAPH::FindSubgraphByName(), SCH_COMPONENT::GetPins(), SCH_COMPONENT::GetRef(), SCHEMATIC::GetSheets(), CONNECTION_SUBGRAPH::m_items, CONNECTION_SUBGRAPH::m_no_connect, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_BASE::m_sortedSymbolPinList, and SCH_COMPONENT_T.

Referenced by NETLIST_EXPORTER_BASE::CreatePinList().

◆ findNextSymbol()

SCH_COMPONENT * NETLIST_EXPORTER_BASE::findNextSymbol ( EDA_ITEM aItem,
SCH_SHEET_PATH aSheetPath 
)
protectedinherited

Checks if the given symbol should be processed for netlisting.

Prevents processing multi-unit symbols more than once, etc.

Parameters
aItemis a symbol to check
aSheetPathis the sheet to check the symbol for
Returns
the symbol if it should be processed, or nullptr

Definition at line 74 of file netlist_exporter_base.cpp.

75 {
76  wxString ref;
77 
78  if( aItem->Type() != SCH_COMPONENT_T )
79  return nullptr;
80 
81  // found next component
82  SCH_COMPONENT* symbol = (SCH_COMPONENT*) aItem;
83 
84  // Power symbols and other symbols which have the reference starting with "#" are not
85  // included in netlist (pseudo or virtual symbols)
86  ref = symbol->GetRef( aSheetPath );
87 
88  if( ref[0] == wxChar( '#' ) )
89  return nullptr;
90 
91  // if( symbol->m_FlagControlMulti == 1 )
92  // continue; /* yes */
93  // removed because with multiple instances of one schematic (several sheets pointing to
94  // 1 screen), this will be erroneously be toggled.
95 
96  if( !symbol->GetPartRef() )
97  return nullptr;
98 
99  // If component is a "multi parts per package" type
100  if( symbol->GetPartRef()->GetUnitCount() > 1 )
101  {
102  // test if this reference has already been processed, and if so skip
103  if( m_referencesAlreadyFound.Lookup( ref ) )
104  return nullptr;
105  }
106 
107  // record the usage of this library component entry.
108  m_libParts.insert( symbol->GetPartRef().get() ); // rejects non-unique pointers
109 
110  return symbol;
111 }
bool Lookup(const wxString &aString)
Function Lookup returns true if aString already exists in the set, otherwise returns false and adds a...
std::set< LIB_PART *, LIB_PART_LESS_THAN > m_libParts
unique library parts used. LIB_PART items are sorted by names
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple parts per package" symbols to avoid processing a lib part more than once.
std::unique_ptr< LIB_PART > & GetPartRef()
Schematic symbol object.
Definition: sch_component.h:79
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.

References SCH_COMPONENT::GetPartRef(), SCH_COMPONENT::GetRef(), UNIQUE_STRINGS::Lookup(), NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, SCH_COMPONENT_T, and EDA_ITEM::Type().

Referenced by NETLIST_EXPORTER_XML::makeSymbols(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ Format()

bool NETLIST_EXPORTER_PSPICE::Format ( OUTPUTFORMATTER aFormatter,
unsigned  aCtl 
)
inherited

Definition at line 79 of file netlist_exporter_pspice.cpp.

80 {
81  // Netlist options
82  const bool useNetcodeAsNetName = false;//aCtl & NET_USE_NETCODES_AS_NETNAMES;
83 
84  // default title
85  m_title = "KiCad schematic";
86 
87  if( !ProcessNetlist( aCtl ) )
88  return false;
89 
90  aFormatter->Print( 0, ".title %s\n", (const char*) m_title.c_str() );
91 
92  // Write .include directives
93  for( const auto& lib : m_libraries )
94  {
95  wxString full_path;
96 
97  if( ( aCtl & NET_ADJUST_INCLUDE_PATHS ) )
98  {
99  // Look for the library in known search locations
100  full_path = ResolveFile( lib, &Pgm().GetLocalEnvVariables(), &m_schematic->Prj() );
101 
102  if( full_path.IsEmpty() )
103  {
104  DisplayError( NULL, wxString::Format( _( "Could not find library file %s" ), lib ) );
105  full_path = lib;
106  }
107  }
108  else
109  full_path = lib; // just use the unaltered path
110 
111  aFormatter->Print( 0, ".include \"%s\"\n", (const char*) full_path.c_str() );
112  }
113 
114  unsigned int NC_counter = 1;
115 
116  for( const auto& item : m_spiceItems )
117  {
118  if( !item.m_enabled )
119  continue;
120 
121  wxString device = GetSpiceDevice( item.m_refName );
122  aFormatter->Print( 0, "%s ", (const char*) device.c_str() );
123 
124  size_t pspiceNodes = item.m_pinSequence.empty() ? item.m_pins.size() : item.m_pinSequence.size();
125 
126  for( size_t ii = 0; ii < pspiceNodes; ii++ )
127  {
128  // Use the custom order if defined, otherwise use the standard pin order as defined in the compon
129  size_t activePinIndex = item.m_pinSequence.empty() ? ii : item.m_pinSequence[ii];
130  // Valid used Node Indexes are in the set
131  // {0,1,2,...m_item.m_pin.size()-1}
132  if( activePinIndex >= item.m_pins.size() )
133  {
134  wxASSERT_MSG( false, "Used an invalid pin number in node sequence" );
135  continue;
136  }
137 
138  wxString netName = item.m_pins[activePinIndex];
139 
140  wxASSERT( m_netMap.count( netName ) );
141 
142  if( useNetcodeAsNetName )
143  {
144  aFormatter->Print( 0, "%d ", m_netMap[netName] );
145  }
146  else
147  {
148  // Replace parenthesis with underscore to prevent parse issues with simulators
149  ReplaceForbiddenChars( netName );
150 
151  // unescape net names that contain a escaped sequence ("{slash}"):
152  netName = UnescapeString( netName );
153 
154  // Borrow LTSpice's nomenclature for unconnected nets
155  if( netName.IsEmpty() )
156  netName = wxString::Format( wxT( "NC_%.2u" ), NC_counter++ );
157 
158  aFormatter->Print( 0, "%s ", TO_UTF8( netName ) );
159  }
160  }
161 
162  aFormatter->Print( 0, "%s\n", (const char*) item.m_model.c_str() );
163  }
164 
165  // Print out all directives found in the text fields on the schematics
166  writeDirectives( aFormatter, aCtl );
167 
168  aFormatter->Print( 0, ".end\n" );
169 
170  return true;
171 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
wxString ResolveFile(const wxString &aFileName, const ENV_VAR_MAP *aEnvVars, const PROJECT *aProject)
Search the default paths trying to find one with the requested file.
Definition: env_paths.cpp:150
std::set< wxString > m_libraries
Map circuit nodes to net names.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
wxString m_title
< Spice simulation title found in the processed schematic sheet
NET_INDEX_MAP m_netMap
List of items representing schematic components in the Spice world.
#define NULL
virtual void writeDirectives(OUTPUTFORMATTER *aFormatter, unsigned aCtl) const
Save the Spice directives.
bool ProcessNetlist(unsigned aCtl)
Process the netlist to create net mapping and a list of SPICE_ITEMs.
static void ReplaceForbiddenChars(wxString &aNetName)
Replace illegal spice net name characters with an underscore.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33
wxString UnescapeString(const wxString &aSource)
Definition: string.cpp:150
PROJECT & Prj() const
Return a reference to the project this schematic is part of.
Definition: schematic.h:85
wxString GetSpiceDevice(const wxString &aComponent) const
Return name of Spice device corresponding to a schematic component.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:408

References _, DisplayError(), Format(), NETLIST_EXPORTER_PSPICE::GetSpiceDevice(), NETLIST_EXPORTER_PSPICE::m_libraries, NETLIST_EXPORTER_PSPICE::m_netMap, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_PSPICE::m_spiceItems, NETLIST_EXPORTER_PSPICE::m_title, NET_ADJUST_INCLUDE_PATHS, NULL, Pgm(), OUTPUTFORMATTER::Print(), SCHEMATIC::Prj(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars(), ResolveFile(), TO_UTF8, UnescapeString(), and NETLIST_EXPORTER_PSPICE::writeDirectives().

Referenced by NETLIST_EXPORTER_PSPICE::WriteNetlist().

◆ GetCurrents()

const std::vector< wxString > & NETLIST_EXPORTER_PSPICE_SIM::GetCurrents ( SPICE_PRIMITIVE  aPrimitive)
static

Return a list of currents that can be probed in a Spice primitive.

Definition at line 108 of file netlist_exporter_pspice_sim.cpp.

109 {
110  static const std::vector<wxString> passive = { "I" };
111  static const std::vector<wxString> diode = { "Id" };
112  static const std::vector<wxString> bjt = { "Ib", "Ic", "Ie" };
113  static const std::vector<wxString> mos = { "Ig", "Id", "Is" };
114  static const std::vector<wxString> empty;
115 
116  switch( aPrimitive )
117  {
118  case SP_RESISTOR:
119  case SP_CAPACITOR:
120  case SP_INDUCTOR:
121  case SP_VSOURCE:
122  return passive;
123 
124  case SP_DIODE:
125  return diode;
126 
127  case SP_BJT:
128  return bjt;
129 
130  case SP_MOSFET:
131  return mos;
132 
133  default:
134  return empty;
135  }
136 }
static bool empty(const wxTextEntryBase *aCtrl)

References empty(), SP_BJT, SP_CAPACITOR, SP_DIODE, SP_INDUCTOR, SP_MOSFET, SP_RESISTOR, and SP_VSOURCE.

Referenced by DIALOG_SIGNAL_LIST::TransferDataToWindow(), and writeDirectives().

◆ GetDirectives()

const std::vector<wxString> NETLIST_EXPORTER_PSPICE::GetDirectives ( ) const
inlineinherited

Return a vector of Spice directives found in the schematics.

Definition at line 204 of file netlist_exporter_pspice.h.

205  {
206  return m_directives;
207  }
std::vector< wxString > m_directives
Libraries used by the simulated circuit.

References NETLIST_EXPORTER_PSPICE::m_directives.

Referenced by GetSheetSimCommand(), and writeDirectives().

◆ GetNetIndexMap()

const NET_INDEX_MAP& NETLIST_EXPORTER_PSPICE::GetNetIndexMap ( ) const
inlineinherited

Return a map of circuit nodes to net names.

Definition at line 164 of file netlist_exporter_pspice.h.

165  {
166  return m_netMap;
167  }
NET_INDEX_MAP m_netMap
List of items representing schematic components in the Spice world.

References NETLIST_EXPORTER_PSPICE::m_netMap.

Referenced by DIALOG_SIM_SETTINGS::ShowModal(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), and writeDirectives().

◆ GetSheetSimCommand()

wxString NETLIST_EXPORTER_PSPICE_SIM::GetSheetSimCommand ( )

Return simulation command directives placed in schematic sheets (if any).

Definition at line 139 of file netlist_exporter_pspice_sim.cpp.

140 {
141  wxString simCmd;
142 
144 
145  for( const auto& dir : GetDirectives() )
146  {
147  if( IsSimCommand( dir ) )
148  simCmd += wxString::Format( "%s\r\n", dir );
149  }
150 
151  return simCmd;
152 }
const std::vector< wxString > GetDirectives() const
Return a vector of Spice directives found in the schematics.
static bool IsSimCommand(const wxString &aCmd)
Determine if a directive is a simulation command.
void UpdateDirectives(unsigned aCtl)
Update the vector of Spice directives placed in the schematics.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format(), NETLIST_EXPORTER_PSPICE::GetDirectives(), IsSimCommand(), NET_ALL_FLAGS, and NETLIST_EXPORTER_PSPICE::UpdateDirectives().

Referenced by GetUsedSimCommand(), and DIALOG_SIM_SETTINGS::loadDirectives().

◆ GetSimCommand()

const wxString& NETLIST_EXPORTER_PSPICE_SIM::GetSimCommand ( ) const
inline

Return the simulation command directive.

Definition at line 93 of file netlist_exporter_pspice_sim.h.

94  {
95  return m_simCommand;
96  }
wxString m_simCommand
< Custom simulation command (has priority over the schematic sheet simulation commands)

References m_simCommand.

◆ GetSimType()

SIM_TYPE NETLIST_EXPORTER_PSPICE_SIM::GetSimType ( )

Return simulation type basing on the simulation command directives.

Simulation directives set using SetSimCommand() have priority over the ones placed in schematic sheets.

Definition at line 161 of file netlist_exporter_pspice_sim.cpp.

162 {
164 }
wxString GetUsedSimCommand()
Return the command directive that is in use (either from the sheet or from m_simCommand.
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.

References CommandToSimType(), and GetUsedSimCommand().

Referenced by DIALOG_SIGNAL_LIST::TransferDataToWindow().

◆ GetSpiceDevice()

wxString NETLIST_EXPORTER_PSPICE::GetSpiceDevice ( const wxString &  aComponent) const
inherited

Return name of Spice device corresponding to a schematic component.

Parameters
aComponentis the component reference.
Returns
Spice device name or empty string if there is no such component in the netlist. The name is either plain reference if the first character of reference corresponds to the assigned device model type or it is the reference prefixed with a character defining the device model type.

Definition at line 43 of file netlist_exporter_pspice.cpp.

44 {
45  const auto& spiceItems = GetSpiceItems();
46 
47  auto it = std::find_if( spiceItems.begin(), spiceItems.end(), [&]( const SPICE_ITEM& item ) {
48  return item.m_refName == aComponent;
49  } );
50 
51  if( it == spiceItems.end() )
52  return wxEmptyString;
53 
54  // Prefix the device type if plain reference would result in a different device type
55  return it->m_primitive != it->m_refName[0] ?
56  wxString( it->m_primitive + it->m_refName ) : it->m_refName;
57 }
const SPICE_ITEM_LIST & GetSpiceItems() const
Return list of items representing schematic components in the Spice world.
Structure to represent a schematic component in the Spice simulation.

References NETLIST_EXPORTER_PSPICE::GetSpiceItems().

Referenced by ComponentToVector(), DIALOG_SIM_SETTINGS::evaluateDCControls(), NETLIST_EXPORTER_PSPICE::Format(), DIALOG_SIM_SETTINGS::TransferDataFromWindow(), and TUNER_SLIDER::TUNER_SLIDER().

◆ GetSpiceField()

wxString NETLIST_EXPORTER_PSPICE::GetSpiceField ( SPICE_FIELD  aField,
SCH_COMPONENT aComponent,
unsigned  aCtl 
)
staticinherited

Retrieve either the requested field value or the default value.

Definition at line 174 of file netlist_exporter_pspice.cpp.

176 {
177  SCH_FIELD* field = aComponent->FindField( GetSpiceFieldName( aField ) );
178  return field ? field->GetShownText() : GetSpiceFieldDefVal( aField, aComponent, aCtl );
179 }
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
static const wxString & GetSpiceFieldName(SPICE_FIELD aField)
Return a string used for a particular component field related to Spice simulation.
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:104
static wxString GetSpiceFieldDefVal(SPICE_FIELD aField, SCH_COMPONENT *aComponent, unsigned aCtl)
Retrieve the default value for a given field.

References SCH_COMPONENT::FindField(), SCH_FIELD::GetShownText(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal(), and NETLIST_EXPORTER_PSPICE::GetSpiceFieldName().

Referenced by SIM_PLOT_FRAME::AddTuner(), and NETLIST_EXPORTER_PSPICE::ProcessNetlist().

◆ GetSpiceFieldDefVal()

wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal ( SPICE_FIELD  aField,
SCH_COMPONENT aComponent,
unsigned  aCtl 
)
staticinherited

Retrieve the default value for a given field.

Definition at line 182 of file netlist_exporter_pspice.cpp.

184 {
185  switch( aField )
186  {
187  case SF_PRIMITIVE:
188  {
189  const wxString refName = aComponent->GetField( REFERENCE_FIELD )->GetShownText();
190  return refName.GetChar( 0 );
191  break;
192  }
193 
194  case SF_MODEL:
195  {
196  wxChar prim = aComponent->GetField( REFERENCE_FIELD )->GetShownText().GetChar( 0 );
197  wxString value = aComponent->GetField( VALUE_FIELD )->GetShownText();
198 
199  // Is it a passive component?
200  if( aCtl & NET_ADJUST_PASSIVE_VALS && ( prim == 'C' || prim == 'L' || prim == 'R' ) )
201  {
202  // Regular expression to match common formats used for passive parts description
203  // (e.g. 100k, 2k3, 1 uF)
204  wxRegEx passiveVal( "^([0-9\\. ]+)([fFpPnNuUmMkKgGtT]|M(e|E)(g|G))?([fFhH]|ohm)?([-1-9 ]*)$" );
205 
206  if( passiveVal.Matches( value ) )
207  {
208  wxString prefix( passiveVal.GetMatch( value, 1 ) );
209  wxString unit( passiveVal.GetMatch( value, 2 ) );
210  wxString suffix( passiveVal.GetMatch( value, 6 ) );
211 
212  prefix.Trim(); prefix.Trim( false );
213  unit.Trim(); unit.Trim( false );
214  suffix.Trim(); suffix.Trim( false );
215 
216  // Make 'mega' units comply with the Spice expectations
217  if( unit == "M" )
218  unit = "Meg";
219 
220  value = prefix + unit + suffix;
221  }
222  }
223 
224  return value;
225  break;
226  }
227 
228  case SF_ENABLED:
229  return wxString( "Y" );
230  break;
231 
232  case SF_NODE_SEQUENCE:
233  {
234  wxString nodeSeq;
235  std::vector<LIB_PIN*> pins;
236 
237  wxCHECK( aComponent->GetPartRef(), wxString() );
238  aComponent->GetPartRef()->GetPins( pins );
239 
240  for( auto pin : pins )
241  nodeSeq += pin->GetNumber() + " ";
242 
243  nodeSeq.Trim();
244 
245  return nodeSeq;
246  break;
247  }
248 
249  case SF_LIB_FILE:
250  // There is no default Spice library
251  return wxEmptyString;
252  break;
253 
254  default:
255  wxASSERT_MSG( false, "Missing default value definition for a Spice field" );
256  break;
257  }
258 
259 
260  return wxString( "<unknown>" );
261 }
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:104
Field Value of part, i.e. "3.3K".
std::unique_ptr< LIB_PART > & GetPartRef()
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
Field Reference of part, i.e. "IC21".

References SCH_COMPONENT::GetField(), SCH_COMPONENT::GetPartRef(), SCH_FIELD::GetShownText(), NET_ADJUST_PASSIVE_VALS, REFERENCE_FIELD, SF_ENABLED, SF_LIB_FILE, SF_MODEL, SF_NODE_SEQUENCE, SF_PRIMITIVE, and VALUE_FIELD.

Referenced by NETLIST_EXPORTER_PSPICE::GetSpiceField(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

◆ GetSpiceFieldName()

static const wxString& NETLIST_EXPORTER_PSPICE::GetSpiceFieldName ( SPICE_FIELD  aField)
inlinestaticinherited

Return a string used for a particular component field related to Spice simulation.

Definition at line 180 of file netlist_exporter_pspice.h.

181  {
182  return m_spiceFields[(int) aField];
183  }
static const std::vector< wxString > m_spiceFields

References NETLIST_EXPORTER_PSPICE::m_spiceFields.

Referenced by DIALOG_SPICE_MODEL::getLibField(), DIALOG_SPICE_MODEL::getSchField(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and DIALOG_SPICE_MODEL::TransferDataFromWindow().

◆ GetSpiceFields()

static const std::vector<wxString>& NETLIST_EXPORTER_PSPICE::GetSpiceFields ( )
inlinestaticinherited

Return a vector of component field names related to Spice simulation.

Definition at line 172 of file netlist_exporter_pspice.h.

173  {
174  return m_spiceFields;
175  }
static const std::vector< wxString > m_spiceFields

References NETLIST_EXPORTER_PSPICE::m_spiceFields.

Referenced by DIALOG_SPICE_MODEL::TransferDataToWindow().

◆ GetSpiceItems()

const SPICE_ITEM_LIST& NETLIST_EXPORTER_PSPICE::GetSpiceItems ( ) const
inlineinherited

Return list of items representing schematic components in the Spice world.

Definition at line 121 of file netlist_exporter_pspice.h.

122  {
123  return m_spiceItems;
124  }

References NETLIST_EXPORTER_PSPICE::m_spiceItems.

Referenced by NETLIST_EXPORTER_PSPICE::GetSpiceDevice(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_SIM_SETTINGS::updateDCSources(), and writeDirectives().

◆ GetUsedSimCommand()

wxString NETLIST_EXPORTER_PSPICE_SIM::GetUsedSimCommand ( )

Return the command directive that is in use (either from the sheet or from m_simCommand.

Returns

Definition at line 155 of file netlist_exporter_pspice_sim.cpp.

156 {
157  return m_simCommand.IsEmpty() ? GetSheetSimCommand() : m_simCommand;
158 }
wxString m_simCommand
< Custom simulation command (has priority over the schematic sheet simulation commands)
wxString GetSheetSimCommand()
Return simulation command directives placed in schematic sheets (if any).

References GetSheetSimCommand(), and m_simCommand.

Referenced by GetSimType().

◆ IsSimCommand()

static bool NETLIST_EXPORTER_PSPICE_SIM::IsSimCommand ( const wxString &  aCmd)
inlinestatic

Determine if a directive is a simulation command.

Definition at line 137 of file netlist_exporter_pspice_sim.h.

138  {
139  return CommandToSimType( aCmd ) != ST_UNKNOWN;
140  }
static SIM_TYPE CommandToSimType(const wxString &aCmd)
Return simulation type basing on a simulation command directive.

References CommandToSimType(), and ST_UNKNOWN.

Referenced by GetSheetSimCommand(), and writeDirectives().

◆ MakeCommandLine()

wxString NETLIST_EXPORTER_BASE::MakeCommandLine ( const wxString &  aFormatString,
const wxString &  aNetlistFile,
const wxString &  aFinalFile,
const wxString &  aProjectDirectory 
)
staticinherited

Function MakeCommandLine builds up a string that describes a command line for executing a child process.

The input and output file names along with any options to the executable are all possibly in the returned string.

Parameters
aFormatStringholds:
  • the name of the external program
  • any options needed by that program
  • formatting sequences, see below.
aNetlistFileis the name of the input file for the external program, that is a intermediate netlist file in xml format.
aFinalFileis the name of the output file that the user expects.
aProjectDirectoryis used for P replacement, it should omit the trailing '/'.

Supported formatting sequences and their meaning:

  • B => base filename of selected output file, minus path and extension.
  • I => complete filename and path of the temporary input file.
  • O => complete filename and path of the user chosen output file.
  • P => project directory, without name and without trailing '/'

Definition at line 38 of file netlist_exporter_base.cpp.

42 {
43  // Expand format symbols in the command line:
44  // %B => base filename of selected output file, minus path and extension.
45  // %P => project directory name, without trailing '/' or '\'.
46  // %I => full filename of the input file (the intermediate net file).
47  // %O => complete filename and path (but without extension) of the user chosen output file.
48 
49  wxString ret = aFormatString;
50  wxFileName in = aNetlistFile;
51  wxFileName out = aFinalFile;
52  wxString str_out = out.GetFullPath();
53 
54  ret.Replace( "%P", aProjectPath, true );
55  ret.Replace( "%B", out.GetName(), true );
56  ret.Replace( "%I", in.GetFullPath(), true );
57 
58 #ifdef __WINDOWS__
59  // A ugly hack to run xsltproc that has a serious bug on Window since a long time:
60  // the filename given after -o option (output filename) cannot use '\' in filename
61  // so replace if by '/' if possible (I mean if the filename does not start by "\\"
62  // that is a filename on a Windows server)
63 
64  if( !str_out.StartsWith( "\\\\" ) )
65  str_out.Replace( "\\", "/" );
66 #endif
67 
68  ret.Replace( "%O", str_out, true );
69 
70  return ret;
71 }

Referenced by SCH_EDIT_FRAME::WriteNetListFile().

◆ ParseDCCommand()

bool NETLIST_EXPORTER_PSPICE_SIM::ParseDCCommand ( const wxString &  aCmd,
SPICE_DC_PARAMS aSource1,
SPICE_DC_PARAMS aSource2 
)

Parse a two-source .dc command directive into its components.

Parameters
aCmdis the input command string
Returns
true if the command was parsed successfully

Definition at line 193 of file netlist_exporter_pspice_sim.cpp.

195 {
196  if( !aCmd.Lower().StartsWith( ".dc" ) )
197  return false;
198 
199  wxString cmd = aCmd.Mid( 3 ).Trim().Trim( false );
200 
201  wxStringTokenizer tokens( cmd );
202 
203  size_t num = tokens.CountTokens();
204 
205  if( num != 4 && num != 8 )
206  return false;
207 
208  aSource1->m_source = tokens.GetNextToken();
209  aSource1->m_vstart = SPICE_VALUE( tokens.GetNextToken() );
210  aSource1->m_vend = SPICE_VALUE( tokens.GetNextToken() );
211  aSource1->m_vincrement = SPICE_VALUE( tokens.GetNextToken() );
212 
213  if( num == 8 )
214  {
215  aSource2->m_source = tokens.GetNextToken();
216  aSource2->m_vstart = SPICE_VALUE( tokens.GetNextToken() );
217  aSource2->m_vend = SPICE_VALUE( tokens.GetNextToken() );
218  aSource2->m_vincrement = SPICE_VALUE( tokens.GetNextToken() );
219  }
220 
221  return true;
222 }
< Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) Helper class to recognize Spi...
Definition: spice_value.h:34

References SPICE_DC_PARAMS::m_source, SPICE_DC_PARAMS::m_vend, SPICE_DC_PARAMS::m_vincrement, and SPICE_DC_PARAMS::m_vstart.

Referenced by DIALOG_SIM_SETTINGS::parseCommand().

◆ ProcessNetlist()

bool NETLIST_EXPORTER_PSPICE::ProcessNetlist ( unsigned  aCtl)
inherited

Process the netlist to create net mapping and a list of SPICE_ITEMs.

It is automatically called by WriteNetlist(), but might be used separately, if only net mapping and the list of SPICE_ITEMs are required.

Returns
True if successful.

Definition at line 264 of file netlist_exporter_pspice.cpp.

265 {
266  const wxString delimiters( "{:,; }" );
267 
268  SCH_SHEET_LIST sheetList = m_schematic->GetSheets();
269  // Set of reference names, to check for duplications
270  std::set<wxString> refNames;
271 
272  m_netMap.clear();
273  m_netMap["GND"] = 0; // 0 is reserved for "GND"
274  int netIdx = 1;
275 
276  m_libraries.clear();
278  m_libParts.clear();
279 
280  UpdateDirectives( aCtl );
281 
282  for( unsigned sheet_idx = 0; sheet_idx < sheetList.size(); sheet_idx++ )
283  {
284  SCH_SHEET_PATH sheet = sheetList[sheet_idx];
285 
286  // Process component attributes to find Spice directives
287  for( auto item : sheet.LastScreen()->Items().OfType( SCH_COMPONENT_T ) )
288  {
289  SCH_COMPONENT* symbol = findNextSymbol( item, &sheet );
290 
291  if( !symbol )
292  continue;
293 
294  CreatePinList( symbol, &sheet );
295  SPICE_ITEM spiceItem;
296  spiceItem.m_parent = symbol;
297 
298  // Obtain Spice fields
299  SCH_FIELD* fieldLibFile = symbol->FindField( GetSpiceFieldName( SF_LIB_FILE ) );
300  SCH_FIELD* fieldSeq = symbol->FindField( GetSpiceFieldName( SF_NODE_SEQUENCE ) );
301 
302  spiceItem.m_primitive = GetSpiceField( SF_PRIMITIVE, symbol, aCtl )[0];
303  spiceItem.m_model = GetSpiceField( SF_MODEL, symbol, aCtl );
304  spiceItem.m_refName = symbol->GetRef( &sheet );
305 
306  // Duplicate references will result in simulation errors
307  if( refNames.count( spiceItem.m_refName ) )
308  {
309  DisplayError( NULL, wxT( "There are duplicate components. "
310  "You need to annotate schematics first." ) );
311  return false;
312  }
313 
314  refNames.insert( spiceItem.m_refName );
315 
316  // Check to see if component should be removed from Spice netlist
317  spiceItem.m_enabled = StringToBool( GetSpiceField( SF_ENABLED, symbol, aCtl ) );
318 
319  if( fieldLibFile && !fieldLibFile->GetShownText().IsEmpty() )
320  m_libraries.insert( fieldLibFile->GetShownText() );
321 
322  wxArrayString pinNames;
323 
324  // Store pin information
325  for( const PIN_INFO& pin : m_sortedSymbolPinList )
326  {
327  // Create net mapping
328  spiceItem.m_pins.push_back( pin.netName );
329  pinNames.Add( pin.num );
330 
331  if( m_netMap.count( pin.netName ) == 0 )
332  m_netMap[pin.netName] = netIdx++;
333  }
334 
335  // Check if an alternative pin sequence is available:
336  if( fieldSeq )
337  {
338  // Get the string containing the sequence of nodes:
339  const wxString& nodeSeqIndexLineStr = fieldSeq->GetShownText();
340 
341  // Verify field exists and is not empty:
342  if( !nodeSeqIndexLineStr.IsEmpty() )
343  {
344  // Get Alt Pin Name Array From User:
345  wxStringTokenizer tkz( nodeSeqIndexLineStr, delimiters );
346 
347  while( tkz.HasMoreTokens() )
348  {
349  wxString pinIndex = tkz.GetNextToken();
350  int seq;
351 
352  // Find PinName In Standard List assign Standard List Index to Name:
353  seq = pinNames.Index( pinIndex );
354 
355  if( seq != wxNOT_FOUND )
356  spiceItem.m_pinSequence.push_back( seq );
357  }
358  }
359  }
360 
361  m_spiceItems.push_back( spiceItem );
362  }
363  }
364 
365  return true;
366 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:253
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
EE_TYPE OfType(KICAD_T aType) const
Definition: sch_rtree.h:219
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:51
SCH_FIELD * FindField(const wxString &aFieldName, bool aIncludeDefaultFields=true)
Search for a SCH_FIELD with aFieldName.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
void CreatePinList(SCH_COMPONENT *aSymbol, SCH_SHEET_PATH *aSheetPath)
Function findNextSymbolAndCreatePinList finds a symbol from the DrawList and builds its pin list in m...
std::set< wxString > m_libraries
Map circuit nodes to net names.
std::vector< PIN_INFO > m_sortedSymbolPinList
Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic...
SCH_COMPONENT * m_parent
< Schematic component represented by this SPICE_ITEM.
Structure to represent a schematic component in the Spice simulation.
std::vector< wxString > m_pins
Numeric indices into m_SortedComponentPinList.
static const wxString & GetSpiceFieldName(SPICE_FIELD aField)
Return a string used for a particular component field related to Spice simulation.
bool m_enabled
Array containing Standard Pin Name.
void Clear()
Function Clear erases the record.
static bool StringToBool(const wxString &aStr)
Convert typical boolean string values (no/yes, true/false, 1/0) to a boolean value.
std::set< LIB_PART *, LIB_PART_LESS_THAN > m_libParts
unique library parts used. LIB_PART items are sorted by names
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: sch_field.cpp:104
UNIQUE_STRINGS m_referencesAlreadyFound
Used for "multiple parts per package" symbols to avoid processing a lib part more than once.
wxString m_refName
Flag to indicate whether the component should be used in simulation.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
NET_INDEX_MAP m_netMap
List of items representing schematic components in the Spice world.
#define NULL
void UpdateDirectives(unsigned aCtl)
Update the vector of Spice directives placed in the schematics.
SCH_COMPONENT * findNextSymbol(EDA_ITEM *aItem, SCH_SHEET_PATH *aSheetPath)
Checks if the given symbol should be processed for netlisting.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SCREEN * LastScreen()
EE_RTREE & Items()
Definition: sch_screen.h:159
static wxString GetSpiceField(SPICE_FIELD aField, SCH_COMPONENT *aComponent, unsigned aCtl)
Retrieve either the requested field value or the default value.
Schematic symbol object.
Definition: sch_component.h:79
wxChar m_primitive
Library model (for semiconductors and subcircuits), component value (for passive components) or volta...
std::vector< int > m_pinSequence
const wxString GetRef(const SCH_SHEET_PATH *aSheet, bool aIncludeUnit=false) const
Return the reference for the given sheet path.

References UNIQUE_STRINGS::Clear(), NETLIST_EXPORTER_BASE::CreatePinList(), DisplayError(), SCH_COMPONENT::FindField(), NETLIST_EXPORTER_BASE::findNextSymbol(), SCH_COMPONENT::GetRef(), SCHEMATIC::GetSheets(), SCH_FIELD::GetShownText(), NETLIST_EXPORTER_PSPICE::GetSpiceField(), NETLIST_EXPORTER_PSPICE::GetSpiceFieldName(), SCH_SCREEN::Items(), SCH_SHEET_PATH::LastScreen(), SPICE_ITEM::m_enabled, NETLIST_EXPORTER_BASE::m_libParts, NETLIST_EXPORTER_PSPICE::m_libraries, SPICE_ITEM::m_model, NETLIST_EXPORTER_PSPICE::m_netMap, SPICE_ITEM::m_parent, SPICE_ITEM::m_pins, SPICE_ITEM::m_pinSequence, SPICE_ITEM::m_primitive, NETLIST_EXPORTER_BASE::m_referencesAlreadyFound, SPICE_ITEM::m_refName, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_BASE::m_sortedSymbolPinList, NETLIST_EXPORTER_PSPICE::m_spiceItems, NULL, EE_RTREE::OfType(), SCH_COMPONENT_T, SF_ENABLED, SF_LIB_FILE, SF_MODEL, SF_NODE_SEQUENCE, SF_PRIMITIVE, NETLIST_EXPORTER_PSPICE::StringToBool(), and NETLIST_EXPORTER_PSPICE::UpdateDirectives().

Referenced by NETLIST_EXPORTER_PSPICE::Format().

◆ ReplaceForbiddenChars()

void NETLIST_EXPORTER_PSPICE::ReplaceForbiddenChars ( wxString &  aNetName)
staticinherited

Replace illegal spice net name characters with an underscore.

Parameters
aNetNameis the net name to modify.

Definition at line 67 of file netlist_exporter_pspice.cpp.

68 {
69  // some chars are not accepted in netnames in spice netlists, because they are separators
70  // they are replaced an underscore or some other allowed char.
71  // Note: this is a static function
72 
73  aNetName.Replace( "(", "_" );
74  aNetName.Replace( ")", "_" );
75  aNetName.Replace( " ", "_" );
76 }

Referenced by ComponentToVector(), and NETLIST_EXPORTER_PSPICE::Format().

◆ SetSimCommand()

void NETLIST_EXPORTER_PSPICE_SIM::SetSimCommand ( const wxString &  aCmd)
inline

Override the simulation command directive.

Definition at line 85 of file netlist_exporter_pspice_sim.h.

86  {
87  m_simCommand = aCmd;
88  }
wxString m_simCommand
< Custom simulation command (has priority over the schematic sheet simulation commands)

References m_simCommand.

◆ StringToBool()

static bool NETLIST_EXPORTER_PSPICE::StringToBool ( const wxString &  aStr)
inlinestaticinherited

Convert typical boolean string values (no/yes, true/false, 1/0) to a boolean value.

Definition at line 212 of file netlist_exporter_pspice.h.

213  {
214  if( aStr.IsEmpty() )
215  return false;
216 
217  char c = tolower( aStr[0] );
218 
219  // Different ways of saying false (no/false/0)
220  return !( c == 'n' || c == 'f' || c == '0' );
221  }

Referenced by NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

◆ UpdateDirectives()

void NETLIST_EXPORTER_PSPICE::UpdateDirectives ( unsigned  aCtl)
inherited

Update the vector of Spice directives placed in the schematics.

Definition at line 369 of file netlist_exporter_pspice.cpp.

370 {
371  const SCH_SHEET_LIST& sheetList = m_schematic->GetSheets();
372  wxRegEx couplingK( "^[kK][[:digit:]]*[[:space:]]+[[:alnum:]]+[[:space:]]+[[:alnum:]]+",
373  wxRE_ADVANCED );
374 
375  m_directives.clear();
376  bool controlBlock = false;
377  bool circuitBlock = false;
378 
379  for( unsigned i = 0; i < sheetList.size(); i++ )
380  {
381  for( auto item : sheetList[i].LastScreen()->Items().OfType( SCH_TEXT_T ) )
382  {
383  wxString text = static_cast<SCH_TEXT*>( item )->GetShownText();
384 
385  if( text.IsEmpty() )
386  continue;
387 
388  // Analyze each line of a text field
389  wxStringTokenizer tokenizer( text, "\r\n" );
390 
391  // Flag to follow multiline directives
392  bool directiveStarted = false;
393 
394  while( tokenizer.HasMoreTokens() )
395  {
396  wxString line( tokenizer.GetNextToken() );
397 
398  // Cleanup: remove preceding and trailing white-space characters
399  line.Trim( true ).Trim( false );
400  // Convert to lower-case for parsing purposes only
401  wxString lowercaseline = line;
402  lowercaseline.MakeLower();
403 
404  // 'Include' directive stores the library file name, so it
405  // can be later resolved using a list of paths
406  if( lowercaseline.StartsWith( ".inc" ) )
407  {
408  wxString lib = line.AfterFirst( ' ' );
409 
410  if( lib.IsEmpty() )
411  continue;
412 
413  // Strip quotes if present
414  if( ( lib.StartsWith( "\"" ) && lib.EndsWith( "\"" ) )
415  || ( lib.StartsWith( "'" ) && lib.EndsWith( "'" ) ) )
416  {
417  lib = lib.Mid( 1, lib.Length() - 2 );
418  }
419 
420  m_libraries.insert( lib );
421  }
422 
423  // Store the title to be sure it appears
424  // in the first line of output
425  else if( lowercaseline.StartsWith( ".title " ) )
426  {
427  m_title = line.AfterFirst( ' ' );
428  }
429 
430  else if( line.StartsWith( '.' ) // one-line directives
431  || controlBlock // .control .. .endc block
432  || circuitBlock // .subckt .. .ends block
433  || couplingK.Matches( line ) // K## L## L## coupling constant
434  || ( directiveStarted && line.StartsWith( '+' ) ) ) // multiline directives
435  {
436  m_directives.push_back( line );
437  }
438 
439 
440  // Handle .control .. .endc blocks
441  if( lowercaseline.IsSameAs( ".control" ) && ( !controlBlock ) )
442  controlBlock = true;
443 
444  if( lowercaseline.IsSameAs( ".endc" ) && controlBlock )
445  controlBlock = false;
446 
447  // Handle .subckt .. .ends blocks
448  if( lowercaseline.StartsWith( ".subckt" ) && ( !circuitBlock ) )
449  circuitBlock = true;
450 
451  if( lowercaseline.IsSameAs( ".ends" ) && circuitBlock )
452  circuitBlock = false;
453 
454  // Mark directive as started or continued in case it is a multi-line one
455  directiveStarted = line.StartsWith( '.' )
456  || ( directiveStarted && line.StartsWith( '+' ) );
457  }
458  }
459  }
460 }
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
SCH_SHEET_LIST GetSheets() const
Builds and returns an updated schematic hierarchy TODO: can this be cached?
Definition: schematic.h:97
std::set< wxString > m_libraries
Map circuit nodes to net names.
std::vector< wxString > m_directives
Libraries used by the simulated circuit.
SCHEMATIC * m_schematic
The schematic we're generating a netlist for.
wxString m_title
< Spice simulation title found in the processed schematic sheet

References SCHEMATIC::GetSheets(), NETLIST_EXPORTER_PSPICE::m_directives, NETLIST_EXPORTER_PSPICE::m_libraries, NETLIST_EXPORTER_BASE::m_schematic, NETLIST_EXPORTER_PSPICE::m_title, and SCH_TEXT_T.

Referenced by GetSheetSimCommand(), and NETLIST_EXPORTER_PSPICE::ProcessNetlist().

◆ VectorToSignal()

SIM_PLOT_TYPE NETLIST_EXPORTER_PSPICE_SIM::VectorToSignal ( const std::string &  aVector,
wxString &  aSignal 
) const

Return name of Spice dataset for a specific plot.

Parameters
aVectoris name of the vector produced by ngspice
[out]aSignalis output in form: V(R1), Ib(Q2), I(L8)
Returns
[SPT_VOLTAGE, SPT_CURRENT]. Otherwise SPT_UNKNOWN if vector is of different, unsupported type.

Definition at line 73 of file netlist_exporter_pspice_sim.cpp.

75 {
76  using namespace std;
77 
78  // See ngspice manual chapt. 31.1 "Accessing internal device parameters"
79  wxRegEx internalDevParameter( "^@(\\w*[\\.\\w+]*)\\[(\\w*)\\]$", wxRE_ADVANCED );
80  wxString vector( aVector );
81 
82  if( !internalDevParameter.Matches( vector ) )
83  {
84  // any text is a node name, which returns voltage
85  aSignal = "V(" + aVector + ")";
86  return SPT_VOLTAGE;
87  }
88  else
89  {
90  wxString paramType = internalDevParameter.GetMatch( vector, 2 );
91 
92  if( paramType.Lower()[0] == 'i' )
93  {
94  // this is a branch current
95  paramType[0] = 'I';
96  aSignal = paramType + "(";
97  aSignal += internalDevParameter.GetMatch( vector, 1 ).Upper() + ")";
98  return SPT_CURRENT;
99  }
100  else
101  {
102  return SPT_UNKNOWN;
103  }
104  }
105 }
Definition: bitmap.cpp:58

References SPT_CURRENT, SPT_UNKNOWN, and SPT_VOLTAGE.

◆ writeDirectives()

void NETLIST_EXPORTER_PSPICE_SIM::writeDirectives ( OUTPUTFORMATTER aFormatter,
unsigned  aCtl 
) const
overrideprotectedvirtual

Save the Spice directives.

Todo:
is it required to switch to lowercase

Reimplemented from NETLIST_EXPORTER_PSPICE.

Definition at line 225 of file netlist_exporter_pspice_sim.cpp.

226 {
227  // Add a directive to obtain currents
228  //aFormatter->Print( 0, ".options savecurrents\n" ); // does not work :(
229 
230  for( const auto& item : GetSpiceItems() )
231  {
232  for( const auto& current :
234  {
235  if( !item.m_enabled )
236  continue;
237 
239  aFormatter->Print( 0, ".save %s\n",
240  (const char*) ComponentToVector( item.m_refName, SPT_CURRENT, current )
241  .c_str() );
242  }
243  }
244 
245  // If we print out .save directives for currents, then it needs to be done for voltages as well
246  for( const auto& netMap : GetNetIndexMap() )
247  {
248  // the "0" and the "GND" nets are automaticallly saved internally by ngspice.
249  // Skip them
250  wxString netname = ComponentToVector( netMap.first, SPT_VOLTAGE );
251 
252  if( netname == "V(0)" || netname == "V(GND)" )
253  continue;
254 
255  aFormatter->Print( 0, ".save %s\n", (const char*) netname.c_str() );
256  }
257 
258  if( m_simCommand.IsEmpty() )
259  {
260  // Fallback to the default behavior and just write all directives
261  NETLIST_EXPORTER_PSPICE::writeDirectives( aFormatter, aCtl );
262  }
263  else
264  {
265  // Dump all directives but simulation commands
266  for( const auto& dir : GetDirectives() )
267  {
268  if( !IsSimCommand( dir ) )
269  aFormatter->Print( 0, "%s\n", (const char*) dir.c_str() );
270  }
271 
272  // Finish with our custom simulation command
273  aFormatter->Print( 0, "%s\n", (const char*) m_simCommand.c_str() );
274  }
275 }
wxString m_simCommand
< Custom simulation command (has priority over the schematic sheet simulation commands)
wxString ComponentToVector(const wxString &aName, SIM_PLOT_TYPE aType, const wxString &aParam=wxEmptyString) const
Return name of Spice dataset for a specific plot.
const SPICE_ITEM_LIST & GetSpiceItems() const
Return list of items representing schematic components in the Spice world.
const std::vector< wxString > GetDirectives() const
Return a vector of Spice directives found in the schematics.
static bool IsSimCommand(const wxString &aCmd)
Determine if a directive is a simulation command.
static const std::vector< wxString > & GetCurrents(SPICE_PRIMITIVE aPrimitive)
Return a list of currents that can be probed in a Spice primitive.
virtual void writeDirectives(OUTPUTFORMATTER *aFormatter, unsigned aCtl) const
Save the Spice directives.
const NET_INDEX_MAP & GetNetIndexMap() const
Return a map of circuit nodes to net names.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:408

References ComponentToVector(), GetCurrents(), NETLIST_EXPORTER_PSPICE::GetDirectives(), NETLIST_EXPORTER_PSPICE::GetNetIndexMap(), NETLIST_EXPORTER_PSPICE::GetSpiceItems(), IsSimCommand(), m_simCommand, OUTPUTFORMATTER::Print(), SPT_CURRENT, SPT_VOLTAGE, and NETLIST_EXPORTER_PSPICE::writeDirectives().

◆ WriteNetlist()

bool NETLIST_EXPORTER_PSPICE::WriteNetlist ( const wxString &  aOutFileName,
unsigned  aNetlistOptions 
)
overridevirtualinherited

Write to specified output file.

Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.

Reimplemented from NETLIST_EXPORTER_BASE.

Definition at line 60 of file netlist_exporter_pspice.cpp.

61 {
62  FILE_OUTPUTFORMATTER outputFile( aOutFileName, wxT( "wt" ), '\'' );
63 
64  return Format( &outputFile, aNetlistOptions );
65 }
bool Format(OUTPUTFORMATTER *aFormatter, unsigned aCtl)
Used for text file output.
Definition: richio.h:453

References NETLIST_EXPORTER_PSPICE::Format().

Member Data Documentation

◆ m_libParts

std::set<LIB_PART*, LIB_PART_LESS_THAN> NETLIST_EXPORTER_BASE::m_libParts
protectedinherited

◆ m_referencesAlreadyFound

UNIQUE_STRINGS NETLIST_EXPORTER_BASE::m_referencesAlreadyFound
protectedinherited

Used for "multiple parts per package" symbols to avoid processing a lib part more than once.

Definition at line 106 of file netlist_exporter_base.h.

Referenced by NETLIST_EXPORTER_BASE::findNextSymbol(), NETLIST_EXPORTER_XML::makeSymbols(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), and NETLIST_EXPORTER_CADSTAR::WriteNetlist().

◆ m_savedCurrentSheet

SCH_SHEET_PATH NETLIST_EXPORTER_BASE::m_savedCurrentSheet
protectedinherited

The schematic's CurrentSheet when we entered. Restore on exiting.

Definition at line 115 of file netlist_exporter_base.h.

Referenced by NETLIST_EXPORTER_BASE::NETLIST_EXPORTER_BASE(), and NETLIST_EXPORTER_BASE::~NETLIST_EXPORTER_BASE().

◆ m_schematic

◆ m_simCommand

wxString NETLIST_EXPORTER_PSPICE_SIM::m_simCommand
private

< Custom simulation command (has priority over the schematic sheet simulation commands)

Definition at line 153 of file netlist_exporter_pspice_sim.h.

Referenced by ClearSimCommand(), GetSimCommand(), GetUsedSimCommand(), SetSimCommand(), and writeDirectives().

◆ m_sortedSymbolPinList

std::vector<PIN_INFO> NETLIST_EXPORTER_BASE::m_sortedSymbolPinList
protectedinherited

Used to temporarily store and filter the list of pins of a schematic symbol when generating schematic symbol data in netlist (comp section).

No ownership of members. TODO(snh): Descope this object

Definition at line 102 of file netlist_exporter_base.h.

Referenced by NETLIST_EXPORTER_BASE::CreatePinList(), NETLIST_EXPORTER_BASE::eraseDuplicatePins(), NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), and NETLIST_EXPORTER_ORCADPCB2::WriteNetlist().


The documentation for this class was generated from the following files: