27#include <boost/algorithm/string.hpp>
35 case SIM_MODEL::DEVICE_T::NPN:
36 case SIM_MODEL::DEVICE_T::PNP:
37 return { fmt::format(
"I({}:c)",
ItemName( aItem ) ),
38 fmt::format(
"I({}:b)",
ItemName( aItem ) ),
39 fmt::format(
"I({}:e)",
ItemName( aItem ) ) };
41 case SIM_MODEL::DEVICE_T::NJFET:
42 case SIM_MODEL::DEVICE_T::PJFET:
43 case SIM_MODEL::DEVICE_T::NMES:
44 case SIM_MODEL::DEVICE_T::PMES:
45 case SIM_MODEL::DEVICE_T::NMOS:
46 case SIM_MODEL::DEVICE_T::PMOS:
47 return { fmt::format(
"I({}:d)",
ItemName( aItem ) ),
48 fmt::format(
"I({}:g)",
ItemName( aItem ) ),
49 fmt::format(
"I({}:s)",
ItemName( aItem ) ) };
51 case SIM_MODEL::DEVICE_T::R:
52 case SIM_MODEL::DEVICE_T::C:
53 case SIM_MODEL::DEVICE_T::L:
54 case SIM_MODEL::DEVICE_T::D:
90 if( param.
Matches( aParamName ) )
99 if( !param.
info.
name.ends_with(
'_' ) )
102 if( param.
Matches( aParamName +
"_" ) )
111 const std::string& aValue,
116 if( boost::iequals( aParamName,
"level" ) || boost::iequals( aParamName,
"version" ) )
129 if( param.
Matches( aParamName ) )
144 if( !param.
info.
name.ends_with(
'_' ) )
147 if( param.
Matches( aParamName +
"_" ) )
161 if( ngspiceParamInfo.Matches( aParamName ) )
172 if( paramInfo.
id == ngspiceParamInfo.id )
184 THROW_IO_ERROR( wxString::Format(
"Unknown simulation model parameter '%s'", aParamName ) );
191 if( boost::iequals( aParamName,
"mfg" ) || boost::iequals( aParamName,
"type" ) )
196 if( boost::iequals( aParamName,
"perim" )
197 || boost::iequals( aParamName,
"isw" )
198 || boost::iequals( aParamName,
"ns" )
199 || boost::iequals( aParamName,
"rsw" )
200 || boost::iequals( aParamName,
"cjsw" )
201 || boost::iequals( aParamName,
"vjsw" )
202 || boost::iequals( aParamName,
"mjsw" )
203 || boost::iequals( aParamName,
"fcs" ) )
212 if( boost::iequals( aParamName,
"icrating" ) || boost::iequals( aParamName,
"vceo" ) )
216 if(
GetType() == TYPE::NPN_GUMMELPOON ||
GetType() == TYPE::PNP_GUMMELPOON )
219 if( boost::iequals( aParamName,
"bvcbo" )
220 || boost::iequals( aParamName,
"nbvcbo" )
221 || boost::iequals( aParamName,
"tbvcbo1" )
222 || boost::iequals( aParamName,
"tbvcbo2" )
223 || boost::iequals( aParamName,
"bvbe" )
224 || boost::iequals( aParamName,
"ibvbe" )
225 || boost::iequals( aParamName,
"nbvbe" ) )
231 if(
GetType() == TYPE::NMOS_VDMOS ||
GetType() == TYPE::PMOS_VDMOS )
234 if( boost::iequals( aParamName,
"vds" )
235 || boost::iequals( aParamName,
"ron" )
236 || boost::iequals( aParamName,
"qg" ) )
256 case TYPE::NONE:
return MODEL_TYPE::NONE;
257 case TYPE::D:
return MODEL_TYPE::DIODE;
260 case TYPE::PNP_VBIC:
return MODEL_TYPE::VBIC;
261 case TYPE::NPN_GUMMELPOON:
262 case TYPE::PNP_GUMMELPOON:
return MODEL_TYPE::BJT;
263 case TYPE::NPN_HICUM2:
264 case TYPE::PNP_HICUM2:
return MODEL_TYPE::HICUM2;
266 case TYPE::NJFET_SHICHMANHODGES:
267 case TYPE::PJFET_SHICHMANHODGES:
return MODEL_TYPE::JFET;
268 case TYPE::NJFET_PARKERSKELLERN:
269 case TYPE::PJFET_PARKERSKELLERN:
return MODEL_TYPE::JFET2;
271 case TYPE::NMES_STATZ:
272 case TYPE::PMES_STATZ:
return MODEL_TYPE::MES;
273 case TYPE::NMES_YTTERDAL:
274 case TYPE::PMES_YTTERDAL:
return MODEL_TYPE::MESA;
275 case TYPE::NMES_HFET1:
276 case TYPE::PMES_HFET1:
return MODEL_TYPE::HFET1;
277 case TYPE::NMES_HFET2:
278 case TYPE::PMES_HFET2:
return MODEL_TYPE::HFET2;
280 case TYPE::NMOS_VDMOS:
281 case TYPE::PMOS_VDMOS:
return MODEL_TYPE::VDMOS;
282 case TYPE::NMOS_MOS1:
283 case TYPE::PMOS_MOS1:
return MODEL_TYPE::MOS1;
284 case TYPE::NMOS_MOS2:
285 case TYPE::PMOS_MOS2:
return MODEL_TYPE::MOS2;
286 case TYPE::NMOS_MOS3:
287 case TYPE::PMOS_MOS3:
return MODEL_TYPE::MOS3;
288 case TYPE::NMOS_BSIM1:
289 case TYPE::PMOS_BSIM1:
return MODEL_TYPE::BSIM1;
290 case TYPE::NMOS_BSIM2:
291 case TYPE::PMOS_BSIM2:
return MODEL_TYPE::BSIM2;
292 case TYPE::NMOS_MOS6:
293 case TYPE::PMOS_MOS6:
return MODEL_TYPE::MOS6;
294 case TYPE::NMOS_BSIM3:
295 case TYPE::PMOS_BSIM3:
return MODEL_TYPE::BSIM3;
296 case TYPE::NMOS_MOS9:
297 case TYPE::PMOS_MOS9:
return MODEL_TYPE::MOS9;
298 case TYPE::NMOS_B4SOI:
299 case TYPE::PMOS_B4SOI:
return MODEL_TYPE::B4SOI;
300 case TYPE::NMOS_BSIM4:
301 case TYPE::PMOS_BSIM4:
return MODEL_TYPE::BSIM4;
302 case TYPE::NMOS_B3SOIFD:
303 case TYPE::PMOS_B3SOIFD:
return MODEL_TYPE::B3SOIFD;
304 case TYPE::NMOS_B3SOIDD:
305 case TYPE::PMOS_B3SOIDD:
return MODEL_TYPE::B3SOIDD;
306 case TYPE::NMOS_B3SOIPD:
307 case TYPE::PMOS_B3SOIPD:
return MODEL_TYPE::B3SOIPD;
308 case TYPE::NMOS_HISIM2:
309 case TYPE::PMOS_HISIM2:
return MODEL_TYPE::HISIM2;
310 case TYPE::NMOS_HISIMHV1:
311 case TYPE::PMOS_HISIMHV1:
return MODEL_TYPE::HISIMHV1;
312 case TYPE::NMOS_HISIMHV2:
313 case TYPE::PMOS_HISIMHV2:
return MODEL_TYPE::HISIMHV2;
316 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_NGSPICE" );
317 return MODEL_TYPE::NONE;
335 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