23#include <boost/algorithm/string/replace.hpp>
24#include <boost/algorithm/string/trim.hpp>
38 case SIM_MODEL::TYPE::R_BEHAVIORAL:
39 case SIM_MODEL::TYPE::C_BEHAVIORAL:
40 case SIM_MODEL::TYPE::L_BEHAVIORAL:
47 case SIM_MODEL::TYPE::V_BEHAVIORAL:
54 case SIM_MODEL::TYPE::I_BEHAVIORAL:
62 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_BEHAVIORAL" );
71 static PARAM::INFO resistor =
makeParams(
"r",
"Expression for resistance",
"Ω" );
72 static PARAM::INFO capacitor =
makeParams(
"c",
"Expression for capacitance",
"F" );
73 static PARAM::INFO inductor =
makeParams(
"l",
"Expression for inductance",
"H" );
74 static PARAM::INFO vsource =
makeParams(
"v",
"Expression for voltage",
"V" );
75 static PARAM::INFO isource =
makeParams(
"i",
"Expression for current",
"A" );
79 case TYPE::R_BEHAVIORAL:
AddParam( resistor );
break;
80 case TYPE::C_BEHAVIORAL:
AddParam( capacitor );
break;
81 case TYPE::L_BEHAVIORAL:
AddParam( inductor );
break;
82 case TYPE::V_BEHAVIORAL:
AddParam( vsource );
break;
83 case TYPE::I_BEHAVIORAL:
AddParam( isource );
break;
84 default: wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_IDEAL" );
91 std::string expr = aValueField;
93 if( expr.find(
"=" ) == std::string::npos )
96 boost::replace_first( expr,
"=",
"" );
104 const std::string& aDescription,
105 const std::string& aUnit )
108 PARAM::CATEGORY::PRINCIPAL );
110 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)
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