28#include <boost/algorithm/string/predicate.hpp>
30#include <pegtl/contrib/parse_tree.hpp>
52 if( aItem.
refName !=
"" && boost::starts_with( aItem.
refName, type ) )
55 return fmt::format(
"{}{}", type, aItem.
refName );
69 pin.symbolPinNumber );
73 long symbolPinIndex = std::distance( aItem.
pinNumbers.begin(), it );
74 result.append( fmt::format(
" {}", aItem.
pinNetNames.at( symbolPinIndex ) ) );
78 result.append( fmt::format(
" NC-{}-{}", aItem.
refName, ncCounter++ ) );
86 for(
const std::string& pinNetName : aItem.
pinNetNames )
87 result.append( fmt::format(
" {}", pinNetName ) );
108 if( !
param.info.isSpiceInstanceParam )
111 if(
param.info.name ==
"model" )
126 item.
pinNumbers.push_back( fmt::format(
"{}", i + 1 ) );
127 item.
pinNetNames.push_back( fmt::format(
"{}", i + 1 ) );
134SIM_MODEL_RAW_SPICE::SIM_MODEL_RAW_SPICE(
const std::string& aSpiceSource ) :
136 m_spiceCode( aSpiceSource )
138 static std::vector<PARAM::INFO> paramInfos = makeParamInfos();
141 AddParam( paramInfo );
143 SetParamValue(
"model", aSpiceSource );
148 const wxString& aSymbolPinNumber )
151 int pinIndex = (int) strtol( aModelPinName.c_str(),
nullptr, 10 );
158 m_modelPins[ --pinIndex ].symbolPinNumber = aSymbolPinNumber;
165 std::vector<PARAM::INFO> paramInfos;
167 for( SPICE_PARAM spiceParam : SPICE_PARAM_ITERATOR() )
173 case SPICE_PARAM::TYPE:
174 paramInfo.
name =
"type";
182 paramInfos.push_back( paramInfo );
185 case SPICE_PARAM::MODEL:
186 paramInfo.
name =
"model";
194 paramInfos.push_back( paramInfo );
197 case SPICE_PARAM::LIB:
198 paramInfo.
name =
"lib";
206 paramInfos.push_back( paramInfo );
209 case SPICE_PARAM::_ENUM_END:
void AssignSymbolPinNumberToModelPin(const std::string &aModelPinName, const wxString &aSymbolPinNumber) override
static std::vector< PARAM::INFO > makeParamInfos()
std::vector< SIM_MODEL_PIN > m_modelPins
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
static std::string ToSpice(const std::string &aString)
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::string ItemPins(const SPICE_ITEM &aItem) const override
std::string ItemModelName(const SPICE_ITEM &aItem) const override
std::string ItemParams() const override
std::string Preview(const SPICE_ITEM &aItem) const override
std::string ItemName(const SPICE_ITEM &aItem) const override
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
virtual std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
const SIM_MODEL & m_model
static bool empty(const wxTextEntryBase *aCtrl)
bool isSpiceInstanceParam
std::vector< std::string > pinNetNames
std::vector< std::string > pinNumbers