27#include <boost/algorithm/string/replace.hpp>
28#include <boost/algorithm/string/trim.hpp>
42 case SIM_MODEL::TYPE::R_BEHAVIORAL:
43 case SIM_MODEL::TYPE::C_BEHAVIORAL:
44 case SIM_MODEL::TYPE::L_BEHAVIORAL:
51 case SIM_MODEL::TYPE::V_BEHAVIORAL:
58 case SIM_MODEL::TYPE::I_BEHAVIORAL:
66 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_BEHAVIORAL" );
75 static PARAM::INFO resistor =
makeParams(
"r",
"Expression for resistance",
"Ω" );
76 static PARAM::INFO capacitor =
makeParams(
"c",
"Expression for capacitance",
"F" );
77 static PARAM::INFO inductor =
makeParams(
"l",
"Expression for inductance",
"H" );
78 static PARAM::INFO vsource =
makeParams(
"v",
"Expression for voltage",
"V" );
79 static PARAM::INFO isource =
makeParams(
"i",
"Expression for current",
"A" );
83 case TYPE::R_BEHAVIORAL:
AddParam( resistor );
break;
84 case TYPE::C_BEHAVIORAL:
AddParam( capacitor );
break;
85 case TYPE::L_BEHAVIORAL:
AddParam( inductor );
break;
86 case TYPE::V_BEHAVIORAL:
AddParam( vsource );
break;
87 case TYPE::I_BEHAVIORAL:
AddParam( isource );
break;
89 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_IDEAL" );
96 std::string expr = aValueField;
98 if( expr.find(
"=" ) == std::string::npos )
101 boost::replace_first( expr,
"=",
"" );
109 const std::string& aDescription,
110 const std::string& aUnit )
113 PARAM::CATEGORY::PRINCIPAL );
115 paramInfo.description = aDescription;
bool parseValueField(const std::string &aValueField)
SIM_MODEL_BEHAVIORAL(TYPE aType)
static PARAM::INFO makeParams(const std::string &aName, const std::string &aDescription, const std::string &aUnit)
void AddParam(const PARAM::INFO &aInfo)
virtual const PARAM & GetParam(unsigned aParamIndex) const
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
static std::string ToSpice(const std::string &aString)
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::string ItemLine(const SPICE_ITEM &aItem) const override
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
const SIM_MODEL & m_model