Sim: Transmission line models

Implement transmission line models and perform some adjustments to
the current models. Add some QA tests.
This commit is contained in:
Mikolaj Wielgus 2022-05-31 04:55:48 +02:00
parent fe38c622a9
commit 6984f63af8
46 changed files with 6538 additions and 2712 deletions

View File

@ -331,6 +331,7 @@ if( KICAD_SPICE )
sim/sim_model_spice.cpp
sim/sim_model_source.cpp
sim/sim_model_subckt.cpp
sim/sim_model_tline.cpp
sim/sim_value.cpp
sim/spice_simulator.cpp
sim/spice_value.cpp

View File

@ -115,7 +115,7 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
m_modelNameCombobox->SetStringSelection(
SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_SPICE::NAME_FIELD ) );
m_overrideCheckbox->SetValue( curModel().HasNonPrincipalOverrides() );
m_overrideCheckbox->SetValue( curModel().HasNonInstanceOverrides() );
}
else
{
@ -148,20 +148,26 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
if( !DIALOG_SIM_MODEL_BASE::TransferDataFromWindow() )
return false;
wxString modelName = "";
if( m_useLibraryModelRadioButton->GetValue() )
modelName = m_modelNameCombobox->GetValue();
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_SPICE::NAME_FIELD, modelName );
wxString path = "";
if( m_useLibraryModelRadioButton->GetValue() )
{
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_SPICE::NAME_FIELD,
m_modelNameCombobox->GetValue() );
wxString path = m_library->GetFilePath();
path = m_library->GetFilePath();
wxFileName fn( path );
if( fn.MakeRelativeTo( Prj().GetProjectPath() ) && !fn.GetFullPath().StartsWith( ".." ) )
path = fn.GetFullPath();
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_SPICE::LIBRARY_FIELD, path );
}
SIM_MODEL::SetFieldValue( m_fields, SIM_LIBRARY_SPICE::LIBRARY_FIELD, path );
curModel().WriteFields( m_fields );
return true;
@ -267,7 +273,7 @@ void DIALOG_SIM_MODEL<T>::updateModelParamsTab()
// Most of the values are disabled when the override checkbox is unchecked.
prop->Enable( m_useInstanceModelRadioButton->GetValue()
|| prop->GetParam().info.category == CATEGORY::PRINCIPAL
|| prop->GetParam().info.isInstanceParam
|| m_overrideCheckbox->GetValue() );
}
}
@ -549,7 +555,7 @@ wxPGProperty* DIALOG_SIM_MODEL<T>::newParamProperty( int aParamIndex ) const
if( m_useLibraryModelRadioButton->GetValue()
&& !m_overrideCheckbox->GetValue()
&& param.info.category != SIM_MODEL::PARAM::CATEGORY::PRINCIPAL )
&& !param.info.isInstanceParam )
{
prop->Enable( false );
}
@ -611,7 +617,7 @@ wxString DIALOG_SIM_MODEL<T>::getModelPinString( int modelPinNumber ) const
template <typename T>
int DIALOG_SIM_MODEL<T>::getModelPinNumber( const wxString& aModelPinString ) const
unsigned DIALOG_SIM_MODEL<T>::getModelPinNumber( const wxString& aModelPinString ) const
{
if( aModelPinString == "Not Connected" )
return SIM_MODEL::PIN::NOT_CONNECTED;
@ -624,7 +630,7 @@ int DIALOG_SIM_MODEL<T>::getModelPinNumber( const wxString& aModelPinString ) co
long result = 0;
aModelPinString.Mid( 0, length ).ToCLong( &result );
return static_cast<int>( result );
return static_cast<unsigned>( result );
}
@ -712,8 +718,8 @@ template <typename T>
void DIALOG_SIM_MODEL<T>::onPinAssignmentsGridCellChange( wxGridEvent& aEvent )
{
int symbolPinNumber = aEvent.GetRow() + 1;
int oldModelPinNumber = getModelPinNumber( aEvent.GetString() );
int modelPinNumber = getModelPinNumber(
unsigned oldModelPinNumber = getModelPinNumber( aEvent.GetString() );
unsigned modelPinNumber = getModelPinNumber(
m_pinAssignmentsGrid->GetCellValue( aEvent.GetRow(), aEvent.GetCol() ) );
if( oldModelPinNumber != SIM_MODEL::PIN::NOT_CONNECTED )

View File

@ -67,7 +67,7 @@ private:
wxString getSymbolPinString( int aSymbolPinNumber ) const;
wxString getModelPinString( int aModelPinNumber ) const;
int getModelPinNumber( const wxString& aModelPinString ) const;
unsigned getModelPinNumber( const wxString& aModelPinString ) const;
void onRadioButton( wxCommandEvent& aEvent ) override;
void onBrowseButtonClick( wxCommandEvent& aEvent ) override;

View File

@ -78,7 +78,7 @@ bool NETLIST_EXPORTER_SPICE::GenerateNetlist( OUTPUTFORMATTER& aFormatter, unsig
writeIncludes( aFormatter, aNetlistOptions );
writeModels( aFormatter );
writeDirectives( aFormatter, aNetlistOptions );
WriteDirectives( aFormatter, aNetlistOptions );
writeItems( aFormatter );
aFormatter.Print( 0, ".end\n" );
@ -115,13 +115,13 @@ bool NETLIST_EXPORTER_SPICE::ReadSchematicAndLibraries( unsigned aNetlistOptions
item.model = SIM_MODEL::Create(
static_cast<int>( m_sortedSymbolPinList.size() ), symbol->GetFields() );
if( !readRefName( sheet, *symbol, item, refNames ) )
return false;
readLibraryField( *symbol, item );
readNameField( *symbol, item );
readEnabledField( *symbol, item );
if( !readRefName( sheet, *symbol, item, refNames ) )
return false;
readPins( *symbol, item, notConnectedCounter );
// TODO: transmission line handling?
@ -217,7 +217,7 @@ void NETLIST_EXPORTER_SPICE::readLibraryField( SCH_SYMBOL& aSymbol, SPICE_ITEM&
else if( auto model = dynamic_cast<const SIM_MODEL_SPICE*>( aItem.model.get() ) )
{
// Special case for legacy models.
int libParamIndex = static_cast<int>( SIM_MODEL_SPICE::SPICE_PARAM::LIB );
unsigned libParamIndex = static_cast<unsigned>( SIM_MODEL_SPICE::SPICE_PARAM::LIB );
path = model->GetParam( libParamIndex ).value->ToString();
}
@ -233,15 +233,14 @@ void NETLIST_EXPORTER_SPICE::readLibraryField( SCH_SYMBOL& aSymbol, SPICE_ITEM&
void NETLIST_EXPORTER_SPICE::readNameField( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem )
{
SCH_FIELD* field = aSymbol.FindField( SIM_LIBRARY::NAME_FIELD );
if( !field )
return;
wxString modelName = field->GetShownText();
if( m_libraries.count( aItem.libraryPath ) )
{
SCH_FIELD* field = aSymbol.FindField( SIM_LIBRARY::NAME_FIELD );
if( !field )
return;
wxString modelName = field->GetShownText();
const SIM_LIBRARY& library = *m_libraries.at( aItem.libraryPath );
const SIM_MODEL* baseModel = library.FindModel( modelName );
@ -254,6 +253,8 @@ void NETLIST_EXPORTER_SPICE::readNameField( SCH_SYMBOL& aSymbol, SPICE_ITEM& aIt
return;
}
}
else
aItem.modelName = "__" + aItem.model->GenerateSpiceItemName( aItem.refName );
}
@ -360,7 +361,8 @@ void NETLIST_EXPORTER_SPICE::writeItems( OUTPUTFORMATTER& aFormatter )
}
void NETLIST_EXPORTER_SPICE::writeDirectives( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions )
void NETLIST_EXPORTER_SPICE::WriteDirectives( OUTPUTFORMATTER& aFormatter,
unsigned aNetlistOptions ) const
{
if( aNetlistOptions & OPTION_SAVE_ALL_VOLTAGES )
aFormatter.Print( 0, ".save all\n" );

View File

@ -120,6 +120,7 @@ public:
protected:
void ReadDirectives();
virtual void WriteDirectives( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions ) const;
private:
void readLibraryField( SCH_SYMBOL& aSymbol, SPICE_ITEM& aItem );
@ -132,7 +133,6 @@ private:
void writeIncludes( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions );
void writeModels( OUTPUTFORMATTER& aFormatter );
void writeItems( OUTPUTFORMATTER& aFormatter );
void writeDirectives( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions );
wxString m_title; ///< Spice simulation title found in the schematic sheet
std::vector<wxString> m_directives; ///< Spice directives found in the schematic sheet

View File

@ -55,9 +55,9 @@ public:
//RESISTOR,
//CAPACITOR,
//INDUCTOR,
LTRA,
TRANLINE,
URC,
//LTRA,
//TRANLINE,
//URC,
//TRANSLINE,
SWITCH,
CSWITCH,

View File

@ -151,3 +151,11 @@ bool NGSPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAM
return true;
}
void NGSPICE_CIRCUIT_MODEL::WriteDirectives( OUTPUTFORMATTER& aFormatter,
unsigned aNetlistOptions ) const
{
NETLIST_EXPORTER_SPICE::WriteDirectives( aFormatter, aNetlistOptions );
aFormatter.Print( 0, "%s\n", TO_UTF8( GetSimCommand() ) );
}

View File

@ -138,6 +138,9 @@ public:
*/
static SIM_TYPE CommandToSimType( const wxString& aCmd );
protected:
void WriteDirectives( OUTPUTFORMATTER& aFormatter, unsigned aNetlistOptions ) const override;
private:
///< Custom simulation command (has priority over the schematic sheet simulation commands)
wxString m_simCommand;

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,7 @@
#include <sim/sim_model_source.h>
#include <sim/sim_model_spice.h>
#include <sim/sim_model_subckt.h>
#include <sim/sim_model_tline.h>
#include <sim/sim_model_xspice.h>
#include <pegtl.hpp>
@ -59,22 +60,25 @@ namespace SIM_MODEL_PARSER
template <> struct fieldParamValuePairsSelector<quotedString> : std::true_type {};
template <typename Rule> struct pinSequenceSelector : std::false_type {};
template <> struct pinSequenceSelector<pinNumber> : std::true_type {};
}
namespace SIM_MODEL_SPICE_PARSER
{
using namespace SPICE_GRAMMAR;
template <typename Rule> struct spiceUnitSelector : std::false_type {};
template <> struct spiceUnitSelector<dotModel> : std::true_type {};
template <> struct spiceUnitSelector<modelName> : std::true_type {};
template <> struct spiceUnitSelector<dotModelType> : std::true_type {};
template <> struct spiceUnitSelector<param> : std::true_type {};
template <> struct spiceUnitSelector<number<SIM_VALUE::TYPE::INT, NOTATION::SPICE>>
: std::true_type {};
template <> struct spiceUnitSelector<number<SIM_VALUE::TYPE::FLOAT, NOTATION::SPICE>>
: std::true_type {};
template <> struct spiceUnitSelector<paramValue> : std::true_type {};
template <> struct spiceUnitSelector<dotSubckt> : std::true_type {};
template <typename Rule> struct pinSequenceSelector : std::false_type {};
template <> struct pinSequenceSelector<pinNumber> : std::true_type {};
}
@ -133,10 +137,8 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
case TYPE::L_ADV: return { DEVICE_TYPE::L, "ADV", "Advanced" };
case TYPE::L_BEHAVIORAL: return { DEVICE_TYPE::L, "=", "Behavioral" };
case TYPE::TLINE_LOSSY: return { DEVICE_TYPE::TLINE, "", "Lossy" };
case TYPE::TLINE_LOSSLESS: return { DEVICE_TYPE::TLINE, "LOSSLESS", "Lossless" };
case TYPE::TLINE_URC: return { DEVICE_TYPE::TLINE, "URC", "Uniform RC" };
case TYPE::TLINE_KSPICE: return { DEVICE_TYPE::TLINE, "KSPICE", "KSPICE" };
case TYPE::TLINE_Z0: return { DEVICE_TYPE::TLINE, "Z0", "Characteristic impedance" };
case TYPE::TLINE_RLGC: return { DEVICE_TYPE::TLINE, "RLGC", "RLGC" };
case TYPE::SW_V: return { DEVICE_TYPE::SW, "V", "Voltage-controlled" };
case TYPE::SW_I: return { DEVICE_TYPE::SW, "I", "Current-controlled" };
@ -163,8 +165,8 @@ SIM_MODEL::INFO SIM_MODEL::TypeInfo( TYPE aType )
case TYPE::PMES_YTTERDAL: return { DEVICE_TYPE::PMES, "YTTERDAL", "Ytterdal" };
case TYPE::NMES_HFET1: return { DEVICE_TYPE::NMES, "HFET1", "HFET1" };
case TYPE::PMES_HFET1: return { DEVICE_TYPE::PMES, "HFET1", "HFET1" };
case TYPE::PMES_HFET2: return { DEVICE_TYPE::NMES, "HFET2", "HFET2" };
case TYPE::NMES_HFET2: return { DEVICE_TYPE::PMES, "HFET2", "HFET2" };
case TYPE::NMES_HFET2: return { DEVICE_TYPE::NMES, "HFET2", "HFET2" };
case TYPE::PMES_HFET2: return { DEVICE_TYPE::PMES, "HFET2", "HFET2" };
case TYPE::NMOS_MOS1: return { DEVICE_TYPE::NMOS, "MOS1", "Classical quadratic (MOS1)" };
case TYPE::PMOS_MOS1: return { DEVICE_TYPE::PMOS, "MOS1", "Classical quadratic (MOS1)" };
@ -255,87 +257,85 @@ SIM_MODEL::SPICE_INFO SIM_MODEL::SpiceInfo( TYPE aType )
{
case TYPE::R: return { "R", "" };
case TYPE::R_ADV: return { "R", "r" };
case TYPE::R_BEHAVIORAL: return { "R", "", "", 0, true };
case TYPE::R_BEHAVIORAL: return { "R", "", "", "0", false, true };
case TYPE::C: return { "C", "" };
case TYPE::C_ADV: return { "C", "c", };
case TYPE::C_BEHAVIORAL: return { "C", "", "", 0, true };
case TYPE::C_BEHAVIORAL: return { "C", "", "", "0", false, true };
case TYPE::L: return { "L", "" };
case TYPE::L_ADV: return { "L", "l" };
case TYPE::L_BEHAVIORAL: return { "L", "", "", 0, true };
case TYPE::L_BEHAVIORAL: return { "L", "", "", "0", false, true };
case TYPE::TLINE_LOSSY: return { "O", "ltra" };
case TYPE::TLINE_LOSSLESS: return { "T" };
case TYPE::TLINE_URC: return { "U" };
case TYPE::TLINE_KSPICE: return { "Y" };
case TYPE::TLINE_Z0: return { "T" };
case TYPE::TLINE_RLGC: return { "O", "ltra" };
case TYPE::SW_V: return { "S", "switch" };
case TYPE::SW_I: return { "W", "cswitch" };
case TYPE::D: return { "D", "d" };
case TYPE::NPN_GUMMELPOON: return { "Q", "npn", "", 1 };
case TYPE::PNP_GUMMELPOON: return { "Q", "pnp", "", 1 };
case TYPE::NPN_GUMMELPOON: return { "Q", "npn", "", "1", true };
case TYPE::PNP_GUMMELPOON: return { "Q", "pnp", "", "1", true };
case TYPE::NPN_VBIC: return { "Q", "npn", "", 4 };
case TYPE::PNP_VBIC: return { "Q", "pnp", "", 4 };
case TYPE::NPN_VBIC: return { "Q", "npn", "", "4" };
case TYPE::PNP_VBIC: return { "Q", "pnp", "", "4" };
case TYPE::NPN_HICUML2: return { "Q", "npn", "", 8 };
case TYPE::PNP_HICUML2: return { "Q", "pnp", "", 8 };
case TYPE::NPN_HICUML2: return { "Q", "npn", "", "8" };
case TYPE::PNP_HICUML2: return { "Q", "pnp", "", "8" };
case TYPE::NJFET_SHICHMANHODGES: return { "M", "njf", "", 1 };
case TYPE::PJFET_SHICHMANHODGES: return { "M", "pjf", "", 1 };
case TYPE::NJFET_PARKERSKELLERN: return { "M", "njf", "", 2 };
case TYPE::PJFET_PARKERSKELLERN: return { "M", "pjf", "", 2 };
case TYPE::NJFET_SHICHMANHODGES: return { "M", "njf", "", "1" };
case TYPE::PJFET_SHICHMANHODGES: return { "M", "pjf", "", "1" };
case TYPE::NJFET_PARKERSKELLERN: return { "M", "njf", "", "2" };
case TYPE::PJFET_PARKERSKELLERN: return { "M", "pjf", "", "2" };
case TYPE::NMES_STATZ: return { "Z", "nmf", "", 1 };
case TYPE::PMES_STATZ: return { "Z", "pmf", "", 1 };
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::PMES_HFET2: return { "Z", "nmf", "", 6 };
case TYPE::NMES_HFET2: return { "Z", "pmf", "", 6 };
case TYPE::NMES_STATZ: return { "Z", "nmf", "", "1" };
case TYPE::PMES_STATZ: return { "Z", "pmf", "", "1" };
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_MOS1: return { "M", "nmos", "", 1 };
case TYPE::PMOS_MOS1: return { "M", "pmos", "", 1 };
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_MOS1: return { "M", "nmos", "", "1" };
case TYPE::PMOS_MOS1: return { "M", "pmos", "", "1" };
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, "1.2.4" };
case TYPE::PMOS_HISIMHV1: return { "M", "pmos", "", 73, false, "1.2.4" };
case TYPE::NMOS_HISIMHV2: return { "M", "nmos", "", 73, false, "2.2.0" };
case TYPE::PMOS_HISIMHV2: return { "M", "pmos", "", 73, 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", true, false, "1.2.4" };
case TYPE::PMOS_HISIMHV1: return { "M", "pmos", "", "73", true, false, "1.2.4" };
case TYPE::NMOS_HISIMHV2: return { "M", "nmos", "", "73", true, false, "2.2.0" };
case TYPE::PMOS_HISIMHV2: return { "M", "pmos", "", "73", true, false, "2.2.0" };
case TYPE::V_DC: return { "V", "" };
case TYPE::V_SIN: return { "V", "", "SIN" };
@ -392,13 +392,13 @@ TYPE SIM_MODEL::ReadTypeFromSpiceCode( const std::string& aSpiceCode )
try
{
root = tao::pegtl::parse_tree::parse<SIM_MODEL_PARSER::spiceUnitGrammar,
SIM_MODEL_PARSER::spiceUnitSelector>
root = tao::pegtl::parse_tree::parse<SIM_MODEL_SPICE_PARSER::spiceUnitGrammar,
SIM_MODEL_SPICE_PARSER::spiceUnitSelector>
( in );
}
catch( const tao::pegtl::parse_error& e )
{
// TODO: Maybe announce an error somehow?
wxLogDebug( "%s", e.what() );
return TYPE::NONE;
}
@ -406,24 +406,54 @@ TYPE SIM_MODEL::ReadTypeFromSpiceCode( const std::string& aSpiceCode )
for( const auto& node : root->children )
{
if( node->is_type<SIM_MODEL_PARSER::dotModel>() )
if( node->is_type<SIM_MODEL_SPICE_PARSER::dotModel>() )
{
wxString paramName;
wxString typeString;
wxString level;
wxString version;
for( const auto& subnode : node->children )
{
if( subnode->is_type<SIM_MODEL_PARSER::modelName>() )
if( subnode->is_type<SIM_MODEL_SPICE_PARSER::modelName>() )
{
// Do nothing.
}
else if( subnode->is_type<SIM_MODEL_PARSER::dotModelType>() )
return readTypeFromSpiceTypeString( subnode->string() );
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::dotModelType>() )
{
typeString = subnode->string();
TYPE type = readTypeFromSpiceStrings( typeString );
if( type != TYPE::SPICE )
return type;
}
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::param>() )
{
paramName = subnode->string();
}
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::paramValue>() )
{
wxASSERT( paramName != "" );
if( paramName == "level" )
level = subnode->string();
else if( paramName == "version" ) // TODO! This isn't a number!
version = subnode->string();
}
else
{
wxFAIL_MSG( "Unhandled parse tree subnode" );
return TYPE::NONE;
}
}
// Type was not determined from Spice type string alone, so now we take `level` and
// `version` variables into account too. This is suboptimal since we read the model
// twice this way, and moreover the code is now somewhat duplicated.
return readTypeFromSpiceStrings( typeString, level, version, false );
}
else if( node->is_type<SIM_MODEL_PARSER::dotSubckt>() )
else if( node->is_type<SIM_MODEL_SPICE_PARSER::dotSubckt>() )
return TYPE::SUBCKT;
else
{
@ -550,6 +580,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const std::string& aSpiceCode )
if( !model->ReadSpiceCode( aSpiceCode ) )
{
wxLogDebug( "%s", model->GetErrorMessage() );
// Demote to raw Spice element and try again.
std::unique_ptr<SIM_MODEL> rawSpiceModel = create( TYPE::SPICE );
@ -675,8 +706,8 @@ bool SIM_MODEL::ReadSpiceCode( const std::string& aSpiceCode )
try
{
root = tao::pegtl::parse_tree::parse<SIM_MODEL_PARSER::spiceUnitGrammar,
SIM_MODEL_PARSER::spiceUnitSelector>
root = tao::pegtl::parse_tree::parse<SIM_MODEL_SPICE_PARSER::spiceUnitGrammar,
SIM_MODEL_SPICE_PARSER::spiceUnitSelector>
( in );
}
catch( tao::pegtl::parse_error& e )
@ -690,37 +721,36 @@ bool SIM_MODEL::ReadSpiceCode( const std::string& aSpiceCode )
for( const auto& node : root->children )
{
if( node->is_type<SIM_MODEL_PARSER::dotModel>() )
if( node->is_type<SIM_MODEL_SPICE_PARSER::dotModel>() )
{
wxString paramName = "";
for( const auto& subnode : node->children )
{
if( subnode->is_type<SIM_MODEL_PARSER::modelName>() )
if( subnode->is_type<SIM_MODEL_SPICE_PARSER::modelName>() )
{
// Do nothing.
}
else if( subnode->is_type<SIM_MODEL_PARSER::dotModelType>() )
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::dotModelType>() )
{
// Do nothing.
}
else if( subnode->is_type<SIM_MODEL_PARSER::param>() )
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::param>() )
{
paramName = subnode->string();
}
// TODO: Do something with number<SIM_VALUE::TYPE::INT, ...>.
// It doesn't seem too useful?
else if( subnode->is_type<
SIM_MODEL_PARSER::number<SIM_VALUE::TYPE::INT,
SIM_MODEL_PARSER::NOTATION::SPICE>>()
|| subnode->is_type<
SIM_MODEL_PARSER::number<SIM_VALUE::TYPE::FLOAT,
SIM_MODEL_PARSER::NOTATION::SPICE>>() )
else if( subnode->is_type<SIM_MODEL_SPICE_PARSER::paramValue>() )
{
wxASSERT( !paramName.IsEmpty() );
if( !SetParamFromSpiceCode( paramName, subnode->string() ) )
{
m_errorMessage =
wxString::Format( _( "Failed to set parameter '%s' to '%s'" ),
paramName,
subnode->string() );
return false;
}
}
else
{
@ -804,7 +834,7 @@ wxString SIM_MODEL::GenerateSpiceModelLine( const wxString& aModelName ) const
{
LOCALE_IO toggle;
if( !HasOverrides() )
if( !HasOverrides() || !requiresSpiceModel() )
return "";
wxString result = "";
@ -815,12 +845,12 @@ wxString SIM_MODEL::GenerateSpiceModelLine( const wxString& aModelName ) const
for( unsigned paramIndex = 0; paramIndex < GetParamCount(); ++paramIndex )
{
const PARAM& param = GetParam( paramIndex );
wxString valueStr = param.value->ToString();
wxString valueStr = param.value->ToString( SIM_VALUE_GRAMMAR::NOTATION::SPICE );
if( valueStr.IsEmpty() )
continue;
wxString append = " " + param.info.name + "=" + param.value->ToString();
wxString append = " " + param.info.name + "=" + valueStr;
if( line.Length() + append.Length() > 60 )
{
@ -831,7 +861,7 @@ wxString SIM_MODEL::GenerateSpiceModelLine( const wxString& aModelName ) const
line << append;
}
result << line + ")\n";
result << line + " )\n";
return result;
}
@ -870,12 +900,14 @@ wxString SIM_MODEL::GenerateSpiceItemLine( const wxString& aRefName,
}
}
result << aModelName << " ";
if( requiresSpiceModel() )
result << aModelName << " ";
for( const PARAM& param : GetParams() )
{
if( param.info.isInstanceParam )
result << param.info.name << "=" << param.value->ToString() << " ";
if( param.info.isSpiceInstanceParam )
result << param.info.name << "="
<< param.value->ToString( SIM_VALUE_GRAMMAR::NOTATION::SPICE ) << " ";
}
result << "\n";
@ -907,12 +939,6 @@ wxString SIM_MODEL::GenerateSpicePreview( const wxString& aModelName ) const
}
SIM_MODEL::SPICE_INFO SIM_MODEL::GetSpiceInfo() const
{
return SpiceInfo( GetType() );
}
std::vector<wxString> SIM_MODEL::GenerateSpiceCurrentNames( const wxString& aRefName ) const
{
LOCALE_IO toggle;
@ -957,13 +983,30 @@ std::vector<std::reference_wrapper<const SIM_MODEL::PIN>> SIM_MODEL::GetPins() c
const SIM_MODEL::PARAM& SIM_MODEL::GetParam( unsigned aParamIndex ) const
{
if( m_baseModel && m_params.at( aParamIndex ).value->ToString().IsEmpty() )
if( m_baseModel && m_params.at( aParamIndex ).value->ToString() == "" )
return m_baseModel->GetParam( aParamIndex );
else
return m_params.at( aParamIndex );
}
const SIM_MODEL::PARAM* SIM_MODEL::FindParam( const wxString& aParamName ) const
{
std::vector<std::reference_wrapper<const PARAM>> params = GetParams();
auto it = std::find_if( params.begin(), params.end(),
[aParamName]( const PARAM& param )
{
return param.info.name == aParamName.Lower();
} );
if( it == params.end() )
return nullptr;
return &it->get();
}
std::vector<std::reference_wrapper<const SIM_MODEL::PARAM>> SIM_MODEL::GetParams() const
{
std::vector<std::reference_wrapper<const PARAM>> params;
@ -994,7 +1037,7 @@ bool SIM_MODEL::SetParamValue( unsigned aParamIndex, const wxString& aValue,
SIM_VALUE_GRAMMAR::NOTATION aNotation )
{
// Models sourced from a library are immutable.
if( !m_spiceCode.IsEmpty() )
if( m_spiceCode != "" )
return false;
return m_params.at( aParamIndex ).value->FromString( aValue, aNotation );
@ -1005,7 +1048,7 @@ bool SIM_MODEL::HasOverrides() const
{
for( const PARAM& param : m_params )
{
if( !param.value->ToString().IsEmpty() )
if( param.value->ToString() != "" )
return true;
}
@ -1013,15 +1056,12 @@ bool SIM_MODEL::HasOverrides() const
}
bool SIM_MODEL::HasNonPrincipalOverrides() const
bool SIM_MODEL::HasNonInstanceOverrides() const
{
for( const PARAM& param : m_params )
{
if( param.info.category != PARAM::CATEGORY::PRINCIPAL
&& !param.value->ToString().IsEmpty() )
{
if( !param.info.isInstanceParam && param.value->ToString() != "" )
return true;
}
}
return false;
@ -1076,9 +1116,7 @@ wxString SIM_MODEL::GenerateParamsField( const wxString& aPairSeparator ) const
for( const PARAM& param : m_params )
{
wxString valueStr = param.value->ToString();
if( valueStr.IsEmpty() )
if( param.value->ToString() == "" )
continue;
result << GenerateParamValuePair( param, isFirst );
@ -1125,7 +1163,7 @@ bool SIM_MODEL::ParseParamsField( const wxString& aParamsField )
SIM_MODEL_PARSER::NOTATION::SI>>()
|| node->is_type<SIM_MODEL_PARSER::unquotedString>() )
{
wxASSERT( !paramName.IsEmpty() );
wxASSERT( paramName != "" );
// TODO: Shouldn't be named "...fromSpiceCode" here...
SetParamFromSpiceCode( paramName, node->string(), SIM_VALUE_GRAMMAR::NOTATION::SI );
@ -1238,6 +1276,10 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::create( TYPE aType )
case TYPE::V_BEHAVIORAL:
case TYPE::I_BEHAVIORAL:
return std::make_unique<SIM_MODEL_BEHAVIORAL>( aType );
case TYPE::TLINE_Z0:
case TYPE::TLINE_RLGC:
return std::make_unique<SIM_MODEL_TLINE>( aType );
case TYPE::V_DC:
case TYPE::I_DC:
@ -1284,22 +1326,31 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::create( TYPE aType )
}
TYPE SIM_MODEL::readTypeFromSpiceTypeString( const std::string& aTypeString )
TYPE SIM_MODEL::readTypeFromSpiceStrings( const wxString& aTypeString,
const wxString& aLevel,
const wxString& aVersion,
bool aSkipDefaultLevel )
{
std::string lowercaseTypeString = aTypeString;
std::transform( lowercaseTypeString.begin(), lowercaseTypeString.end(),
lowercaseTypeString.begin(), ::tolower );
std::unique_ptr<SIM_VALUE> readLevel = SIM_VALUE::Create( SIM_VALUE::TYPE::INT, aLevel );
for( TYPE type : TYPE_ITERATOR() )
{
wxString typePrefix = SpiceInfo( type ).modelType;
wxString level = SpiceInfo( type ).level;
wxString version = SpiceInfo( type ).version;
bool isDefaultLevel = SpiceInfo( type ).isDefaultLevel;
if( typePrefix == "" )
continue;
// Check if `aTypeString` starts with `typePrefix`.
if( lowercaseTypeString.rfind( typePrefix, 0 ) == 0 )
if( aTypeString.Lower().StartsWith( typePrefix )
&& ( level == readLevel->ToString()
|| ( !aSkipDefaultLevel && isDefaultLevel && aLevel == "" ) )
&& version == aVersion )
{
return type;
}
}
// If the type string is not recognized, demote to a raw Spice element. This way the user won't
@ -1358,3 +1409,15 @@ wxString SIM_MODEL::generatePinsField() const
return result;
}
bool SIM_MODEL::requiresSpiceModel() const
{
for( const PARAM& param : GetParams() )
{
if( !param.info.isSpiceInstanceParam )
return true;
}
return false;
}

View File

@ -37,7 +37,7 @@ class SIM_LIBRARY;
namespace SIM_MODEL_GRAMMAR
{
using namespace SPICE_GRAMMAR;
using namespace SIM_VALUE_GRAMMAR;
struct sep : plus<space> {};
@ -58,6 +58,8 @@ namespace SIM_MODEL_GRAMMAR
'"'>>,
one<'"'>>>> {};
struct param : plus<alnum> {};
struct fieldParamValuePair : seq<param,
opt<sep>,
one<'='>,
@ -142,10 +144,8 @@ public:
L_ADV,
L_BEHAVIORAL,
TLINE_LOSSY,
TLINE_LOSSLESS,
TLINE_URC,
TLINE_KSPICE,
TLINE_Z0,
TLINE_RLGC,
SW_V,
SW_I,
@ -292,7 +292,8 @@ public:
wxString itemType;
wxString modelType = "";
wxString inlineTypeString = "";
int level = 0;
wxString level = "";
bool isDefaultLevel = false;
bool hasExpression = false;
wxString version = "";
};
@ -300,7 +301,7 @@ public:
struct PIN
{
static constexpr auto NOT_CONNECTED = 0;
static constexpr unsigned NOT_CONNECTED = 0;
const wxString name;
unsigned symbolPinNumber;
@ -347,6 +348,7 @@ public:
wxString defaultValueOfOtherVariant = ""; // Legacy (don't remove).
wxString description = "";
bool isInstanceParam = false;
bool isSpiceInstanceParam = false;
};
std::unique_ptr<SIM_VALUE> value;
@ -437,14 +439,17 @@ public:
virtual wxString GenerateSpicePreview( const wxString& aModelName ) const;
SPICE_INFO GetSpiceInfo() const;
SPICE_INFO GetSpiceInfo() const { return SpiceInfo( GetType() ); }
virtual std::vector<wxString> GenerateSpiceCurrentNames( const wxString& aRefName ) const;
void AddPin( const PIN& aPin );
unsigned FindModelPinNumber( unsigned aSymbolPinNumber );
void AddParam( const PARAM::INFO& aInfo, bool aIsOtherVariant = false );
DEVICE_TYPE GetDeviceType() const { return TypeInfo( GetType() ).deviceType; }
DEVICE_INFO GetDeviceTypeInfo() const { return DeviceTypeInfo( GetDeviceType() ); }
INFO GetTypeInfo() const { return TypeInfo( GetType() ); }
DEVICE_TYPE GetDeviceType() const { return GetTypeInfo().deviceType; }
TYPE GetType() const { return m_type; }
const SIM_MODEL* GetBaseModel() const { return m_baseModel; }
@ -464,6 +469,8 @@ public:
unsigned GetParamCount() const { return m_params.size(); }
const PARAM& GetParam( unsigned aParamIndex ) const; // Return base parameter unless it's overridden.
const PARAM* FindParam( const wxString& aParamName ) const;
std::vector<std::reference_wrapper<const PARAM>> GetParams() const;
const PARAM& GetUnderlyingParam( unsigned aParamIndex ) const; // Return the actual parameter.
@ -473,12 +480,12 @@ public:
= SIM_VALUE_GRAMMAR::NOTATION::SI );
bool HasOverrides() const;
bool HasNonPrincipalOverrides() const;
bool HasNonInstanceOverrides() const;
// Can modifying a model parameter also modify other parameters?
virtual bool HasAutofill() const { return false; }
wxString GetErrorMessage() { return m_errorMessage; }
wxString GetErrorMessage() const { return m_errorMessage; }
protected:
SIM_MODEL( TYPE aType );
@ -503,7 +510,10 @@ protected:
private:
static std::unique_ptr<SIM_MODEL> create( TYPE aType );
static TYPE readTypeFromSpiceTypeString( const std::string& aTypeString );
static TYPE readTypeFromSpiceStrings( const wxString& aTypeString,
const wxString& aLevel = "",
const wxString& aVersion = "",
bool aSkipDefaultLevel = true );
template <typename T>
@ -520,6 +530,8 @@ private:
wxString generatePinsField() const;
virtual bool requiresSpiceModel() const;
const SIM_MODEL* m_baseModel;

View File

@ -29,7 +29,7 @@
SIM_MODEL_BEHAVIORAL::SIM_MODEL_BEHAVIORAL( TYPE aType )
: SIM_MODEL( aType )
{
static PARAM::INFO resistor = makeParams( "r", "Expression for resistance", "ohm" );
static PARAM::INFO resistor = makeParams( "r", "Expression for resistance", "Ω" );
static PARAM::INFO capacitor = makeParams( "c", "Expression for capacitance", "F" );
static PARAM::INFO inductor = makeParams( "l", "Expression for inductance", "H" );
static PARAM::INFO vsource = makeParams( "v", "Expression for voltage", "V" );

View File

@ -31,7 +31,7 @@ SIM_MODEL_IDEAL::SIM_MODEL_IDEAL( TYPE aType )
: SIM_MODEL( aType ),
m_isInferred( false )
{
static PARAM::INFO resistor = makeParamInfo( "r", "Resistance", "ohm" );
static PARAM::INFO resistor = makeParamInfo( "r", "Resistance", "Ω" );
static PARAM::INFO capacitor = makeParamInfo( "c", "Capacitance", "F" );
static PARAM::INFO inductor = makeParamInfo( "l", "Inductance", "H" );

View File

@ -79,6 +79,11 @@ std::vector<wxString> SIM_MODEL_NGSPICE::GenerateSpiceCurrentNames( const wxStri
bool SIM_MODEL_NGSPICE::SetParamFromSpiceCode( const wxString& aParamName, const wxString& aParamValue,
SIM_VALUE_GRAMMAR::NOTATION aNotation )
{
// "level" and "version" are not really parameters - they're part of the type - so silently
// ignore them.
if( aParamName == "level" || aParamName == "version" )
return true;
// One Spice param can have multiple names, we need to take this into account.
std::vector<std::reference_wrapper<const PARAM>> params = GetParams();
@ -93,7 +98,6 @@ bool SIM_MODEL_NGSPICE::SetParamFromSpiceCode( const wxString& aParamName, const
if( paramIt != params.end() )
return SetParamValue( paramIt - params.begin(), aParamValue, aNotation );
std::vector<PARAM::INFO> ngspiceParams = NGSPICE::ModelInfo( getModelType() ).modelParams;
auto ngspiceParamIt = std::find_if( ngspiceParams.begin(), ngspiceParams.end(),
@ -133,13 +137,6 @@ NGSPICE::MODEL_TYPE SIM_MODEL_NGSPICE::getModelType() const
switch( GetType() )
{
case TYPE::NONE: return NGSPICE::MODEL_TYPE::NONE;
//case TYPE::R_ADV: return NGSPICE::MODEL_TYPE::RESISTOR;
//case TYPE::C_ADV: return NGSPICE::MODEL_TYPE::CAPACITOR;
//case TYPE::L_ADV: return NGSPICE::MODEL_TYPE::INDUCTOR;
case TYPE::TLINE_LOSSY: return NGSPICE::MODEL_TYPE::LTRA;
case TYPE::TLINE_LOSSLESS: return NGSPICE::MODEL_TYPE::TRANLINE;
case TYPE::TLINE_URC: return NGSPICE::MODEL_TYPE::URC;
//case TYPE::TLINE_KSPICE: return NGSPICE::MODEL_TYPE::TRANSLINE;
case TYPE::SW_V: return NGSPICE::MODEL_TYPE::SWITCH;
case TYPE::SW_I: return NGSPICE::MODEL_TYPE::CSWITCH;
case TYPE::D: return NGSPICE::MODEL_TYPE::DIODE;
@ -162,8 +159,8 @@ NGSPICE::MODEL_TYPE SIM_MODEL_NGSPICE::getModelType() const
case TYPE::PMES_YTTERDAL: return NGSPICE::MODEL_TYPE::MESA;
case TYPE::NMES_HFET1:
case TYPE::PMES_HFET1: return NGSPICE::MODEL_TYPE::HFET1;
case TYPE::PMES_HFET2:
case TYPE::NMES_HFET2: return NGSPICE::MODEL_TYPE::HFET2;
case TYPE::NMES_HFET2:
case TYPE::PMES_HFET2: return NGSPICE::MODEL_TYPE::HFET2;
case TYPE::NMOS_MOS1:
case TYPE::PMOS_MOS1: return NGSPICE::MODEL_TYPE::MOS1;

View File

@ -30,7 +30,7 @@ using PARAM = SIM_MODEL::PARAM;
SIM_MODEL_PASSIVE::SIM_MODEL_PASSIVE( TYPE aType )
: SIM_MODEL( aType )
{
static std::vector<PARAM::INFO> resistor = makeParamInfos( "r", "Resistance", "ohm" );
static std::vector<PARAM::INFO> resistor = makeParamInfos( "r", "Resistance", "Ω" );
static std::vector<PARAM::INFO> capacitor = makeParamInfos( "c", "Capacitance", "F" );
static std::vector<PARAM::INFO> inductor = makeParamInfos( "l", "Inductance", "H" );
@ -57,41 +57,6 @@ SIM_MODEL_PASSIVE::SIM_MODEL_PASSIVE( TYPE aType )
}
wxString SIM_MODEL_PASSIVE::GenerateSpiceItemLine( const wxString& aRefName,
const wxString& aModelName,
const std::vector<wxString>& aPinNetNames ) const
{
wxString result = "";
result << GenerateSpiceItemName( aRefName ) << " ";
for( const PIN& pin : GetPins() )
{
for( unsigned i = 0; i < aPinNetNames.size(); ++i )
{
unsigned symbolPinNumber = i + 1;
if( symbolPinNumber == pin.symbolPinNumber )
result << aPinNetNames[i] << " ";
}
}
// The model name is preceded by the principal value for resistors.
//if( GetType() == TYPE::R_ADV )
//result << GetParam( 0 ).value->ToString( SIM_VALUE::NOTATION::SPICE ) << " ";
result << aModelName << " ";
for( const PARAM& param : GetParams() )
{
if( param.info.isInstanceParam )
result << param.info.name << "=" << param.value->ToString() << " ";
}
result << "\n";
return result;
}
bool SIM_MODEL_PASSIVE::SetParamFromSpiceCode( const wxString& aParamName,
const wxString& aParamValue,
SIM_VALUE_GRAMMAR::NOTATION aNotation )
@ -105,8 +70,8 @@ bool SIM_MODEL_PASSIVE::SetParamFromSpiceCode( const wxString& aParamName,
if( aParamName.Lower() == "tc1r" )
return SIM_MODEL::SetParamFromSpiceCode( "tc1", aParamValue, aNotation );
if( aParamName.Lower() == "tc2r" )
return SIM_MODEL::SetParamFromSpiceCode( "tc2", aParamValue, aNotation );
/*if( aParamName.Lower() == "tc2r" )
return SIM_MODEL::SetParamFromSpiceCode( "tc2", aParamValue, aNotation );*/
if( aParamName.Lower() == "res" )
return SIM_MODEL::SetParamFromSpiceCode( "r", aParamValue, aNotation );
@ -140,28 +105,31 @@ std::vector<PARAM::INFO> SIM_MODEL_PASSIVE::makeParamInfos( wxString aName,
std::vector<PARAM::INFO> paramInfos;
PARAM::INFO paramInfo = {};
paramInfo.name = "temp";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "°C";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "27";
paramInfo.description = "Temperature";
paramInfo.isInstanceParam = true;
paramInfos.push_back( paramInfo );
paramInfo.name = aName;
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = aUnit;
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = aDescription;
paramInfos.push_back( paramInfo );
paramInfo.name = "temp";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "deg C";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "27";
paramInfo.description = "Temperature";
paramInfo.isInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "tnom";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "deg C";
paramInfo.unit = "°C";
paramInfo.category = PARAM::CATEGORY::TEMPERATURE;
paramInfo.defaultValue = "27";
paramInfo.description = "Nominal temperature";
paramInfo.isInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "tc1";
@ -169,16 +137,18 @@ std::vector<PARAM::INFO> SIM_MODEL_PASSIVE::makeParamInfos( wxString aName,
paramInfo.unit = aUnit;
paramInfo.category = PARAM::CATEGORY::TEMPERATURE;
paramInfo.defaultValue = "0";
paramInfo.description = "1st order temperature coefficient";
paramInfo.description = "Temperature coefficient";
paramInfo.isInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "tc2";
/*paramInfo.name = "tc2";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = aUnit;
paramInfo.category = PARAM::CATEGORY::TEMPERATURE;
paramInfo.defaultValue = "0";
paramInfo.description = "2nd order temperature coefficient";
paramInfos.push_back( paramInfo );
paramInfo.isInstanceParam = false;
paramInfos.push_back( paramInfo );*/
/*if( aName != "l" )
{
@ -199,6 +169,7 @@ std::vector<PARAM::INFO> SIM_MODEL_PASSIVE::makeParamInfos( wxString aName,
paramInfo.category = PARAM::CATEGORY::NOISE;
paramInfo.defaultValue = "True";
paramInfo.description = "Enable thermal noise";
paramInfo.isInstanceParam = false;
paramInfos.push_back( paramInfo );
}

View File

@ -33,10 +33,6 @@ class SIM_MODEL_PASSIVE : public SIM_MODEL
public:
SIM_MODEL_PASSIVE( TYPE aType );
wxString GenerateSpiceItemLine( const wxString& aRefName,
const wxString& aModelName,
const std::vector<wxString>& aPinNetNames ) const override;
bool SetParamFromSpiceCode( const wxString& aParamName, const wxString& aParamValue,
SIM_VALUE_GRAMMAR::NOTATION aNotation
= SIM_VALUE_GRAMMAR::NOTATION::SPICE ) override;

View File

@ -85,9 +85,14 @@ wxString SIM_MODEL_SOURCE::GenerateSpiceItemLine( const wxString& aRefName,
const std::vector<wxString>& aPinNetNames ) const
{
wxString argList = "";
for( const PARAM& param : GetParams() )
{
wxString argStr = param.value->ToString( SIM_VALUE_GRAMMAR::NOTATION::SPICE );
for( unsigned i = 0; i < GetParamCount(); ++i )
argList << GetParam( i ).value->ToString() << " ";
if( argStr != "" )
argList << argStr << " ";
}
wxString model = wxString::Format( GetSpiceInfo().inlineTypeString + "( %s)", argList );

View File

@ -27,9 +27,9 @@
#include <pegtl/contrib/parse_tree.hpp>
namespace SIM_MODEL_SUBCKT_PARSER
namespace SIM_MODEL_SUBCKT_SPICE_PARSER
{
using namespace SIM_MODEL_GRAMMAR;
using namespace SPICE_GRAMMAR;
template <typename Rule> struct spiceUnitSelector : std::false_type {};
@ -57,8 +57,8 @@ bool SIM_MODEL_SUBCKT::ReadSpiceCode( const std::string& aSpiceCode )
try
{
root = tao::pegtl::parse_tree::parse<SIM_MODEL_SUBCKT_PARSER::spiceUnitGrammar,
SIM_MODEL_SUBCKT_PARSER::spiceUnitSelector>
root = tao::pegtl::parse_tree::parse<SIM_MODEL_SUBCKT_SPICE_PARSER::spiceUnitGrammar,
SIM_MODEL_SUBCKT_SPICE_PARSER::spiceUnitSelector>
( in );
}
catch( const tao::pegtl::parse_error& e )
@ -70,31 +70,32 @@ bool SIM_MODEL_SUBCKT::ReadSpiceCode( const std::string& aSpiceCode )
for( const auto& node : root->children )
{
if( node->is_type<SIM_MODEL_SUBCKT_PARSER::dotSubckt>() )
if( node->is_type<SIM_MODEL_SUBCKT_SPICE_PARSER::dotSubckt>() )
{
for( const auto& subnode : node->children )
{
if( subnode->is_type<SIM_MODEL_SUBCKT_PARSER::modelName>() )
if( subnode->is_type<SIM_MODEL_SUBCKT_SPICE_PARSER::modelName>() )
{
}
else if( subnode->is_type<SIM_MODEL_SUBCKT_PARSER::dotSubcktPinName>() )
else if( subnode->is_type<SIM_MODEL_SUBCKT_SPICE_PARSER::dotSubcktPinName>() )
{
AddPin( { subnode->string(), GetPinCount() + 1 } );
}
else if( subnode->is_type<SIM_MODEL_SUBCKT_PARSER::param>() )
else if( subnode->is_type<SIM_MODEL_SUBCKT_SPICE_PARSER::param>() )
{
m_paramInfos.push_back( std::make_unique<PARAM::INFO>() );
m_paramInfos.back()->name = subnode->string();
m_paramInfos.back()->isInstanceParam = true;
m_paramInfos.back()->isSpiceInstanceParam = true;
AddParam( *m_paramInfos.back() );
}
else if( subnode->is_type<
SIM_MODEL_SUBCKT_PARSER::number<SIM_VALUE::TYPE::INT,
SIM_MODEL_SUBCKT_PARSER::NOTATION::SPICE>>()
SIM_MODEL_SUBCKT_SPICE_PARSER::number<SIM_VALUE::TYPE::INT,
SIM_MODEL_SUBCKT_SPICE_PARSER::NOTATION::SPICE>>()
|| subnode->is_type<
SIM_MODEL_SUBCKT_PARSER::number<SIM_VALUE::TYPE::FLOAT,
SIM_MODEL_SUBCKT_PARSER::NOTATION::SPICE>>() )
SIM_MODEL_SUBCKT_SPICE_PARSER::number<SIM_VALUE::TYPE::FLOAT,
SIM_MODEL_SUBCKT_SPICE_PARSER::NOTATION::SPICE>>() )
{
wxASSERT( m_paramInfos.size() > 0 );
m_paramInfos.back()->defaultValue = subnode->string();

View File

@ -34,11 +34,13 @@ public:
SIM_MODEL_SUBCKT( TYPE aType );
bool ReadSpiceCode( const std::string& aSpiceCode ) override;
wxString GenerateSpiceModelLine( const wxString& aModelName ) const;
wxString GenerateSpiceModelLine( const wxString& aModelName ) const override;
std::vector<wxString> GenerateSpiceCurrentNames( const wxString& aRefName ) const override;
void SetBaseModel( const SIM_MODEL& aBaseModel ) override;
private:
bool requiresSpiceModel() const override { return true; }
std::vector<std::unique_ptr<PARAM::INFO>> m_paramInfos;
};

View File

@ -0,0 +1,151 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mikolaj Wielgus
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* https://www.gnu.org/licenses/gpl-3.0.html
* or you may search the http://www.gnu.org website for the version 3 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sim/sim_model_tline.h>
using PARAM = SIM_MODEL::PARAM;
SIM_MODEL_TLINE::SIM_MODEL_TLINE( TYPE aType )
: SIM_MODEL( aType )
{
static std::vector<PARAM::INFO> z0 = makeZ0ParamInfo();
static std::vector<PARAM::INFO> rlgc = makeRlgcParamInfo();
switch( aType )
{
case TYPE::TLINE_Z0:
for( const PARAM::INFO& paramInfo : z0 )
AddParam( paramInfo );
break;
case TYPE::TLINE_RLGC:
for( const PARAM::INFO& paramInfo : rlgc )
AddParam( paramInfo );
break;
default:
wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_TLINE" );
}
}
/*wxString SIM_MODEL_TLINE::GenerateSpiceItemName( const wxString& aRefName ) const
{
}*/
std::vector<PARAM::INFO> SIM_MODEL_TLINE::makeZ0ParamInfo()
{
std::vector<PARAM::INFO> paramInfos;
PARAM::INFO paramInfo = {};
paramInfo.name = "z0";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "Ω";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Characteristic impedance";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = true;
paramInfos.push_back( paramInfo );
paramInfo.name = "td";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "s";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Transmission delay";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = true;
paramInfos.push_back( paramInfo );
return paramInfos;
}
std::vector<PARAM::INFO> SIM_MODEL_TLINE::makeRlgcParamInfo()
{
std::vector<PARAM::INFO> paramInfos;
PARAM::INFO paramInfo = {};
paramInfo.name = "len";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "m";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "";
paramInfo.description = "Length";
paramInfo.isInstanceParam = true;
paramInfo.isSpiceInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "r";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "Ω/m";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "0";
paramInfo.description = "Resistance per length";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "l";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "H/m";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "0";
paramInfo.description = "Inductance per length";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "g";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "1/(Ω m)";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "0";
paramInfo.description = "Conductance per length";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = false;
paramInfos.push_back( paramInfo );
paramInfo.name = "c";
paramInfo.type = SIM_VALUE::TYPE::FLOAT;
paramInfo.unit = "C/m";
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.defaultValue = "0";
paramInfo.description = "Capacitance per length";
paramInfo.isInstanceParam = false;
paramInfo.isSpiceInstanceParam = false;
paramInfos.push_back( paramInfo );
return paramInfos;
}
bool SIM_MODEL_TLINE::requiresSpiceModel() const
{
return GetType() == TYPE::TLINE_RLGC;
}

View File

@ -0,0 +1,46 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 Mikolaj Wielgus
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* https://www.gnu.org/licenses/gpl-3.0.html
* or you may search the http://www.gnu.org website for the version 3 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef SIM_MODEL_TLINE_H
#define SIM_MODEL_TLINE_H
#include <sim/sim_model.h>
class SIM_MODEL_TLINE : public SIM_MODEL
{
public:
SIM_MODEL_TLINE( TYPE aType );
private:
static std::vector<PARAM::INFO> makeZ0ParamInfo();
static std::vector<PARAM::INFO> makeRlgcParamInfo();
std::vector<wxString> getPinNames() const override { return { "1+", "1-", "2+", "2-" }; }
// Subcircuits require models even when they have no Spice instance parameters.
bool requiresSpiceModel() const override;
};
#endif // SIM_MODEL_TLINE_H

View File

@ -26,6 +26,7 @@
#define SIM_PROPERTY_H
#include <sim/sim_model.h>
#include <wx/window.h>
#include <wx/propgrid/props.h>

View File

@ -30,35 +30,35 @@
#include <pegtl/contrib/parse_tree.hpp>
#define CALL_INSTANCE( ValueType, Notation, func, ... ) \
switch( ValueType ) \
{ \
#define CALL_INSTANCE( ValueType, Notation, func, ... ) \
switch( ValueType ) \
{ \
case SIM_VALUE::TYPE::INT: \
switch( Notation ) \
{ \
case NOTATION::SI: \
switch( Notation ) \
{ \
case NOTATION::SI: \
func<SIM_VALUE::TYPE::INT, NOTATION::SI>( __VA_ARGS__ ); \
break; \
\
case NOTATION::SPICE: \
break; \
\
case NOTATION::SPICE: \
func<SIM_VALUE::TYPE::INT, NOTATION::SPICE>( __VA_ARGS__ ); \
break; \
} \
break; \
\
break; \
} \
break; \
\
case SIM_VALUE::TYPE::FLOAT: \
switch( Notation ) \
{ \
case NOTATION::SI: \
switch( Notation ) \
{ \
case NOTATION::SI: \
func<SIM_VALUE::TYPE::FLOAT, NOTATION::SI>( __VA_ARGS__ ); \
break; \
\
case NOTATION::SPICE: \
break; \
\
case NOTATION::SPICE: \
func<SIM_VALUE::TYPE::FLOAT, NOTATION::SPICE>( __VA_ARGS__ ); \
break; \
} \
break; \
\
break; \
} \
break; \
\
case SIM_VALUE::TYPE::BOOL: \
case SIM_VALUE::TYPE::COMPLEX: \
case SIM_VALUE::TYPE::STRING: \
@ -67,7 +67,7 @@
case SIM_VALUE::TYPE::FLOAT_VECTOR: \
case SIM_VALUE::TYPE::COMPLEX_VECTOR: \
wxFAIL_MSG( "Unhandled SIM_VALUE type" ); \
break; \
break; \
}
@ -215,7 +215,7 @@ SIM_VALUE_PARSER::PARSE_RESULT SIM_VALUE_PARSER::Parse( const wxString& aString,
CALL_INSTANCE( aValueType, aNotation, handleNodeForParse, *node, result );
}
}
catch( std::invalid_argument& e )
catch( const std::invalid_argument& e )
{
wxFAIL_MSG( wxString::Format( "Parsing simulator value failed: %s", e.what() ) );
result.isOk = false;
@ -437,7 +437,7 @@ bool SIM_VALUE_INSTANCE<long>::FromString( const wxString& aString, NOTATION aNo
if( parseResult.isEmpty )
return true;
if( !parseResult.intPart || parseResult.fracPart )
if( !parseResult.intPart || ( parseResult.fracPart && *parseResult.fracPart != 0 ) )
return false;
long exponent = parseResult.exponent ? *parseResult.exponent : 0;
@ -543,7 +543,7 @@ wxString SIM_VALUE_INSTANCE<long>::ToString( NOTATION aNotation ) const
if( m_value )
{
long value = *m_value;
long value = std::abs( *m_value );
long exponent = 0;
while( value != 0 && value % 1000 == 0 )
@ -555,7 +555,7 @@ wxString SIM_VALUE_INSTANCE<long>::ToString( NOTATION aNotation ) const
long dummy = 0;
wxString metricSuffix = SIM_VALUE_PARSER::ExponentToMetricSuffix(
static_cast<double>( exponent ), dummy, aNotation );
return wxString::Format( "%d%s", value, metricSuffix );
return wxString::Format( "%ld%s", value, metricSuffix );
}
return "";
@ -569,11 +569,12 @@ wxString SIM_VALUE_INSTANCE<double>::ToString( NOTATION aNotation ) const
if( m_value )
{
double exponent = std::log10( *m_value );
double exponent = std::log10( std::abs( *m_value ) );
long reductionExponent = 0;
wxString metricSuffix = SIM_VALUE_PARSER::ExponentToMetricSuffix( exponent,
reductionExponent );
reductionExponent,
aNotation );
double reducedValue = *m_value / std::pow( 10, reductionExponent );
return wxString::Format( "%g%s", reducedValue, metricSuffix );
@ -637,10 +638,10 @@ wxString SIM_VALUE_INSTANCE<std::complex<double>>::ToSimpleString() const
template <typename T>
bool SIM_VALUE_INSTANCE<T>::operator==( const SIM_VALUE& aOther ) const
{
const SIM_VALUE_INSTANCE* otherNumber = dynamic_cast<const SIM_VALUE_INSTANCE*>( &aOther );
const SIM_VALUE_INSTANCE* otherValue = dynamic_cast<const SIM_VALUE_INSTANCE*>( &aOther );
if( otherNumber )
return m_value == otherNumber->m_value;
if( otherValue )
return m_value == otherValue->m_value;
return false;
}

View File

@ -111,7 +111,7 @@ namespace SIM_VALUE_GRAMMAR
struct sign : one<'+', '-'> {};
struct intPart : digits {};
struct intPart : seq<opt<sign>, digits> {};
//struct fracPartPrefix : one<'.'> {};
struct fracPart : digits {};

View File

@ -33,46 +33,86 @@ namespace SPICE_GRAMMAR
using namespace SIM_VALUE_GRAMMAR;
struct eolComment : seq<one<';'>, until<eol>> {};
struct commentLine : seq<one<'*', ';'>, until<eol>> {};
struct garbage : plus<one<' ', '\t', '=', '(', ')', ','>> {};
struct leaders : plus<one<' ', '\t'>> {};
struct trailers : plus<one<' ', '\t', '\v', '\f'>> {};
// NOTE: In Ngspice, a '$' opening a comment must be preceded by ' ', ',', or '\t'. We don't
// implement that here - this may cause problems in the future.
// Ngspice supports '//' for comments.
struct eolCommentStart : sor<one<';', '$'>,
string<'/', '/'>> {};
struct eolComment : seq<eolCommentStart,
until<eol>> {};
struct commentLine : seq<opt<garbage>,
one<'*'>,
until<eol>> {};
struct linespaces : plus<not_at<eol>,
space> {};
struct newline : seq<sor<eol,
eolComment>,
not_at<one<'+'>>> {};
struct continuation : seq<opt<linespaces>,
sor<eol,
eolComment>,
star<commentLine>,
one<'+'>,
opt<linespaces>> {};
struct sep : sor<continuation,
linespaces> {};
struct backslashContinuation : seq<string<'\\', '\\'>,
opt<trailers>,
eol> {};
struct commentBackslashContinuation : seq<eolCommentStart,
seq<star<not_at<eol>,
not_at<string<'\\', '\\'>,
opt<trailers>,
eol>,
any>,
string<'\\', '\\'>,
opt<trailers>,
eol>> {};
struct param : plus<alnum> {};
struct suffixUnit : plus<alpha> {};
struct plusContinuation : seq<sor<eol,
eolComment>,
star<commentLine>,
opt<leaders>,
one<'+'>> {};
struct continuation : seq<opt<garbage>,
sor<backslashContinuation,
commentBackslashContinuation,
plusContinuation>,
opt<garbage>> {};
struct sep : sor<plus<continuation>,
garbage> {};
// Ngspice has some heuristic logic to allow + and - in tokens. We mimic that here.
struct tokenStart : seq<opt<one<'+', '-'>>,
opt<seq<star<sor<tao::pegtl::digit,
one<'.'>>>,
one<'e', 'E'>,
opt<one<'+', '-'>>>>> {};
struct token : seq<tokenStart,
star<not_at<eol>,
not_at<backslashContinuation>,
not_one<' ', '\t', '=', '(', ')', ',', '+', '-', '*', '/', '^', ';'>>>
{};
struct param : token {};
struct paramValue : token {};
template <SIM_VALUE::TYPE Type, NOTATION Notation>
struct paramValuePair : seq<param,
opt<sep>,
one<'='>,
opt<sep>,
number<Type, Notation>,
opt<suffixUnit>> {};
template <NOTATION Notation>
struct paramValuePairs : seq<opt<paramValuePair<SIM_VALUE::TYPE::FLOAT,
Notation>,
sep,
paramValue> {};
struct paramValuePairs : seq<opt<paramValuePair,
star<sep,
paramValuePair<SIM_VALUE::TYPE::FLOAT,
Notation>>>> {};
struct modelName : plus<alnum,
star<sor<alnum,
one<'!', '#', '$', '%', '[', ']', '_'>>>> {};
paramValuePair>>> {};
struct modelName : star<sor<alnum,
one<'!', '#', '$', '%', '[', ']', '_'>>> {};
/*seq<alpha,
star<sor<alnum,
one<'!', '#', '$', '%', '[', ']', '_'>>>> {};*/
@ -100,15 +140,15 @@ namespace SPICE_GRAMMAR
modelName,
sep,
dotModelType,
sor<seq<opt<sep>,
one<'('>,
opt<sep>,
paramValuePairs<NOTATION::SPICE>,
opt<sep>,
// Ngspice doesn't require the parentheses to match, though.
one<')'>>,
seq<sep,
paramValuePairs<NOTATION::SPICE>>>,
opt<sor<seq<opt<sep>,
one<'('>,
opt<sep>,
paramValuePairs,
opt<sep>,
// Ngspice doesn't require the parentheses to match, though.
one<')'>>,
seq<sep,
paramValuePairs>>>,
opt<sep>,
newline> {};
@ -131,7 +171,7 @@ namespace SPICE_GRAMMAR
opt<sep,
TAO_PEGTL_ISTRING( "params:" ),
sep,
paramValuePairs<NOTATION::SPICE>>,
paramValuePairs>,
opt<sep>,
newline,
until<dotSubcktEnd>> {};

View File

@ -0,0 +1,626 @@
*
* bjts.lib.spice
*
* All parameter values are made up and physically nonsensical.
* Commented out some parameters to avoid making test code overly long.
* First, Gummel-Poon.
*
.MODEL _0_NPN_GUMMELPOON NPN(
+ IS=000.000E+07
+ NF=100.001E+07
+ ISE=200.002E+07
+ NE=300.003E+07
+ BF=400.004E+07
+ IKF=500.005E+07
+ VAF=600.006E+07
+ NR=700.007E+07
+ ISC=800.008E+07
+ NC=900.009E+07
+)
*+ BR=1.111E-05
*+ IKR=2.222E-04
*+ VAR=3.333E-03
*+ RB=4.444E-02
*+ IRB=5.555E-01
*+ RBM=6.666E-00
*+ RE=7.777E*+01
*+ RC=8.888E*+02
*+ XTB=9.999E*+03
*+ EG=0.000E*+04
*+ XTI=1.111E*+05
*+ CJE=2.222E*+06
*+ VJE=3.333E*+07
*+ MJE=4.444E*+08
*+ TF=5.555E*+09
*+ XTF=6.666E*+10
*+ VTF=7.777E*+11
*+ ITF=8.888E*+12
*+ PTF=9.999E*+13
*+ CJC=0.000E*+14
*+ VJC=1.111E*+15
*+ MJC=2.2222
*+ XCJC=3.3333
*+ TR=4.4444
*+ CJS=5.5555
*+ VJS=6.6666
*+ MJS=7.7777
*+ FC=8.8888 )
*
*
.MODEL _1_PNP_GUMMELPOON PNP( level = 1. ; Decimal separator must be accepted too.
+ IS=000.000E+07
+ NF=100.001E+07
+ ISE=200.002E+07
+ NE=300.003E+07
+ BF=400.004E+07
+ IKF=500.005E+07
+ VAF=600.006E+07
+ NR=700.007E+07
+ ISC=800.008E+07
+ NC=900.009E+07
+)
*+ BR=1.111E-05
*+ IKR=2.222E-04
*+ VAR=3.333E-03
*+ RB=4.444E-02
*+ IRB=5.555E-01
*+ RBM=6.666E-00
*+ RE=7.777E*+01
*+ RC=8.888E*+02
*+ XTB=9.999E*+03
*+ EG=0.000E*+04
*+ XTI=1.111E*+05
*+ CJE=2.222E*+06
*+ VJE=3.333E*+07
*+ MJE=4.444E*+08
*+ TF=5.555E*+09
*+ XTF=6.666E*+10
*+ VTF=7.777E*+11
*+ ITF=8.888E*+12
*+ PTF=9.999E*+13
*+ CJC=0.000E*+14
*+ VJC=1.111E*+15
*+ MJC=2.2222
*+ XCJC=3.3333
*+ TR=4.4444
*+ CJS=5.5555
*+ VJS=6.6666
*+ MJS=7.7777
*+ FC=8.8888 )
*
* VBIC.
.model _2_NPN_VBIC NPN( level=4
+ rcx = 000.000E+07
+ rci = 100.001E+07
+ vo = 200.002E+07
+ gamm = 300.003E+07
+ hrcf = 400.004E+07
+ rbx = 500.005E+07
+ rbi = 600.006E+07
+ re = 700.007E+07
+ rs = 800.008E+07
+ rbp = 900.009E+07
+)
*+ is = 123.456E+07
*+ nf = 123.456E+07
*+ nr = 123.456E+07
*+ fc = 123.456E+07
*+ cbeo = 123.456E+07
*+ cje = 123.456E+07
*+ pe = 123.456E+07
*+ me = 123.456E+07
*+ aje = 123.456E+07
*+ cbco = 123.456E+07
*+ cjc = 123.456E+07
*+ qco = 123.456E+07
*+ cjep = 123.456E+07
*+ pc = 123.456E+07
*+ mc = 123.456E+07
*+ ajc = 123.456E+07
*+ cjcp = 123.456E+07
*+ ps = 123.456E+07
*+ ms = 123.456E+07
*+ ajs = 123.456E+07
*+ ibei = 123.456E+07
*+ wbe = 123.456E+07
*+ nei = 123.456E+07
*+ iben = 123.456E+07
*+ nen = 123.456E+07
*+ ibci = 123.456E+07
*+ nci = 123.456E+07
*+ ibcn = 123.456E+07
*+ ncn = 123.456E+07
*+ avc1 = 123.456E+07
*+ avc2 = 123.456E+07
*+ isp = 123.456E+07
*+ wsp = 123.456E+07
*+ nfp = 123.456E+07
*+ ibeip = 123.456E+07
*+ ibenp = 123.456E+07
*+ ibcip = 123.456E+07
*+ ncip = 123.456E+07
*+ ibcnp = 123.456E+07
*+ ncnp = 123.456E+07
*+ vef = 123.456E+07
*+ ver = 123.456E+07
*+ ikf = 123.456E+07
*+ ikr = 123.456E+07
*+ ikp = 123.456E+07
*+ tf = 123.456E+07
*+ qtf = 123.456E+07
*+ xtf = 123.456E+07
*+ vtf = 123.456E+07
*+ itf = 123.456E+07
*+ tr = 123.456E+07
*+ td = 123.456E+07
*+ kfn = 123.456E+07
*+ afn = 123.456E+07
*+ bfn = 123.456E+07
*+ xre = 123.456E+07
*+ xrb = 123.456E+07
*+ xrbi = 123.456E+07
*+ xrc = 123.456E+07
*+ xrci = 123.456E+07
*+ xrs = 123.456E+07
*+ xvo = 123.456E+07
*+ ea = 123.456E+07
*+ eaie = 123.456E+07
*+ eaic = 123.456E+07
*+ eais = 123.456E+07
*+ eane = 123.456E+07
*+ eanc = 123.456E+07
*+ eans = 123.456E+07
*+ xis = 123.456E+07
*+ xii = 123.456E+07
*+ xin = 123.456E+07
*+ tnf = 123.456E+07
*+ tavc = 123.456E+07
*+ rth = 123.456E+07
*+ cth = 123.456E+07
*+ vrt = 123.456E+07
*+ art = 123.456E+07
*+ ccso = 123.456E+07
*+ qbm = 123.456E+07
*+ nkf = 123.456E+07
*+ xikf = 123.456E+07
*+ xrcx = 123.456E+07
*+ xrbx = 123.456E+07
*+ xrbp = 123.456E+07
*+ isrr = 123.456E+07
*+ xisr = 123.456E+07
*+ dear = 123.456E+07
*+ eap = 123.456E+07
*+ vbbe = 123.456E+07
*+ nbbe = 123.456E+07
*+ ibbe = 123.456E+07
*+ tvbbe1 = 123.456E+07
*+ tvbbe2 = 123.456E+07
*+ tnbbe = 123.456E+07
*+ ebbe = 123.456E+07
*+ dtemp = 123.456E+07
*+ vers = 123.456E+07
*+ vref = 123.456E+07
*+ vbe_max = 123.456E+07
*+ vbc_max = 123.456E+07
*+ vce_max = 123.456E+07
*+)
.model _3_PNP_VBIC PNP( level=4.0
+ rcx = 000.000E+07
+ rci = 100.001E+07
+ vo = 200.002E+07
+ gamm = 300.003E+07
+ hrcf = 400.004E+07
+ rbx = 500.005E+07
+ rbi = 600.006E+07
+ re = 700.007E+07
+ rs = 800.008E+07
+ rbp = 900.009E+07
+)
*+ is = 123.456E+07
*+ nf = 123.456E+07
*+ nr = 123.456E+07
*+ fc = 123.456E+07
*+ cbeo = 123.456E+07
*+ cje = 123.456E+07
*+ pe = 123.456E+07
*+ me = 123.456E+07
*+ aje = 123.456E+07
*+ cbco = 123.456E+07
*+ cjc = 123.456E+07
*+ qco = 123.456E+07
*+ cjep = 123.456E+07
*+ pc = 123.456E+07
*+ mc = 123.456E+07
*+ ajc = 123.456E+07
*+ cjcp = 123.456E+07
*+ ps = 123.456E+07
*+ ms = 123.456E+07
*+ ajs = 123.456E+07
*+ ibei = 123.456E+07
*+ wbe = 123.456E+07
*+ nei = 123.456E+07
*+ iben = 123.456E+07
*+ nen = 123.456E+07
*+ ibci = 123.456E+07
*+ nci = 123.456E+07
*+ ibcn = 123.456E+07
*+ ncn = 123.456E+07
*+ avc1 = 123.456E+07
*+ avc2 = 123.456E+07
*+ isp = 123.456E+07
*+ wsp = 123.456E+07
*+ nfp = 123.456E+07
*+ ibeip = 123.456E+07
*+ ibenp = 123.456E+07
*+ ibcip = 123.456E+07
*+ ncip = 123.456E+07
*+ ibcnp = 123.456E+07
*+ ncnp = 123.456E+07
*+ vef = 123.456E+07
*+ ver = 123.456E+07
*+ ikf = 123.456E+07
*+ ikr = 123.456E+07
*+ ikp = 123.456E+07
*+ tf = 123.456E+07
*+ qtf = 123.456E+07
*+ xtf = 123.456E+07
*+ vtf = 123.456E+07
*+ itf = 123.456E+07
*+ tr = 123.456E+07
*+ td = 123.456E+07
*+ kfn = 123.456E+07
*+ afn = 123.456E+07
*+ bfn = 123.456E+07
*+ xre = 123.456E+07
*+ xrb = 123.456E+07
*+ xrbi = 123.456E+07
*+ xrc = 123.456E+07
*+ xrci = 123.456E+07
*+ xrs = 123.456E+07
*+ xvo = 123.456E+07
*+ ea = 123.456E+07
*+ eaie = 123.456E+07
*+ eaic = 123.456E+07
*+ eais = 123.456E+07
*+ eane = 123.456E+07
*+ eanc = 123.456E+07
*+ eans = 123.456E+07
*+ xis = 123.456E+07
*+ xii = 123.456E+07
*+ xin = 123.456E+07
*+ tnf = 123.456E+07
*+ tavc = 123.456E+07
*+ rth = 123.456E+07
*+ cth = 123.456E+07
*+ vrt = 123.456E+07
*+ art = 123.456E+07
*+ ccso = 123.456E+07
*+ qbm = 123.456E+07
*+ nkf = 123.456E+07
*+ xikf = 123.456E+07
*+ xrcx = 123.456E+07
*+ xrbx = 123.456E+07
*+ xrbp = 123.456E+07
*+ isrr = 123.456E+07
*+ xisr = 123.456E+07
*+ dear = 123.456E+07
*+ eap = 123.456E+07
*+ vbbe = 123.456E+07
*+ nbbe = 123.456E+07
*+ ibbe = 123.456E+07
*+ tvbbe1 = 123.456E+07
*+ tvbbe2 = 123.456E+07
*+ tnbbe = 123.456E+07
*+ ebbe = 123.456E+07
*+ dtemp = 123.456E+07
*+ vers = 123.456E+07
*+ vref = 123.456E+07
*+ vbe_max = 123.456E+07
*+ vbc_max = 123.456E+07
*+ vce_max = 123.456E+07
*+)
* HICUM/L2
.model _4_NPN_HICUML2 NPN( level=8.00
+ c10 = 000.000E+07
+ qp0 = 100.001E+07
+ ich = 200.002E+07
+ hf0 = 300.003E+07
+ hfe = 400.004E+07
+ hfc = 500.005E+07
+ hjei = 600.006E+07
+ ahjei = 700.007E+07
+ rhjei = 800.008E+07
+ hjci = 900.009E+07
+)
*+ ibeis = 123.456E+07
*+ mbei = 123.456E+07
*+ ireis = 123.456E+07
*+ mrei = 123.456E+07
*+ ibeps = 123.456E+07
*+ mbep = 123.456E+07
*+ ireps = 123.456E+07
*+ mrep = 123.456E+07
*+ mcf = 123.456E+07
*+ tbhrec = 123.456E+07
*+ ibcis = 123.456E+07
*+ mbci = 123.456E+07
*+ ibcxs = 123.456E+07
*+ mbcx = 123.456E+07
*+ ibets = 123.456E+07
*+ abet = 123.456E+07
*+ tunode = 123.456E+07
*+ favl = 123.456E+07
*+ qavl = 123.456E+07
*+ kavl = 123.456E+07
*+ alfav = 123.456E+07
*+ alqav = 123.456E+07
*+ alkav = 123.456E+07
*+ rbi0 = 123.456E+07
*+ rbx = 123.456E+07
*+ fgeo = 123.456E+07
*+ fdqr0 = 123.456E+07
*+ fcrbi = 123.456E+07
*+ fqi = 123.456E+07
*+ re = 123.456E+07
*+ rcx = 123.456E+07
*+ itss = 123.456E+07
*+ msf = 123.456E+07
*+ iscs = 123.456E+07
*+ msc = 123.456E+07
*+ tsf = 123.456E+07
*+ rsu = 123.456E+07
*+ csu = 123.456E+07
*+ cjei0 = 123.456E+07
*+ vdei = 123.456E+07
*+ zei = 123.456E+07
*+ ajei = 123.456E+07
*+ aljei = 123.456E+07
*+ cjep0 = 123.456E+07
*+ vdep = 123.456E+07
*+ zep = 123.456E+07
*+ ajep = 123.456E+07
*+ aljep = 123.456E+07
*+ cjci0 = 123.456E+07
*+ vdci = 123.456E+07
*+ zci = 123.456E+07
*+ vptci = 123.456E+07
*+ cjcx0 = 123.456E+07
*+ vdcx = 123.456E+07
*+ zcx = 123.456E+07
*+ vptcx = 123.456E+07
*+ fbcpar = 123.456E+07
*+ fbc = 123.456E+07
*+ fbepar = 123.456E+07
*+ fbe = 123.456E+07
*+ cjs0 = 123.456E+07
*+ vds = 123.456E+07
*+ zs = 123.456E+07
*+ vpts = 123.456E+07
*+ cscp0 = 123.456E+07
*+ vdsp = 123.456E+07
*+ zsp = 123.456E+07
*+ vptsp = 123.456E+07
*+ t0 = 123.456E+07
*+ dt0h = 123.456E+07
*+ tbvl = 123.456E+07
*+ tef0 = 123.456E+07
*+ gtfe = 123.456E+07
*+ thcs = 123.456E+07
*+ ahc = 123.456E+07
*+ alhc = 123.456E+07
*+ fthc = 123.456E+07
*+ rci0 = 123.456E+07
*+ vlim = 123.456E+07
*+ vces = 123.456E+07
*+ vpt = 123.456E+07
*+ aick = 123.456E+07
*+ delck = 123.456E+07
*+ tr = 123.456E+07
*+ vcbar = 123.456E+07
*+ icbar = 123.456E+07
*+ acbar = 123.456E+07
*+ cbepar = 123.456E+07
*+ ceox = 123.456E+07
*+ cbcpar = 123.456E+07
*+ ccox = 123.456E+07
*+ alqf = 123.456E+07
*+ alit = 123.456E+07
*+ flnqs = 123.456E+07
*+ kf = 123.456E+07
*+ af = 123.456E+07
*+ cfbe = 123.456E+07
*+ flcono = 123.456E+07
*+ kfre = 123.456E+07
*+ afre = 123.456E+07
*+ latb = 123.456E+07
*+ latl = 123.456E+07
*+ vgb = 123.456E+07
*+ alt0 = 123.456E+07
*+ kt0 = 123.456E+07
*+ zetaci = 123.456E+07
*+ alvs = 123.456E+07
*+ alces = 123.456E+07
*+ zetarbi = 123.456E+07
*+ zetarbx = 123.456E+07
*+ zetarcx = 123.456E+07
*+ zetare = 123.456E+07
*+ zetacx = 123.456E+07
*+ vge = 123.456E+07
*+ vgc = 123.456E+07
*+ vgs = 123.456E+07
*+ f1vg = 123.456E+07
*+ f2vg = 123.456E+07
*+ zetact = 123.456E+07
*+ zetabet = 123.456E+07
*+ alb = 123.456E+07
*+ dvgbe = 123.456E+07
*+ zetahjei = 123.456E+07
*+ zetavgbe = 123.456E+07
*+ flsh = 123.456E+07
*+ rth = 123.456E+07
*+ zetarth = 123.456E+07
*+ alrth = 123.456E+07
*+ cth = 123.456E+07
*+ flcomp = 123.456E+07
*+ vbe_max = 123.456E+07
*+ vbc_max = 123.456E+07
*+ vce_max = 123.456E+07
*+)
.model _5_PNP_HICUML2 PNP( level=8
+ c10 = 000.000E+07
+ qp0 = 100.001E+07
+ ich = 200.002E+07
+ hf0 = 300.003E+07
+ hfe = 400.004E+07
+ hfc = 500.005E+07
+ hjei = 600.006E+07
+ ahjei = 700.007E+07
+ rhjei = 800.008E+07
+ hjci = 900.009E+07
+)
*+ ibeis = 123.456E+07
*+ mbei = 123.456E+07
*+ ireis = 123.456E+07
*+ mrei = 123.456E+07
*+ ibeps = 123.456E+07
*+ mbep = 123.456E+07
*+ ireps = 123.456E+07
*+ mrep = 123.456E+07
*+ mcf = 123.456E+07
*+ tbhrec = 123.456E+07
*+ ibcis = 123.456E+07
*+ mbci = 123.456E+07
*+ ibcxs = 123.456E+07
*+ mbcx = 123.456E+07
*+ ibets = 123.456E+07
*+ abet = 123.456E+07
*+ tunode = 123.456E+07
*+ favl = 123.456E+07
*+ qavl = 123.456E+07
*+ kavl = 123.456E+07
*+ alfav = 123.456E+07
*+ alqav = 123.456E+07
*+ alkav = 123.456E+07
*+ rbi0 = 123.456E+07
*+ rbx = 123.456E+07
*+ fgeo = 123.456E+07
*+ fdqr0 = 123.456E+07
*+ fcrbi = 123.456E+07
*+ fqi = 123.456E+07
*+ re = 123.456E+07
*+ rcx = 123.456E+07
*+ itss = 123.456E+07
*+ msf = 123.456E+07
*+ iscs = 123.456E+07
*+ msc = 123.456E+07
*+ tsf = 123.456E+07
*+ rsu = 123.456E+07
*+ csu = 123.456E+07
*+ cjei0 = 123.456E+07
*+ vdei = 123.456E+07
*+ zei = 123.456E+07
*+ ajei = 123.456E+07
*+ aljei = 123.456E+07
*+ cjep0 = 123.456E+07
*+ vdep = 123.456E+07
*+ zep = 123.456E+07
*+ ajep = 123.456E+07
*+ aljep = 123.456E+07
*+ cjci0 = 123.456E+07
*+ vdci = 123.456E+07
*+ zci = 123.456E+07
*+ vptci = 123.456E+07
*+ cjcx0 = 123.456E+07
*+ vdcx = 123.456E+07
*+ zcx = 123.456E+07
*+ vptcx = 123.456E+07
*+ fbcpar = 123.456E+07
*+ fbc = 123.456E+07
*+ fbepar = 123.456E+07
*+ fbe = 123.456E+07
*+ cjs0 = 123.456E+07
*+ vds = 123.456E+07
*+ zs = 123.456E+07
*+ vpts = 123.456E+07
*+ cscp0 = 123.456E+07
*+ vdsp = 123.456E+07
*+ zsp = 123.456E+07
*+ vptsp = 123.456E+07
*+ t0 = 123.456E+07
*+ dt0h = 123.456E+07
*+ tbvl = 123.456E+07
*+ tef0 = 123.456E+07
*+ gtfe = 123.456E+07
*+ thcs = 123.456E+07
*+ ahc = 123.456E+07
*+ alhc = 123.456E+07
*+ fthc = 123.456E+07
*+ rci0 = 123.456E+07
*+ vlim = 123.456E+07
*+ vces = 123.456E+07
*+ vpt = 123.456E+07
*+ aick = 123.456E+07
*+ delck = 123.456E+07
*+ tr = 123.456E+07
*+ vcbar = 123.456E+07
*+ icbar = 123.456E+07
*+ acbar = 123.456E+07
*+ cbepar = 123.456E+07
*+ ceox = 123.456E+07
*+ cbcpar = 123.456E+07
*+ ccox = 123.456E+07
*+ alqf = 123.456E+07
*+ alit = 123.456E+07
*+ flnqs = 123.456E+07
*+ kf = 123.456E+07
*+ af = 123.456E+07
*+ cfbe = 123.456E+07
*+ flcono = 123.456E+07
*+ kfre = 123.456E+07
*+ afre = 123.456E+07
*+ latb = 123.456E+07
*+ latl = 123.456E+07
*+ vgb = 123.456E+07
*+ alt0 = 123.456E+07
*+ kt0 = 123.456E+07
*+ zetaci = 123.456E+07
*+ alvs = 123.456E+07
*+ alces = 123.456E+07
*+ zetarbi = 123.456E+07
*+ zetarbx = 123.456E+07
*+ zetarcx = 123.456E+07
*+ zetare = 123.456E+07
*+ zetacx = 123.456E+07
*+ vge = 123.456E+07
*+ vgc = 123.456E+07
*+ vgs = 123.456E+07
*+ f1vg = 123.456E+07
*+ f2vg = 123.456E+07
*+ zetact = 123.456E+07
*+ zetabet = 123.456E+07
*+ alb = 123.456E+07
*+ dvgbe = 123.456E+07
*+ zetahjei = 123.456E+07
*+ zetavgbe = 123.456E+07
*+ flsh = 123.456E+07
*+ rth = 123.456E+07
*+ zetarth = 123.456E+07
*+ alrth = 123.456E+07
*+ cth = 123.456E+07
*+ flcomp = 123.456E+07
*+ vbe_max = 123.456E+07
*+ vbc_max = 123.456E+07
*+ vce_max = 123.456E+07
*+)

View File

@ -0,0 +1,132 @@
*
* diodes.lib
*
* Some diode models to test if reading Spice libraries works.
* Not really 1N4148, just shoddily based on some values in datasheet.
.MODEL 1N4148 D (BV=100 CJO=4p IBV=100u IS=4n M=0.33 N=2
+ RS=0.5 TT=10n VJ=0.8)
* The below models have made up values - I didn't bother to check if they are physically correct.
.model D1 D(Is=1.23n N=1.23 Rs=.7890 Ikf=12.34m Xti=3 Eg=1.23 Cjo=.90p
+ M=.56 Vj=.78 Fc=.9 Isr=12.34n Nr=2.345 Bv=100 Ibv=100u Tt=12.34n)
* This line has a single trailing space.
* DUsual* models always have the same values to save space on test asserts.
.model D2_Usual D(BV=1.1U CJO=2.2M IBV=3.3 IS=4.4K M=5.5MEG N=6.6G)
* Trailing spaces, and an (empty) continuation.
.model D3_Usual D(BV=1.1U CJO=2.2M IBV=3.3 IS=4.4K M=5.5MEG N=6.6G
+)
.model D4 D( Is=0.1p
+ Rs=2
+ CJO=3p
+ Tt=45n ; Test comment
+ Bv=678
+ Ibv=0.1p )
* (Has trailing spaces after each parameter value)
.model D5_Empty D () ; Empty model
* Parentheses are optional.
.model D6_Empty D
.model D7_Empty D ; Empty model, no parentheses, ending with a comment.
.model D8_Empty D
.model D9_Empty D;
* Several parameters, no parentheses.
.model D10_Usual D BV=1.1U CJO=2.2M IBV=3.3 IS=4.4K M=5.5MEG N=6.6G
* Several parameters, no parentheses, multiple lines, backslash continuations.
.model D11_Usual D BV=1.1U \\
CJO=2.2M
+ IBV=3.3;
+ IS=4.4K ; Test comment
+ M=5.5MEG\\
N=6.6G
.model D12_Usual D
+BV=1.1U
+CJO=2.2M
+IBV=3.3;
+IS=4.4K;
+M=5.5MEG
+N=6.6G
* Test some parameter synonyms.
.model D13_Usual D
+ BV=1.1U
+ CJ0=2.2M
+ IBV=3.3
+ JS=4.4K
+ MJ=5.5MEG
+ N=6.6G
.model D14_Usual D
+ BV=1.1U
+ CJ=2.2M
+ IBV=3.3
+ JS=4.4K
+ MJ=5.5MEG
+ N=6.6G
* Two spaces as a separator everywhere, two leading, two trailing spaces.
.model D15_Usual D ( BV=1.1U CJ=2.2M IBV=3.3 JS=4.4K MJ=5.5MEG N=6.6G )
* Spaces aligning param names and values.
* Leading tab.
.model D16_Usual D
+ BV = 1.1U
+ CJ0 = 2.2M
+ IBV = 3.3
+ JS = 4.4K
+ MJ = 5.5MEG
+ N = 6.6G
* Parameters intermingled with garbage characters. Spice allows that, so we should too.
.model D17_Usual D ( () ) , =
+ BV ==== +1.1E-6,
+ CJ0 ,, ,, +2.2e-03 ,
+ IBV 3.3E-00
+ JS = = 4.4e+03
+ MJ +5.5MEG,;,
+ N = 6.6G ;
* All valid combinations of + - signs.
.model D18 D
+ N -1.1, MJ +2.2, JS -3.3e-3, IBV +4.4e+4, CJ0 5.5e-5, BV 6.6e+6
* Multiple empty-line continuations.
* TODO
.model D19_Usual D
* Comment 1
* Comment 2
+ BV=1.1U
+
+ CJ=2.2M\\
\\
+
* Comment 3
+
+ IBV=3.3
+
+
+ JS=4.4K
* Comment 4
* Comment 5
+
* Comment 8
+ MJ=5.5MEG
+
(),= * Comment 9
+ N=6.6G
* No newline at the end of file.
.model D20_Usual D(BV=1.1U CJ=2.2M IBV=3.3 JS=4.4K MJ=5.5MEG N=6.6G)

View File

@ -0,0 +1,578 @@
*
* fets.lib.spice
*
* All parameter values are made up and physically nonsensical.
.model _0_NJF_SHICHMANHODGES njf (level=1
+ VTO=000.000E+07
+ BETA=100.001E+07
+ LAMBDA=200.002E+07
+ RD=300.003E+07
+ RS=400.004E+07
+ CGS=500.005E+07
+ CGD=600.006E+07
+ PB=700.007E+07
+ IS=800.008E+07
+ FC=900.009E+07
+)
.model _1_PJF_SHICHMANHODGES pjf (level=1
+ VTO=000.000E+07
+ BETA=100.001E+07
+ LAMBDA=200.002E+07
+ RD=300.003E+07
+ RS=400.004E+07
+ CGS=500.005E+07
+ CGD=600.006E+07
+ PB=700.007E+07
+ IS=800.008E+07
+ FC=900.009E+07
+)
.model _2_NJF_PARKERSKELLERN njf (level=2
+ VBI=000.000E+07;;;
+ AF=100.001E+07
+ BETA=200.002E+07
+ CDS=300.003E+07
+ CGD=400.004E+07
+ CGS=500.005E+07
+ DELTA=600.006E+07
+ HFETA=700.007E+07;;;
+ MVST=800.008E+07
+ MXI=900.009E+07
+)
.model _3_PJF_PARKERSKELLERN pjf (level=2
+ VBI=000.000E+07;;;
+ AF=100.001E+07
+ BETA=200.002E+07
+ CDS=300.003E+07
+ CGD=400.004E+07
+ CGS=500.005E+07
+ DELTA=600.006E+07
+ HFETA=700.007E+07;;;
+ MVST=800.008E+07
+ MXI=900.009E+07
+)
.model _4_NMF_STATZ nmf (level=1
+ VTO=000.000E+07
+ ALPHA=100.001E+07
+ BETA=200.002E+07
+ LAMBDA=300.003E+07
+ B=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CGS=700.007E+07
+ CGD=800.008E+07
+ PB=900.009E+07
+)
.model _5_PMF_STATZ pmf (level=1
+ VTO=000.000E+07
+ ALPHA=100.001E+07
+ BETA=200.002E+07
+ LAMBDA=300.003E+07
+ B=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CGS=700.007E+07
+ CGD=800.008E+07
+ PB=900.009E+07
+)
* TODO: Ngspice User's Manual shows model line for MESFETs with level=4 - investigate that.
.model _6_NMF_YTTERDAL nmf (level=2
+ VTO=000.000E+07
+ LAMBDA=100.001E+07
+ LAMBDAHF=200.002E+07
+ BETA=300.003E+07
+ VS=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ RG=700.007E+07
+ RI=800.008E+07
+ RF=900.009E+07
+)
.model _7_PMF_YTTERDAL pmf (level=2
+ VTO=000.000E+07
+ LAMBDA=100.001E+07
+ LAMBDAHF=200.002E+07
+ BETA=300.003E+07
+ VS=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ RG=700.007E+07
+ RI=800.008E+07
+ RF=900.009E+07
+)
.model _8_NMF_HFET1 nmf (level=5
+ VTO=000.000E+07
+ LAMBDA=100.001E+07
+ RD=200.002E+07
+ RS=300.003E+07
+ RG=400.004E+07
+ RDI=500.005E+07
+ RSI=600.006E+07
+ RGS=700.007E+07
+ RGD=800.008E+07;;;
+ ETA=900.009E+07
+)
.model _9_PMF_HFET1 pmf (level=5
+ VTO=000.000E+07
+ LAMBDA=100.001E+07
+ RD=200.002E+07
+ RS=300.003E+07
+ RG=400.004E+07
+ RDI=500.005E+07
+ RSI=600.006E+07
+ RGS=700.007E+07
+ RGD=800.008E+07;;;
+ ETA=900.009E+07
+)
.model _10_NMF_HFET2 nmf (level=6
+ VS=000.000E+07;;;
+ GGR=100.001E+07
+ JS=200.002E+07;;;
+ DEL=300.003E+07
+ DELTA=400.004E+07
+ DELTAD=500.005E+07
+ DI=600.006E+07
+ EPSI=700.007E+07
+ ETA=800.008E+07
+ ETA1=900.009E+07
+)
.model _11_PMF_HFET2 pmf (level=6
+ VS=000.000E+07;;;
+ GGR=100.001E+07
+ JS=200.002E+07;;;
+ DEL=300.003E+07
+ DELTA=400.004E+07
+ DELTAD=500.005E+07
+ DI=600.006E+07
+ EPSI=700.007E+07
+ ETA=800.008E+07
+ ETA1=900.009E+07
+)
.model _12_NMOS_MOS1 nmos (level=1
+ VTO=000.000E+07
+ KP=100.001E+07
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _13_PMOS_MOS1 pmos (level=1
+ VTO=000.000E+07
+ KP=100.001E+07
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _14_NMOS_MOS2 nmos (level=2
+ VTO=000.000E+07
+ KP=100.001E+07
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _15_PMOS_MOS2 pmos (level=2
+ VTO=000.000E+07
+ KP=100.001E+07 ; Does not exist in MOS3 and MOS6
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07 ; Does not exist in MOS3
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _16_NMOS_MOS3 nmos (level=3
+ VTO=000.000E+07
+ THETA=100.001E+07 ; MOS3 and MOS9-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ ETA=400.004E+07 ; MOS3 and MOS9-only
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _17_PMOS_MOS3 pmos (level=3
+ VTO=000.000E+07
+ THETA=100.001E+07 ; MOS3 and MOS9-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ ETA=400.004E+07 ; MOS3 and MOS9-only
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _18_NMOS_BSIM1 nmos (level=4
+ VFB=000.000E+07
+ LVFB=100.001E+07
+ WVFB=200.002E+07
+ PHI=300.003E+07
+ LPHI=400.004E+07
+ WPHI=500.005E+07
+ K1=600.006E+07
+ LK1=700.007E+07
+ WK1=800.008E+07
+ K2=900.009E+07
+)
.model _19_PMOS_BSIM1 pmos (level=4
+ VFB=000.000E+07
+ LVFB=100.001E+07
+ WVFB=200.002E+07
+ PHI=300.003E+07
+ LPHI=400.004E+07
+ WPHI=500.005E+07
+ K1=600.006E+07
+ LK1=700.007E+07
+ WK1=800.008E+07
+ K2=900.009E+07
+)
.model _20_NMOS_BSIM2 nmos (level=5
+ BIB=000.000E+07
+ LBIB=100.001E+07
+ WBIB=200.002E+07
+ VGHIGH=300.003E+07
+ LVGHIGH=400.004E+07
+ WVGHIGH=500.005E+07;;;
+ WAIB=600.006E+07
+ BI0=700.007E+07
+ LBI0=800.008E+07
+ WBI0=900.009E+07
+)
.model _21_PMOS_BSIM2 pmos (level=5
+ BIB=000.000E+07
+ LBIB=100.001E+07
+ WBIB=200.002E+07
+ VGHIGH=300.003E+07
+ LVGHIGH=400.004E+07
+ WVGHIGH=500.005E+07;;;
+ WAIB=600.006E+07
+ BI0=700.007E+07
+ LBI0=800.008E+07
+ WBI0=900.009E+07
+)
.model _22_NMOS_MOS6 nmos (level=6
+ VTO=000.000E+07
+ NVTH=100.001E+07 ; MOS6-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _23_PMOS_MOS6 pmos (level=6
+ VTO=000.000E+07
+ NVTH=100.001E+07 ; MOS6-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ LAMBDA=400.004E+07
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _24_NMOS_BSIM3 nmos (level=8
+ TOX=000.000E+07
+ TOXM=100.001E+07
+ CDSC=200.002E+07
+ CDSCB=300.003E+07
+ CDSCD=400.004E+07
+ CIT=500.005E+07
+ NFACTOR=600.006E+07
+ XJ=700.007E+07
+ VSAT=800.008E+07
+ AT=900.009E+07
+)
.model _25_PMOS_BSIM3 pmos (level=8
+ TOX=000.000E+07
+ TOXM=100.001E+07
+ CDSC=200.002E+07
+ CDSCB=300.003E+07
+ CDSCD=400.004E+07
+ CIT=500.005E+07
+ NFACTOR=600.006E+07
+ XJ=700.007E+07
+ VSAT=800.008E+07
+ AT=900.009E+07
+)
.model _26_NMOS_MOS9 nmos (level=9
+ VTO=000.000E+07
+ THETA=100.001E+07 ; MOS3 and MOS9-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ ETA=400.004E+07 ; MOS3 and MOS9-only
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _27_PMOS_MOS9 pmos (level=9
+ VTO=000.000E+07
+ THETA=100.001E+07 ; MOS3 and MOS9-only
+ GAMMA=200.002E+07
+ PHI=300.003E+07
+ ETA=400.004E+07 ; MOS3 and MOS9-only
+ RD=500.005E+07
+ RS=600.006E+07
+ CBD=700.007E+07
+ CBS=800.008E+07
+ IS=900.009E+07
+)
.model _28_NMOS_B4SOI nmos (level=10
+ TOX=000.000E+07
+ TOXP=100.001E+07
+ TOXM=200.002E+07
+ DTOXCV=300.003E+07
+ CDSC=400.004E+07
+ CDSCB=500.005E+07
+ CDSCD=600.006E+07
+ CIT=700.007E+07
+ NFACTOR=800.008E+07
+ VSAT=900.009E+07
+)
.model _29_PMOS_B4SOI pmos (level=10
+ TOX=000.000E+07
+ TOXP=100.001E+07
+ TOXM=200.002E+07
+ DTOXCV=300.003E+07
+ CDSC=400.004E+07
+ CDSCB=500.005E+07
+ CDSCD=600.006E+07
+ CIT=700.007E+07
+ NFACTOR=800.008E+07
+ VSAT=900.009E+07
+)
.model _30_NMOS_BSIM4 nmos (level=14
+ RBPS0=000.000E+07
+ RBPSL=100.001E+07
+ RBPSW=200.002E+07
+ RBPSNF=300.003E+07
+ RBPD0=400.004E+07
+ RBPDL=500.005E+07
+ RBPDW=600.006E+07
+ RBPDNF=700.007E+07
+ RBPBX0=800.008E+07
+ RBPBXL=900.009E+07
+)
.model _31_PMOS_BSIM4 pmos (level=14
+ RBPS0=000.000E+07
+ RBPSL=100.001E+07
+ RBPSW=200.002E+07
+ RBPSNF=300.003E+07
+ RBPD0=400.004E+07
+ RBPDL=500.005E+07
+ RBPDW=600.006E+07
+ RBPDNF=700.007E+07
+ RBPBX0=800.008E+07
+ RBPBXL=900.009E+07
+)
.model _32_NMOS_B3SOIFD nmos (level=55
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _33_PMOS_B3SOIFD pmos (level=55
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _34_NMOS_B3SOIDD nmos (level=56
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _35_PMOS_B3SOIDD pmos (level=56
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _36_NMOS_B3SOIPD nmos (level=57
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _37_PMOS_B3SOIPD pmos (level=57
+ TOX=000.000E+07
+ CDSC=100.001E+07
+ CDSCB=200.002E+07
+ CDSCD=300.003E+07
+ CIT=400.004E+07
+ NFACTOR=500.005E+07
+ VSAT=600.006E+07
+ AT=700.007E+07
+ A0=800.008E+07
+ AGS=900.009E+07
+)
.model _38_NMOS_HISIM2 nmos (level=68
+ DEPMUE0=000.000E+07
+ DEPMUE0L=100.001E+07
+ DEPMUE0LP=200.002E+07
+ DEPMUE1=300.003E+07
+ DEPMUE1L=400.004E+07
+ DEPMUE1LP=500.005E+07
+ DEPMUEBACK0=600.006E+07
+ DEPMUEBACK0L=700.007E+07
+ DEPMUEBACK0LP=800.008E+07
+ DEPMUEBACK1=900.009E+07
+)
.model _39_PMOS_HISIM2 pmos (level=68
+ DEPMUE0=000.000E+07
+ DEPMUE0L=100.001E+07
+ DEPMUE0LP=200.002E+07
+ DEPMUE1=300.003E+07
+ DEPMUE1L=400.004E+07
+ DEPMUE1LP=500.005E+07
+ DEPMUEBACK0=600.006E+07
+ DEPMUEBACK0L=700.007E+07
+ DEPMUEBACK0LP=800.008E+07
+ DEPMUEBACK1=900.009E+07
+)
.model _40_NMOS_HISIMHV1 nmos (level=73 version=1.2.4
+ PRD=000.000E+07
+ PRD22=100.001E+07
+ PRD23=200.002E+07
+ PRD24=300.003E+07
+ PRDICT1=400.004E+07
+ PRDOV13=500.005E+07
+ PRDSLP1=600.006E+07
+ PRDVB=700.007E+07
+ PRDVD=800.008E+07
+ PRDVG11=900.009E+07
+)
.model _41_PMOS_HISIMHV1 pmos (level=73 version=1.2.4
+ PRD=000.000E+07
+ PRD22=100.001E+07
+ PRD23=200.002E+07
+ PRD24=300.003E+07
+ PRDICT1=400.004E+07
+ PRDOV13=500.005E+07
+ PRDSLP1=600.006E+07
+ PRDVB=700.007E+07
+ PRDVD=800.008E+07
+ PRDVG11=900.009E+07
+)
.model _42_NMOS_HISIMHV2 nmos (level=73 version=2.2.0
+ PJS0D=000.000E+07
+ PJS0SWD=100.001E+07
+ PNJD=200.002E+07
+ PCISBKD=300.003E+07
+ PVDIFFJD=400.004E+07
+ PJS0S=500.005E+07
+ PJS0SWS=600.006E+07;;;
+ PRS=700.007E+07
+ PRTH0=800.008E+07
+ PVOVER=900.009E+07
+)
.model _43_PMOS_HISIMHV2 pmos (level=73 version=2.2.0
+ PJS0D=000.000E+07
+ PJS0SWD=100.001E+07
+ PNJD=200.002E+07
+ PCISBKD=300.003E+07
+ PVDIFFJD=400.004E+07
+ PJS0S=500.005E+07
+ PJS0SWS=600.006E+07;;;
+ PRS=700.007E+07
+ PRTH0=800.008E+07
+ PVOVER=900.009E+07
+)

View File

@ -11,7 +11,7 @@ R4 Net-_Q1-E_ Net-_C2-Pad2_ 100
C2 Net-_Q1-E_ Net-_C2-Pad2_ 10u
R5 Net-_C2-Pad2_ GND 1
R3 Net-_R1-Pad1_ /out 100
V2 Net-_C1-Pad1_ GND SIN( 0 10m 10k )
V2 Net-_C1-Pad1_ GND SIN( 0 10m 10k )
C1 Net-_C1-Pad1_ Net-_Q1-B_ 10u
V1 Net-_R1-Pad1_ GND ( 9 )
.end

View File

@ -4,10 +4,10 @@
.probe alli
.tran 10u 10m
V3 GND Net-_U1-V-_ ( 5 )
R2 Net-_U1--_ Net-_R2-Pad2_ 10k
XU1 Net-_U1-+_ Net-_U1--_ Net-_U1-V+_ Net-_U1-V-_ Net-_R2-Pad2_ uopamp_lvl2
V2 Net-_U1-V+_ GND ( 5 )
V1 Net-_U1-+_ GND SIN( 0 100m 1k )
R1 GND Net-_U1--_ 10k
R2 Net-_U1--_ /out 10k
V3 GND Net-_U1-V-_ ( 5 )
VSIN1 /in GND SIN( 0 100m 1k )
V2 Net-_U1-V+_ GND ( 5 )
XU1 /in Net-_U1--_ Net-_U1-V+_ Net-_U1-V-_ /out uopamp_lvl2
.end

View File

@ -320,6 +320,15 @@
(uuid be48cb8e-7c9f-4216-838e-ee151aaeb3f9)
)
(label "out" (at 168.91 91.44 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid c6d665cf-2828-4128-ae59-06a65deb6b7e)
)
(label "in" (at 142.24 88.9 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid e8a13b17-85b1-4981-ba25-adfdae039d30)
)
(symbol (lib_id "power:GND") (at 157.48 109.22 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 032a39b4-2686-4cc0-a834-fb52cf55377c)

View File

@ -0,0 +1,20 @@
.title KiCad schematic
.include "passives.lib"
.model __R2 r(
+ r=10Meg tnom=20 tc1=100u )
.model __C2 c(
+ c=100u tnom=15 tc1=21.4u )
.model __L2 l(
+ l=220n tnom=20 tc1=125u )
.save all
.probe alli
.dc TEMP -40 125 1
R2 VCC GND __R2
C2 VCC GND __C2
R1 VCC GND VISHAY_CRCW060310M0FKTABC
L1 VCC GND AVX_0603WL221GT
C1 VCC GND AVX_12066D107MAT4A
VDC1 VCC GND ( 1 )
L2 VCC GND __L2
.end

View File

@ -302,7 +302,7 @@
"meta": {
"version": 1
},
"net_format_name": "",
"net_format_name": "Spice",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
@ -316,8 +316,8 @@
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"spice_save_all_currents": false,
"spice_save_all_voltages": false,
"spice_save_all_currents": true,
"spice_save_all_voltages": true,
"subpart_first_id": 65,
"subpart_id_separator": 0
},

View File

@ -322,26 +322,39 @@
)
)
(junction (at 190.5 114.2622) (diameter 0) (color 0 0 0 0)
(uuid eafda027-8fd2-40c0-b082-f15f04050481)
)
(wire (pts (xy 190.5 101.6) (xy 190.5 104.14))
(wire (pts (xy 163.83 101.6) (xy 163.83 104.14))
(stroke (width 0) (type default))
(uuid 03e5d1ef-95c5-418e-822d-d942eb7eea5f)
)
(wire (pts (xy 165.1 101.6) (xy 165.1 104.14))
(wire (pts (xy 163.83 111.76) (xy 163.83 114.3))
(stroke (width 0) (type default))
(uuid 0fb888fc-45a9-4c15-b043-1b1cb8b1cf53)
)
(wire (pts (xy 163.83 63.5) (xy 163.83 66.04))
(stroke (width 0) (type default))
(uuid 173fa779-c5a7-4b1a-95ce-91199dd82f54)
)
(wire (pts (xy 152.4 101.6) (xy 152.4 104.14))
(stroke (width 0) (type default))
(uuid 215ca15f-8dc1-4558-b14d-ce81bdd98add)
)
(wire (pts (xy 190.5 114.2622) (xy 190.5 114.3))
(wire (pts (xy 139.7 73.66) (xy 139.7 76.2))
(stroke (width 0) (type default))
(uuid 35f870a7-448a-4ca6-9dc9-3095aaefc3f9)
(uuid 53d968d7-6d42-4330-9ebe-0ae0fb3eecb7)
)
(wire (pts (xy 165.1 111.76) (xy 165.1 114.3))
(wire (pts (xy 152.4 63.5) (xy 152.4 66.04))
(stroke (width 0) (type default))
(uuid 763ba38e-8af3-4955-8594-07caefc86b78)
)
(wire (pts (xy 152.4 111.76) (xy 152.4 114.3))
(stroke (width 0) (type default))
(uuid 8c444764-4ee8-4e6a-b678-fea30fbd1bdb)
)
(wire (pts (xy 152.4 73.66) (xy 152.4 76.2))
(stroke (width 0) (type default))
(uuid 986be16e-5da9-4d36-b06b-f7cb4d7f78c5)
)
(wire (pts (xy 139.7 111.76) (xy 139.7 114.3))
(stroke (width 0) (type default))
(uuid a5287d05-b271-47b7-b485-2abae8ee6bda)
@ -350,28 +363,40 @@
(stroke (width 0) (type default))
(uuid af29e35f-ad8e-42ad-92d8-dab3c77b10f7)
)
(wire (pts (xy 163.83 73.66) (xy 163.83 76.2))
(stroke (width 0) (type default))
(uuid b67e725b-3ef9-4c64-991e-50387c35c6dc)
)
(wire (pts (xy 114.3 101.6) (xy 114.3 102.87))
(stroke (width 0) (type default))
(uuid c8381c0e-870a-4b60-a370-665e41cc0a82)
)
(wire (pts (xy 190.5 111.76) (xy 190.5 114.2622))
(stroke (width 0) (type default))
(uuid c96a0874-8a88-41d8-8fc9-4f44b9a77308)
)
(wire (pts (xy 114.3 113.03) (xy 114.3 114.3))
(stroke (width 0) (type default))
(uuid e4efd56a-f328-4d4d-b131-d2bd4285571c)
)
(wire (pts (xy 139.7 63.5) (xy 139.7 66.04))
(stroke (width 0) (type default))
(uuid f237b74b-ff9e-4b2e-9887-131786d834ff)
)
(text "Embedded" (at 148.59 57.15 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 24063ad1-094c-4f8e-95cf-5811e6fff1f0)
)
(text ".dc TEMP -40 125 1" (at 114.3 127 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 7375d298-3734-4861-a3c5-951d900d6e42)
)
(text "Sourced" (at 148.59 95.25 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid c8c71c1a-5715-466e-bc54-9e4aed1449ff)
)
(symbol (lib_id "power:VCC") (at 139.7 101.6 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 0b5a77ca-f3ff-42b7-8572-0eefa9011bf1)
(property "Reference" "#PWR?" (id 0) (at 139.7 105.41 0)
(property "Reference" "#PWR05" (id 0) (at 139.7 105.41 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 139.7 97.79 0)
@ -386,116 +411,134 @@
(pin "1" (uuid 80684c7b-5b8f-4fa5-a22a-6c3e25ecf03a))
)
(symbol (lib_id "power:VCC") (at 190.5 101.6 0) (unit 1)
(symbol (lib_id "power:GND") (at 139.7 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 2f62470a-49dd-4c2d-89e9-a2acc60c442d)
(property "Reference" "#PWR?" (id 0) (at 190.5 105.41 0)
(uuid 1021faa6-6c38-4f02-a9de-cc7465312989)
(property "Reference" "#PWR04" (id 0) (at 139.7 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 190.5 97.79 0)
(property "Value" "GND" (id 1) (at 139.7 81.28 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 190.5 101.6 0)
(property "Footprint" "" (id 2) (at 139.7 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 190.5 101.6 0)
(property "Datasheet" "" (id 3) (at 139.7 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4f25ee85-ce45-4eb0-9eaf-b2b6f835bafa))
)
(symbol (lib_id "power:VCC") (at 163.83 101.6 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 2f62470a-49dd-4c2d-89e9-a2acc60c442d)
(property "Reference" "#PWR013" (id 0) (at 163.83 105.41 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 163.83 97.79 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 163.83 101.6 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 163.83 101.6 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid d3b8058c-41bf-4fda-9fb7-d5dd8c40209d))
)
(symbol (lib_id "power:GND") (at 165.1 114.3 0) (unit 1)
(symbol (lib_id "power:GND") (at 152.4 114.3 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 438ece8c-3eb3-4d7e-9271-8a8e8aeb6d3c)
(property "Reference" "#PWR?" (id 0) (at 165.1 120.65 0)
(property "Reference" "#PWR010" (id 0) (at 152.4 120.65 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 165.1 119.38 0)
(property "Value" "GND" (id 1) (at 152.4 119.38 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 165.1 114.3 0)
(property "Footprint" "" (id 2) (at 152.4 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 165.1 114.3 0)
(property "Datasheet" "" (id 3) (at 152.4 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid d4f9c990-709a-4cab-83e6-f03cac3e330c))
)
(symbol (lib_id "power:VCC") (at 165.1 101.6 0) (unit 1)
(symbol (lib_id "power:VCC") (at 152.4 101.6 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 613737e0-8030-4980-b87e-8290b8a61eaf)
(property "Reference" "#PWR?" (id 0) (at 165.1 105.41 0)
(property "Reference" "#PWR09" (id 0) (at 152.4 105.41 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 165.1 97.79 0)
(property "Value" "VCC" (id 1) (at 152.4 97.79 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 165.1 101.6 0)
(property "Footprint" "" (id 2) (at 152.4 101.6 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 165.1 101.6 0)
(property "Datasheet" "" (id 3) (at 152.4 101.6 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4e31b1ca-d4bc-4891-b37e-bc167f16d091))
)
(symbol (lib_id "Device:C") (at 165.1 107.95 0) (unit 1)
(symbol (lib_id "Device:C") (at 152.4 107.95 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 6566e118-05df-4951-a19e-df5ca72becf1)
(property "Reference" "C1" (id 0) (at 168.91 107.315 0)
(property "Reference" "C1" (id 0) (at 156.21 107.315 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "100u" (id 1) (at 168.91 109.855 0)
(property "Value" "100u" (id 1) (at 156.21 109.855 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 166.0652 111.76 0)
(property "Footprint" "" (id 2) (at 153.3652 111.76 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 165.1 107.95 0)
(property "Datasheet" "~" (id 3) (at 152.4 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Name" "AVX_12066D107MAT4A" (id 4) (at 165.1 107.95 0)
(property "Model_Name" "AVX_12066D107MAT4A" (id 4) (at 152.4 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Library" "passives.lib" (id 5) (at 165.1 107.95 0)
(property "Model_Library" "passives.lib" (id 5) (at 152.4 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "C" (id 6) (at 165.1 107.95 0)
(property "Model_Device" "C" (id 6) (at 152.4 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "ADV" (id 7) (at 165.1 107.95 0)
(property "Model_Type" "ADV" (id 7) (at 152.4 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid b036b9d3-38c0-48ea-9a7e-5c57025637b1))
(pin "2" (uuid 35151b75-27a9-4e4d-b0b5-cdabe4516193))
)
(symbol (lib_id "Device:L") (at 190.5 107.95 0) (unit 1)
(symbol (lib_id "Device:L") (at 163.83 107.95 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 65be26d9-e694-445c-9a01-797abd973f29)
(property "Reference" "L1" (id 0) (at 191.77 107.315 0)
(property "Reference" "L1" (id 0) (at 165.1 107.315 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "220n" (id 1) (at 191.77 109.855 0)
(property "Value" "220n" (id 1) (at 165.1 109.855 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 190.5 107.95 0)
(property "Footprint" "" (id 2) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 190.5 107.95 0)
(property "Datasheet" "~" (id 3) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Name" "AVX_0603WL221GT" (id 4) (at 190.5 107.95 0)
(property "Model_Name" "AVX_0603WL221GT" (id 4) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Library" "passives.lib" (id 5) (at 190.5 107.95 0)
(property "Model_Library" "passives.lib" (id 5) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "L" (id 6) (at 190.5 107.95 0)
(property "Model_Device" "L" (id 6) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "ADV" (id 7) (at 190.5 107.95 0)
(property "Model_Type" "ADV" (id 7) (at 163.83 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 31abb371-b97b-4c10-a4b3-748d55802214))
@ -529,6 +572,9 @@
(property "Model_Type" "ADV" (id 7) (at 139.7 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Pins" "1 2" (id 8) (at 139.7 107.95 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 9258bd9f-6e64-48cb-b10a-9f0ab959f571))
(pin "2" (uuid f024f933-67b5-408d-9af7-d6ece6042782))
)
@ -536,7 +582,7 @@
(symbol (lib_id "Simulation_SPICE:VDC") (at 114.3 107.95 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 83608f1c-11c0-46f8-ae54-fcb488541f6a)
(property "Reference" "VDC" (id 0) (at 118.11 106.045 0)
(property "Reference" "VDC1" (id 0) (at 118.11 106.045 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "1" (id 1) (at 118.11 108.585 0)
@ -564,28 +610,46 @@
(pin "2" (uuid 77371cba-8f4b-45a2-91a6-f825ae3f9546))
)
(symbol (lib_id "power:GND") (at 190.5 114.2622 0) (unit 1)
(symbol (lib_id "power:GND") (at 163.83 114.3 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid aa1c725b-e908-4ffe-a8e1-dbe74874ec0b)
(property "Reference" "#PWR?" (id 0) (at 190.5 120.6122 0)
(property "Reference" "#PWR014" (id 0) (at 163.83 120.65 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 190.5 119.3422 0)
(property "Value" "GND" (id 1) (at 163.83 119.38 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 190.5 114.2622 0)
(property "Footprint" "" (id 2) (at 163.83 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 190.5 114.2622 0)
(property "Datasheet" "" (id 3) (at 163.83 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 08083956-7f80-48fc-a073-d7e31be1dea5))
)
(symbol (lib_id "power:VCC") (at 163.83 63.5 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid af8afa4e-4235-475c-9551-2d7ded7072b6)
(property "Reference" "#PWR011" (id 0) (at 163.83 67.31 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 163.83 59.69 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 163.83 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 163.83 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 60c0540f-5266-4fab-a810-a4f5d4360ee1))
)
(symbol (lib_id "power:VCC") (at 114.3 101.6 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid b60fd0ca-97bd-4e20-9a27-3046f059d2b9)
(property "Reference" "#PWR?" (id 0) (at 114.3 105.41 0)
(property "Reference" "#PWR01" (id 0) (at 114.3 105.41 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 114.3 97.79 0)
@ -600,10 +664,84 @@
(pin "1" (uuid 03c6ace1-caf1-4775-b684-3e857b918919))
)
(symbol (lib_id "Device:C") (at 152.4 69.85 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ba938e19-1c33-428c-a122-b75b8be63133)
(property "Reference" "C2" (id 0) (at 156.21 69.215 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "100u" (id 1) (at 156.21 71.755 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 153.3652 73.66 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 152.4 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "C" (id 6) (at 152.4 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "ADV" (id 7) (at 152.4 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Params" "c=100u tnom=15 tc1=21.4u" (id 8) (at 152.4 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4db98037-11ef-40fd-a79c-ab47cb0f3d8a))
(pin "2" (uuid ff2f22cc-3989-4ae1-a34a-f5f99bfaa1ea))
)
(symbol (lib_id "Device:L") (at 163.83 69.85 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid c38b2288-cfde-4d06-b96a-fb8e8c8154c6)
(property "Reference" "L2" (id 0) (at 165.1 69.215 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "220n" (id 1) (at 165.1 71.755 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 163.83 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 163.83 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "L" (id 6) (at 163.83 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "ADV" (id 7) (at 163.83 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Params" "l=220n tnom=20 tc1=125u" (id 8) (at 163.83 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid bd5c01d7-4639-4174-bce3-3a4ebc133615))
(pin "2" (uuid c36540c4-25b9-4a5c-9315-ed92c9c50911))
)
(symbol (lib_id "power:GND") (at 152.4 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid c6e7e2c3-9808-4e24-b9f8-b0bec1fd8ac2)
(property "Reference" "#PWR08" (id 0) (at 152.4 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 152.4 81.28 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 152.4 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 152.4 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 612601f6-320c-421e-80f6-82ff029d2c62))
)
(symbol (lib_id "power:GND") (at 114.3 114.3 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid cae1a2a0-561b-4729-802f-81c375ac4c1e)
(property "Reference" "#PWR?" (id 0) (at 114.3 120.65 0)
(property "Reference" "#PWR02" (id 0) (at 114.3 120.65 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 114.3 119.38 0)
@ -618,10 +756,28 @@
(pin "1" (uuid b4bef1f0-ad5b-4c59-87c6-a3d88d776adf))
)
(symbol (lib_id "power:VCC") (at 139.7 63.5 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid cb427ace-dc8b-439f-b07d-a8c28be3b1a1)
(property "Reference" "#PWR03" (id 0) (at 139.7 67.31 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 139.7 59.69 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 139.7 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 139.7 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid fb5b8536-d9a8-4885-be61-801019970b94))
)
(symbol (lib_id "power:GND") (at 139.7 114.3 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid d829b2e0-05c9-40a0-815e-35a8d1f6cecd)
(property "Reference" "#PWR?" (id 0) (at 139.7 120.65 0)
(property "Reference" "#PWR06" (id 0) (at 139.7 120.65 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 139.7 119.38 0)
@ -636,46 +792,137 @@
(pin "1" (uuid 924cf866-e3b9-4af1-895c-792ddd27e24d))
)
(symbol (lib_id "Device:R") (at 139.7 69.85 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid d9242e06-77b6-413a-988e-016305303690)
(property "Reference" "R2" (id 0) (at 142.24 69.215 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "10M" (id 1) (at 142.24 71.755 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 137.922 69.85 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 139.7 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "R" (id 6) (at 139.7 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "ADV" (id 7) (at 139.7 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Params" "r=10M tnom=20 tc1=100u" (id 8) (at 139.7 69.85 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid cd7b39c8-f7c4-4e87-86a9-3754364bf841))
(pin "2" (uuid 40cab1c5-55df-4200-8cc2-c45f042f041c))
)
(symbol (lib_id "power:VCC") (at 152.4 63.5 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid e5d82f4f-4a4d-49d2-aad6-37bf5437c82b)
(property "Reference" "#PWR07" (id 0) (at 152.4 67.31 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "VCC" (id 1) (at 152.4 59.69 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 152.4 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 152.4 63.5 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 3b4a0d73-4f05-4bb4-b992-cd7e99816a94))
)
(symbol (lib_id "power:GND") (at 163.83 76.2 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid f5956c68-9906-48b7-b8fa-babd31da28d9)
(property "Reference" "#PWR012" (id 0) (at 163.83 82.55 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 163.83 81.28 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 163.83 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 163.83 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 1afccd04-6810-4c4a-bf2d-14a29b9d3429))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/0b5a77ca-f3ff-42b7-8572-0eefa9011bf1"
(reference "#PWR?") (unit 1) (value "VCC") (footprint "")
)
(path "/2f62470a-49dd-4c2d-89e9-a2acc60c442d"
(reference "#PWR?") (unit 1) (value "VCC") (footprint "")
)
(path "/438ece8c-3eb3-4d7e-9271-8a8e8aeb6d3c"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
(path "/613737e0-8030-4980-b87e-8290b8a61eaf"
(reference "#PWR?") (unit 1) (value "VCC") (footprint "")
)
(path "/aa1c725b-e908-4ffe-a8e1-dbe74874ec0b"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
(path "/b60fd0ca-97bd-4e20-9a27-3046f059d2b9"
(reference "#PWR?") (unit 1) (value "VCC") (footprint "")
(reference "#PWR01") (unit 1) (value "VCC") (footprint "")
)
(path "/cae1a2a0-561b-4729-802f-81c375ac4c1e"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
(reference "#PWR02") (unit 1) (value "GND") (footprint "")
)
(path "/cb427ace-dc8b-439f-b07d-a8c28be3b1a1"
(reference "#PWR03") (unit 1) (value "VCC") (footprint "")
)
(path "/1021faa6-6c38-4f02-a9de-cc7465312989"
(reference "#PWR04") (unit 1) (value "GND") (footprint "")
)
(path "/0b5a77ca-f3ff-42b7-8572-0eefa9011bf1"
(reference "#PWR05") (unit 1) (value "VCC") (footprint "")
)
(path "/d829b2e0-05c9-40a0-815e-35a8d1f6cecd"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
(reference "#PWR06") (unit 1) (value "GND") (footprint "")
)
(path "/e5d82f4f-4a4d-49d2-aad6-37bf5437c82b"
(reference "#PWR07") (unit 1) (value "VCC") (footprint "")
)
(path "/c6e7e2c3-9808-4e24-b9f8-b0bec1fd8ac2"
(reference "#PWR08") (unit 1) (value "GND") (footprint "")
)
(path "/613737e0-8030-4980-b87e-8290b8a61eaf"
(reference "#PWR09") (unit 1) (value "VCC") (footprint "")
)
(path "/438ece8c-3eb3-4d7e-9271-8a8e8aeb6d3c"
(reference "#PWR010") (unit 1) (value "GND") (footprint "")
)
(path "/af8afa4e-4235-475c-9551-2d7ded7072b6"
(reference "#PWR011") (unit 1) (value "VCC") (footprint "")
)
(path "/f5956c68-9906-48b7-b8fa-babd31da28d9"
(reference "#PWR012") (unit 1) (value "GND") (footprint "")
)
(path "/2f62470a-49dd-4c2d-89e9-a2acc60c442d"
(reference "#PWR013") (unit 1) (value "VCC") (footprint "")
)
(path "/aa1c725b-e908-4ffe-a8e1-dbe74874ec0b"
(reference "#PWR014") (unit 1) (value "GND") (footprint "")
)
(path "/6566e118-05df-4951-a19e-df5ca72becf1"
(reference "C1") (unit 1) (value "100u") (footprint "")
)
(path "/ba938e19-1c33-428c-a122-b75b8be63133"
(reference "C2") (unit 1) (value "100u") (footprint "")
)
(path "/65be26d9-e694-445c-9a01-797abd973f29"
(reference "L1") (unit 1) (value "220n") (footprint "")
)
(path "/c38b2288-cfde-4d06-b96a-fb8e8c8154c6"
(reference "L2") (unit 1) (value "220n") (footprint "")
)
(path "/698024ab-bd78-4be5-8cb1-c09eef71c67f"
(reference "R1") (unit 1) (value "10M") (footprint "")
)
(path "/d9242e06-77b6-413a-988e-016305303690"
(reference "R2") (unit 1) (value "10M") (footprint "")
)
(path "/83608f1c-11c0-46f8-ae54-fcb488541f6a"
(reference "VDC") (unit 1) (value "1") (footprint "")
(reference "VDC1") (unit 1) (value "1") (footprint "")
)
)
)

View File

@ -4,8 +4,8 @@
.probe alli
.tran 1u 10m
C1 /out GND 10u
R1 /out GND 100k
D1 /in /out DIODE1
V1 /in GND SIN( 0 5 10k )
R1 /out GND 10k
C1 /out GND 10u
VSIN1 /in GND SIN( 0 5 1k )
.end

View File

@ -322,10 +322,10 @@
(symbol (lib_id "Simulation_SPICE:VSIN") (at 134.62 101.6 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 2f4ce84c-7613-4135-9bc6-7662b55052cf)
(property "Reference" "VSIN" (id 0) (at 118.11 99.06 0)
(property "Reference" "VSIN1" (id 0) (at 118.11 99.06 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "" (id 1) (at 118.11 101.6 0)
(property "Value" "ampl=5 f=1k" (id 1) (at 118.11 101.6 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 134.62 101.6 0)
@ -394,7 +394,7 @@
(property "Reference" "R1" (id 0) (at 167.64 99.695 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "" (id 1) (at 167.64 102.235 0)
(property "Value" "10K" (id 1) (at 167.64 102.235 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 163.322 100.33 90)
@ -449,7 +449,7 @@
(reference "R1") (unit 1) (value "10K") (footprint "")
)
(path "/2f4ce84c-7613-4135-9bc6-7662b55052cf"
(reference "VSIN") (unit 1) (value "ampl=5 f=1k") (footprint "")
(reference "VSIN1") (unit 1) (value "ampl=5 f=1k") (footprint "")
)
)
)

View File

@ -0,0 +1,82 @@
(kicad_symbol_lib (version 20220331) (generator kicad_symbol_editor)
(symbol "TLINE" (in_bom no) (on_board no)
(property "Reference" "T" (id 0) (at 0 -2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "TLINE" (id 1) (at 0 2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://ngspice.sourceforge.net/docs/ngspice-36-manual.pdf#7f" (id 3) (at 0 5.08 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "lossless transmission line characteristic impedance" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Lossless transmission line, for simulation only" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "TLINE_0_1"
(circle (center -3.81 0) (radius 1.27)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -5.08 -1.27)
(xy 3.81 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -3.81 0)
(xy -5.08 0)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -3.81 1.27)
(xy 3.81 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 5.08 -1.27)
(xy 3.81 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 3.8776 -1.27) (mid 5.0818 0) (end 3.8776 1.27)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "TLINE_1_1"
(pin passive line (at -7.62 0 0) (length 2.54)
(name "" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at -5.08 -2.54 90) (length 1.27)
(name "" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 7.62 0 180) (length 2.54)
(name "" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 5.08 -2.54 90) (length 1.27)
(name "" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
)
)
)

View File

@ -0,0 +1,3 @@
(sym_lib_table
(lib (name "Transmission_Line")(type "KiCad")(uri "${KIPRJMOD}/Transmission_Line.kicad_sym")(options "")(descr ""))
)

View File

@ -0,0 +1,14 @@
.title KiCad schematic
.model __OT2 ltra(
+ len=1 r=0 l=1.25m g=0 c=500n )
.save all
.probe alli
.tran 1u 1m
R1 /z0_out GND 50
VPULSE2 /rlgc_in GND PULSE( 0 1 0 1u 1u 50u 100u )
OT2 /rlgc_in GND /rlgc_out GND __OT2
R2 /rlgc_out GND 50
T1 /z0_in GND /z0_out GND z0=50 td=25u
VPULSE1 /z0_in GND PULSE( 0 1 0 1u 1u 50u 100u )
.end

View File

@ -0,0 +1,2 @@
(kicad_pcb (version 20220308) (generator pcbnew)
)

View File

@ -0,0 +1,331 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.1,
"copper_line_width": 0.2,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"other_line_width": 0.15,
"silk_line_width": 0.15,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"rules": {
"min_copper_edge_clearance": 0.0,
"solder_mask_clearance": 0.0,
"solder_mask_min_width": 0.0
},
"track_widths": [],
"via_dimensions": []
},
"layer_presets": [],
"viewports": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "tlines.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6.0
}
],
"meta": {
"version": 2
},
"net_colors": null
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "Spice",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"spice_save_all_currents": true,
"spice_save_all_voltages": true,
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [
[
"f74aa792-5ddc-4342-b3b1-f3d782106d77",
""
]
],
"text_variables": {}
}

View File

@ -0,0 +1,623 @@
(kicad_sch (version 20220331) (generator eeschema)
(uuid f74aa792-5ddc-4342-b3b1-f3d782106d77)
(paper "A4")
(lib_symbols
(symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "R" (id 0) (at 2.032 0 90)
(effects (font (size 1.27 1.27)))
)
(property "Value" "R" (id 1) (at 0 0 90)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at -1.778 0 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "R res resistor" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Resistor" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "R_*" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "R_0_1"
(rectangle (start -1.016 -2.54) (end 1.016 2.54)
(stroke (width 0.254) (type default))
(fill (type none))
)
)
(symbol "R_1_1"
(pin passive line (at 0 3.81 270) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 -3.81 90) (length 1.27)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Simulation_SPICE:VPULSE" (pin_numbers hide) (pin_names (offset 0.0254)) (in_bom yes) (on_board yes)
(property "Reference" "V" (id 0) (at 2.54 2.54 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "VPULSE" (id 1) (at 2.54 0 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Spice_Netlist_Enabled" "Y" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Spice_Primitive" "V" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) (justify left) hide)
)
(property "Spice_Model" "pulse(0 1 2n 2n 2n 50n 100n)" (id 6) (at 2.54 -2.54 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "ki_keywords" "simulation" (id 7) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Voltage source, pulse" (id 8) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "VPULSE_0_0"
(polyline
(pts
(xy -2.032 -0.762)
(xy -1.397 -0.762)
(xy -1.143 0.762)
(xy -0.127 0.762)
(xy 0.127 -0.762)
(xy 1.143 -0.762)
(xy 1.397 0.762)
(xy 2.032 0.762)
)
(stroke (width 0) (type default))
(fill (type none))
)
(text "+" (at 0 1.905 0)
(effects (font (size 1.27 1.27)))
)
)
(symbol "VPULSE_0_1"
(circle (center 0 0) (radius 2.54)
(stroke (width 0.254) (type default))
(fill (type background))
)
)
(symbol "VPULSE_1_1"
(pin passive line (at 0 5.08 270) (length 2.54)
(name "~" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 0 -5.08 90) (length 2.54)
(name "~" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Transmission_Line:TLINE" (in_bom no) (on_board no)
(property "Reference" "T" (id 0) (at 0 -2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "TLINE" (id 1) (at 0 2.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://ngspice.sourceforge.net/docs/ngspice-36-manual.pdf#7f" (id 3) (at 0 5.08 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "lossless transmission line characteristic impedance" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Lossless transmission line, for simulation only" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "TLINE_0_1"
(circle (center -3.81 0) (radius 1.27)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -5.08 -1.27)
(xy 3.81 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -3.81 0)
(xy -5.08 0)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy -3.81 1.27)
(xy 3.81 1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(polyline
(pts
(xy 5.08 -1.27)
(xy 3.81 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
(arc (start 3.8776 -1.27) (mid 5.0818 0) (end 3.8776 1.27)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "TLINE_1_1"
(pin passive line (at -7.62 0 0) (length 2.54)
(name "" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at -5.08 -2.54 90) (length 1.27)
(name "" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 7.62 0 180) (length 2.54)
(name "" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin passive line (at 5.08 -2.54 90) (length 1.27)
(name "" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "power:GND" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes)
(property "Reference" "#PWR" (id 0) (at 0 -6.35 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 0 -3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "power-flag" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Power symbol creates a global label with name \"GND\" , ground" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "GND_0_1"
(polyline
(pts
(xy 0 0)
(xy 0 -1.27)
(xy 1.27 -1.27)
(xy 0 -2.54)
(xy -1.27 -1.27)
(xy 0 -1.27)
)
(stroke (width 0) (type default))
(fill (type none))
)
)
(symbol "GND_1_1"
(pin power_in line (at 0 0 270) (length 0) hide
(name "GND" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
)
)
)
(wire (pts (xy 165.1 83.82) (xy 165.1 86.36))
(stroke (width 0) (type default))
(uuid 2ba860d8-4c67-4b9e-85f2-068d29a33da8)
)
(wire (pts (xy 153.67 114.3) (xy 165.1 114.3))
(stroke (width 0) (type default))
(uuid 3668df94-f0a6-4370-aa0d-9f77618594f1)
)
(wire (pts (xy 127 76.2) (xy 138.43 76.2))
(stroke (width 0) (type default))
(uuid b00425c7-fc25-4d52-86ca-c25504c4afd0)
)
(wire (pts (xy 153.67 76.2) (xy 165.1 76.2))
(stroke (width 0) (type default))
(uuid b49a2030-2a38-4ee5-93a8-9e5f491987d4)
)
(wire (pts (xy 127 114.3) (xy 138.43 114.3))
(stroke (width 0) (type default))
(uuid c54361d7-984a-4956-9835-91d4c78f3499)
)
(wire (pts (xy 165.1 121.92) (xy 165.1 124.46))
(stroke (width 0) (type default))
(uuid f6b1e3a3-6d27-412f-badc-8a952a963985)
)
(text "RLGC model" (at 140.97 106.68 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 038e46ca-eb20-484c-98ed-ea8d53265c3a)
)
(text "Z0 model" (at 140.97 68.58 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 22e3550a-57e1-4d36-aa59-7cd278354265)
)
(text ".tran 1u 1m" (at 128.27 142.24 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid aed2dcac-ccbe-4203-b5c4-eb7aa00d9f70)
)
(label "rlgc_in" (at 127 114.3 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 0821414f-2b2d-471a-aa30-b748365de6cf)
)
(label "z0_out" (at 165.1 76.2 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 3624eef7-cd56-469b-9bc9-d0fd3a4804f4)
)
(label "rlgc_out" (at 165.1 114.3 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 59ba7133-1446-4b84-958d-a03a68c90d05)
)
(label "z0_in" (at 127 76.2 0) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid c50f3d74-34e4-4791-9f17-976408b8033d)
)
(symbol (lib_id "power:GND") (at 127 86.36 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 0bb52765-586c-4bf2-a0f2-cc8769dedeec)
(property "Reference" "#PWR0106" (id 0) (at 127 92.71 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 127 91.44 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 127 86.36 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 127 86.36 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 646ae8f9-e672-4035-ba98-115c4670c2c0))
)
(symbol (lib_id "power:GND") (at 151.13 116.84 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 232c811f-1246-4b76-86b4-d8721684bd11)
(property "Reference" "#PWR0104" (id 0) (at 151.13 123.19 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 151.13 121.92 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 151.13 116.84 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 151.13 116.84 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid afd18e4f-ec3d-4b0c-9c3a-f269db3363d6))
)
(symbol (lib_id "Transmission_Line:TLINE") (at 146.05 114.3 0) (unit 1)
(in_bom no) (on_board no) (fields_autoplaced)
(uuid 34b3fec2-c790-40cf-bb63-dd642fff2299)
(property "Reference" "T2" (id 0) (at 146.0509 109.22 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "TLINE" (id 1) (at 146.0509 111.76 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 146.05 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://ngspice.sourceforge.net/docs/ngspice-36-manual.pdf#7f" (id 3) (at 146.05 109.22 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "TLINE" (id 4) (at 146.05 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "RLGC" (id 5) (at 146.05 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Pins" "1 2 3 4" (id 6) (at 146.05 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Params" "len=1 r=0 l=1.25m g=0 c=500n" (id 7) (at 146.05 114.3 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 3ba94ccd-338c-44da-afd8-322313c0ff13))
(pin "2" (uuid ed81258e-3e5d-4a2d-8e04-b3182f9c51c0))
(pin "3" (uuid 443d9994-dd5c-4f22-b64a-7cbede1ad619))
(pin "4" (uuid 5b960bbf-5dc9-492f-b460-847fb0c65707))
)
(symbol (lib_id "Simulation_SPICE:VPULSE") (at 127 81.28 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 56fc236a-df5f-49ef-9b92-3227f86197b4)
(property "Reference" "VPULSE1" (id 0) (at 87.63 80.01 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "v2=1 tr=1u tf=1u pw=50u per=100u" (id 1) (at 87.63 82.55 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 127 81.28 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 127 81.28 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 5e20d69f-9003-4997-b6ac-fca384177c2c))
(pin "2" (uuid 59e755b2-04d0-4799-bdf1-e10965451a30))
)
(symbol (lib_id "power:GND") (at 140.97 78.74 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 59dbe783-3723-4dcc-a641-a603ab67a5a4)
(property "Reference" "#PWR0107" (id 0) (at 140.97 85.09 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 140.97 83.82 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 140.97 78.74 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 140.97 78.74 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 872f8eab-890e-44cc-a827-4116fa2b9a93))
)
(symbol (lib_id "power:GND") (at 165.1 86.36 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 5b460e62-196b-4585-8ed3-c8e3325f6a48)
(property "Reference" "#PWR0101" (id 0) (at 165.1 92.71 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 165.1 91.44 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 165.1 86.36 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 165.1 86.36 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 084b1caf-06a0-4971-9750-c64366f414d2))
)
(symbol (lib_id "power:GND") (at 127 124.46 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 5f9f7595-cc0b-4628-ae7b-35d307a4eb99)
(property "Reference" "#PWR0102" (id 0) (at 127 130.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 127 129.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 127 124.46 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 127 124.46 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid e537417c-dc56-4566-b159-06201f9d24eb))
)
(symbol (lib_id "Device:R") (at 165.1 80.01 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 9eecf3ec-d266-4199-973b-6e10e301b41b)
(property "Reference" "R1" (id 0) (at 167.64 79.375 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "50" (id 1) (at 167.64 81.915 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 163.322 80.01 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 165.1 80.01 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 1ec2478e-c74c-4b1f-94f8-f36178bb057b))
(pin "2" (uuid d9cd7012-5227-493d-a953-8c8f9e0cc488))
)
(symbol (lib_id "power:GND") (at 140.97 116.84 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid b0fd7eaf-a224-48f5-80b6-b4c9a3988f57)
(property "Reference" "#PWR0103" (id 0) (at 140.97 123.19 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 140.97 121.92 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 140.97 116.84 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 140.97 116.84 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 432e54be-78c9-4ddf-8ec7-819cecbfe6c2))
)
(symbol (lib_id "Transmission_Line:TLINE") (at 146.05 76.2 0) (unit 1)
(in_bom no) (on_board no) (fields_autoplaced)
(uuid b320600b-eef1-4883-916c-38700f3f43d4)
(property "Reference" "T1" (id 0) (at 146.0509 71.12 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "TLINE" (id 1) (at 146.0509 73.66 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 146.05 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "http://ngspice.sourceforge.net/docs/ngspice-36-manual.pdf#7f" (id 3) (at 146.05 71.12 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Device" "TLINE" (id 4) (at 146.05 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Type" "Z0" (id 5) (at 146.05 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Pins" "1 2 3 4" (id 6) (at 146.05 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Model_Params" "z0=50 td=25u" (id 7) (at 146.05 76.2 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid ea050e5c-1246-4281-a897-0695b0c28888))
(pin "2" (uuid 6a849f27-b16c-48cb-80be-7504707e9e4a))
(pin "3" (uuid a8652546-dd2b-4f4f-874e-abb58500b88a))
(pin "4" (uuid c752f402-877d-4339-af44-9bdefe8327ef))
)
(symbol (lib_id "Device:R") (at 165.1 118.11 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid c89e9e2f-1e5f-45ee-9942-af42fb5cfaf4)
(property "Reference" "R2" (id 0) (at 167.64 117.475 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "50" (id 1) (at 167.64 120.015 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 163.322 118.11 90)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 165.1 118.11 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 720acbb9-4c0b-48b1-9b2a-ca5415db622e))
(pin "2" (uuid aee2f2ef-458b-4835-9263-2a66796398fe))
)
(symbol (lib_id "power:GND") (at 151.13 78.74 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid fc8afb4b-228e-4b15-8225-7bdabc7f37d5)
(property "Reference" "#PWR0108" (id 0) (at 151.13 85.09 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 151.13 83.82 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 151.13 78.74 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 151.13 78.74 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 3a04e902-893e-40a5-b4c0-3247e54eeb89))
)
(symbol (lib_id "Simulation_SPICE:VPULSE") (at 127 119.38 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid fcc0dfa9-c624-4a32-a3d3-4c36ee7b0fe6)
(property "Reference" "VPULSE2" (id 0) (at 87.63 118.11 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "v2=1 tr=1u tf=1u pw=50u per=100u" (id 1) (at 87.63 120.65 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 127 119.38 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 127 119.38 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4697d16d-3f33-43d4-bdc9-9604ce8ac4d7))
(pin "2" (uuid b718a7b9-338a-42ec-b700-e8a6ef481ecb))
)
(symbol (lib_id "power:GND") (at 165.1 124.46 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ff04fe94-7180-4f4a-b4d1-f6aca630b6d1)
(property "Reference" "#PWR0105" (id 0) (at 165.1 130.81 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 165.1 129.54 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 165.1 124.46 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 165.1 124.46 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 51e6012c-cc82-4ffa-9f4c-c6cdff662294))
)
(sheet_instances
(path "/" (page "1"))
)
(symbol_instances
(path "/5b460e62-196b-4585-8ed3-c8e3325f6a48"
(reference "#PWR0101") (unit 1) (value "GND") (footprint "")
)
(path "/5f9f7595-cc0b-4628-ae7b-35d307a4eb99"
(reference "#PWR0102") (unit 1) (value "GND") (footprint "")
)
(path "/b0fd7eaf-a224-48f5-80b6-b4c9a3988f57"
(reference "#PWR0103") (unit 1) (value "GND") (footprint "")
)
(path "/232c811f-1246-4b76-86b4-d8721684bd11"
(reference "#PWR0104") (unit 1) (value "GND") (footprint "")
)
(path "/ff04fe94-7180-4f4a-b4d1-f6aca630b6d1"
(reference "#PWR0105") (unit 1) (value "GND") (footprint "")
)
(path "/0bb52765-586c-4bf2-a0f2-cc8769dedeec"
(reference "#PWR0106") (unit 1) (value "GND") (footprint "")
)
(path "/59dbe783-3723-4dcc-a641-a603ab67a5a4"
(reference "#PWR0107") (unit 1) (value "GND") (footprint "")
)
(path "/fc8afb4b-228e-4b15-8225-7bdabc7f37d5"
(reference "#PWR0108") (unit 1) (value "GND") (footprint "")
)
(path "/9eecf3ec-d266-4199-973b-6e10e301b41b"
(reference "R1") (unit 1) (value "50") (footprint "")
)
(path "/c89e9e2f-1e5f-45ee-9942-af42fb5cfaf4"
(reference "R2") (unit 1) (value "50") (footprint "")
)
(path "/b320600b-eef1-4883-916c-38700f3f43d4"
(reference "T1") (unit 1) (value "TLINE") (footprint "")
)
(path "/34b3fec2-c790-40cf-bb63-dd642fff2299"
(reference "T2") (unit 1) (value "TLINE") (footprint "")
)
(path "/56fc236a-df5f-49ef-9b92-3227f86197b4"
(reference "VPULSE1") (unit 1) (value "v2=1 tr=1u tf=1u pw=50u per=100u") (footprint "")
)
(path "/fcc0dfa9-c624-4a32-a3d3-4c36ee7b0fe6"
(reference "VPULSE2") (unit 1) (value "v2=1 tr=1u tf=1u pw=50u per=100u") (footprint "")
)
)
)

View File

@ -75,6 +75,7 @@ if( KICAD_SPICE )
set( QA_EESCHEMA_SRCS
${QA_EESCHEMA_SRCS}
# Simulation tests
sim/test_library_spice.cpp
sim/test_ngspice.cpp
sim/test_ngspice_helpers.cpp
)

View File

@ -0,0 +1,566 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <eeschema_test_utils.h>
#include <sim/sim_library_spice.h>
class TEST_SIM_LIBRARY_SPICE_FIXTURE
{
public:
wxString GetLibraryPath( const wxString& aBaseName )
{
wxFileName fn = KI_TEST::GetEeschemaTestDataDir();
fn.AppendDir( "spice_netlists" );
fn.AppendDir( "libraries" );
fn.SetName( aBaseName );
fn.SetExt( "lib.spice" );
return fn.GetFullPath();
}
void LoadLibrary( const wxString& aBaseName )
{
wxString path = GetLibraryPath( aBaseName );
m_library = std::make_unique<SIM_LIBRARY_SPICE>();
BOOST_CHECK( m_library->ReadFile( path ) );
}
void CompareToUsualDiodeModel( const SIM_MODEL& aModel, const wxString& aModelName, int aModelIndex )
{
BOOST_CHECK( aModel.GetType() == SIM_MODEL::TYPE::D );
BOOST_CHECK_EQUAL( aModelName, aModel.GetSpiceInfo().modelType.Upper()
+ wxString::FromCDouble( aModelIndex )
+ "_Usual" );
BOOST_CHECK_EQUAL( aModel.FindParam( "bv" )->value->ToString(), "1.1u" );
BOOST_CHECK_EQUAL( aModel.FindParam( "cjo" )->value->ToString(), "2.2m" );
BOOST_CHECK_EQUAL( aModel.FindParam( "ibv" )->value->ToString(), "3.3" );
BOOST_CHECK_EQUAL( aModel.FindParam( "is" )->value->ToString(), "4.4k" );
BOOST_CHECK_EQUAL( aModel.FindParam( "m" )->value->ToString(), "5.5M" );
BOOST_CHECK_EQUAL( aModel.FindParam( "n" )->value->ToString(), "6.6G" );
}
void CompareToEmptyModel( const SIM_MODEL& aModel, const wxString& aModelName, int aModelIndex )
{
BOOST_TEST_CONTEXT( "Model index: " << aModelIndex )
{
BOOST_CHECK_EQUAL( aModelName, aModel.GetSpiceInfo().modelType.Upper()
+ wxString::FromCDouble( aModelIndex )
+ "_Empty" );
for( unsigned i = 0; i < aModel.GetParamCount(); ++i )
{
BOOST_TEST_CONTEXT( "Param name: " << aModel.GetParam( i ).info.name )
{
BOOST_CHECK_EQUAL( aModel.GetUnderlyingParam( i ).value->ToString(), "" );
}
}
}
}
void TestTransistor( const SIM_MODEL& aModel, const wxString& aModelName, int aModelIndex,
SIM_MODEL::TYPE aType, const std::vector<wxString>& aParamNames )
{
BOOST_TEST_CONTEXT( "Model index: " << aModelIndex
<< ", Model name: " << aModelName
<< ", Model device type: " << aModel.GetDeviceTypeInfo().fieldValue
<< ", Model type: " << aModel.GetTypeInfo().fieldValue )
{
BOOST_CHECK( aModel.GetType() == aType );
BOOST_CHECK_EQUAL( aModelName, "_" + wxString::FromCDouble( aModelIndex )
+ "_" + aModel.GetSpiceInfo().modelType.Upper()
+ "_" + aModel.GetTypeInfo().fieldValue );
for( int i = 0; i < aParamNames.size(); ++i )
{
wxString paramName = aParamNames.at( i );
BOOST_TEST_CONTEXT( "Param name: " << paramName )
{
if( i == 0 )
{
BOOST_CHECK_EQUAL( aModel.FindParam( paramName )->value->ToString(), "0" );
}
else
{
BOOST_CHECK_EQUAL( aModel.FindParam( paramName )->value->ToString(),
wxString::FromCDouble( i ) + ".0000"
+ wxString::FromCDouble( i ) + "G" );
}
}
}
}
}
std::unique_ptr<SIM_LIBRARY_SPICE> m_library;
};
BOOST_FIXTURE_TEST_SUITE( SimLibrarySpice, TEST_SIM_LIBRARY_SPICE_FIXTURE )
BOOST_AUTO_TEST_CASE( Diodes )
{
LoadLibrary( "diodes" );
const std::vector<std::reference_wrapper<SIM_MODEL>> models = m_library->GetModels();
const std::vector<wxString>& modelNames = m_library->GetModelNames();
BOOST_CHECK_EQUAL( models.size(), 21 );
for( int i = 0; i < models.size(); ++i )
{
const SIM_MODEL& model = models.at( i );
const wxString& modelName = modelNames.at( i );
switch( i )
{
case 0:
BOOST_CHECK_EQUAL( modelName, "1N4148" );
BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value->ToString(), "100" );
BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value->ToString(), "4p" );
BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value->ToString(), "100u" );
BOOST_CHECK_EQUAL( model.FindParam( "is" )->value->ToString(), "4n" );
BOOST_CHECK_EQUAL( model.FindParam( "m" )->value->ToString(), "330m" );
BOOST_CHECK_EQUAL( model.FindParam( "n" )->value->ToString(), "2" );
BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value->ToString(), "500m" );
BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value->ToString(), "10n" );
BOOST_CHECK_EQUAL( model.FindParam( "vj" )->value->ToString(), "800m" );
break;
case 1:
BOOST_CHECK_EQUAL( modelName, "D1" );
BOOST_CHECK_EQUAL( model.FindParam( "is" )->value->ToString(), "1.23n" );
BOOST_CHECK_EQUAL( model.FindParam( "n" )->value->ToString(), "1.23" );
BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value->ToString(), "789m" );
BOOST_CHECK_EQUAL( model.FindParam( "ikf" )->value->ToString(), "12.34m" );
BOOST_CHECK_EQUAL( model.FindParam( "xti" )->value->ToString(), "3" );
BOOST_CHECK_EQUAL( model.FindParam( "eg" )->value->ToString(), "1.23" );
BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value->ToString(), "900f" );
BOOST_CHECK_EQUAL( model.FindParam( "m" )->value->ToString(), "560m" );
BOOST_CHECK_EQUAL( model.FindParam( "vj" )->value->ToString(), "780m" );
BOOST_CHECK_EQUAL( model.FindParam( "fc" )->value->ToString(), "900m" );
BOOST_CHECK_EQUAL( model.FindParam( "isr" )->value->ToString(), "12.34n" );
BOOST_CHECK_EQUAL( model.FindParam( "nr" )->value->ToString(), "2.345" );
BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value->ToString(), "100" );
BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value->ToString(), "100u" );
BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value->ToString(), "12.34n" );
break;
case 2:
case 3:
CompareToUsualDiodeModel( model, modelName, i );
break;
case 4:
BOOST_CHECK_EQUAL( modelName, "D4" );
BOOST_CHECK_EQUAL( model.FindParam( "is" )->value->ToString(), "100f" );
BOOST_CHECK_EQUAL( model.FindParam( "rs" )->value->ToString(), "2" );
BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value->ToString(), "3p" );
BOOST_CHECK_EQUAL( model.FindParam( "tt" )->value->ToString(), "45n" );
BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value->ToString(), "678" );
BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value->ToString(), "100f" );
break;
case 5:
case 6:
case 7:
case 8:
case 9:
CompareToEmptyModel( model, modelName, i );
break;
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
CompareToUsualDiodeModel( model, modelName, i );
break;
case 18:
BOOST_CHECK_EQUAL( modelName, "D18" );
BOOST_CHECK_EQUAL( model.FindParam( "n" )->value->ToString(), "-1.1" );
BOOST_CHECK_EQUAL( model.FindParam( "m" )->value->ToString(), "2.2" );
BOOST_CHECK_EQUAL( model.FindParam( "is" )->value->ToString(), "-3.3m" );
BOOST_CHECK_EQUAL( model.FindParam( "ibv" )->value->ToString(), "44k" );
BOOST_CHECK_EQUAL( model.FindParam( "cjo" )->value->ToString(), "55u" );
BOOST_CHECK_EQUAL( model.FindParam( "bv" )->value->ToString(), "6.6M" );
break;
case 19:
case 20:
CompareToUsualDiodeModel( model, modelName, i );
break;
default:
BOOST_FAIL( "Unknown parameter index" );
}
}
}
BOOST_AUTO_TEST_CASE( Bjts )
{
LoadLibrary( "bjts" );
const std::vector<std::reference_wrapper<SIM_MODEL>> models = m_library->GetModels();
const std::vector<wxString>& modelNames = m_library->GetModelNames();
BOOST_CHECK_EQUAL( models.size(), 6 );
for( int i = 0; i < models.size(); ++i )
{
const SIM_MODEL& model = models.at( i );
const wxString& modelName = modelNames.at( i );
switch( i )
{
case 0:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_GUMMELPOON,
{ "is", "nf", "ise", "ne", "bf", "ikf", "vaf", "nr", "isc", "nc" } );
break;
case 1:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_GUMMELPOON,
{ "is", "nf", "ise", "ne", "bf", "ikf", "vaf", "nr", "isc", "nc" } );
break;
case 2:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_VBIC,
{ "rcx", "rci", "vo", "gamm", "hrcf", "rbx", "rbi", "re", "rs",
"rbp" } );
break;
case 3:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_VBIC,
{ "rcx", "rci", "vo", "gamm", "hrcf", "rbx", "rbi", "re", "rs",
"rbp" } );
break;
case 4:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NPN_HICUML2,
{ "c10", "qp0", "ich", "hf0", "hfe", "hfc", "hjei", "ahjei", "rhjei",
"hjci" } );
break;
case 5:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PNP_HICUML2,
{ "c10", "qp0", "ich", "hf0", "hfe", "hfc", "hjei", "ahjei", "rhjei",
"hjci" } );
break;
}
}
}
BOOST_AUTO_TEST_CASE( Fets )
{
LoadLibrary( "fets" );
const std::vector<std::reference_wrapper<SIM_MODEL>> models = m_library->GetModels();
const std::vector<wxString>& modelNames = m_library->GetModelNames();
BOOST_CHECK_EQUAL( models.size(), 44 );
for( int i = 0; i < models.size(); ++i )
{
const SIM_MODEL& model = models.at( i );
const wxString& modelName = modelNames.at( i );
switch( i )
{
case 0:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NJFET_SHICHMANHODGES,
{ "vt0", "beta", "lambda", "rd", "rs", "cgs", "cgd", "pb", "is",
"fc" } );
break;
case 1:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PJFET_SHICHMANHODGES,
{ "vt0", "beta", "lambda", "rd", "rs", "cgs", "cgd", "pb", "is",
"fc" } );
break;
case 2:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NJFET_PARKERSKELLERN,
{ "vbi", "af", "beta", "cds", "cgd", "cgs", "delta", "hfeta", "mvst",
"mxi" } );
break;
case 3:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PJFET_PARKERSKELLERN,
{ "vbi", "af", "beta", "cds", "cgd", "cgs", "delta", "hfeta", "mvst",
"mxi" } );
break;
case 4:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_STATZ,
{ "vt0", "alpha", "beta", "lambda", "b", "rd", "rs", "cgs", "cgd",
"pb" } );
break;
case 5:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_STATZ,
{ "vt0", "alpha", "beta", "lambda", "b", "rd", "rs", "cgs", "cgd",
"pb" } );
break;
case 6:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_YTTERDAL,
{ "vto", "lambda", "lambdahf", "beta", "vs", "rd", "rs", "rg", "ri",
"rf" } );
break;
case 7:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_YTTERDAL,
{ "vto", "lambda", "lambdahf", "beta", "vs", "rd", "rs", "rg", "ri",
"rf" } );
break;
case 8:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_HFET1,
{ "vt0", "lambda", "rd", "rs", "rg", "rdi", "rsi", "rgs", "rgd",
"eta" } );
break;
case 9:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_HFET1,
{ "vt0", "lambda", "rd", "rs", "rg", "rdi", "rsi", "rgs", "rgd",
"eta" } );
break;
case 10:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMES_HFET2,
{ "vs", "ggr", "js", "del", "delta", "deltad", "di", "epsi", "eta",
"eta1" } );
break;
case 11:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMES_HFET2,
{ "vs", "ggr", "js", "del", "delta", "deltad", "di", "epsi", "eta",
"eta1" } );
break;
case 12:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS1,
{ "vto", "kp", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 13:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS1,
{ "vto", "kp", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 14:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS2,
{ "vto", "kp", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 15:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS2,
{ "vto", "kp", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 16:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS3,
{ "vto", "theta", "gamma", "phi", "eta", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 17:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS3,
{ "vto", "theta", "gamma", "phi", "eta", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 18:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM1,
{ "vfb", "lvfb", "wvfb", "phi", "lphi", "wphi", "k1", "lk1", "wk1",
"k2" } );
break;
case 19:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM1,
{ "vfb", "lvfb", "wvfb", "phi", "lphi", "wphi", "k1", "lk1", "wk1",
"k2" } );
break;
case 20:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM2,
{ "bib", "lbib", "wbib", "vghigh", "lvghigh", "wvghigh",
"waib", "bi0", "lbi0", "wbi0" } );
break;
case 21:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM2,
{ "bib", "lbib", "wbib", "vghigh", "lvghigh", "wvghigh",
"waib", "bi0", "lbi0", "wbi0" } );
break;
case 22:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS6,
{ "vto", "nvth", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 23:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS6,
{ "vto", "nvth", "gamma", "phi", "lambda", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 24:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM3,
{ "tox", "toxm", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "xj",
"vsat", "at" } );
break;
case 25:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM3,
{ "tox", "toxm", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "xj",
"vsat", "at" } );
break;
case 26:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_MOS9,
{ "vto", "theta", "gamma", "phi", "eta", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 27:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_MOS9,
{ "vto", "theta", "gamma", "phi", "eta", "rd", "rs", "cbd", "cbs",
"is" } );
break;
case 28:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B4SOI,
{ "tox", "toxp", "toxm", "dtoxcv", "cdsc", "cdscb", "cdscd", "cit",
"nfactor", "vsat" } );
break;
case 29:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B4SOI,
{ "tox", "toxp", "toxm", "dtoxcv", "cdsc", "cdscb", "cdscd", "cit",
"nfactor", "vsat" } );
break;
case 30:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_BSIM4,
{ "rbps0", "rbpsl", "rbpsw", "rbpsnf", "rbpd0", "rbpdl", "rbpdw", "rbpdnf",
"rbpbx0", "rbpbxl" } );
break;
case 31:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_BSIM4,
{ "rbps0", "rbpsl", "rbpsw", "rbpsnf", "rbpd0", "rbpdl", "rbpdw", "rbpdnf",
"rbpbx0", "rbpbxl" } );
break;
case 32:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIFD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 33:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIFD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 34:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIDD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 35:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIDD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 36:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_B3SOIPD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 37:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_B3SOIPD,
{ "tox", "cdsc", "cdscb", "cdscd", "cit", "nfactor", "vsat", "at", "a0",
"ags" } );
break;
case 38:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIM2,
{ "depmue0", "depmue0l", "depmue0lp", "depmue1", "depmue1l",
"depmue1lp", "depmueback0", "depmueback0l", "depmueback0lp",
"depmueback1" } );
break;
case 39:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIM2,
{ "depmue0", "depmue0l", "depmue0lp", "depmue1", "depmue1l", "depmue1lp",
"depmueback0", "depmueback0l", "depmueback0lp", "depmueback1" } );
break;
case 40:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIMHV1,
{ "prd", "prd22", "prd23", "prd24", "prdict1", "prdov13", "prdslp1",
"prdvb", "prdvd", "prdvg11" } );
break;
case 41:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIMHV1,
{ "prd", "prd22", "prd23", "prd24", "prdict1", "prdov13", "prdslp1",
"prdvb", "prdvd", "prdvg11" } );
break;
case 42:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::NMOS_HISIMHV2,
{ "pjs0d", "pjs0swd", "pnjd", "pcisbkd", "pvdiffjd", "pjs0s", "pjs0sws",
"prs", "prth0", "pvover" } );
break;
case 43:
TestTransistor( model, modelName, i, SIM_MODEL::TYPE::PMOS_HISIMHV2,
{ "pjs0d", "pjs0swd", "pnjd", "pcisbkd", "pvdiffjd", "pjs0s", "pjs0sws",
"prs", "prth0", "pvover" } );
break;
}
}
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE( Models )
BOOST_CHECK_EQUAL( instanceParamCount, 20 );
break;*/
case NGSPICE::MODEL_TYPE::LTRA:
/*case NGSPICE::MODEL_TYPE::LTRA:
BOOST_CHECK_EQUAL( modelParamCount, 18 );
BOOST_CHECK_EQUAL( instanceParamCount, 9 );
break;
@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE( Models )
case NGSPICE::MODEL_TYPE::URC:
BOOST_CHECK_EQUAL( modelParamCount, 7 );
BOOST_CHECK_EQUAL( instanceParamCount, 5 );
break;
break;*/
/*case NGSPICE::MODEL_TYPE::TRANSLINE:
BOOST_CHECK_EQUAL( modelParamCount, 6 );
@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE( Models )
break;
case NGSPICE::MODEL_TYPE::JFET2:
BOOST_CHECK_EQUAL( modelParamCount, 39 );
BOOST_CHECK_EQUAL( modelParamCount, 46 );
BOOST_CHECK_EQUAL( instanceParamCount, 30 );
break;
@ -124,17 +124,17 @@ BOOST_AUTO_TEST_CASE( Models )
break;
case NGSPICE::MODEL_TYPE::MESA:
BOOST_CHECK_EQUAL( modelParamCount, 51 );
BOOST_CHECK_EQUAL( modelParamCount, 71 );
BOOST_CHECK_EQUAL( instanceParamCount, 30 );
break;
case NGSPICE::MODEL_TYPE::HFET1:
BOOST_CHECK_EQUAL( modelParamCount, 22 );
BOOST_CHECK_EQUAL( modelParamCount, 68 );
BOOST_CHECK_EQUAL( instanceParamCount, 28 );
break;
case NGSPICE::MODEL_TYPE::HFET2:
BOOST_CHECK_EQUAL( modelParamCount, 19 );
BOOST_CHECK_EQUAL( modelParamCount, 40 );
BOOST_CHECK_EQUAL( instanceParamCount, 28 );
break;
@ -209,13 +209,13 @@ BOOST_AUTO_TEST_CASE( Models )
break;
case NGSPICE::MODEL_TYPE::HISIMHV1:
BOOST_CHECK_EQUAL( modelParamCount, 536 );
BOOST_CHECK_EQUAL( instanceParamCount, 66 );
BOOST_CHECK_EQUAL( modelParamCount, 610 );
BOOST_CHECK_EQUAL( instanceParamCount, 72 );
break;
case NGSPICE::MODEL_TYPE::HISIMHV2:
BOOST_CHECK_EQUAL( modelParamCount, 630 );
BOOST_CHECK_EQUAL( instanceParamCount, 68 );
BOOST_CHECK_EQUAL( modelParamCount, 730 );
BOOST_CHECK_EQUAL( instanceParamCount, 74 );
break;
default:

View File

@ -115,4 +115,10 @@ BOOST_AUTO_TEST_CASE( Passives )
}
BOOST_AUTO_TEST_CASE( Tlines )
{
TestNetlist( "tlines" );
}
BOOST_AUTO_TEST_SUITE_END()