When migrating simulation models update value to a reference.
This commit is contained in:
parent
05b9836f60
commit
60c937186a
|
@ -136,12 +136,7 @@ template <typename T_symbol, typename T_field>
|
||||||
bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
wxCommandEvent dummyEvent;
|
wxCommandEvent dummyEvent;
|
||||||
|
T_field* valueField = m_symbol.FindField( wxT( "Value" ) );
|
||||||
wxString value;
|
|
||||||
|
|
||||||
// Yes, the Value field is always present, but Coverity doesn't know that...
|
|
||||||
if( T_field* valueField = m_symbol.FindField( wxT( "Value" ) ) )
|
|
||||||
value = valueField->GetText();
|
|
||||||
|
|
||||||
// Infer RLC models if they aren't specified
|
// Infer RLC models if they aren't specified
|
||||||
if( !m_symbol.FindField( SIM_MODEL::DEVICE_TYPE_FIELD )
|
if( !m_symbol.FindField( SIM_MODEL::DEVICE_TYPE_FIELD )
|
||||||
|
@ -149,7 +144,7 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
// pair.first: wxString sim model type
|
// pair.first: wxString sim model type
|
||||||
// pair.second: wxString sim model parameters
|
// pair.second: wxString sim model parameters
|
||||||
auto model = SIM_MODEL::InferSimModel( m_symbol.GetPrefix(), value );
|
auto model = SIM_MODEL::InferSimModel( m_symbol.GetPrefix(), valueField->GetText() );
|
||||||
|
|
||||||
if( !model.second.IsEmpty() )
|
if( !model.second.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -164,6 +159,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
|
||||||
|
|
||||||
m_fields.emplace_back( &m_symbol, -1, SIM_MODEL::PARAMS_FIELD );
|
m_fields.emplace_back( &m_symbol, -1, SIM_MODEL::PARAMS_FIELD );
|
||||||
m_fields.back().SetText( model.second );
|
m_fields.back().SetText( model.second );
|
||||||
|
|
||||||
|
m_fields[ VALUE_FIELD ].SetText( wxT( "${SIM.PARAMS}" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1065,11 +1065,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol )
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString prefix = aSymbol.GetPrefix();
|
wxString prefix = aSymbol.GetPrefix();
|
||||||
wxString value;
|
T_field* valueField = aSymbol.FindField( wxT( "Value" ) );
|
||||||
|
|
||||||
// Yes, the Value field is always present, but Coverity doesn't know that...
|
|
||||||
if( T_field* valueField = aSymbol.FindField( wxT( "Value" ) ) )
|
|
||||||
value = valueField->GetText();
|
|
||||||
|
|
||||||
wxString spiceType;
|
wxString spiceType;
|
||||||
wxString spiceModel;
|
wxString spiceModel;
|
||||||
|
@ -1119,7 +1115,8 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spiceModel = value;
|
spiceModel = valueField->GetText();
|
||||||
|
valueField->SetText( wxT( "${SIM.PARAMS}" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( T_field* netlistEnabledField = aSymbol.FindField( wxT( "Spice_Netlist_Enabled" ) ) )
|
if( T_field* netlistEnabledField = aSymbol.FindField( wxT( "Spice_Netlist_Enabled" ) ) )
|
||||||
|
@ -1142,7 +1139,8 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol )
|
||||||
}
|
}
|
||||||
else if( prefix == wxT( "V" ) || prefix == wxT( "I" ) )
|
else if( prefix == wxT( "V" ) || prefix == wxT( "I" ) )
|
||||||
{
|
{
|
||||||
spiceModel = value;
|
spiceModel = valueField->GetText();
|
||||||
|
valueField->SetText( wxT( "${SIM.PARAMS}" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1166,7 +1164,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol )
|
||||||
|
|
||||||
wxStringSplit( legacyPins->GetText(), pinIndexes, ' ' );
|
wxStringSplit( legacyPins->GetText(), pinIndexes, ' ' );
|
||||||
|
|
||||||
if( SIM_MODEL::InferSimModel( prefix, value ).second.length() )
|
if( SIM_MODEL::InferSimModel( prefix, valueField->GetText() ).second.length() )
|
||||||
{
|
{
|
||||||
if( pinIndexes[0] == wxT( "2" ) )
|
if( pinIndexes[0] == wxT( "2" ) )
|
||||||
pins = "1=- 2=+";
|
pins = "1=- 2=+";
|
||||||
|
|
Loading…
Reference in New Issue