Mutual Inductor isn't an inductor.

It's a statement about two other inductors.
This commit is contained in:
Jeff Young 2024-01-21 22:25:24 +00:00
parent a836a66170
commit 1bd8da41a7
14 changed files with 2616 additions and 2549 deletions

View File

@ -91,7 +91,7 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, T_symb
m_waveformChoice->Clear();
m_deviceChoice->Clear();
m_deviceTypeChoice->Clear();
m_deviceSubtypeChoice->Clear();
m_scintillaTricksCode = new SCINTILLA_TRICKS( m_codePreview, wxT( "{}" ), false );
m_scintillaTricksSubckt = new SCINTILLA_TRICKS( m_subckt, wxT( "()" ), false );
@ -188,10 +188,10 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
if( SIM_MODEL::InferSimModel( m_symbol, &m_fields, false, SIM_VALUE_GRAMMAR::NOTATION::SI,
&deviceType, &modelType, &modelParams, &pinMap ) )
{
setFieldValue( SIM_DEVICE_TYPE_FIELD, deviceType );
setFieldValue( SIM_DEVICE_FIELD, deviceType );
if( !modelType.IsEmpty() )
setFieldValue( SIM_TYPE_FIELD, modelType );
setFieldValue( SIM_DEVICE_SUBTYPE_FIELD, modelType );
setFieldValue( SIM_PARAMS_FIELD, modelParams );
@ -288,8 +288,8 @@ bool DIALOG_SIM_MODEL<T_symbol, T_field>::TransferDataToWindow()
}
}
}
else if( !SIM_MODEL::GetFieldValue( &m_fields, SIM_DEVICE_TYPE_FIELD ).empty()
|| !SIM_MODEL::GetFieldValue( &m_fields, SIM_TYPE_FIELD ).empty() )
else if( !SIM_MODEL::GetFieldValue( &m_fields, SIM_DEVICE_FIELD ).empty()
|| !SIM_MODEL::GetFieldValue( &m_fields, SIM_DEVICE_SUBTYPE_FIELD ).empty() )
{
// The model is sourced from the instance.
m_rbBuiltinModel->SetValue( true );
@ -430,8 +430,8 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateWidgets()
m_deviceLabel->Enable( enableBuiltinCtrls );
m_deviceChoice->Enable( enableBuiltinCtrls );
m_deviceTypeLabel->Enable( enableBuiltinCtrls );
m_deviceTypeChoice->Enable( enableBuiltinCtrls );
m_deviceSubtypeLabel->Enable( enableBuiltinCtrls );
m_deviceSubtypeChoice->Enable( enableBuiltinCtrls );
SIM_MODEL* model = &curModel();
@ -505,7 +505,7 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateBuiltinModelWidgets( SIM_MODEL*
if( aModel != m_prevModel )
{
m_deviceChoice->Clear();
m_deviceTypeChoice->Clear();
m_deviceSubtypeChoice->Clear();
if( !m_rbLibraryModel->GetValue() )
{
@ -536,13 +536,16 @@ void DIALOG_SIM_MODEL<T_symbol, T_field>::updateBuiltinModelWidgets( SIM_MODEL*
if( deviceType == aModel->GetDeviceType()
|| deviceTypeDesc == aModel->GetDeviceInfo().description )
{
m_deviceTypeChoice->Append( SIM_MODEL::TypeInfo( type ).description );
m_deviceSubtypeChoice->Append( SIM_MODEL::TypeInfo( type ).description );
if( type == aModel->GetType() )
m_deviceTypeChoice->SetSelection( m_deviceTypeChoice->GetCount() - 1 );
m_deviceSubtypeChoice->SetSelection( m_deviceSubtypeChoice->GetCount() - 1 );
}
}
}
m_deviceSubtypeLabel->Show( m_deviceSubtypeChoice->GetCount() > 1 );
m_deviceSubtypeChoice->Show( m_deviceSubtypeChoice->GetCount() > 1 );
}
if( dynamic_cast<SIM_MODEL_RAW_SPICE*>( aModel ) )
@ -1323,7 +1326,7 @@ template <typename T_symbol, typename T_field>
void DIALOG_SIM_MODEL<T_symbol, T_field>::onTypeChoice( wxCommandEvent& aEvent )
{
SIM_MODEL::DEVICE_T deviceType = curModel().GetDeviceType();
wxString typeDescription = m_deviceTypeChoice->GetStringSelection();
wxString typeDescription = m_deviceSubtypeChoice->GetStringSelection();
for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() )
{

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -115,17 +115,17 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
m_deviceChoice->SetSelection( 0 );
fgSizer16->Add( m_deviceChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
m_deviceTypeLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Device type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_deviceTypeLabel->Wrap( -1 );
fgSizer16->Add( m_deviceTypeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_deviceSubtypeLabel = new wxStaticText( m_modelPanel, wxID_ANY, _("Device type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_deviceSubtypeLabel->Wrap( -1 );
fgSizer16->Add( m_deviceSubtypeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxArrayString m_deviceTypeChoiceChoices;
m_deviceTypeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceTypeChoiceChoices, 0 );
m_deviceTypeChoice->SetSelection( 0 );
fgSizer16->Add( m_deviceTypeChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
wxArrayString m_deviceSubtypeChoiceChoices;
m_deviceSubtypeChoice = new wxChoice( m_modelPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_deviceSubtypeChoiceChoices, 0 );
m_deviceSubtypeChoice->SetSelection( 0 );
fgSizer16->Add( m_deviceSubtypeChoice, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 10 );
bSizerMargins->Add( fgSizer16, 0, wxEXPAND|wxLEFT, 24 );
bSizerMargins->Add( fgSizer16, 0, wxEXPAND|wxLEFT|wxRESERVE_SPACE_EVEN_IF_HIDDEN, 24 );
bSizerMargins->Add( 0, 15, 0, wxEXPAND, 5 );
@ -353,8 +353,8 @@ DIALOG_SIM_MODEL_BASE::DIALOG_SIM_MODEL_BASE( wxWindow* parent, wxWindowID id, c
m_deviceLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeLabelUpdate ), NULL, this );
m_deviceChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoice ), NULL, this );
m_deviceChoice->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoiceUpdate ), NULL, this );
m_deviceTypeLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_deviceTypeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_deviceSubtypeLabel->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_deviceSubtypeChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_modelNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEventHandler( DIALOG_SIM_MODEL_BASE::onPageChanging ), NULL, this );
m_paramGridMgr->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onSizeParamGrid ), NULL, this );
m_pinAssignmentsGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );
@ -390,8 +390,8 @@ DIALOG_SIM_MODEL_BASE::~DIALOG_SIM_MODEL_BASE()
m_deviceLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeLabelUpdate ), NULL, this );
m_deviceChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoice ), NULL, this );
m_deviceChoice->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onDeviceTypeChoiceUpdate ), NULL, this );
m_deviceTypeLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_deviceTypeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_deviceSubtypeLabel->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SIM_MODEL_BASE::onTypeLabelUpdate ), NULL, this );
m_deviceSubtypeChoice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_SIM_MODEL_BASE::onTypeChoice ), NULL, this );
m_modelNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxNotebookEventHandler( DIALOG_SIM_MODEL_BASE::onPageChanging ), NULL, this );
m_paramGridMgr->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SIM_MODEL_BASE::onSizeParamGrid ), NULL, this );
m_pinAssignmentsGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SIM_MODEL_BASE::onPinAssignmentsGridCellChange ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -70,8 +70,8 @@ class DIALOG_SIM_MODEL_BASE : public DIALOG_SHIM
wxRadioButton* m_rbBuiltinModel;
wxStaticText* m_deviceLabel;
wxChoice* m_deviceChoice;
wxStaticText* m_deviceTypeLabel;
wxChoice* m_deviceTypeChoice;
wxStaticText* m_deviceSubtypeLabel;
wxChoice* m_deviceSubtypeChoice;
wxNotebook* m_modelNotebook;
wxPanel* m_parametersPanel;
wxPropertyGridManager* m_paramGridMgr;

View File

@ -199,7 +199,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::loadLibPart( const CADSTAR_PART_ENTRY& aPart )
if(aPart.m_SpiceModel.has_value())
{
wxString modelVal = wxString::Format( "model=\"%s\"", aPart.m_SpiceModel.value() );
addNewFieldToSymbol( SIM_DEVICE_TYPE_FIELD, retSym )->SetText( "SPICE" );
addNewFieldToSymbol( SIM_DEVICE_FIELD, retSym )->SetText( "SPICE" );
addNewFieldToSymbol( SIM_PARAMS_FIELD, retSym )->SetText( modelVal );
}

View File

