Add scanning for coupled inductor declarations to SPICE directives.
Fixes https://gitlab.com/kicad/code/kicad/issues/13431
This commit is contained in:
parent
ea4c3a267b
commit
453f1f393e
|
@ -389,6 +389,8 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
|
|||
{
|
||||
wxString line = tokenizer.GetNextToken().Upper();
|
||||
|
||||
if( line.StartsWith( wxT( "." ) ) )
|
||||
{
|
||||
if( line.StartsWith( wxT( ".AC" ) )
|
||||
|| line.StartsWith( wxT( ".CONTROL" ) )
|
||||
|| line.StartsWith( wxT( ".CSPARAM" ) )
|
||||
|
@ -431,6 +433,32 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions )
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if( line.StartsWith( wxT( "K" ) ) )
|
||||
{
|
||||
// Check for mutual inductor declaration
|
||||
wxStringTokenizer line_t( line, wxT( " \t" ), wxTOKEN_STRTOK );
|
||||
|
||||
// Coupling ID
|
||||
if( !line_t.HasMoreTokens() || !line_t.GetNextToken().StartsWith( wxT( "K" ) ) )
|
||||
continue;
|
||||
|
||||
// Inductor 1 ID
|
||||
if( !line_t.HasMoreTokens() || !line_t.GetNextToken().StartsWith( wxT( "L" ) ) )
|
||||
continue;
|
||||
|
||||
// Inductor 2 ID
|
||||
if( !line_t.HasMoreTokens() || !line_t.GetNextToken().StartsWith( wxT( "L" ) ) )
|
||||
continue;
|
||||
|
||||
// That's probably distinctive enough not to bother trying to parse the
|
||||
// coupling value. If there's anything else, assume it's the value.
|
||||
if( line_t.HasMoreTokens() )
|
||||
{
|
||||
foundDirective = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( foundDirective )
|
||||
m_directives.emplace_back( text );
|
||||
|
|
Loading…
Reference in New Issue