Spice fields enum values renamed from SPICE_* to SF_*
This commit is contained in:
parent
3ebc2494a7
commit
27a7a9b1a5
|
@ -76,9 +76,9 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
{
|
||||
switch( m_pasType->GetSelection() )
|
||||
{
|
||||
case 0: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_RESISTOR; break;
|
||||
case 1: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_CAPACITOR; break;
|
||||
case 2: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_INDUCTOR; break;
|
||||
case 0: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_RESISTOR; break;
|
||||
case 1: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_CAPACITOR; break;
|
||||
case 2: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_INDUCTOR; break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unhandled passive type" );
|
||||
|
@ -86,7 +86,7 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
break;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_MODEL] = m_pasValue->GetValue();
|
||||
m_fieldsTmp[SF_MODEL] = m_pasValue->GetValue();
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,9 +95,9 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
{
|
||||
switch( m_semiType->GetSelection() )
|
||||
{
|
||||
case 0: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_DIODE; break;
|
||||
case 1: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_BJT; break;
|
||||
case 2: m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_MOSFET; break;
|
||||
case 0: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_DIODE; break;
|
||||
case 1: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_BJT; break;
|
||||
case 2: m_fieldsTmp[SF_PRIMITIVE] = (char) SP_MOSFET; break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unhandled semiconductor type" );
|
||||
|
@ -105,21 +105,21 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
break;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_MODEL] = m_semiModel->GetValue();
|
||||
m_fieldsTmp[SF_MODEL] = m_semiModel->GetValue();
|
||||
|
||||
if( !empty( m_semiLib ) )
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = m_semiLib->GetValue();
|
||||
m_fieldsTmp[SF_LIB_FILE] = m_semiLib->GetValue();
|
||||
}
|
||||
|
||||
|
||||
// Integrated circuit
|
||||
else if( page == m_ic )
|
||||
{
|
||||
m_fieldsTmp[SPICE_PRIMITIVE] = (char) SP_SUBCKT;
|
||||
m_fieldsTmp[SPICE_MODEL] = m_icModel->GetValue();
|
||||
m_fieldsTmp[SF_PRIMITIVE] = (char) SP_SUBCKT;
|
||||
m_fieldsTmp[SF_MODEL] = m_icModel->GetValue();
|
||||
|
||||
if( !empty( m_icLib ) )
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = m_icLib->GetValue();
|
||||
m_fieldsTmp[SF_LIB_FILE] = m_icLib->GetValue();
|
||||
}
|
||||
|
||||
|
||||
|
@ -131,8 +131,8 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
if( !generatePowerSource( model ) )
|
||||
return false;
|
||||
|
||||
m_fieldsTmp[SPICE_PRIMITIVE] = (char)( m_pwrType->GetSelection() ? SP_ISOURCE : SP_VSOURCE );
|
||||
m_fieldsTmp[SPICE_MODEL] = model;
|
||||
m_fieldsTmp[SF_PRIMITIVE] = (char)( m_pwrType->GetSelection() ? SP_ISOURCE : SP_VSOURCE );
|
||||
m_fieldsTmp[SF_MODEL] = model;
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,11 +142,11 @@ bool DIALOG_SPICE_MODEL::TransferDataFromWindow()
|
|||
return false;
|
||||
}
|
||||
|
||||
m_fieldsTmp[SPICE_ENABLED] = !m_disabled->GetValue() ? "Y" : "N"; // note bool inversion
|
||||
m_fieldsTmp[SPICE_NODE_SEQUENCE] = m_nodeSeqCheck->IsChecked() ? m_nodeSeqVal->GetValue() : "";
|
||||
m_fieldsTmp[SF_ENABLED] = !m_disabled->GetValue() ? "Y" : "N"; // note bool inversion
|
||||
m_fieldsTmp[SF_NODE_SEQUENCE] = m_nodeSeqCheck->IsChecked() ? m_nodeSeqVal->GetValue() : "";
|
||||
|
||||
// Apply the settings
|
||||
for( int i = 0; i < SPICE_FIELD_END; ++i )
|
||||
for( int i = 0; i < SF_END; ++i )
|
||||
{
|
||||
if( m_fieldsTmp.count( (SPICE_FIELD) i ) > 0 && !m_fieldsTmp.at( i ).IsEmpty() )
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
|
|||
}
|
||||
|
||||
// Analyze the component fields to fill out the dialog
|
||||
char primitive = toupper( m_fieldsTmp[SPICE_PRIMITIVE][0] );
|
||||
char primitive = toupper( m_fieldsTmp[SF_PRIMITIVE][0] );
|
||||
|
||||
switch( primitive )
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
|
|||
: primitive == SP_CAPACITOR ? 1
|
||||
: primitive == SP_INDUCTOR ? 2
|
||||
: -1 );
|
||||
m_pasValue->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
m_pasValue->SetValue( m_fieldsTmp[SF_MODEL] );
|
||||
break;
|
||||
|
||||
case SP_DIODE:
|
||||
|
@ -215,33 +215,33 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
|
|||
: primitive == SP_BJT ? 1
|
||||
: primitive == SP_MOSFET ? 2
|
||||
: -1 );
|
||||
m_semiModel->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
m_semiLib->SetValue( m_fieldsTmp[SPICE_LIB_FILE] );
|
||||
m_semiModel->SetValue( m_fieldsTmp[SF_MODEL] );
|
||||
m_semiLib->SetValue( m_fieldsTmp[SF_LIB_FILE] );
|
||||
|
||||
if( !empty( m_semiLib ) )
|
||||
{
|
||||
const wxString& libFile = m_semiLib->GetValue();
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = libFile;
|
||||
m_fieldsTmp[SF_LIB_FILE] = libFile;
|
||||
updateFromFile( m_semiModel, libFile, "model" );
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_SUBCKT:
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_ic ) );
|
||||
m_icModel->SetValue( m_fieldsTmp[SPICE_MODEL] );
|
||||
m_icLib->SetValue( m_fieldsTmp[SPICE_LIB_FILE] );
|
||||
m_icModel->SetValue( m_fieldsTmp[SF_MODEL] );
|
||||
m_icLib->SetValue( m_fieldsTmp[SF_LIB_FILE] );
|
||||
|
||||
if( !empty( m_icLib ) )
|
||||
{
|
||||
const wxString& libFile = m_icLib->GetValue();
|
||||
m_fieldsTmp[SPICE_LIB_FILE] = libFile;
|
||||
m_fieldsTmp[SF_LIB_FILE] = libFile;
|
||||
updateFromFile( m_icModel, libFile, "subckt" );
|
||||
}
|
||||
break;
|
||||
|
||||
case SP_VSOURCE:
|
||||
case SP_ISOURCE:
|
||||
if( !parsePowerSource( m_fieldsTmp[SPICE_MODEL] ) )
|
||||
if( !parsePowerSource( m_fieldsTmp[SF_MODEL] ) )
|
||||
return false;
|
||||
|
||||
m_notebook->SetSelection( m_notebook->FindPage( m_power ) );
|
||||
|
@ -253,14 +253,14 @@ bool DIALOG_SPICE_MODEL::TransferDataToWindow()
|
|||
break;
|
||||
}
|
||||
|
||||
m_disabled->SetValue( !NETLIST_EXPORTER_PSPICE::StringToBool( m_fieldsTmp[SPICE_ENABLED] ) );
|
||||
m_disabled->SetValue( !NETLIST_EXPORTER_PSPICE::StringToBool( m_fieldsTmp[SF_ENABLED] ) );
|
||||
|
||||
// Check if node sequence is different than the default one
|
||||
if( m_fieldsTmp[SPICE_NODE_SEQUENCE]
|
||||
!= NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_NODE_SEQUENCE, &m_component, 0 ) )
|
||||
if( m_fieldsTmp[SF_NODE_SEQUENCE]
|
||||
!= NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SF_NODE_SEQUENCE, &m_component, 0 ) )
|
||||
{
|
||||
m_nodeSeqCheck->SetValue( true );
|
||||
m_nodeSeqVal->SetValue( m_fieldsTmp[SPICE_NODE_SEQUENCE] );
|
||||
m_nodeSeqVal->SetValue( m_fieldsTmp[SF_NODE_SEQUENCE] );
|
||||
}
|
||||
|
||||
return DIALOG_SPICE_MODEL_BASE::TransferDataToWindow();
|
||||
|
|
|
@ -144,7 +144,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_FIELD aField,
|
|||
SCH_COMPONENT* aComponent, unsigned aCtl )
|
||||
{
|
||||
SCH_FIELD* field = aComponent->FindField( GetSpiceFieldName( aField ) );
|
||||
return field ? field->GetText() : GetSpiceFieldDefVal( SPICE_PRIMITIVE, aComponent, aCtl );
|
||||
return field ? field->GetText() : GetSpiceFieldDefVal( SF_PRIMITIVE, aComponent, aCtl );
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
{
|
||||
switch( aField )
|
||||
{
|
||||
case SPICE_PRIMITIVE:
|
||||
case SF_PRIMITIVE:
|
||||
{
|
||||
const wxString& refName = aComponent->GetField( REFERENCE )->GetText();
|
||||
|
||||
|
@ -165,7 +165,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
break;
|
||||
}
|
||||
|
||||
case SPICE_MODEL:
|
||||
case SF_MODEL:
|
||||
{
|
||||
wxChar prim = aComponent->GetField( REFERENCE )->GetText().GetChar( 0 );
|
||||
wxString value = aComponent->GetField( VALUE )->GetText();
|
||||
|
@ -199,11 +199,11 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
break;
|
||||
}
|
||||
|
||||
case SPICE_ENABLED:
|
||||
case SF_ENABLED:
|
||||
return wxString( "Y" );
|
||||
break;
|
||||
|
||||
case SPICE_NODE_SEQUENCE:
|
||||
case SF_NODE_SEQUENCE:
|
||||
{
|
||||
wxString nodeSeq;
|
||||
std::vector<LIB_PIN*> pins;
|
||||
|
@ -219,7 +219,7 @@ wxString NETLIST_EXPORTER_PSPICE::GetSpiceFieldDefVal( SPICE_FIELD aField,
|
|||
break;
|
||||
}
|
||||
|
||||
case SPICE_LIB_FILE:
|
||||
case SF_LIB_FILE:
|
||||
// There is no default Spice library
|
||||
return wxEmptyString;
|
||||
break;
|
||||
|
@ -268,22 +268,15 @@ void NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
|
|||
spiceItem.m_parent = comp;
|
||||
|
||||
// Obtain Spice fields
|
||||
SCH_FIELD* fieldPrim = comp->FindField( GetSpiceFieldName( SPICE_PRIMITIVE ) );
|
||||
SCH_FIELD* fieldModel = comp->FindField( GetSpiceFieldName( SPICE_MODEL ) );
|
||||
SCH_FIELD* fieldEnabled = comp->FindField( GetSpiceFieldName( SPICE_ENABLED ) );
|
||||
SCH_FIELD* fieldLibFile = comp->FindField( GetSpiceFieldName( SPICE_LIB_FILE ) );
|
||||
SCH_FIELD* fieldSeq = comp->FindField( GetSpiceFieldName( SPICE_NODE_SEQUENCE ) );
|
||||
|
||||
spiceItem.m_primitive = fieldPrim ? fieldPrim->GetText()[0]
|
||||
: GetSpiceFieldDefVal( SPICE_PRIMITIVE, comp, aCtl )[0];
|
||||
|
||||
spiceItem.m_model = fieldModel ? fieldModel->GetText()
|
||||
: GetSpiceFieldDefVal( SPICE_MODEL, comp, aCtl );
|
||||
SCH_FIELD* fieldLibFile = comp->FindField( GetSpiceFieldName( SF_LIB_FILE ) );
|
||||
SCH_FIELD* fieldSeq = comp->FindField( GetSpiceFieldName( SF_NODE_SEQUENCE ) );
|
||||
|
||||
spiceItem.m_primitive = GetSpiceField( SF_PRIMITIVE, comp, aCtl )[0];
|
||||
spiceItem.m_model = GetSpiceField( SF_MODEL, comp, aCtl );
|
||||
spiceItem.m_refName = comp->GetRef( &sheetList[sheet_idx] );
|
||||
|
||||
// Check to see if component should be removed from Spice netlist
|
||||
spiceItem.m_enabled = fieldEnabled ? StringToBool( fieldEnabled->GetText() ) : true;
|
||||
spiceItem.m_enabled = StringToBool( GetSpiceField( SF_ENABLED, comp, aCtl ) );
|
||||
|
||||
if( fieldLibFile && !fieldLibFile->GetText().IsEmpty() )
|
||||
m_libraries.insert( fieldLibFile->GetText() );
|
||||
|
|
|
@ -41,12 +41,12 @@ enum SPICE_NETLIST_OPTIONS {
|
|||
};
|
||||
|
||||
enum SPICE_FIELD {
|
||||
SPICE_PRIMITIVE,
|
||||
SPICE_MODEL,
|
||||
SPICE_ENABLED,
|
||||
SPICE_NODE_SEQUENCE,
|
||||
SPICE_LIB_FILE,
|
||||
SPICE_FIELD_END // sentinel
|
||||
SF_PRIMITIVE,
|
||||
SF_MODEL,
|
||||
SF_ENABLED,
|
||||
SF_NODE_SEQUENCE,
|
||||
SF_LIB_FILE,
|
||||
SF_END // sentinel
|
||||
};
|
||||
|
||||
enum SPICE_PRIMITIVE {
|
||||
|
|
|
@ -189,7 +189,7 @@ void SIM_PLOT_FRAME::AddTuner( SCH_COMPONENT* aComponent )
|
|||
return;
|
||||
|
||||
// For now limit the tuner tool to RLC components
|
||||
char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_PRIMITIVE, aComponent, 0 )[0];
|
||||
char primitiveType = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
|
||||
|
||||
if( primitiveType != SP_RESISTOR && primitiveType != SP_CAPACITOR && primitiveType != SP_INDUCTOR )
|
||||
return;
|
||||
|
@ -247,7 +247,7 @@ void SIM_PLOT_FRAME::updateNetlistExporter()
|
|||
}
|
||||
|
||||
|
||||
bool SIM_PLOT_FRAME::updatePlot( const wxString& aSpiceName, const wxString& aName, SIM_PLOT_PANEL* aPanel )
|
||||
bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, SIM_PLOT_PANEL* aPanel )
|
||||
{
|
||||
if( !m_simulator )
|
||||
return false;
|
||||
|
|
|
@ -39,7 +39,7 @@ TUNER_SLIDER::TUNER_SLIDER( SIM_PLOT_FRAME* aParent, SCH_COMPONENT* aComponent )
|
|||
m_changed = false;
|
||||
|
||||
// Generate Spice component name
|
||||
char prim = NETLIST_EXPORTER_PSPICE::GetSpiceField( SPICE_PRIMITIVE, aComponent, 0 )[0];
|
||||
char prim = NETLIST_EXPORTER_PSPICE::GetSpiceField( SF_PRIMITIVE, aComponent, 0 )[0];
|
||||
m_spiceName = wxString( prim + compName ).Lower();
|
||||
|
||||
// Call Set*() methods to update fields and slider
|
||||
|
|
Loading…
Reference in New Issue