Correctly netlist a voltage source with both AC and DC values.
Fixes https://gitlab.com/kicad/code/kicad/issues/13912
This commit is contained in:
parent
40e1296a8b
commit
c618bb7046
|
@ -48,17 +48,19 @@ std::string SPICE_GENERATOR_SOURCE::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
SPICE_ITEM item = aItem;
|
SPICE_ITEM item = aItem;
|
||||||
item.modelName = "";
|
|
||||||
|
|
||||||
std::string inlineType = m_model.GetSpiceInfo().inlineTypeString;
|
|
||||||
std::string ac = m_model.FindParam( "ac" )->value->ToSpiceString();
|
std::string ac = m_model.FindParam( "ac" )->value->ToSpiceString();
|
||||||
std::string ph = m_model.FindParam( "ph" )->value->ToSpiceString();
|
|
||||||
|
|
||||||
if( ac != "" )
|
if( ac != "" )
|
||||||
item.modelName.append( fmt::format( "AC {} {} ", ac, ph ) );
|
{
|
||||||
|
std::string dc = m_model.FindParam( "dc" )->value->ToSpiceString();
|
||||||
|
std::string ph = m_model.FindParam( "ph" )->value->ToSpiceString();
|
||||||
|
|
||||||
|
if( dc != "" )
|
||||||
if( inlineType != "" && inlineType != "DC" )
|
item.modelName = fmt::format( "DC {} AC {} {} ", dc, ac, ph );
|
||||||
|
else
|
||||||
|
item.modelName = fmt::format( "AC {} {} ", ac, ph );
|
||||||
|
}
|
||||||
|
else if( m_model.GetSpiceInfo().inlineTypeString != "" )
|
||||||
{
|
{
|
||||||
std::string args = "";
|
std::string args = "";
|
||||||
|
|
||||||
|
@ -95,8 +97,9 @@ std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: dt should be tstep by default.
|
// TODO: dt should be tstep by default.
|
||||||
|
|
||||||
|
@ -146,8 +149,9 @@ std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
|
|
||||||
args.append( range.ToSpiceString() + " " );
|
args.append( range.ToSpiceString() + " " );
|
||||||
args.append( offset.ToSpiceString() + " " );
|
args.append( offset.ToSpiceString() + " " );
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SIM_MODEL::TYPE::V_RANDNORMAL:
|
case SIM_MODEL::TYPE::V_RANDNORMAL:
|
||||||
case SIM_MODEL::TYPE::I_RANDNORMAL:
|
case SIM_MODEL::TYPE::I_RANDNORMAL:
|
||||||
|
@ -184,16 +188,15 @@ std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
|
||||||
if( argStr != "" )
|
if( argStr != "" )
|
||||||
args.append( argStr + " " );
|
args.append( argStr + " " );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.modelName.append( fmt::format( "{}( {})",
|
item.modelName = fmt::format( "{}( {})", m_model.GetSpiceInfo().inlineTypeString, args );
|
||||||
m_model.GetSpiceInfo().inlineTypeString,
|
|
||||||
args ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item.modelName.append( m_model.GetParam( 0 ).value->ToSpiceString() );
|
item.modelName = m_model.GetParam( 0 ).value->ToSpiceString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return SPICE_GENERATOR::ItemLine( item );
|
return SPICE_GENERATOR::ItemLine( item );
|
||||||
|
|
Loading…
Reference in New Issue