Fix exporting Spice instance lines for multi-part symbols

Only pins from the current symbol part were used: the rest was
incorrectly set to Not Connected.

Also slightly change generation of names for Not Connected nets.
This commit is contained in:
Mikolaj Wielgus 2022-08-25 08:37:59 +02:00
parent 3e4cfab254
commit a0400791c0
2 changed files with 6 additions and 5 deletions

View File

@ -344,8 +344,8 @@ bool NETLIST_EXPORTER_SPICE::readModel( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem )
void NETLIST_EXPORTER_SPICE::readPinNumbers( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem )
{
for( const LIB_PIN* pin : aSymbol.GetLibPins() )
aItem.pinNumbers.push_back( pin->GetShownNumber() );
for( const PIN_INFO& pin : m_sortedSymbolPinList )
aItem.pinNumbers.push_back( pin.num );
}
@ -361,7 +361,7 @@ void NETLIST_EXPORTER_SPICE::readPinNetNames( SCH_SYMBOL& aSymbol, SPICE_ITEM& a
LOCALE_IO toggle;
if( netName == "" )
netName = wxString::Format( wxT( "__NC_%.2u" ), aNCCounter++ );
netName = wxString::Format( wxT( "NC-%u" ), aNCCounter++ );
aItem.pinNetNames.push_back( netName );
m_nets.insert( netName );

View File

@ -990,9 +990,10 @@ wxString SIM_MODEL::GenerateSpiceItemLine( const wxString& aRefName,
wxString result = "";
result << GenerateSpiceItemName( aRefName ) << " ";
int ncCounter = 0;
for( const PIN& pin : GetPins() )
{
int ncCounter = 0;
auto it = std::find( aSymbolPinNumbers.begin(),
aSymbolPinNumbers.end(),
pin.symbolPinNumber );
@ -1000,7 +1001,7 @@ wxString SIM_MODEL::GenerateSpiceItemLine( const wxString& aRefName,
if( it == aSymbolPinNumbers.end() )
{
LOCALE_IO toggle;
result << wxString::Format( "__NC_%s_%s_%.2u", aRefName, aModelName, ncCounter++ );
result << wxString::Format( "NC-%s-%u ", aRefName, ncCounter++ );
}
else
{