27#include <boost/algorithm/string.hpp>
36 case SIM_MODEL::DEVICE_T::NPN:
37 case SIM_MODEL::DEVICE_T::PNP:
38 return { fmt::format(
"I({}:c)",
ItemName( aItem ) ),
39 fmt::format(
"I({}:b)",
ItemName( aItem ) ),
40 fmt::format(
"I({}:e)",
ItemName( aItem ) ) };
42 case SIM_MODEL::DEVICE_T::NJFET:
43 case SIM_MODEL::DEVICE_T::PJFET:
44 case SIM_MODEL::DEVICE_T::NMES:
45 case SIM_MODEL::DEVICE_T::PMES:
46 case SIM_MODEL::DEVICE_T::NMOS:
47 case SIM_MODEL::DEVICE_T::PMOS:
48 return { fmt::format(
"I({}:d)",
ItemName( aItem ) ),
49 fmt::format(
"I({}:g)",
ItemName( aItem ) ),
50 fmt::format(
"I({}:s)",
ItemName( aItem ) ) };
52 case SIM_MODEL::DEVICE_T::R:
53 case SIM_MODEL::DEVICE_T::C:
54 case SIM_MODEL::DEVICE_T::L:
55 case SIM_MODEL::DEVICE_T::D:
91 if( param.
Matches( aParamName ) )
100 if( !param.
info.
name.ends_with(
'_' ) )
103 if( param.
Matches( aParamName +
"_" ) )
112 const std::string& aValue,
117 if( boost::iequals( aParamName,
"level" ) || boost::iequals( aParamName,
"version" ) )
130 if( param.
Matches( aParamName ) )
145 if( !param.
info.
name.ends_with(
'_' ) )
148 if( param.
Matches( aParamName +
"_" ) )
162 if( ngspiceParamInfo.Matches( aParamName ) )
173 if( paramInfo.
id == ngspiceParamInfo.id )
185 THROW_IO_ERROR( wxString::Format(
"Unknown simulation model parameter '%s'", aParamName ) );
192 if( boost::iequals( aParamName,
"mfg" ) || boost::iequals( aParamName,
"type" ) )
197 if( boost::iequals( aParamName,
"perim" )
198 || boost::iequals( aParamName,
"isw" )
199 || boost::iequals( aParamName,
"ns" )
200 || boost::iequals( aParamName,
"rsw" )
201 || boost::iequals( aParamName,
"cjsw" )
202 || boost::iequals( aParamName,
"vjsw" )
203 || boost::iequals( aParamName,
"mjsw" )
204 || boost::iequals( aParamName,
"fcs" ) )
213 if( boost::iequals( aParamName,
"icrating" ) || boost::iequals( aParamName,
"vceo" ) )
217 if(
GetType() == TYPE::NPN_GUMMELPOON ||
GetType() == TYPE::PNP_GUMMELPOON )
220 if( boost::iequals( aParamName,
"bvcbo" )
221 || boost::iequals( aParamName,
"nbvcbo" )
222 || boost::iequals( aParamName,
"tbvcbo1" )
223 || boost::iequals( aParamName,
"tbvcbo2" )
224 || boost::iequals( aParamName,
"bvbe" )
225 || boost::iequals( aParamName,
"ibvbe" )
226 || boost::iequals( aParamName,
"nbvbe" ) )
232 if(
GetType() == TYPE::NMOS_VDMOS ||
GetType() == TYPE::PMOS_VDMOS )
235 if( boost::iequals( aParamName,
"vds" )
236 || boost::iequals( aParamName,
"ron" )
237 || boost::iequals( aParamName,
"qg" ) )
257 case TYPE::NONE:
return MODEL_TYPE::NONE;
258 case TYPE::D:
return MODEL_TYPE::DIODE;
261 case TYPE::PNP_VBIC:
return MODEL_TYPE::VBIC;
262 case TYPE::NPN_GUMMELPOON:
263 case TYPE::PNP_GUMMELPOON:
return MODEL_TYPE::BJT;
264 case TYPE::NPN_HICUM2:
265 case TYPE::PNP_HICUM2:
return MODEL_TYPE::HICUM2;
267 case TYPE::NJFET_SHICHMANHODGES:
268 case TYPE::PJFET_SHICHMANHODGES:
return MODEL_TYPE::JFET;
269 case TYPE::NJFET_PARKERSKELLERN:
270 case TYPE::PJFET_PARKERSKELLERN:
return MODEL_TYPE::JFET2;
272 case TYPE::NMES_STATZ:
273 case TYPE::PMES_STATZ:
return MODEL_TYPE::MES;
274 case TYPE::NMES_YTTERDAL:
275 case TYPE::PMES_YTTERDAL:
return MODEL_TYPE::MESA;
276 case TYPE::NMES_HFET1:
277 case TYPE::PMES_HFET1:
return MODEL_TYPE::HFET1;
278 case TYPE::NMES_HFET2:
279 case TYPE::PMES_HFET2:
return MODEL_TYPE::HFET2;
281 case TYPE::NMOS_VDMOS:
282 case TYPE::PMOS_VDMOS:
return MODEL_TYPE::VDMOS;
283 case TYPE::NMOS_MOS1:
284 case TYPE::PMOS_MOS1:
return MODEL_TYPE::MOS1;
285 case TYPE::NMOS_MOS2:
286 case TYPE::PMOS_MOS2:
return MODEL_TYPE::MOS2;
287 case TYPE::NMOS_MOS3:
288 case TYPE::PMOS_MOS3:
return MODEL_TYPE::MOS3;
289 case TYPE::NMOS_BSIM1:
290 case TYPE::PMOS_BSIM1:
return MODEL_TYPE::BSIM1;
291 case TYPE::NMOS_BSIM2:
292 case TYPE::PMOS_BSIM2:
return MODEL_TYPE::BSIM2;
293 case TYPE::NMOS_MOS6:
294 case TYPE::PMOS_MOS6:
return MODEL_TYPE::MOS6;
295 case TYPE::NMOS_BSIM3:
296 case TYPE::PMOS_BSIM3:
return MODEL_TYPE::BSIM3;
297 case TYPE::NMOS_MOS9:
298 case TYPE::PMOS_MOS9:
return MODEL_TYPE::MOS9;
299 case TYPE::NMOS_B4SOI:
300 case TYPE::PMOS_B4SOI:
return MODEL_TYPE::B4SOI;
301 case TYPE::NMOS_BSIM4:
302 case TYPE::PMOS_BSIM4:
return MODEL_TYPE::BSIM4;
303 case TYPE::NMOS_B3SOIFD:
304 case TYPE::PMOS_B3SOIFD:
return MODEL_TYPE::B3SOIFD;
305 case TYPE::NMOS_B3SOIDD:
306 case TYPE::PMOS_B3SOIDD:
return MODEL_TYPE::B3SOIDD;
307 case TYPE::NMOS_B3SOIPD:
308 case TYPE::PMOS_B3SOIPD:
return MODEL_TYPE::B3SOIPD;
309 case TYPE::NMOS_HISIM2:
310 case TYPE::PMOS_HISIM2:
return MODEL_TYPE::HISIM2;
311 case TYPE::NMOS_HISIMHV1:
312 case TYPE::PMOS_HISIMHV1:
return MODEL_TYPE::HISIMHV1;
313 case TYPE::NMOS_HISIMHV2:
314 case TYPE::PMOS_HISIMHV2:
return MODEL_TYPE::HISIMHV2;
317 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_NGSPICE" );
318 return MODEL_TYPE::NONE;
336 modelInfos[SIM_MODEL_NGSPICE::MODEL_TYPE::NONE] = {};
bool canSilentlyIgnoreParam(const std::string &aParamName)
static const MODEL_INFO & ModelInfo(MODEL_TYPE aType)
std::vector< std::string > GetPinNames() const override
MODEL_TYPE getModelType() const
void SetParamFromSpiceCode(const std::string &aParamName, const std::string &aValue, SIM_VALUE_GRAMMAR::NOTATION aNotation) override
int doFindParam(const std::string &aParamName) const override
SIM_MODEL_NGSPICE(TYPE aType)
void AddParam(const PARAM::INFO &aInfo)
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
DEVICE_T GetDeviceType() const
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const override
virtual std::string ItemName(const SPICE_ITEM &aItem) const
const SIM_MODEL & m_model
virtual std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const
#define THROW_IO_ERROR(msg)
static std::unique_ptr< NGSPICE_MODEL_INFO_MAP > s_ModelInfoMap
std::unordered_map< MODEL_TYPE, MODEL_INFO > modelInfos
bool isSpiceInstanceParam
bool Matches(const std::string &aName) const