sim - Check FindParam() results before using them
This commit is contained in:
parent
f5902dad28
commit
5482bc2905
|
@ -110,10 +110,18 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PR
|
||||||
|
|
||||||
KIBIS_PARAMETER kparams;
|
KIBIS_PARAMETER kparams;
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "vcc" ) )
|
||||||
kparams.SetCornerFromString( kparams.m_supply, m_model.FindParam( "vcc" )->value->ToString() );
|
kparams.SetCornerFromString( kparams.m_supply, m_model.FindParam( "vcc" )->value->ToString() );
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "rpin" ) )
|
||||||
kparams.SetCornerFromString( kparams.m_Rpin, m_model.FindParam( "rpin" )->value->ToString() );
|
kparams.SetCornerFromString( kparams.m_Rpin, m_model.FindParam( "rpin" )->value->ToString() );
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "lpin" ) )
|
||||||
kparams.SetCornerFromString( kparams.m_Lpin, m_model.FindParam( "lpin" )->value->ToString() );
|
kparams.SetCornerFromString( kparams.m_Lpin, m_model.FindParam( "lpin" )->value->ToString() );
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "cpin" ) )
|
||||||
kparams.SetCornerFromString( kparams.m_Cpin, m_model.FindParam( "cpin" )->value->ToString() );
|
kparams.SetCornerFromString( kparams.m_Cpin, m_model.FindParam( "cpin" )->value->ToString() );
|
||||||
|
|
||||||
//kparams.SetCornerFromString( kparams.m_Ccomp, FindParam( "ccomp" )->value->ToString() );
|
//kparams.SetCornerFromString( kparams.m_Ccomp, FindParam( "ccomp" )->value->ToString() );
|
||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
|
@ -129,7 +137,10 @@ std::string SPICE_GENERATOR_KIBIS::IbisDevice( const SPICE_ITEM& aItem, const PR
|
||||||
|
|
||||||
case SIM_MODEL::TYPE::KIBIS_DRIVER_DC:
|
case SIM_MODEL::TYPE::KIBIS_DRIVER_DC:
|
||||||
{
|
{
|
||||||
std::string paramValue = m_model.FindParam( "dc" )->value->ToString();
|
std::string paramValue = "";
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "dc" ) )
|
||||||
|
paramValue = m_model.FindParam( "dc" )->value->ToString();
|
||||||
|
|
||||||
if( paramValue == "hi-Z" )
|
if( paramValue == "hi-Z" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,14 @@
|
||||||
|
|
||||||
std::string SPICE_GENERATOR_R_POT::ModelLine( const SPICE_ITEM& aItem ) const
|
std::string SPICE_GENERATOR_R_POT::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
std::string r = m_model.FindParam( "r" )->value->ToSpiceString();
|
std::string r = "0";
|
||||||
std::string position = m_model.FindParam( "pos" )->value->ToSpiceString();
|
std::string position = "";
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "r" ) )
|
||||||
|
r = m_model.FindParam( "r" )->value->ToSpiceString();
|
||||||
|
|
||||||
|
if ( m_model.FindParam( "pos" ) )
|
||||||
|
position = m_model.FindParam( "pos" )->value->ToSpiceString();
|
||||||
|
|
||||||
if( position != "" )
|
if( position != "" )
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ using PARAM = SIM_MODEL::PARAM;
|
||||||
|
|
||||||
std::string SPICE_GENERATOR_TLINE::ModelLine( const SPICE_ITEM& aItem ) const
|
std::string SPICE_GENERATOR_TLINE::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
{
|
{
|
||||||
std::string r, l, g, c, len;
|
std::string r="0" , l="0", g="0", c="0", len="1";
|
||||||
|
|
||||||
switch( m_model.GetType() )
|
switch( m_model.GetType() )
|
||||||
{
|
{
|
||||||
|
@ -50,15 +50,20 @@ std::string SPICE_GENERATOR_TLINE::ModelLine( const SPICE_ITEM& aItem ) const
|
||||||
len = SIM_VALUE_FLOAT( 1 ).ToSpiceString();
|
len = SIM_VALUE_FLOAT( 1 ).ToSpiceString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SIM_MODEL::TYPE::TLINE_RLGC:
|
case SIM_MODEL::TYPE::TLINE_RLGC:
|
||||||
|
{
|
||||||
|
if( m_model.FindParam( "r" ) )
|
||||||
r = m_model.FindParam( "r" )->value->ToSpiceString();
|
r = m_model.FindParam( "r" )->value->ToSpiceString();
|
||||||
|
if( m_model.FindParam( "l" ) )
|
||||||
l = m_model.FindParam( "l" )->value->ToSpiceString();
|
l = m_model.FindParam( "l" )->value->ToSpiceString();
|
||||||
|
if( m_model.FindParam( "g" ) )
|
||||||
g = m_model.FindParam( "g" )->value->ToSpiceString();
|
g = m_model.FindParam( "g" )->value->ToSpiceString();
|
||||||
|
if( m_model.FindParam( "c" ) )
|
||||||
c = m_model.FindParam( "c" )->value->ToSpiceString();
|
c = m_model.FindParam( "c" )->value->ToSpiceString();
|
||||||
|
if( m_model.FindParam( "len" ) )
|
||||||
len = m_model.FindParam( "len" )->value->ToSpiceString();
|
len = m_model.FindParam( "len" )->value->ToSpiceString();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_TLINE" );
|
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_TLINE" );
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in New Issue