35 case SIM_MODEL::TYPE::SW_V:
41 case SIM_MODEL::TYPE::SW_I:
43 std::string vsourceName = fmt::format(
"V__{}", aItem.
refName );
45 wxCHECK_MSG( aItem.
pinNetNames.size() >= 2,
"", wxS(
"Missing two pin net names for SW_I" ) );
57 wxFAIL_MSG( wxS(
"Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" ) );
77 std::string value = param.
value;
80 result.append(
" " + value );
91 case SIM_MODEL::TYPE::SW_V:
94 case SIM_MODEL::TYPE::SW_I:
98 wxFAIL_MSG(
"Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" );
114 for(
const PARAM::INFO& paramInfo : vsw )
119 for(
const PARAM::INFO& paramInfo : isw )
124 wxFAIL_MSG( wxS(
"Unhandled SIM_MODEL type in SIM_MODEL_SWITCH" ) );
132 std::vector<PARAM::INFO> paramInfos;
133 PARAM::INFO paramInfo;
135 paramInfo.name =
"thr";
137 paramInfo.unit =
"V";
138 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
139 paramInfo.defaultValue =
"0";
140 paramInfo.description =
"Threshold voltage";
141 paramInfo.isSpiceInstanceParam =
false;
142 paramInfo.spiceModelName =
"vt";
143 paramInfo.enumValues = {};
144 paramInfos.push_back( paramInfo );
146 paramInfo.name =
"his";
148 paramInfo.unit =
"V";
149 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
150 paramInfo.defaultValue =
"0";
151 paramInfo.description =
"Hysteresis voltage";
152 paramInfo.isSpiceInstanceParam =
false;
153 paramInfo.spiceModelName =
"vh";
154 paramInfo.enumValues = {};
155 paramInfos.push_back( paramInfo );
157 paramInfo.name =
"ron";
159 paramInfo.unit =
"Ω";
160 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
161 paramInfo.defaultValue =
"1";
162 paramInfo.description =
"Resistance when closed";
163 paramInfo.isSpiceInstanceParam =
false;
164 paramInfo.spiceModelName =
"";
165 paramInfo.enumValues = {};
166 paramInfos.push_back( paramInfo );
168 paramInfo.name =
"roff";
170 paramInfo.unit =
"Ω";
171 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
172 paramInfo.defaultValue =
"1e+12";
173 paramInfo.description =
"Resistance when open";
174 paramInfo.isSpiceInstanceParam =
false;
175 paramInfo.spiceModelName =
"";
176 paramInfo.enumValues = {};
177 paramInfos.push_back( paramInfo );
179 paramInfo.name =
"ic";
182 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
183 paramInfo.defaultValue =
"none";
184 paramInfo.description =
"Initial state";
185 paramInfo.isSpiceInstanceParam =
true;
186 paramInfo.spiceModelName =
"";
187 paramInfo.enumValues = {
"none",
"off",
"on" };
188 paramInfos.push_back( paramInfo );
196 std::vector<PARAM::INFO> paramInfos;
197 PARAM::INFO paramInfo;
199 paramInfo.name =
"thr";
201 paramInfo.unit =
"A";
202 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
203 paramInfo.defaultValue =
"0";
204 paramInfo.description =
"Threshold current";
205 paramInfo.isSpiceInstanceParam =
false;
206 paramInfo.spiceModelName =
"it";
207 paramInfo.enumValues = {};
208 paramInfos.push_back( paramInfo );
210 paramInfo.name =
"his";
212 paramInfo.unit =
"A";
213 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
214 paramInfo.defaultValue =
"0";
215 paramInfo.description =
"Hysteresis current";
216 paramInfo.isSpiceInstanceParam =
false;
217 paramInfo.spiceModelName =
"ih";
218 paramInfo.enumValues = {};
219 paramInfos.push_back( paramInfo );
221 paramInfo.name =
"ron";
223 paramInfo.unit =
"Ω";
224 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
225 paramInfo.defaultValue =
"1";
226 paramInfo.description =
"Resistance when closed";
227 paramInfo.isSpiceInstanceParam =
false;
228 paramInfo.spiceModelName =
"";
229 paramInfo.enumValues = {};
230 paramInfos.push_back( paramInfo );
232 paramInfo.name =
"roff";
234 paramInfo.unit =
"Ω";
235 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
236 paramInfo.defaultValue =
"1e+12";
237 paramInfo.description =
"Resistance when open";
238 paramInfo.isSpiceInstanceParam =
false;
239 paramInfo.spiceModelName =
"";
240 paramInfo.enumValues = {};
241 paramInfos.push_back( paramInfo );
243 paramInfo.name =
"ic";
246 paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
247 paramInfo.defaultValue =
"1";
248 paramInfo.description =
"Initial state";
249 paramInfo.isSpiceInstanceParam =
true;
250 paramInfo.spiceModelName =
"";
251 paramInfo.enumValues = {
"none",
"off",
"on" };
252 paramInfos.push_back( paramInfo );
SIM_MODEL_SWITCH(TYPE aType)
static const std::vector< PARAM::INFO > makeSwVParamInfos()
static const std::vector< PARAM::INFO > makeSwIParamInfos()
void AddParam(const PARAM::INFO &aInfo)
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
const SIM_MODEL_PIN & GetPin(unsigned aIndex) const
std::string ItemLine(const SPICE_ITEM &aItem) const override
std::string ItemParams() const override
std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const override
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
const SIM_MODEL & m_model
bool isSpiceInstanceParam
std::vector< std::string > pinNetNames