@ -3051,7 +3051,7 @@ SCH_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseSchematicSymbol()
// Exclude from simulation used to be managed by a Sim.Enable field set to "0" when
// simulation was disabled.
if( field->GetCanonicalName() == SIM_ENABLE_FIELD )
if( field->GetCanonicalName() == SIM_LEGACY_ENABLE_FIELD_V7 )
{
symbol->SetExcludedFromSim( field->GetText() == wxS( "0" ) );
break;

View File

@ -1345,6 +1345,18 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, i
}
}
// Consider missing simulation fields as empty, not un-resolved
if( token->IsSameAs( wxT( "SIM.DEVICE" ) )
|| token->IsSameAs( wxT( "SIM.TYPE" ) )
|| token->IsSameAs( wxT( "SIM.PINS" ) )
|| token->IsSameAs( wxT( "SIM.PARAMS" ) )
|| token->IsSameAs( wxT( "SIM.LIBRARY" ) )
|| token->IsSameAs( wxT( "SIM.NAME" ) ) )
{
*token = wxEmptyString;
return true;
}
for( const TEMPLATE_FIELDNAME& templateFieldname :
schematic->Settings().m_TemplateFieldNames.GetTemplateFieldNames() )
{

View File

@ -220,12 +220,12 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const SCH_SHEET_PATH* aSheetPath, S
if( SIM_MODEL::InferSimModel( aSymbol, &fields, true, SIM_VALUE_GRAMMAR::NOTATION::SI,
&deviceType, &modelType, &modelParams, &pinMap ) )
{
fields.emplace_back( &aSymbol, -1, SIM_DEVICE_TYPE_FIELD );
fields.emplace_back( &aSymbol, -1, SIM_DEVICE_FIELD );
fields.back().SetText( deviceType );
if( !modelType.IsEmpty() )
{
fields.emplace_back( &aSymbol, -1, SIM_TYPE_FIELD );
fields.emplace_back( &aSymbol, -1, SIM_DEVICE_SUBTYPE_FIELD );
fields.back().SetText( modelType );
}

View File

@ -57,39 +57,43 @@ SIM_MODEL::DEVICE_INFO SIM_MODEL::DeviceInfo( DEVICE_T aDeviceType )
{
switch( aDeviceType )
{
case DEVICE_T::NONE: return { "", "", true };
case DEVICE_T::R: return { "R", "Resistor", true };
case DEVICE_T::C: return { "C", "Capacitor", true };
case DEVICE_T::L: return { "L", "Inductor", true };
case DEVICE_T::TLINE: return { "TLINE", "Transmission Line", true };
case DEVICE_T::SW: return { "SW", "Switch", true };
// | fieldValue | description | showInMenu |
// -------------------------------------------------------
//
case DEVICE_T::NONE: return { "", "", true };
case DEVICE_T::R: return { "R", "Resistor", true };
case DEVICE_T::C: return { "C", "Capacitor", true };
case DEVICE_T::L: return { "L", "Inductor", true };
case DEVICE_T::K: return { "K", "Mutual Inductance Statement", true };
case DEVICE_T::TLINE: return { "TLINE", "Transmission Line", true };
case DEVICE_T::SW: return { "SW", "Switch", true };
case DEVICE_T::D: return { "D", "Diode", true };
case DEVICE_T::NPN: return { "NPN", "NPN BJT", true };
case DEVICE_T::PNP: return { "PNP", "PNP BJT", true };
case DEVICE_T::D: return { "D", "Diode", true };
case DEVICE_T::NPN: return { "NPN", "NPN BJT", true };
case DEVICE_T::PNP: return { "PNP", "PNP BJT", true };
case DEVICE_T::NJFET: return { "NJFET", "N-channel JFET", true };
case DEVICE_T::PJFET: return { "PJFET", "P-channel JFET", true };
case DEVICE_T::NJFET: return { "NJFET", "N-channel JFET", true };
case DEVICE_T::PJFET: return { "PJFET", "P-channel JFET", true };
case DEVICE_T::NMOS: return { "NMOS", "N-channel MOSFET", true };
case DEVICE_T::PMOS: return { "PMOS", "P-channel MOSFET", true };
case DEVICE_T::NMES: return { "NMES", "N-channel MESFET", true };
case DEVICE_T::PMES: return { "PMES", "P-channel MESFET", true };
case DEVICE_T::NMOS: return { "NMOS", "N-channel MOSFET", true };
case DEVICE_T::PMOS: return { "PMOS", "P-channel MOSFET", true };
case DEVICE_T::NMES: return { "NMES", "N-channel MESFET", true };
case DEVICE_T::PMES: return { "PMES", "P-channel MESFET", true };
case DEVICE_T::V: return { "V", "Voltage Source", true };
case DEVICE_T::I: return { "I", "Current Source", true };
case DEVICE_T::E: return { "E", "Voltage Source", false };
case DEVICE_T::F: return { "F", "Current Source", false };
case DEVICE_T::G: return { "G", "Current Source", false };
case DEVICE_T::H: return { "H", "Voltage Source", false };
case DEVICE_T::V: return { "V", "Voltage Source", true };
case DEVICE_T::I: return { "I", "Current Source", true };
case DEVICE_T::E: return { "E", "Voltage Source", false };
case DEVICE_T::F: return { "F", "Current Source", false };
case DEVICE_T::G: return { "G", "Current Source", false };
case DEVICE_T::H: return { "H", "Voltage Source", false };
case DEVICE_T::KIBIS: return { "IBIS", "IBIS Model", false };
case DEVICE_T::KIBIS: return { "IBIS", "IBIS Model", false };
case DEVICE_T::SUBCKT: return { "SUBCKT", "Subcircuit", false };
case DEVICE_T::XSPICE: return { "XSPICE", "XSPICE Code Model", true };
case DEVICE_T::SPICE: return { "SPICE", "Raw Spice Element", true };
case DEVICE_T::SUBCKT: return { "SUBCKT", "Subcircuit", false };
case DEVICE_T::XSPICE: return { "XSPICE", "XSPICE Code Model", true };
case DEVICE_T::SPICE: return { "SPICE", "Raw Spice Element", true };
default: wxFAIL; return {};
default: wxFAIL; return {};
}
}
@ -98,136 +102,140 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
{
switch( aType )
{
case TYPE::NONE: return { DEVICE_T::NONE, "", "" };
// | deviceType | fieldValue | description |
// ---------------------------------------------------------------------
//
case TYPE::NONE: return { DEVICE_T::NONE, "", "" };
case TYPE::R: return { DEVICE_T::R, "", "Ideal" };
case TYPE::R_POT: return { DEVICE_T::R, "POT", "Potentiometer" };
case TYPE::R_BEHAVIORAL: return { DEVICE_T::R, "=", "Behavioral" };
case TYPE::R: return { DEVICE_T::R, "", "Ideal" };
case TYPE::R_POT: return { DEVICE_T::R, "POT", "Potentiometer" };
case TYPE::R_BEHAVIORAL: return { DEVICE_T::R, "=", "Behavioral" };
case TYPE::C: return { DEVICE_T::C, "", "Ideal" };
case TYPE::C_BEHAVIORAL: return { DEVICE_T::C, "=", "Behavioral" };
case TYPE::C: return { DEVICE_T::C, "", "Ideal" };
case TYPE::C_BEHAVIORAL: return { DEVICE_T::C, "=", "Behavioral" };
case TYPE::L: return { DEVICE_T::L, "", "Ideal" };
case TYPE::L_MUTUAL: return { DEVICE_T::L, "MUTUAL", "Mutual" };
case TYPE::L_BEHAVIORAL: return { DEVICE_T::L, "=", "Behavioral" };
case TYPE::L: return { DEVICE_T::L, "", "Ideal" };
case TYPE::L_BEHAVIORAL: return { DEVICE_T::L, "=", "Behavioral" };
case TYPE::TLINE_Z0: return { DEVICE_T::TLINE, "", "Characteristic impedance" };
case TYPE::TLINE_RLGC: return { DEVICE_T::TLINE, "RLGC", "RLGC" };
case TYPE::K: return { DEVICE_T::K, "", "Mutual Inductance Statement" };
case TYPE::SW_V: return { DEVICE_T::SW, "V", "Voltage-controlled" };
case TYPE::SW_I: return { DEVICE_T::SW, "I", "Current-controlled" };
case TYPE::TLINE_Z0: return { DEVICE_T::TLINE, "", "Characteristic impedance" };
case TYPE::TLINE_RLGC: return { DEVICE_T::TLINE, "RLGC", "RLGC" };
case TYPE::D: return { DEVICE_T::D, "", "" };
case TYPE::SW_V: return { DEVICE_T::SW, "V", "Voltage-controlled" };
case TYPE::SW_I: return { DEVICE_T::SW, "I", "Current-controlled" };
case TYPE::NPN_VBIC: return { DEVICE_T::NPN, "VBIC", "VBIC" };
case TYPE::PNP_VBIC: return { DEVICE_T::PNP, "VBIC", "VBIC" };
case TYPE::NPN_GUMMELPOON: return { DEVICE_T::NPN, "GUMMELPOON", "Gummel-Poon" };
case TYPE::PNP_GUMMELPOON: return { DEVICE_T::PNP, "GUMMELPOON", "Gummel-Poon" };
case TYPE::D: return { DEVICE_T::D, "", "" };
case TYPE::NPN_VBIC: return { DEVICE_T::NPN, "VBIC", "VBIC" };
case TYPE::PNP_VBIC: return { DEVICE_T::PNP, "VBIC", "VBIC" };
case TYPE::NPN_GUMMELPOON: return { DEVICE_T::NPN, "GUMMELPOON", "Gummel-Poon" };
case TYPE::PNP_GUMMELPOON: return { DEVICE_T::PNP, "GUMMELPOON", "Gummel-Poon" };
//case TYPE::BJT_MEXTRAM: return {};
case TYPE::NPN_HICUM2: return { DEVICE_T::NPN, "HICUML2", "HICUM level 2" };
case TYPE::PNP_HICUM2: return { DEVICE_T::PNP, "HICUML2", "HICUM level 2" };
case TYPE::NPN_HICUM2: return { DEVICE_T::NPN, "HICUML2", "HICUM level 2" };
case TYPE::PNP_HICUM2: return { DEVICE_T::PNP, "HICUML2", "HICUM level 2" };
//case TYPE::BJT_HICUM_L0: return {};
case TYPE::NJFET_SHICHMANHODGES: return { DEVICE_T::NJFET, "SHICHMANHODGES", "Shichman-Hodges" };
case TYPE::PJFET_SHICHMANHODGES: return { DEVICE_T::PJFET, "SHICHMANHODGES", "Shichman-Hodges" };
case TYPE::NJFET_PARKERSKELLERN: return { DEVICE_T::NJFET, "PARKERSKELLERN", "Parker-Skellern" };
case TYPE::PJFET_PARKERSKELLERN: return { DEVICE_T::PJFET, "PARKERSKELLERN", "Parker-Skellern" };
case TYPE::NJFET_SHICHMANHODGES: return { DEVICE_T::NJFET, "SHICHMANHODGES", "Shichman-Hodges" };
case TYPE::PJFET_SHICHMANHODGES: return { DEVICE_T::PJFET, "SHICHMANHODGES", "Shichman-Hodges" };
case TYPE::NJFET_PARKERSKELLERN: return { DEVICE_T::NJFET, "PARKERSKELLERN", "Parker-Skellern" };
case TYPE::PJFET_PARKERSKELLERN: return { DEVICE_T::PJFET, "PARKERSKELLERN", "Parker-Skellern" };
case TYPE::NMES_STATZ: return { DEVICE_T::NMES, "STATZ", "Statz" };
case TYPE::PMES_STATZ: return { DEVICE_T::PMES, "STATZ", "Statz" };
case TYPE::NMES_YTTERDAL: return { DEVICE_T::NMES, "YTTERDAL", "Ytterdal" };
case TYPE::PMES_YTTERDAL: return { DEVICE_T::PMES, "YTTERDAL", "Ytterdal" };
case TYPE::NMES_HFET1: return { DEVICE_T::NMES, "HFET1", "HFET1" };
case TYPE::PMES_HFET1: return { DEVICE_T::PMES, "HFET1", "HFET1" };
case TYPE::NMES_HFET2: return { DEVICE_T::NMES, "HFET2", "HFET2" };
case TYPE::PMES_HFET2: return { DEVICE_T::PMES, "HFET2", "HFET2" };
case TYPE::NMES_STATZ: return { DEVICE_T::NMES, "STATZ", "Statz" };
case TYPE::PMES_STATZ: return { DEVICE_T::PMES, "STATZ", "Statz" };
case TYPE::NMES_YTTERDAL: return { DEVICE_T::NMES, "YTTERDAL", "Ytterdal" };
case TYPE::PMES_YTTERDAL: return { DEVICE_T::PMES, "YTTERDAL", "Ytterdal" };
case TYPE::NMES_HFET1: return { DEVICE_T::NMES, "HFET1", "HFET1" };
case TYPE::PMES_HFET1: return { DEVICE_T::PMES, "HFET1", "HFET1" };
case TYPE::NMES_HFET2: return { DEVICE_T::NMES, "HFET2", "HFET2" };
case TYPE::PMES_HFET2: return { DEVICE_T::PMES, "HFET2", "HFET2" };
case TYPE::NMOS_VDMOS: return { DEVICE_T::NMOS, "VDMOS", "VDMOS" };
case TYPE::PMOS_VDMOS: return { DEVICE_T::PMOS, "VDMOS", "VDMOS" };
case TYPE::NMOS_MOS1: return { DEVICE_T::NMOS, "MOS1", "Classical quadratic (MOS1)" };
case TYPE::PMOS_MOS1: return { DEVICE_T::PMOS, "MOS1", "Classical quadratic (MOS1)" };
case TYPE::NMOS_MOS2: return { DEVICE_T::NMOS, "MOS2", "Grove-Frohman (MOS2)" };
case TYPE::PMOS_MOS2: return { DEVICE_T::PMOS, "MOS2", "Grove-Frohman (MOS2)" };
case TYPE::NMOS_MOS3: return { DEVICE_T::NMOS, "MOS3", "MOS3" };
case TYPE::PMOS_MOS3: return { DEVICE_T::PMOS, "MOS3", "MOS3" };
case TYPE::NMOS_BSIM1: return { DEVICE_T::NMOS, "BSIM1", "BSIM1" };
case TYPE::PMOS_BSIM1: return { DEVICE_T::PMOS, "BSIM1", "BSIM1" };
case TYPE::NMOS_BSIM2: return { DEVICE_T::NMOS, "BSIM2", "BSIM2" };
case TYPE::PMOS_BSIM2: return { DEVICE_T::PMOS, "BSIM2", "BSIM2" };
case TYPE::NMOS_MOS6: return { DEVICE_T::NMOS, "MOS6", "MOS6" };
case TYPE::PMOS_MOS6: return { DEVICE_T::PMOS, "MOS6", "MOS6" };
case TYPE::NMOS_BSIM3: return { DEVICE_T::NMOS, "BSIM3", "BSIM3" };
case TYPE::PMOS_BSIM3: return { DEVICE_T::PMOS, "BSIM3", "BSIM3" };
case TYPE::NMOS_MOS9: return { DEVICE_T::NMOS, "MOS9", "MOS9" };
case TYPE::PMOS_MOS9: return { DEVICE_T::PMOS, "MOS9", "MOS9" };
case TYPE::NMOS_B4SOI: return { DEVICE_T::NMOS, "B4SOI", "BSIM4 SOI (B4SOI)" };
case TYPE::PMOS_B4SOI: return { DEVICE_T::PMOS, "B4SOI", "BSIM4 SOI (B4SOI)" };
case TYPE::NMOS_BSIM4: return { DEVICE_T::NMOS, "BSIM4", "BSIM4" };
case TYPE::PMOS_BSIM4: return { DEVICE_T::PMOS, "BSIM4", "BSIM4" };
case TYPE::NMOS_VDMOS: return { DEVICE_T::NMOS, "VDMOS", "VDMOS" };
case TYPE::PMOS_VDMOS: return { DEVICE_T::PMOS, "VDMOS", "VDMOS" };
case TYPE::NMOS_MOS1: return { DEVICE_T::NMOS, "MOS1", "Classical quadratic (MOS1)" };
case TYPE::PMOS_MOS1: return { DEVICE_T::PMOS, "MOS1", "Classical quadratic (MOS1)" };
case TYPE::NMOS_MOS2: return { DEVICE_T::NMOS, "MOS2", "Grove-Frohman (MOS2)" };
case TYPE::PMOS_MOS2: return { DEVICE_T::PMOS, "MOS2", "Grove-Frohman (MOS2)" };
case TYPE::NMOS_MOS3: return { DEVICE_T::NMOS, "MOS3", "MOS3" };
case TYPE::PMOS_MOS3: return { DEVICE_T::PMOS, "MOS3", "MOS3" };
case TYPE::NMOS_BSIM1: return { DEVICE_T::NMOS, "BSIM1", "BSIM1" };
case TYPE::PMOS_BSIM1: return { DEVICE_T::PMOS, "BSIM1", "BSIM1" };
case TYPE::NMOS_BSIM2: return { DEVICE_T::NMOS, "BSIM2", "BSIM2" };
case TYPE::PMOS_BSIM2: return { DEVICE_T::PMOS, "BSIM2", "BSIM2" };
case TYPE::NMOS_MOS6: return { DEVICE_T::NMOS, "MOS6", "MOS6" };
case TYPE::PMOS_MOS6: return { DEVICE_T::PMOS, "MOS6", "MOS6" };
case TYPE::NMOS_BSIM3: return { DEVICE_T::NMOS, "BSIM3", "BSIM3" };
case TYPE::PMOS_BSIM3: return { DEVICE_T::PMOS, "BSIM3", "BSIM3" };
case TYPE::NMOS_MOS9: return { DEVICE_T::NMOS, "MOS9", "MOS9" };
case TYPE::PMOS_MOS9: return { DEVICE_T::PMOS, "MOS9", "MOS9" };
case TYPE::NMOS_B4SOI: return { DEVICE_T::NMOS, "B4SOI", "BSIM4 SOI (B4SOI)" };
case TYPE::PMOS_B4SOI: return { DEVICE_T::PMOS, "B4SOI", "BSIM4 SOI (B4SOI)" };
case TYPE::NMOS_BSIM4: return { DEVICE_T::NMOS, "BSIM4", "BSIM4" };
case TYPE::PMOS_BSIM4: return { DEVICE_T::PMOS, "BSIM4", "BSIM4" };
//case TYPE::NMOS_EKV2_6: return {};
//case TYPE::PMOS_EKV2_6: return {};
//case TYPE::NMOS_PSP: return {};
//case TYPE::PMOS_PSP: return {};
case TYPE::NMOS_B3SOIFD: return { DEVICE_T::NMOS, "B3SOIFD", "B3SOIFD (BSIM3 FD-SOI)" };
case TYPE::PMOS_B3SOIFD: return { DEVICE_T::PMOS, "B3SOIFD", "B3SOIFD (BSIM3 FD-SOI)" };
case TYPE::NMOS_B3SOIDD: return { DEVICE_T::NMOS, "B3SOIDD", "B3SOIDD (BSIM3 SOI)" };
case TYPE::PMOS_B3SOIDD: return { DEVICE_T::PMOS, "B3SOIDD", "B3SOIDD (BSIM3 SOI)" };
case TYPE::NMOS_B3SOIPD: return { DEVICE_T::NMOS, "B3SOIPD", "B3SOIPD (BSIM3 PD-SOI)" };
case TYPE::PMOS_B3SOIPD: return { DEVICE_T::PMOS, "B3SOIPD", "B3SOIPD (BSIM3 PD-SOI)" };
case TYPE::NMOS_B3SOIFD: return { DEVICE_T::NMOS, "B3SOIFD", "B3SOIFD (BSIM3 FD-SOI)" };
case TYPE::PMOS_B3SOIFD: return { DEVICE_T::PMOS, "B3SOIFD", "B3SOIFD (BSIM3 FD-SOI)" };
case TYPE::NMOS_B3SOIDD: return { DEVICE_T::NMOS, "B3SOIDD", "B3SOIDD (BSIM3 SOI)" };
case TYPE::PMOS_B3SOIDD: return { DEVICE_T::PMOS, "B3SOIDD", "B3SOIDD (BSIM3 SOI)" };
case TYPE::NMOS_B3SOIPD: return { DEVICE_T::NMOS, "B3SOIPD", "B3SOIPD (BSIM3 PD-SOI)" };
case TYPE::PMOS_B3SOIPD: return { DEVICE_T::PMOS, "B3SOIPD", "B3SOIPD (BSIM3 PD-SOI)" };
//case TYPE::NMOS_STAG: return {};
//case TYPE::PMOS_STAG: return {};
case TYPE::NMOS_HISIM2: return { DEVICE_T::NMOS, "HISIM2", "HiSIM2" };
case TYPE::PMOS_HISIM2: return { DEVICE_T::PMOS, "HISIM2", "HiSIM2" };
case TYPE::NMOS_HISIMHV1: return { DEVICE_T::NMOS, "HISIMHV1", "HiSIM_HV1" };
case TYPE::PMOS_HISIMHV1: return { DEVICE_T::PMOS, "HISIMHV1", "HiSIM_HV1" };
case TYPE::NMOS_HISIMHV2: return { DEVICE_T::NMOS, "HISIMHV2", "HiSIM_HV2" };
case TYPE::PMOS_HISIMHV2: return { DEVICE_T::PMOS, "HISIMHV2", "HiSIM_HV2" };
case TYPE::NMOS_HISIM2: return { DEVICE_T::NMOS, "HISIM2", "HiSIM2" };
case TYPE::PMOS_HISIM2: return { DEVICE_T::PMOS, "HISIM2", "HiSIM2" };
case TYPE::NMOS_HISIMHV1: return { DEVICE_T::NMOS, "HISIMHV1", "HiSIM_HV1" };
case TYPE::PMOS_HISIMHV1: return { DEVICE_T::PMOS, "HISIMHV1", "HiSIM_HV1" };
case TYPE::NMOS_HISIMHV2: return { DEVICE_T::NMOS, "HISIMHV2", "HiSIM_HV2" };
case TYPE::PMOS_HISIMHV2: return { DEVICE_T::PMOS, "HISIMHV2", "HiSIM_HV2" };
case TYPE::V: return { DEVICE_T::V, "DC", "DC", };
case TYPE::V_SIN: return { DEVICE_T::V, "SIN", "Sine" };
case TYPE::V_PULSE: return { DEVICE_T::V, "PULSE", "Pulse" };
case TYPE::V_EXP: return { DEVICE_T::V, "EXP", "Exponential" };
case TYPE::V_AM: return { DEVICE_T::V, "AM", "Amplitude modulated" };
case TYPE::V_SFFM: return { DEVICE_T::V, "SFFM", "Single-frequency FM" };
case TYPE::V_VCL: return { DEVICE_T::E, "", "Voltage-controlled" };
case TYPE::V_CCL: return { DEVICE_T::H, "", "Current-controlled" };
case TYPE::V_PWL: return { DEVICE_T::V, "PWL", "Piecewise linear" };
case TYPE::V_WHITENOISE: return { DEVICE_T::V, "WHITENOISE", "White noise" };
case TYPE::V_PINKNOISE: return { DEVICE_T::V, "PINKNOISE", "Pink noise (1/f)" };
case TYPE::V_BURSTNOISE: return { DEVICE_T::V, "BURSTNOISE", "Burst noise" };
case TYPE::V_RANDUNIFORM: return { DEVICE_T::V, "RANDUNIFORM", "Random uniform" };
case TYPE::V_RANDGAUSSIAN: return { DEVICE_T::V, "RANDGAUSSIAN", "Random Gaussian" };
case TYPE::V_RANDEXP: return { DEVICE_T::V, "RANDEXP", "Random exponential" };
case TYPE::V_RANDPOISSON: return { DEVICE_T::V, "RANDPOISSON", "Random Poisson" };
case TYPE::V_BEHAVIORAL: return { DEVICE_T::V, "=", "Behavioral" };
case TYPE::V: return { DEVICE_T::V, "DC", "DC", };
case TYPE::V_SIN: return { DEVICE_T::V, "SIN", "Sine" };
case TYPE::V_PULSE: return { DEVICE_T::V, "PULSE", "Pulse" };
case TYPE::V_EXP: return { DEVICE_T::V, "EXP", "Exponential" };
case TYPE::V_AM: return { DEVICE_T::V, "AM", "Amplitude modulated" };
case TYPE::V_SFFM: return { DEVICE_T::V, "SFFM", "Single-frequency FM" };
case TYPE::V_VCL: return { DEVICE_T::E, "", "Voltage-controlled" };
case TYPE::V_CCL: return { DEVICE_T::H, "", "Current-controlled" };
case TYPE::V_PWL: return { DEVICE_T::V, "PWL", "Piecewise linear" };
case TYPE::V_WHITENOISE: return { DEVICE_T::V, "WHITENOISE", "White noise" };
case TYPE::V_PINKNOISE: return { DEVICE_T::V, "PINKNOISE", "Pink noise (1/f)" };
case TYPE::V_BURSTNOISE: return { DEVICE_T::V, "BURSTNOISE", "Burst noise" };
case TYPE::V_RANDUNIFORM: return { DEVICE_T::V, "RANDUNIFORM", "Random uniform" };
case TYPE::V_RANDGAUSSIAN: return { DEVICE_T::V, "RANDGAUSSIAN", "Random Gaussian" };
case TYPE::V_RANDEXP: return { DEVICE_T::V, "RANDEXP", "Random exponential" };
case TYPE::V_RANDPOISSON: return { DEVICE_T::V, "RANDPOISSON", "Random Poisson" };
case TYPE::V_BEHAVIORAL: return { DEVICE_T::V, "=", "Behavioral" };
case TYPE::I: return { DEVICE_T::I, "DC", "DC", };
case TYPE::I_SIN: return { DEVICE_T::I, "SIN", "Sine" };
case TYPE::I_PULSE: return { DEVICE_T::I, "PULSE", "Pulse" };
case TYPE::I_EXP: return { DEVICE_T::I, "EXP", "Exponential" };
case TYPE::I_AM: return { DEVICE_T::I, "AM", "Amplitude modulated" };
case TYPE::I_SFFM: return { DEVICE_T::I, "SFFM", "Single-frequency FM" };
case TYPE::I_VCL: return { DEVICE_T::G, "", "Voltage-controlled" };
case TYPE::I_CCL: return { DEVICE_T::F, "", "Current-controlled" };
case TYPE::I_PWL: return { DEVICE_T::I, "PWL", "Piecewise linear" };
case TYPE::I_WHITENOISE: return { DEVICE_T::I, "WHITENOISE", "White noise" };
case TYPE::I_PINKNOISE: return { DEVICE_T::I, "PINKNOISE", "Pink noise (1/f)" };
case TYPE::I_BURSTNOISE: return { DEVICE_T::I, "BURSTNOISE", "Burst noise" };
case TYPE::I_RANDUNIFORM: return { DEVICE_T::I, "RANDUNIFORM", "Random uniform" };
case TYPE::I_RANDGAUSSIAN: return { DEVICE_T::I, "RANDGAUSSIAN", "Random Gaussian" };
case TYPE::I_RANDEXP: return { DEVICE_T::I, "RANDEXP", "Random exponential" };
case TYPE::I_RANDPOISSON: return { DEVICE_T::I, "RANDPOISSON", "Random Poisson" };
case TYPE::I_BEHAVIORAL: return { DEVICE_T::I, "=", "Behavioral" };
case TYPE::I: return { DEVICE_T::I, "DC", "DC", };
case TYPE::I_SIN: return { DEVICE_T::I, "SIN", "Sine" };
case TYPE::I_PULSE: return { DEVICE_T::I, "PULSE", "Pulse" };
case TYPE::I_EXP: return { DEVICE_T::I, "EXP", "Exponential" };
case TYPE::I_AM: return { DEVICE_T::I, "AM", "Amplitude modulated" };
case TYPE::I_SFFM: return { DEVICE_T::I, "SFFM", "Single-frequency FM" };
case TYPE::I_VCL: return { DEVICE_T::G, "", "Voltage-controlled" };
case TYPE::I_CCL: return { DEVICE_T::F, "", "Current-controlled" };
case TYPE::I_PWL: return { DEVICE_T::I, "PWL", "Piecewise linear" };
case TYPE::I_WHITENOISE: return { DEVICE_T::I, "WHITENOISE", "White noise" };
case TYPE::I_PINKNOISE: return { DEVICE_T::I, "PINKNOISE", "Pink noise (1/f)" };
case TYPE::I_BURSTNOISE: return { DEVICE_T::I, "BURSTNOISE", "Burst noise" };
case TYPE::I_RANDUNIFORM: return { DEVICE_T::I, "RANDUNIFORM", "Random uniform" };
case TYPE::I_RANDGAUSSIAN: return { DEVICE_T::I, "RANDGAUSSIAN", "Random Gaussian" };
case TYPE::I_RANDEXP: return { DEVICE_T::I, "RANDEXP", "Random exponential" };
case TYPE::I_RANDPOISSON: return { DEVICE_T::I, "RANDPOISSON", "Random Poisson" };
case TYPE::I_BEHAVIORAL: return { DEVICE_T::I, "=", "Behavioral" };
case TYPE::SUBCKT: return { DEVICE_T::SUBCKT, "", "Subcircuit" };
case TYPE::XSPICE: return { DEVICE_T::XSPICE, "", "" };
case TYPE::SUBCKT: return { DEVICE_T::SUBCKT, "", "Subcircuit" };
case TYPE::XSPICE: return { DEVICE_T::XSPICE, "", "" };
case TYPE::KIBIS_DEVICE: return { DEVICE_T::KIBIS, "DEVICE", "Device" };
case TYPE::KIBIS_DRIVER_DC: return { DEVICE_T::KIBIS, "DCDRIVER", "DC driver" };
case TYPE::KIBIS_DRIVER_RECT: return { DEVICE_T::KIBIS, "RECTDRIVER", "Rectangular wave driver" };
case TYPE::KIBIS_DRIVER_PRBS: return { DEVICE_T::KIBIS, "PRBSDRIVER", "PRBS driver" };
case TYPE::KIBIS_DEVICE: return { DEVICE_T::KIBIS, "DEVICE", "Device" };
case TYPE::KIBIS_DRIVER_DC: return { DEVICE_T::KIBIS, "DCDRIVER", "DC driver" };
case TYPE::KIBIS_DRIVER_RECT: return { DEVICE_T::KIBIS, "RECTDRIVER", "Rectangular wave driver" };
case TYPE::KIBIS_DRIVER_PRBS: return { DEVICE_T::KIBIS, "PRBSDRIVER", "PRBS driver" };
case TYPE::RAWSPICE: return { DEVICE_T::SPICE, "", "" };
case TYPE::RAWSPICE: return { DEVICE_T::SPICE, "", "" };
default: wxFAIL; return {};
}
@ -238,131 +246,134 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType )
{
switch( aType )
{
case TYPE::R: return { "R", "" };
case TYPE::R_POT: return { "A", "" };
case TYPE::R_BEHAVIORAL: return { "R", "", "", "0", false, true };
// | itemType | modelType | fnName | level |isDefaultLvl|hasExpr|version|
// -------------------------------------------------------------------------
case TYPE::R: return { "R", "" };
case TYPE::R_POT: return { "A", "" };
case TYPE::R_BEHAVIORAL: return { "R", "", "", "0", false, true };
case TYPE::C: return { "C", "" };
case TYPE::C_BEHAVIORAL: return { "C", "", "", "0", false, true };
case TYPE::C: return { "C", "" };
case TYPE::C_BEHAVIORAL: return { "C", "", "", "0", false, true };
case TYPE::L: return { "L", "" };
case TYPE::L_MUTUAL: return { "K", "" };
case TYPE::L_BEHAVIORAL: return { "L", "", "", "0", false, true };
case TYPE::L: return { "L", "" };
case TYPE::L_BEHAVIORAL: return { "L", "", "", "0", false, true };
//case TYPE::TLINE_Z0: return { "T" };
case TYPE::TLINE_Z0: return { "O", "LTRA" };
case TYPE::TLINE_RLGC: return { "O", "LTRA" };
case TYPE::K: return { "K", "" };
case TYPE::SW_V: return { "S", "SW" };
case TYPE::SW_I: return { "W", "CSW" };
//case TYPE::TLINE_Z0: return { "T" };
case TYPE::TLINE_Z0: return { "O", "LTRA" };
case TYPE::TLINE_RLGC: return { "O", "LTRA" };
case TYPE::D: return { "D", "D" };
case TYPE::SW_V: return { "S", "SW" };
case TYPE::SW_I: return { "W", "CSW" };
case TYPE::NPN_VBIC: return { "Q", "NPN", "", "4" };
case TYPE::PNP_VBIC: return { "Q", "PNP", "", "4" };
case TYPE::NPN_GUMMELPOON: return { "Q", "NPN", "", "1", true };
case TYPE::PNP_GUMMELPOON: return { "Q", "PNP", "", "1", true };
case TYPE::NPN_HICUM2: return { "Q", "NPN", "", "8" };
case TYPE::PNP_HICUM2: return { "Q", "PNP", "", "8" };
case TYPE::D: return { "D", "D" };
case TYPE::NJFET_SHICHMANHODGES: return { "J", "NJF", "", "1", true };
case TYPE::PJFET_SHICHMANHODGES: return { "J", "PJF", "", "1", true };
case TYPE::NJFET_PARKERSKELLERN: return { "J", "NJF", "", "2" };
case TYPE::PJFET_PARKERSKELLERN: return { "J", "PJF", "", "2" };
case TYPE::NPN_VBIC: return { "Q", "NPN", "", "4" };
case TYPE::PNP_VBIC: return { "Q", "PNP", "", "4" };
case TYPE::NPN_GUMMELPOON: return { "Q", "NPN", "", "1", true };
case TYPE::PNP_GUMMELPOON: return { "Q", "PNP", "", "1", true };
case TYPE::NPN_HICUM2: return { "Q", "NPN", "", "8" };
case TYPE::PNP_HICUM2: return { "Q", "PNP", "", "8" };
case TYPE::NMES_STATZ: return { "Z", "NMF", "", "1", true };
case TYPE::PMES_STATZ: return { "Z", "PMF", "", "1", true };
case TYPE::NMES_YTTERDAL: return { "Z", "NMF", "", "2" };
case TYPE::PMES_YTTERDAL: return { "Z", "PMF", "", "2" };
case TYPE::NMES_HFET1: return { "Z", "NMF", "", "5" };
case TYPE::PMES_HFET1: return { "Z", "PMF", "", "5" };
case TYPE::NMES_HFET2: return { "Z", "NMF", "", "6" };
case TYPE::PMES_HFET2: return { "Z", "PMF", "", "6" };
case TYPE::NJFET_SHICHMANHODGES: return { "J", "NJF", "", "1", true };
case TYPE::PJFET_SHICHMANHODGES: return { "J", "PJF", "", "1", true };
case TYPE::NJFET_PARKERSKELLERN: return { "J", "NJF", "", "2" };
case TYPE::PJFET_PARKERSKELLERN: return { "J", "PJF", "", "2" };
case TYPE::NMOS_VDMOS: return { "M", "VDMOS NCHAN", };
case TYPE::PMOS_VDMOS: return { "M", "VDMOS PCHAN", };
case TYPE::NMOS_MOS1: return { "M", "NMOS", "", "1", true };
case TYPE::PMOS_MOS1: return { "M", "PMOS", "", "1", true };
case TYPE::NMOS_MOS2: return { "M", "NMOS", "", "2" };
case TYPE::PMOS_MOS2: return { "M", "PMOS", "", "2" };
case TYPE::NMOS_MOS3: return { "M", "NMOS", "", "3" };
case TYPE::PMOS_MOS3: return { "M", "PMOS", "", "3" };
case TYPE::NMOS_BSIM1: return { "M", "NMOS", "", "4" };
case TYPE::PMOS_BSIM1: return { "M", "PMOS", "", "4" };
case TYPE::NMOS_BSIM2: return { "M", "NMOS", "", "5" };
case TYPE::PMOS_BSIM2: return { "M", "PMOS", "", "5" };
case TYPE::NMOS_MOS6: return { "M", "NMOS", "", "6" };
case TYPE::PMOS_MOS6: return { "M", "PMOS", "", "6" };
case TYPE::NMOS_BSIM3: return { "M", "NMOS", "", "8" };
case TYPE::PMOS_BSIM3: return { "M", "PMOS", "", "8" };
case TYPE::NMOS_MOS9: return { "M", "NMOS", "", "9" };
case TYPE::PMOS_MOS9: return { "M", "PMOS", "", "9" };
case TYPE::NMOS_B4SOI: return { "M", "NMOS", "", "10" };
case TYPE::PMOS_B4SOI: return { "M", "PMOS", "", "10" };
case TYPE::NMOS_BSIM4: return { "M", "NMOS", "", "14" };
case TYPE::PMOS_BSIM4: return { "M", "PMOS", "", "14" };
case TYPE::NMES_STATZ: return { "Z", "NMF", "", "1", true };
case TYPE::PMES_STATZ: return { "Z", "PMF", "", "1", true };
case TYPE::NMES_YTTERDAL: return { "Z", "NMF", "", "2" };
case TYPE::PMES_YTTERDAL: return { "Z", "PMF", "", "2" };
case TYPE::NMES_HFET1: return { "Z", "NMF", "", "5" };
case TYPE::PMES_HFET1: return { "Z", "PMF", "", "5" };
case TYPE::NMES_HFET2: return { "Z", "NMF", "", "6" };
case TYPE::PMES_HFET2: return { "Z", "PMF", "", "6" };
case TYPE::NMOS_VDMOS: return { "M", "VDMOS NCHAN" };
case TYPE::PMOS_VDMOS: return { "M", "VDMOS PCHAN" };
case TYPE::NMOS_MOS1: return { "M", "NMOS", "", "1", true };
case TYPE::PMOS_MOS1: return { "M", "PMOS", "", "1", true };
case TYPE::NMOS_MOS2: return { "M", "NMOS", "", "2" };
case TYPE::PMOS_MOS2: return { "M", "PMOS", "", "2" };
case TYPE::NMOS_MOS3: return { "M", "NMOS", "", "3" };
case TYPE::PMOS_MOS3: return { "M", "PMOS", "", "3" };
case TYPE::NMOS_BSIM1: return { "M", "NMOS", "", "4" };
case TYPE::PMOS_BSIM1: return { "M", "PMOS", "", "4" };
case TYPE::NMOS_BSIM2: return { "M", "NMOS", "", "5" };
case TYPE::PMOS_BSIM2: return { "M", "PMOS", "", "5" };
case TYPE::NMOS_MOS6: return { "M", "NMOS", "", "6" };
case TYPE::PMOS_MOS6: return { "M", "PMOS", "", "6" };
case TYPE::NMOS_BSIM3: return { "M", "NMOS", "", "8" };
case TYPE::PMOS_BSIM3: return { "M", "PMOS", "", "8" };
case TYPE::NMOS_MOS9: return { "M", "NMOS", "", "9" };
case TYPE::PMOS_MOS9: return { "M", "PMOS", "", "9" };
case TYPE::NMOS_B4SOI: return { "M", "NMOS", "", "10" };
case TYPE::PMOS_B4SOI: return { "M", "PMOS", "", "10" };
case TYPE::NMOS_BSIM4: return { "M", "NMOS", "", "14" };
case TYPE::PMOS_BSIM4: return { "M", "PMOS", "", "14" };
//case TYPE::NMOS_EKV2_6: return {};
//case TYPE::PMOS_EKV2_6: return {};
//case TYPE::NMOS_PSP: return {};
//case TYPE::PMOS_PSP: return {};
case TYPE::NMOS_B3SOIFD: return { "M", "NMOS", "", "55" };
case TYPE::PMOS_B3SOIFD: return { "M", "PMOS", "", "55" };
case TYPE::NMOS_B3SOIDD: return { "M", "NMOS", "", "56" };
case TYPE::PMOS_B3SOIDD: return { "M", "PMOS", "", "56" };
case TYPE::NMOS_B3SOIPD: return { "M", "NMOS", "", "57" };
case TYPE::PMOS_B3SOIPD: return { "M", "PMOS", "", "57" };
case TYPE::NMOS_B3SOIFD: return { "M", "NMOS", "", "55" };
case TYPE::PMOS_B3SOIFD: return { "M", "PMOS", "", "55" };
case TYPE::NMOS_B3SOIDD: return { "M", "NMOS", "", "56" };
case TYPE::PMOS_B3SOIDD: return { "M", "PMOS", "", "56" };
case TYPE::NMOS_B3SOIPD: return { "M", "NMOS", "", "57" };
case TYPE::PMOS_B3SOIPD: return { "M", "PMOS", "", "57" };
//case TYPE::NMOS_STAG: return {};
//case TYPE::PMOS_STAG: return {};
case TYPE::NMOS_HISIM2: return { "M", "NMOS", "", "68" };
case TYPE::PMOS_HISIM2: return { "M", "PMOS", "", "68" };
case TYPE::NMOS_HISIMHV1: return { "M", "NMOS", "", "73", false, false, "1.2.4" };
case TYPE::PMOS_HISIMHV1: return { "M", "PMOS", "", "73", false, false, "1.2.4" };
case TYPE::NMOS_HISIMHV2: return { "M", "NMOS", "", "73", false, false, "2.2.0" };
case TYPE::PMOS_HISIMHV2: return { "M", "PMOS", "", "73", false, false, "2.2.0" };
case TYPE::NMOS_HISIM2: return { "M", "NMOS", "", "68" };
case TYPE::PMOS_HISIM2: return { "M", "PMOS", "", "68" };
case TYPE::NMOS_HISIMHV1: return { "M", "NMOS", "", "73", false, false, "1.2.4" };
case TYPE::PMOS_HISIMHV1: return { "M", "PMOS", "", "73", false, false, "1.2.4" };
case TYPE::NMOS_HISIMHV2: return { "M", "NMOS", "", "73", false, false, "2.2.0" };
case TYPE::PMOS_HISIMHV2: return { "M", "PMOS", "", "73", false, false, "2.2.0" };
case TYPE::V: return { "V", "", "DC" };
case TYPE::V_SIN: return { "V", "", "SIN" };
case TYPE::V_PULSE: return { "V", "", "PULSE" };
case TYPE::V_EXP: return { "V", "", "EXP" };
case TYPE::V_AM: return { "V", "", "AM" };
case TYPE::V_SFFM: return { "V", "", "SFFM" };
case TYPE::V_VCL: return { "E", "", "" };
case TYPE::V_CCL: return { "H", "", "" };
case TYPE::V_PWL: return { "V", "", "PWL" };
case TYPE::V_WHITENOISE: return { "V", "", "TRNOISE" };
case TYPE::V_PINKNOISE: return { "V", "", "TRNOISE" };
case TYPE::V_BURSTNOISE: return { "V", "", "TRNOISE" };
case TYPE::V_RANDUNIFORM: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDGAUSSIAN: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDEXP: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDPOISSON: return { "V", "", "TRRANDOM" };
case TYPE::V_BEHAVIORAL: return { "B" };
case TYPE::V: return { "V", "", "DC" };
case TYPE::V_SIN: return { "V", "", "SIN" };
case TYPE::V_PULSE: return { "V", "", "PULSE" };
case TYPE::V_EXP: return { "V", "", "EXP" };
case TYPE::V_AM: return { "V", "", "AM" };
case TYPE::V_SFFM: return { "V", "", "SFFM" };
case TYPE::V_VCL: return { "E", "", "" };
case TYPE::V_CCL: return { "H", "", "" };
case TYPE::V_PWL: return { "V", "", "PWL" };
case TYPE::V_WHITENOISE: return { "V", "", "TRNOISE" };
case TYPE::V_PINKNOISE: return { "V", "", "TRNOISE" };
case TYPE::V_BURSTNOISE: return { "V", "", "TRNOISE" };
case TYPE::V_RANDUNIFORM: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDGAUSSIAN: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDEXP: return { "V", "", "TRRANDOM" };
case TYPE::V_RANDPOISSON: return { "V", "", "TRRANDOM" };
case TYPE::V_BEHAVIORAL: return { "B" };
case TYPE::I: return { "I", "", "DC" };
case TYPE::I_PULSE: return { "I", "", "PULSE" };
case TYPE::I_SIN: return { "I", "", "SIN" };
case TYPE::I_EXP: return { "I", "", "EXP" };
case TYPE::I_AM: return { "V", "", "AM" };
case TYPE::I_SFFM: return { "V", "", "SFFM" };
case TYPE::I_VCL: return { "G", "", "" };
case TYPE::I_CCL: return { "F", "", "" };
case TYPE::I_PWL: return { "I", "", "PWL" };
case TYPE::I_WHITENOISE: return { "I", "", "TRNOISE" };
case TYPE::I_PINKNOISE: return { "I", "", "TRNOISE" };
case TYPE::I_BURSTNOISE: return { "I", "", "TRNOISE" };
case TYPE::I_RANDUNIFORM: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDGAUSSIAN: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDEXP: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDPOISSON: return { "I", "", "TRRANDOM" };
case TYPE::I_BEHAVIORAL: return { "B" };
case TYPE::I: return { "I", "", "DC" };
case TYPE::I_PULSE: return { "I", "", "PULSE" };
case TYPE::I_SIN: return { "I", "", "SIN" };
case TYPE::I_EXP: return { "I", "", "EXP" };
case TYPE::I_AM: return { "V", "", "AM" };
case TYPE::I_SFFM: return { "V", "", "SFFM" };
case TYPE::I_VCL: return { "G", "", "" };
case TYPE::I_CCL: return { "F", "", "" };
case TYPE::I_PWL: return { "I", "", "PWL" };
case TYPE::I_WHITENOISE: return { "I", "", "TRNOISE" };
case TYPE::I_PINKNOISE: return { "I", "", "TRNOISE" };
case TYPE::I_BURSTNOISE: return { "I", "", "TRNOISE" };
case TYPE::I_RANDUNIFORM: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDGAUSSIAN: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDEXP: return { "I", "", "TRRANDOM" };
case TYPE::I_RANDPOISSON: return { "I", "", "TRRANDOM" };
case TYPE::I_BEHAVIORAL: return { "B" };
case TYPE::SUBCKT: return { "X" };
case TYPE::XSPICE: return { "A" };
case TYPE::SUBCKT: return { "X" };
case TYPE::XSPICE: return { "A" };
case TYPE::KIBIS_DEVICE: return { "X" };
case TYPE::KIBIS_DRIVER_DC: return { "X" };
case TYPE::KIBIS_DRIVER_RECT: return { "X" };
case TYPE::KIBIS_DRIVER_PRBS: return { "X" };
case TYPE::KIBIS_DEVICE: return { "X" };
case TYPE::KIBIS_DRIVER_DC: return { "X" };
case TYPE::KIBIS_DRIVER_RECT: return { "X" };
case TYPE::KIBIS_DRIVER_PRBS: return { "X" };
case TYPE::NONE:
case TYPE::RAWSPICE: return {};
@ -380,8 +391,8 @@ template TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<LIB_FIELD>& aFiel
template <typename T>
TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<T>& aFields, REPORTER& aReporter )
{
std::string deviceTypeFieldValue = GetFieldValue( &aFields, SIM_DEVICE_TYPE_FIELD );
std::string typeFieldValue = GetFieldValue( &aFields, SIM_TYPE_FIELD );
std::string deviceTypeFieldValue = GetFieldValue( &aFields, SIM_DEVICE_FIELD );
std::string typeFieldValue = GetFieldValue( &aFields, SIM_DEVICE_SUBTYPE_FIELD );
if( deviceTypeFieldValue != "" )
{
@ -887,7 +898,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType )
case TYPE::R_POT:
return std::make_unique<SIM_MODEL_R_POT>();
case TYPE::L_MUTUAL:
case TYPE::K:
return std::make_unique<SIM_MODEL_L_MUTUAL>();
case TYPE::R_BEHAVIORAL:
@ -1028,7 +1039,7 @@ void SIM_MODEL::doReadDataFields( const std::vector<T>* aFields,
bool diffMode = GetFieldValue( aFields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1";
SwitchSingleEndedDiff( diffMode );
m_serializer->ParseEnable( GetFieldValue( aFields, SIM_ENABLE_FIELD ) );
m_serializer->ParseEnable( GetFieldValue( aFields, SIM_LEGACY_ENABLE_FIELD_V7 ) );
createPins( aPins );
m_serializer->ParsePins( GetFieldValue( aFields, SIM_PINS_FIELD ) );
@ -1061,10 +1072,10 @@ void SIM_MODEL::doWriteFields( std::vector<T>& aFields ) const
aFields.erase( aFields.begin() + ii );
}
SetFieldValue( aFields, SIM_DEVICE_TYPE_FIELD, m_serializer->GenerateDevice() );
SetFieldValue( aFields, SIM_TYPE_FIELD, m_serializer->GenerateType() );
SetFieldValue( aFields, SIM_DEVICE_FIELD, m_serializer->GenerateDevice() );
SetFieldValue( aFields, SIM_DEVICE_SUBTYPE_FIELD, m_serializer->GenerateDeviceSubtype() );
SetFieldValue( aFields, SIM_ENABLE_FIELD, m_serializer->GenerateEnable() );
SetFieldValue( aFields, SIM_LEGACY_ENABLE_FIELD_V7, m_serializer->GenerateEnable() );
SetFieldValue( aFields, SIM_PINS_FIELD, m_serializer->GeneratePins() );
SetFieldValue( aFields, SIM_PARAMS_FIELD, m_serializer->GenerateParams() );
@ -1304,8 +1315,8 @@ bool SIM_MODEL::InferSimModel( T_symbol& aSymbol, std::vector<T_field>* aFields,
wxString value = GetFieldValue( aFields, SIM_VALUE_FIELD, aResolve );
std::vector<LIB_PIN*> pins = aSymbol.GetAllLibPins();
*aDeviceType = GetFieldValue( aFields, SIM_DEVICE_TYPE_FIELD, aResolve );
*aModelType = GetFieldValue( aFields, SIM_TYPE_FIELD, aResolve );
*aDeviceType = GetFieldValue( aFields, SIM_DEVICE_FIELD, aResolve );
*aModelType = GetFieldValue( aFields, SIM_DEVICE_SUBTYPE_FIELD, aResolve );
*aModelParams = GetFieldValue( aFields, SIM_PARAMS_FIELD, aResolve );
*aPinMap = GetFieldValue( aFields, SIM_PINS_FIELD, aResolve );
@ -1475,18 +1486,18 @@ template bool SIM_MODEL::InferSimModel<LIB_SYMBOL, LIB_FIELD>( LIB_SYMBOL& aSymb
template <typename T_symbol, typename T_field>
void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
{
T_field* existing_deviceTypeField = aSymbol.FindField( SIM_DEVICE_TYPE_FIELD );
T_field* existing_typeField = aSymbol.FindField( SIM_TYPE_FIELD );
T_field* existing_deviceField = aSymbol.FindField( SIM_DEVICE_FIELD );
T_field* existing_deviceSubtypeField = aSymbol.FindField( SIM_DEVICE_SUBTYPE_FIELD );
T_field* existing_pinsField = aSymbol.FindField( SIM_PINS_FIELD );
T_field* existing_paramsField = aSymbol.FindField( SIM_PARAMS_FIELD );
wxString existing_type;
wxString existing_deviceSubtype;
if( existing_typeField )
existing_type = existing_typeField->GetShownText( false ).Upper();
if( existing_deviceSubtypeField )
existing_deviceSubtype = existing_deviceSubtypeField->GetShownText( false ).Upper();
if( existing_deviceTypeField
|| existing_typeField
if( existing_deviceField
|| existing_deviceSubtypeField
|| existing_pinsField
|| existing_paramsField )
{
@ -1494,7 +1505,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
// Up until 7.0RC2 we used '+' and '-' for potentiometer pins, which doesn't match
// SPICE. Here we remap them to 'r0' and 'r1'.
if( existing_type == wxS( "POT" ) )
if( existing_deviceSubtype == wxS( "POT" ) )
{
if( existing_pinsField )
{
@ -1506,14 +1517,14 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
}
// Up until 8.0RC1 random voltage/current sources were a bit of a mess.
if( existing_type.StartsWith( wxS( "RAND" ) ) )
if( existing_deviceSubtype.StartsWith( wxS( "RAND" ) ) )
{
// Re-fetch value without resolving references. If it's an indirect value then we
// can't migrate it.
existing_type = existing_typeField->GetText().Upper();
existing_deviceSubtype = existing_deviceSubtypeField->GetText().Upper();
if( existing_type.Replace( wxS( "NORMAL" ), wxS( "GAUSSIAN" ) ) )
existing_typeField->SetText( existing_type );
if( existing_deviceSubtype.Replace( wxS( "NORMAL" ), wxS( "GAUSSIAN" ) ) )
existing_deviceSubtypeField->SetText( existing_deviceSubtype );
if( existing_paramsField )
{
@ -1535,6 +1546,14 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
}
}
// Up until 8.0.1 we treated a mutual inductance statement as a type of inductor --
// which is confusing because it doesn't represent a device at all.
if( existing_deviceSubtype == wxS( "MUTUAL" ) )
{
aSymbol.RemoveField( existing_deviceSubtypeField );
existing_deviceField->SetText( "K" );
}
return;
}
@ -1619,23 +1638,23 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
} );
FIELD_INFO spiceDeviceInfo;
FIELD_INFO spiceModelInfo;
FIELD_INFO spiceTypeInfo;
FIELD_INFO spiceLibInfo;
FIELD_INFO deviceInfo;
FIELD_INFO modelInfo;
FIELD_INFO deviceSubtypeInfo;
FIELD_INFO libInfo;
FIELD_INFO spiceParamsInfo;
FIELD_INFO pinMapInfo;
bool modelFromValueField = false;
if( aSymbol.FindField( SIM_LEGACY_DEVICE_TYPE_FIELD )
if( aSymbol.FindField( SIM_LEGACY_PRIMITIVE_FIELD )
|| aSymbol.FindField( SIM_LEGACY_PINS_FIELD )
|| aSymbol.FindField( SIM_LEGACY_TYPE_FIELD )
|| aSymbol.FindField( SIM_LEGACY_MODEL_FIELD )
|| aSymbol.FindField( SIM_LEGACY_ENABLE_FIELD )
|| aSymbol.FindField( SIM_LEGACY_LIBRARY_FIELD ) )
{
if( T_field* primitiveField = aSymbol.FindField( SIM_LEGACY_DEVICE_TYPE_FIELD ) )
if( T_field* primitiveField = aSymbol.FindField( SIM_LEGACY_PRIMITIVE_FIELD ) )
{
spiceDeviceInfo = FIELD_INFO( primitiveField->GetText(), primitiveField );
deviceInfo = FIELD_INFO( primitiveField->GetText(), primitiveField );
aSymbol.RemoveField( primitiveField );
}
@ -1665,20 +1684,20 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
aSymbol.RemoveField( nodeSequenceField );
}
if( T_field* modelField = aSymbol.FindField( SIM_LEGACY_TYPE_FIELD ) )
if( T_field* modelField = aSymbol.FindField( SIM_LEGACY_MODEL_FIELD ) )
{
spiceModelInfo = FIELD_INFO( getSIValue( modelField ), modelField );
modelInfo = FIELD_INFO( getSIValue( modelField ), modelField );
aSymbol.RemoveField( modelField );
}
else if( valueField )
{
spiceModelInfo = FIELD_INFO( getSIValue( valueField ), valueField );
modelInfo = FIELD_INFO( getSIValue( valueField ), valueField );
modelFromValueField = true;
}
if( T_field* libFileField = aSymbol.FindField( SIM_LEGACY_LIBRARY_FIELD ) )
{
spiceLibInfo = FIELD_INFO( libFileField->GetText(), libFileField );
libInfo = FIELD_INFO( libFileField->GetText(), libFileField );
aSymbol.RemoveField( libFileField );
}
}
@ -1688,12 +1707,12 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
if( T_field* legacyType = aSymbol.FindField( wxT( "Sim_Type" ) ) )
{
legacyType->SetName( SIM_TYPE_FIELD );
legacyType->SetName( SIM_DEVICE_SUBTYPE_FIELD );
}
if( T_field* legacyDevice = aSymbol.FindField( wxT( "Sim_Device" ) ) )
{
legacyDevice->SetName( SIM_DEVICE_TYPE_FIELD );
legacyDevice->SetName( SIM_DEVICE_FIELD );
}
if( T_field* legacyPins = aSymbol.FindField( wxT( "Sim_Pins" ) ) )
@ -1748,16 +1767,16 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
return;
}
wxString spiceDeviceType = spiceDeviceInfo.m_Text.Trim( true ).Trim( false );
wxString spiceLib = spiceLibInfo.m_Text.Trim( true ).Trim( false );
wxString spiceModel = spiceModelInfo.m_Text.Trim( true ).Trim( false );
wxString device = deviceInfo.m_Text.Trim( true ).Trim( false );
wxString lib = libInfo.m_Text.Trim( true ).Trim( false );
wxString model = modelInfo.m_Text.Trim( true ).Trim( false );
wxString modelLineParams;
bool libraryModel = false;
bool inferredModel = false;
bool internalModel = false;
if( !spiceLib.IsEmpty() )
if( !lib.IsEmpty() )
{
wxString msg;
WX_STRING_REPORTER reporter( &msg );
@ -1765,11 +1784,11 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
std::vector<T_field> emptyFields;
// Pull out any following parameters from model name
spiceModel = spiceModel.BeforeFirst( ' ', &modelLineParams );
spiceModelInfo.m_Text = spiceModel;
model = model.BeforeFirst( ' ', &modelLineParams );
modelInfo.m_Text = model;
SIM_LIBRARY::MODEL model = libMgr.CreateModel( spiceLib, spiceModel.ToStdString(),
emptyFields, sourcePins, reporter );
SIM_LIBRARY::MODEL simModel = libMgr.CreateModel( lib, model.ToStdString(),
emptyFields, sourcePins, reporter );
if( reporter.HasMessage() )
libraryModel = false; // Fall back to raw spice model
@ -1780,44 +1799,44 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
{
// Try to generate a default pin map from the SIM_MODEL's pins; if that fails,
// generate one from the symbol's pins
pinMapInfo.m_Text = wxString( model.model.Serializer().GeneratePins() );
pinMapInfo.m_Text = wxString( simModel.model.Serializer().GeneratePins() );
if( pinMapInfo.IsEmpty() )
pinMapInfo.m_Text = generateDefaultPinMapFromSymbol( sourcePins );
}
}
else if( ( spiceDeviceType == wxS( "R" )
|| spiceDeviceType == wxS( "L" )
|| spiceDeviceType == wxS( "C" )
|| spiceDeviceType == wxS( "V" )
|| spiceDeviceType == wxS( "I" ) )
&& prefix.StartsWith( spiceDeviceType )
else if( ( device == wxS( "R" )
|| device == wxS( "L" )
|| device == wxS( "C" )
|| device == wxS( "V" )
|| device == wxS( "I" ) )
&& prefix.StartsWith( device )
&& modelFromValueField )
{
inferredModel = true;
}
else if( spiceDeviceType == wxS( "V" ) || spiceDeviceType == wxS( "I" ) )
else if( device == wxS( "V" ) || device == wxS( "I" ) )
{
// See if we have a SPICE time-dependent function such as "sin(0 1 60)" or "sin 0 1 60"
// that can be handled by a built-in SIM_MODEL_SOURCE.
wxStringTokenizer tokenizer( spiceModel, wxT( "() " ), wxTOKEN_STRTOK );
wxStringTokenizer tokenizer( model, wxT( "() " ), wxTOKEN_STRTOK );
if( tokenizer.HasMoreTokens() )
{
spiceTypeInfo.m_Text = tokenizer.GetNextToken();
spiceTypeInfo.m_Text.MakeUpper();
deviceSubtypeInfo.m_Text = tokenizer.GetNextToken();
deviceSubtypeInfo.m_Text.MakeUpper();
for( SIM_MODEL::TYPE type : SIM_MODEL::TYPE_ITERATOR() )
{
if( spiceDeviceType == SIM_MODEL::SpiceInfo( type ).itemType
&& spiceTypeInfo.m_Text == SIM_MODEL::SpiceInfo( type ).inlineTypeString )
if( device == SIM_MODEL::SpiceInfo( type ).itemType
&& deviceSubtypeInfo.m_Text == SIM_MODEL::SpiceInfo( type ).functionName )
{
try
{
std::unique_ptr<SIM_MODEL> model = SIM_MODEL::Create( type );
std::unique_ptr<SIM_MODEL> simModel = SIM_MODEL::Create( type );
if( spiceTypeInfo.m_Text == wxT( "DC" ) && tokenizer.CountTokens() == 1 )
if( deviceSubtypeInfo.m_Text == wxT( "DC" ) && tokenizer.CountTokens() == 1 )
{
wxCHECK( valueField, /* void */ );
valueField->SetText( tokenizer.GetNextToken() );
@ -1827,14 +1846,14 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
{
for( int ii = 0; tokenizer.HasMoreTokens(); ++ii )
{
model->SetParamValue( ii, tokenizer.GetNextToken().ToStdString(),
SIM_VALUE_GRAMMAR::NOTATION::SPICE );
simModel->SetParamValue( ii, tokenizer.GetNextToken().ToStdString(),
SIM_VALUE_GRAMMAR::NOTATION::SPICE );
}
spiceTypeInfo.m_Text = SIM_MODEL::TypeInfo( type ).fieldValue;
deviceSubtypeInfo.m_Text = SIM_MODEL::TypeInfo( type ).fieldValue;
spiceParamsInfo = spiceModelInfo;
spiceParamsInfo.m_Text = wxString( model->Serializer().GenerateParams() );
spiceParamsInfo = modelInfo;
spiceParamsInfo.m_Text = wxString( simModel->Serializer().GenerateParams() );
}
internalModel = true;
@ -1842,8 +1861,8 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
if( pinMapInfo.IsEmpty() )
{
// Generate a default pin map from the SIM_MODEL's pins
model->createPins( sourcePins );
pinMapInfo.m_Text = wxString( model->Serializer().GeneratePins() );
simModel->createPins( sourcePins );
pinMapInfo.m_Text = wxString( simModel->Serializer().GeneratePins() );
}
}
catch( ... )
@ -1859,15 +1878,15 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
if( libraryModel )
{
T_field libraryField = spiceLibInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD );
aSymbol.AddField( libraryField );
T_field libField = libInfo.CreateField( &aSymbol, SIM_LIBRARY_FIELD );
aSymbol.AddField( libField );
T_field nameField = spiceModelInfo.CreateField( &aSymbol, SIM_NAME_FIELD );
T_field nameField = modelInfo.CreateField( &aSymbol, SIM_NAME_FIELD );
aSymbol.AddField( nameField );
if( !modelLineParams.IsEmpty() )
{
spiceParamsInfo = spiceModelInfo;
spiceParamsInfo = modelInfo;
spiceParamsInfo.m_Pos.x += nameField.GetBoundingBox().GetWidth();
spiceParamsInfo.m_Text = modelLineParams;
@ -1896,11 +1915,14 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
}
else if( internalModel )
{
T_field deviceField = spiceDeviceInfo.CreateField( &aSymbol, SIM_DEVICE_TYPE_FIELD );
T_field deviceField = deviceInfo.CreateField( &aSymbol, SIM_DEVICE_FIELD );
aSymbol.AddField( deviceField );
T_field typeField = spiceTypeInfo.CreateField( &aSymbol, SIM_TYPE_FIELD );
aSymbol.AddField( typeField );
if( !deviceSubtypeInfo.m_Text.IsEmpty() )
{
T_field subtypeField = deviceSubtypeInfo.CreateField( &aSymbol, SIM_DEVICE_SUBTYPE_FIELD );
aSymbol.AddField( subtypeField );
}
if( !spiceParamsInfo.IsEmpty() )
{
@ -1913,19 +1935,19 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
}
else // Insert a raw spice model as a substitute.
{
if( spiceDeviceType.IsEmpty() && spiceLib.IsEmpty() )
if( device.IsEmpty() && lib.IsEmpty() )
{
spiceParamsInfo = spiceModelInfo;
spiceParamsInfo = modelInfo;
}
else
{
spiceParamsInfo.m_Text.Printf( wxT( "type=\"%s\" model=\"%s\" lib=\"%s\"" ),
spiceDeviceType, spiceModel, spiceLib );
spiceParamsInfo.m_Text.Printf( wxT( "type=\"%s\" model=\"%s\" lib=\"%s\"" ), device,
model, lib );
}
spiceDeviceInfo.m_Text = SIM_MODEL::DeviceInfo( SIM_MODEL::DEVICE_T::SPICE ).fieldValue;
deviceInfo.m_Text = SIM_MODEL::DeviceInfo( SIM_MODEL::DEVICE_T::SPICE ).fieldValue;
T_field deviceField = spiceDeviceInfo.CreateField( &aSymbol, SIM_DEVICE_TYPE_FIELD );
T_field deviceField = deviceInfo.CreateField( &aSymbol, SIM_DEVICE_FIELD );
aSymbol.AddField( deviceField );
T_field paramsField = spiceParamsInfo.CreateField( &aSymbol, SIM_PARAMS_FIELD );

View File

@ -49,21 +49,19 @@ class PROJECT;
#define SIM_REFERENCE_FIELD wxT( "Reference" )
#define SIM_VALUE_FIELD wxT( "Value" )
#define SIM_DEVICE_TYPE_FIELD wxT( "Sim.Device" )
#define SIM_TYPE_FIELD wxT( "Sim.Type" )
#define SIM_PINS_FIELD wxT( "Sim.Pins" )
#define SIM_PARAMS_FIELD wxT( "Sim.Params" )
// Note: this has been moved to an actual attribute and is no longer written
// out as a field
#define SIM_ENABLE_FIELD wxT( "Sim.Enable" )
#define SIM_LIBRARY_FIELD wxT( "Sim.Library" )
#define SIM_NAME_FIELD wxT( "Sim.Name" )
#define SIM_DEVICE_FIELD wxT( "Sim.Device" )
#define SIM_DEVICE_SUBTYPE_FIELD wxT( "Sim.Type" )
#define SIM_PINS_FIELD wxT( "Sim.Pins" )
#define SIM_PARAMS_FIELD wxT( "Sim.Params" )
#define SIM_LIBRARY_FIELD wxT( "Sim.Library" )
#define SIM_NAME_FIELD wxT( "Sim.Name" )
#define SIM_LEGACY_DEVICE_TYPE_FIELD wxS( "Spice_Primitive" )
#define SIM_LEGACY_TYPE_FIELD wxS( "Spice_Model" )
#define SIM_LEGACY_PINS_FIELD wxS( "Spice_Node_Sequence" )
#define SIM_LEGACY_ENABLE_FIELD wxS( "Spice_Netlist_Enabled" )
#define SIM_LEGACY_LIBRARY_FIELD wxS( "Spice_Lib_File" )
#define SIM_LEGACY_ENABLE_FIELD_V7 wxT( "Sim.Enable" )
#define SIM_LEGACY_PRIMITIVE_FIELD wxS( "Spice_Primitive" )
#define SIM_LEGACY_MODEL_FIELD wxS( "Spice_Model" )
#define SIM_LEGACY_PINS_FIELD wxS( "Spice_Node_Sequence" )
#define SIM_LEGACY_ENABLE_FIELD wxS( "Spice_Netlist_Enabled" )
#define SIM_LEGACY_LIBRARY_FIELD wxS( "Spice_Lib_File" )
class SIM_MODEL
@ -82,6 +80,7 @@ public:
R,
C,
L,
K,
TLINE,
SW,
@ -132,9 +131,10 @@ public:
C_BEHAVIORAL,
L,
L_MUTUAL,
L_BEHAVIORAL,
K,
TLINE_Z0,
TLINE_RLGC,
@ -294,7 +294,7 @@ public:
{
std::string itemType;
std::string modelType = "";
std::string inlineTypeString = "";
std::string functionName = "";
std::string level = "";
bool isDefaultLevel = false;
bool hasExpression = false;

View File

@ -37,8 +37,7 @@ std::string SPICE_GENERATOR_L_MUTUAL::ItemParams() const
SIM_MODEL_L_MUTUAL::SIM_MODEL_L_MUTUAL() :
SIM_MODEL( SIM_MODEL::TYPE::L_MUTUAL,
std::make_unique<SPICE_GENERATOR_L_MUTUAL>( *this ) )
SIM_MODEL( SIM_MODEL::TYPE::K, std::make_unique<SPICE_GENERATOR_L_MUTUAL>( *this ) )
{
static std::vector<PARAM::INFO> paramInfos = makeParamInfos();
@ -54,7 +53,7 @@ const std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_L_MUTUAL::makeParamInfos()
paramInfo.name = "l1";
paramInfo.type = SIM_VALUE::TYPE_STRING;
paramInfo.unit = "";
paramInfo.unit = "(Reference)";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Inductor 1";
@ -63,7 +62,7 @@ const std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_L_MUTUAL::makeParamInfos()
paramInfo.name = "l2";
paramInfo.type = SIM_VALUE::TYPE_STRING;
paramInfo.unit = "";
paramInfo.unit = "(Reference)";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Inductor 2";

View File

@ -59,7 +59,7 @@ std::string SIM_MODEL_SERIALIZER::GenerateDevice() const
}
std::string SIM_MODEL_SERIALIZER::GenerateType() const
std::string SIM_MODEL_SERIALIZER::GenerateDeviceSubtype() const
{
return m_model.GetTypeInfo().fieldValue;
}

View File

@ -126,7 +126,7 @@ public:
SIM_MODEL_SERIALIZER( SIM_MODEL& aModel ) : m_model( aModel ) {}
std::string GenerateDevice() const;
std::string GenerateType() const;
std::string GenerateDeviceSubtype() const;
std::string GenerateValue() const;
std::string GenerateParams() const;
std::string GeneratePins() const;

View File

@ -72,7 +72,7 @@ std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
item.modelName += fmt::format( "DC {} ", dc );
}
if( m_model.GetSpiceInfo().inlineTypeString != ""
if( m_model.GetSpiceInfo().functionName != ""
&& m_model.GetType() != SIM_MODEL::TYPE::V // DC-only sources are already processed
&& m_model.GetType() != SIM_MODEL::TYPE::I )
{
@ -187,7 +187,7 @@ std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
}
emptyLine = false;
item.modelName += fmt::format( "{}( {}) ", m_model.GetSpiceInfo().inlineTypeString, args );
item.modelName += fmt::format( "{}( {}) ", m_model.GetSpiceInfo().functionName, args );
}
else
{