KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_model_source.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022 Mikolaj Wielgus
5 * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * https://www.gnu.org/licenses/gpl-3.0.html
20 * or you may search the http://www.gnu.org website for the version 3 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
26
27#include <fmt/core.h>
28#include <pegtl.hpp>
29#include <pegtl/contrib/parse_tree.hpp>
30
31
33{
34 using namespace SIM_MODEL_SOURCE_GRAMMAR;
35
36 template <typename Rule> struct pwlValuesSelector : std::false_type {};
37 template <> struct pwlValuesSelector<number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>>
38 : std::true_type {};
39}
40
41
42std::string SPICE_GENERATOR_SOURCE::ModelLine( const SPICE_ITEM& aItem ) const
43{
44 return "";
45}
46
47
48std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
49{
50 SPICE_ITEM item = aItem;
51
52 std::string ac = "";
53 std::string dc = "";
54
55 if( const SIM_MODEL::PARAM* ac_param = m_model.FindParam( "ac" ) )
56 ac = SIM_VALUE::ToSpice( ac_param->value );
57 if( const SIM_MODEL::PARAM* dc_param = m_model.FindParam( "dc" ) )
58 dc = SIM_VALUE::ToSpice( dc_param->value );
59
60 bool emptyLine = true;
61 item.modelName = "";
62
63 // @FIXME
64 // the keyword "DC" refers to both offset of a sine source, and value for DC analysis
65 // Because of this, both values are always equal in a sine source.
66 //
67 // suggestion: rename the sine parameter from "DC" to "offset"
68
69 if( dc != "" )
70 {
71 emptyLine = false;
72 item.modelName += fmt::format( "DC {} ", dc );
73 }
74
76 && m_model.GetType() != SIM_MODEL::TYPE::V // DC-only sources are already processed
77 && m_model.GetType() != SIM_MODEL::TYPE::I )
78 {
79 std::string args = "";
80
81 switch( m_model.GetType() )
82 {
83 case SIM_MODEL::TYPE::V_PWL:
84 case SIM_MODEL::TYPE::I_PWL:
85 {
86 tao::pegtl::string_input<> in( m_model.GetParam( 0 ).value, "from_content" );
87 std::unique_ptr<tao::pegtl::parse_tree::node> root;
88
89 try
90 {
91 root = tao::pegtl::parse_tree::parse<SIM_MODEL_SOURCE_PARSER::pwlValuesGrammar,
93 ( in );
94 }
95 catch( const tao::pegtl::parse_error& )
96 {
97 break;
98 }
99
100 if( root )
101 {
102 for( const auto& node : root->children )
103 {
105 SIM_VALUE::NOTATION::SI>>() )
106 {
107 args.append( SIM_VALUE::ToSpice( node->string() ) + " " );
108 }
109 }
110 }
111
112 break;
113 }
114
115 case SIM_MODEL::TYPE::V_WHITENOISE:
116 case SIM_MODEL::TYPE::I_WHITENOISE:
117 args.append( getParamValueString( "rms", "0" ) + " " );
118 args.append( getParamValueString( "dt", "0" ) + " " );
119 args.append( "0 0 0 0 0 " );
120 break;
121
122 case SIM_MODEL::TYPE::V_PINKNOISE:
123 case SIM_MODEL::TYPE::I_PINKNOISE:
124 args.append( "0 " );
125 args.append( getParamValueString( "dt", "0" ) + " " );
126 args.append( getParamValueString( "slope", "0" ) + " " );
127 args.append( getParamValueString( "rms", "0" ) + " " );
128 args.append( "0 0 0 " );
129 break;
130
131 case SIM_MODEL::TYPE::V_BURSTNOISE:
132 case SIM_MODEL::TYPE::I_BURSTNOISE:
133 args.append( "0 0 0 0 " );
134 args.append( getParamValueString( "ampl", "0" ) + " " );
135 args.append( getParamValueString( "tcapt", "0" ) + " " );
136 args.append( getParamValueString( "temit", "0" ) + " " );
137 break;
138
139 case SIM_MODEL::TYPE::V_RANDUNIFORM:
140 case SIM_MODEL::TYPE::I_RANDUNIFORM:
141 {
142 args.append( "1 " );
143 args.append( getParamValueString( "ts", "0" ) + " " );
144 args.append( getParamValueString( "td", "0" ) + " " );
145 args.append( getParamValueString( "range", "1" ) + " " );
146 args.append( getParamValueString( "offset", "0" ) + " " );
147 break;
148 }
149
150 case SIM_MODEL::TYPE::V_RANDGAUSSIAN:
151 case SIM_MODEL::TYPE::I_RANDGAUSSIAN:
152 args.append( "2 " );
153 args.append( getParamValueString( "ts", "0" ) + " " );
154 args.append( getParamValueString( "td", "0" ) + " " );
155 args.append( getParamValueString( "stddev", "1" ) + " " );
156 args.append( getParamValueString( "mean", "0" ) + " " );
157 break;
158
159 case SIM_MODEL::TYPE::V_RANDEXP:
160 case SIM_MODEL::TYPE::I_RANDEXP:
161 args.append( "3 " );
162 args.append( getParamValueString( "ts", "0" ) + " " );
163 args.append( getParamValueString( "td", "0" ) + " " );
164 args.append( getParamValueString( "mean", "1" ) + " " );
165 args.append( getParamValueString( "offset", "0" ) + " " );
166 break;
167
168 case SIM_MODEL::TYPE::V_RANDPOISSON:
169 case SIM_MODEL::TYPE::I_RANDPOISSON:
170 args.append( "4 " );
171 args.append( getParamValueString( "ts", "0" ) + " " );
172 args.append( getParamValueString( "td", "0" ) + " " );
173 args.append( getParamValueString( "lambda", "1" ) + " " );
174 args.append( getParamValueString( "offset", "0" ) + " " );
175 break;
176
177 default:
178 for( const SIM_MODEL::PARAM& param : m_model.GetParams() )
179 {
180 std::string argStr = SIM_VALUE::ToSpice( param.value );
181
182 if( argStr != "" )
183 args.append( argStr + " " );
184 }
185
186 break;
187 }
188
189 emptyLine = false;
190 item.modelName += fmt::format( "{}( {}) ", m_model.GetSpiceInfo().functionName, args );
191 }
192 else
193 {
194 switch( m_model.GetType() )
195 case SIM_MODEL::TYPE::V_VCL:
196 case SIM_MODEL::TYPE::I_VCL:
197 {
198 item.modelName += fmt::format( "{} ", getParamValueString( "gain", "1.0" ) );
199 emptyLine = false;
200
201 break;
202
203 case SIM_MODEL::TYPE::V_CCL:
204 case SIM_MODEL::TYPE::I_CCL:
205 item.modelName += fmt::format( "{} {} ",
206 getParamValueString( "control", "V?" ),
207 getParamValueString( "gain", "1.0" ) );
208 emptyLine = false;
209 break;
210
211 default:
212 break;
213 }
214 }
215
216 if( ac != "" )
217 {
218 std::string ph = "";
219
220 if( const SIM_MODEL::PARAM* ph_param = m_model.FindParam( "ph" ) )
221 ph = SIM_VALUE::ToSpice( ph_param->value );
222
223 emptyLine = false;
224 item.modelName += fmt::format( "AC {} {} ", ac, ph );
225 }
226
227 std::string portnum = "";
228
229 if( const SIM_MODEL::PARAM* portnum_param = m_model.FindParam( "portnum" ) )
230 portnum = SIM_VALUE::ToSpice( portnum_param->value );
231
232 if( portnum != "" )
233 {
234 item.modelName += fmt::format( "portnum {} ", portnum );
235
236 std::string z0 = "";
237
238 if( const SIM_MODEL::PARAM* z0_param = m_model.FindParam( "z0" ) )
239 z0 = SIM_VALUE::ToSpice( z0_param->value );
240
241 if( z0 != "" )
242 item.modelName += fmt::format( "z0 {} ", z0 );
243 }
244
245 if( emptyLine )
246 {
248 }
249
250 return SPICE_GENERATOR::ItemLine( item );
251}
252
253
254std::string SPICE_GENERATOR_SOURCE::getParamValueString( const std::string& aParamName,
255 const std::string& aDefaultValue ) const
256{
257 std::string result = "";
258
259 if ( m_model.FindParam( aParamName ) )
260 result = SIM_VALUE::ToSpice( m_model.FindParam( aParamName )->value );
261
262 if( result == "" )
263 result = aDefaultValue;
264
265 return result;
266}
267
268
270 SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_SOURCE>( *this ),
271 std::make_unique<SIM_MODEL_SOURCE_SERIALIZER>( *this ) )
272{
273 for( const SIM_MODEL::PARAM::INFO& paramInfo : makeParamInfos( aType ) )
274 AddParam( paramInfo );
275}
276
277
278void SIM_MODEL_SOURCE::doSetParamValue( int aParamIndex, const std::string& aValue )
279{
280 // Sources are special. All preceding parameter values must be filled. If they are not, fill
281 // them out automatically. If a value is nulled, delete everything after it.
282 if( aValue.empty() )
283 {
284 for( int paramIndex = aParamIndex; paramIndex < GetParamCount(); ++paramIndex )
285 {
286 m_params.at( aParamIndex ).value = "";
287 }
288 }
289 else
290 {
291 for( int paramIndex = 0; paramIndex < aParamIndex; ++paramIndex )
292 {
293 if( GetParam( paramIndex ).value == "" )
294 {
295 double dummy;
296 wxString defaultValue = m_params.at( aParamIndex ).info.defaultValue;
297
298 if( !defaultValue.ToDouble( &dummy ) )
299 defaultValue = wxT( "0" );
300
301 m_params.at( aParamIndex ).value = defaultValue;
302 SIM_MODEL::SetParamValue( paramIndex, defaultValue.ToStdString() );
303 }
304 }
305 }
306
307 return SIM_MODEL::doSetParamValue( aParamIndex, aValue );
308}
309
310
311const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYPE aType )
312{
313 static std::vector<PARAM::INFO> vdc = makeDcParamInfos( "y", "V" );
314 static std::vector<PARAM::INFO> idc = makeDcParamInfos( "y", "A" );
315
316 static std::vector<PARAM::INFO> vsin = makeSinParamInfos( "y", "V" );
317 static std::vector<PARAM::INFO> isin = makeSinParamInfos( "y", "A" );
318
319 static std::vector<PARAM::INFO> vpulse = makePulseParamInfos( "y", "V" );
320 static std::vector<PARAM::INFO> ipulse = makePulseParamInfos( "y", "A" );
321
322 static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" );
323 static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" );
324
325 static std::vector<PARAM::INFO> vam = makeAMParamInfos( "y", "V" );
326 static std::vector<PARAM::INFO> iam = makeAMParamInfos( "y", "A" );
327
328 static std::vector<PARAM::INFO> vsffm = makeSFFMParamInfos( "y", "V" );
329 static std::vector<PARAM::INFO> isffm = makeSFFMParamInfos( "y", "A" );
330
331 static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" );
332 static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" );
333 static std::vector<PARAM::INFO> vpwl = makePwlParamInfos( "y", "Voltage", "V" );
334
335 static std::vector<PARAM::INFO> vccs = makeVcParamInfos( "S" );
336 static std::vector<PARAM::INFO> cccs = makeCcParamInfos( "" );
337 static std::vector<PARAM::INFO> ipwl = makePwlParamInfos( "y", "Current", "A" );
338
339 static std::vector<PARAM::INFO> vwhitenoise = makeWhiteNoiseParamInfos( "y", "V" );
340 static std::vector<PARAM::INFO> iwhitenoise = makeWhiteNoiseParamInfos( "y", "A" );
341
342 static std::vector<PARAM::INFO> vpinknoise = makePinkNoiseParamInfos( "y", "V" );
343 static std::vector<PARAM::INFO> ipinknoise = makePinkNoiseParamInfos( "y", "A" );
344
345 static std::vector<PARAM::INFO> vburstnoise = makeBurstNoiseParamInfos( "y", "V" );
346 static std::vector<PARAM::INFO> iburstnoise = makeBurstNoiseParamInfos( "y", "A" );
347
348 static std::vector<PARAM::INFO> vrandomuniform = makeRandomUniformParamInfos( "y", "V" );
349 static std::vector<PARAM::INFO> irandomuniform = makeRandomUniformParamInfos( "y", "A" );
350
351 static std::vector<PARAM::INFO> vrandomnormal = makeRandomNormalParamInfos( "y", "V" );
352 static std::vector<PARAM::INFO> irandomnormal = makeRandomNormalParamInfos( "y", "A" );
353
354 static std::vector<PARAM::INFO> vrandomexp = makeRandomExpParamInfos( "y", "V" );
355 static std::vector<PARAM::INFO> irandomexp = makeRandomExpParamInfos( "y", "A" );
356
357 static std::vector<PARAM::INFO> vrandompoisson = makeRandomPoissonParamInfos( "y", "V" );
358 static std::vector<PARAM::INFO> irandompoisson = makeRandomPoissonParamInfos( "y", "A" );
359
360 switch( aType )
361 {
362 case TYPE::V: return vdc;
363 case TYPE::I: return idc;
364 case TYPE::V_SIN: return vsin;
365 case TYPE::I_SIN: return isin;
366 case TYPE::V_PULSE: return vpulse;
367 case TYPE::I_PULSE: return ipulse;
368 case TYPE::V_EXP: return vexp;
369 case TYPE::I_EXP: return iexp;
370 case TYPE::V_AM: return vam;
371 case TYPE::I_AM: return iam;
372 case TYPE::V_SFFM: return vsffm;
373 case TYPE::I_SFFM: return isffm;
374 case TYPE::V_VCL: return vcvs;
375 case TYPE::V_CCL: return ccvs;
376 case TYPE::V_PWL: return vpwl;
377 case TYPE::I_VCL: return vccs;
378 case TYPE::I_CCL: return cccs;
379 case TYPE::I_PWL: return ipwl;
380 case TYPE::V_WHITENOISE: return vwhitenoise;
381 case TYPE::I_WHITENOISE: return iwhitenoise;
382 case TYPE::V_PINKNOISE: return vpinknoise;
383 case TYPE::I_PINKNOISE: return ipinknoise;
384 case TYPE::V_BURSTNOISE: return vburstnoise;
385 case TYPE::I_BURSTNOISE: return iburstnoise;
386 case TYPE::V_RANDUNIFORM: return vrandomuniform;
387 case TYPE::I_RANDUNIFORM: return irandomuniform;
388 case TYPE::V_RANDGAUSSIAN: return vrandomnormal;
389 case TYPE::I_RANDGAUSSIAN: return irandomnormal;
390 case TYPE::V_RANDEXP: return vrandomexp;
391 case TYPE::I_RANDEXP: return irandomexp;
392 case TYPE::V_RANDPOISSON: return vrandompoisson;
393 case TYPE::I_RANDPOISSON: return irandompoisson;
394 default:
395 wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SOURCE" );
396 static std::vector<SIM_MODEL::PARAM::INFO> empty;
397 return empty;
398 }
399}
400
401
402std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeDcParamInfos( const std::string& aPrefix,
403 const std::string& aUnit )
404{
405 std::vector<PARAM::INFO> paramInfos;
406 PARAM::INFO paramInfo;
407
408 paramInfo.name = "dc";
409 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
410 paramInfo.unit = aUnit;
412 paramInfo.defaultValue = "0";
413 paramInfo.description = "DC value";
414 paramInfos.push_back( paramInfo );
415
416 appendAcParamInfos( paramInfos, aUnit );
417 appendSpParamInfos( paramInfos, aUnit );
418 return paramInfos;
419}
420
421
422std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSinParamInfos( const std::string& aPrefix,
423 const std::string& aUnit )
424{
425 std::vector<PARAM::INFO> paramInfos;
426 PARAM::INFO paramInfo;
427
428 paramInfo.name = "dc";
429 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
430 paramInfo.unit = aUnit;
432 paramInfo.defaultValue = "";
433 paramInfo.description = "DC offset";
434 paramInfos.push_back( paramInfo );
435
436 paramInfo.name = "ampl";
437 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
438 paramInfo.unit = aUnit;
440 paramInfo.defaultValue = "";
441 paramInfo.description = "Amplitude";
442 paramInfos.push_back( paramInfo );
443
444 paramInfo.name = "f";
445 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
446 paramInfo.unit = "Hz";
448 paramInfo.defaultValue = "1/tstop";
449 paramInfo.description = "Frequency";
450 paramInfos.push_back( paramInfo );
451
452 paramInfo.name = "td";
453 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
454 paramInfo.unit = "s";
456 paramInfo.defaultValue = "0";
457 paramInfo.description = "Delay";
458 paramInfos.push_back( paramInfo );
459
460 paramInfo.name = "theta";
461 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
462 paramInfo.unit = "1/s";
464 paramInfo.defaultValue = "0";
465 paramInfo.description = "Damping factor";
466 paramInfos.push_back( paramInfo );
467
468 paramInfo.name = "phase";
469 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
470 paramInfo.unit = "°";
472 paramInfo.defaultValue = "0";
473 paramInfo.description = "Phase";
474 paramInfos.push_back( paramInfo );
475
476 appendAcParamInfos( paramInfos, aUnit );
477 appendSpParamInfos( paramInfos, aUnit );
478 return paramInfos;
479}
480
481
482std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePulseParamInfos( const std::string& aPrefix,
483 const std::string& aUnit )
484{
485 std::vector<PARAM::INFO> paramInfos;
486 PARAM::INFO paramInfo;
487
488 paramInfo.name = aPrefix + "1";
489 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
490 paramInfo.unit = aUnit;
492 paramInfo.defaultValue = "";
493 paramInfo.description = "Initial value";
494 paramInfos.push_back( paramInfo );
495
496 paramInfo.name = aPrefix + "2";
497 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
498 paramInfo.unit = aUnit;
500 paramInfo.defaultValue = "";
501 paramInfo.description = "Pulsed value";
502 paramInfos.push_back( paramInfo );
503
504 paramInfo.name = "td";
505 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
506 paramInfo.unit = "s";
508 paramInfo.defaultValue = "0";
509 paramInfo.description = "Delay";
510 paramInfos.push_back( paramInfo );
511
512 paramInfo.name = "tr";
513 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
514 paramInfo.unit = "s";
516 paramInfo.defaultValue = "tstep";
517 paramInfo.description = "Rise time";
518 paramInfos.push_back( paramInfo );
519
520 paramInfo.name = "tf";
521 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
522 paramInfo.unit = "s";
524 paramInfo.defaultValue = "tstep";
525 paramInfo.description = "Fall time";
526 paramInfos.push_back( paramInfo );
527
528 paramInfo.name = "tw"; // Ngspice calls it "pw".
529 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
530 paramInfo.unit = "s";
532 paramInfo.defaultValue = "tstop";
533 paramInfo.description = "Pulse width";
534 paramInfos.push_back( paramInfo );
535
536 paramInfo.name = "per";
537 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
538 paramInfo.unit = "s";
540 paramInfo.defaultValue = "tstop";
541 paramInfo.description = "Period";
542 paramInfos.push_back( paramInfo );
543
544 paramInfo.name = "np";
545 paramInfo.type = SIM_VALUE::TYPE_INT;
546 paramInfo.unit = "";
548 paramInfo.defaultValue = "";
549 paramInfo.description = "Number of pulses";
550 paramInfos.push_back( paramInfo );
551
552 appendAcParamInfos( paramInfos, aUnit );
553 appendSpParamInfos( paramInfos, aUnit );
554 return paramInfos;
555}
556
557
558std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const std::string& aPrefix,
559 const std::string& aUnit )
560{
561 std::vector<PARAM::INFO> paramInfos;
562 PARAM::INFO paramInfo;
563
564 paramInfo.name = aPrefix + "1";
565 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
566 paramInfo.unit = aUnit;
568 paramInfo.defaultValue = "";
569 paramInfo.description = "Initial value";
570 paramInfos.push_back( paramInfo );
571
572 paramInfo.name = aPrefix + "2";
573 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
574 paramInfo.unit = aUnit;
576 paramInfo.defaultValue = "";
577 paramInfo.description = "Pulsed value";
578 paramInfos.push_back( paramInfo );
579
580 paramInfo.name = "td1";
581 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
582 paramInfo.unit = "s";
584 paramInfo.defaultValue = "0";
585 paramInfo.description = "Rise delay time";
586 paramInfos.push_back( paramInfo );
587
588 paramInfo.name = "tau1";
589 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
590 paramInfo.unit = "s";
592 paramInfo.defaultValue = "tstep";
593 paramInfo.description = "Rise time constant";
594 paramInfos.push_back( paramInfo );
595
596 paramInfo.name = "td2";
597 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
598 paramInfo.unit = "s";
600 paramInfo.defaultValue = "td1+tstep";
601 paramInfo.description = "Fall delay time";
602 paramInfos.push_back( paramInfo );
603
604 paramInfo.name = "tau2";
605 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
606 paramInfo.unit = "s";
608 paramInfo.defaultValue = "tstep";
609 paramInfo.description = "Fall time constant";
610 paramInfos.push_back( paramInfo );
611
612 appendAcParamInfos( paramInfos, aUnit );
613 appendSpParamInfos( paramInfos, aUnit );
614 return paramInfos;
615}
616
617
618std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeAMParamInfos( const std::string& aPrefix,
619 const std::string& aUnit )
620{
621 std::vector<PARAM::INFO> paramInfos;
622 PARAM::INFO paramInfo;
623
624 paramInfo.name = "vo";
625 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
626 paramInfo.unit = aUnit;
628 paramInfo.defaultValue = "";
629 paramInfo.description = "Overall offset";
630 paramInfos.push_back( paramInfo );
631
632 paramInfo.name = "vmo";
633 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
634 paramInfo.unit = aUnit;
636 paramInfo.defaultValue = "";
637 paramInfo.description = "Modulation signal offset";
638 paramInfos.push_back( paramInfo );
639
640 paramInfo.name = "vma";
641 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
642 paramInfo.unit = aUnit;
644 paramInfo.defaultValue = "";
645 paramInfo.description = "Modulation signal amplitude";
646 paramInfos.push_back( paramInfo );
647
648 paramInfo.name = "fm";
649 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
650 paramInfo.unit = "Hz";
652 paramInfo.defaultValue = "5/tstop";
653 paramInfo.description = "Modulation signal frequency";
654 paramInfos.push_back( paramInfo );
655
656 paramInfo.name = "fc";
657 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
658 paramInfo.unit = "Hz";
660 paramInfo.defaultValue = "500/tstop";
661 paramInfo.description = "Carrier signal frequency";
662 paramInfos.push_back( paramInfo );
663
664 paramInfo.name = "td";
665 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
666 paramInfo.unit = "s";
668 paramInfo.defaultValue = "0";
669 paramInfo.description = "Overall delay";
670 paramInfos.push_back( paramInfo );
671
672 paramInfo.name = "phasem";
673 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
674 paramInfo.unit = "°";
676 paramInfo.defaultValue = "0";
677 paramInfo.description = "Modulation signal phase";
678 paramInfos.push_back( paramInfo );
679
680 paramInfo.name = "phasec";
681 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
682 paramInfo.unit = "°";
684 paramInfo.defaultValue = "0";
685 paramInfo.description = "Carrier signal phase";
686 paramInfos.push_back( paramInfo );
687
688 appendAcParamInfos( paramInfos, aUnit );
689 appendSpParamInfos( paramInfos, aUnit );
690 return paramInfos;
691}
692
693
694std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSFFMParamInfos( const std::string& aPrefix,
695 const std::string& aUnit )
696{
697 std::vector<PARAM::INFO> paramInfos;
698 PARAM::INFO paramInfo;
699
700 paramInfo.name = "vo";
701 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
702 paramInfo.unit = aUnit;
704 paramInfo.defaultValue = "";
705 paramInfo.description = "DC offset";
706 paramInfos.push_back( paramInfo );
707
708 paramInfo.name = "va";
709 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
710 paramInfo.unit = aUnit;
712 paramInfo.defaultValue = "";
713 paramInfo.description = "Amplitude";
714 paramInfos.push_back( paramInfo );
715
716 paramInfo.name = "fm";
717 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
718 paramInfo.unit = "Hz";
720 paramInfo.defaultValue = "5/tstop";
721 paramInfo.description = "Modulating frequency";
722 paramInfos.push_back( paramInfo );
723
724 paramInfo.name = "mdi";
725 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
726 paramInfo.unit = "";
728 paramInfo.defaultValue = "";
729 paramInfo.description = "Modulation index";
730 paramInfos.push_back( paramInfo );
731
732 paramInfo.name = "fc";
733 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
734 paramInfo.unit = "Hz";
736 paramInfo.defaultValue = "500/tstop";
737 paramInfo.description = "Carrier frequency";
738 paramInfos.push_back( paramInfo );
739
740 paramInfo.name = "phasem";
741 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
742 paramInfo.unit = "°";
744 paramInfo.defaultValue = "0";
745 paramInfo.description = "Modulating signal phase";
746 paramInfos.push_back( paramInfo );
747
748 paramInfo.name = "phasec";
749 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
750 paramInfo.unit = "°";
752 paramInfo.defaultValue = "0";
753 paramInfo.description = "Carrier signal phase";
754 paramInfos.push_back( paramInfo );
755
756 appendAcParamInfos( paramInfos, aUnit );
757 appendSpParamInfos( paramInfos, aUnit );
758 return paramInfos;
759}
760
761
762std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit )
763{
764 std::vector<PARAM::INFO> paramInfos;
765 PARAM::INFO paramInfo;
766
767 paramInfo.name = "gain";
768 paramInfo.id = 1;
769 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
770 paramInfo.unit = aGainUnit;
771 paramInfo.description = "Gain";
772 paramInfos.push_back( paramInfo );
773
774 paramInfo.name = "control";
775 paramInfo.id = 2;
776 paramInfo.type = SIM_VALUE::TYPE_STRING;
777 paramInfo.description = "Controlling voltage source";
778 paramInfos.push_back( paramInfo );
779
780 return paramInfos;
781}
782
783
784std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit )
785{
786 std::vector<PARAM::INFO> paramInfos;
787 PARAM::INFO paramInfo;
788
789 paramInfo.name = "gain";
790 paramInfo.id = 1;
791 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
792 paramInfo.unit = aGainUnit;
793 paramInfo.description = "Gain";
794 paramInfos.push_back( paramInfo );
795
796 return paramInfos;
797}
798
799
800std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix,
801 const std::string& aQuantity,
802 const std::string& aUnit )
803{
804 std::vector<PARAM::INFO> paramInfos;
805 PARAM::INFO paramInfo;
806
807 paramInfo.name = "pwl";
808 paramInfo.type = SIM_VALUE::TYPE_STRING;
809 paramInfo.unit = "s," + aUnit;
811 paramInfo.defaultValue = "";
812 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
813 paramInfos.push_back( paramInfo );
814
815 // TODO: Ngspice doesn't support "td" and "r" for current sources, so let's disable that for
816 // now.
817
818 /*paramInfo.name = "td";
819 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
820 paramInfo.unit = "s";
821 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
822 paramInfo.defaultValue = "0";
823 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
824 paramInfo.isSpiceInstanceParam = true;
825 paramInfos.push_back( paramInfo );
826
827 paramInfo.name = "repeat";
828 paramInfo.type = SIM_VALUE::TYPE_BOOL;
829 paramInfo.unit = "";
830 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
831 paramInfo.defaultValue = "0";
832 paramInfo.description = "Repeat forever";
833 paramInfo.isSpiceInstanceParam = true;
834 paramInfo.spiceInstanceName = "r";
835 paramInfos.push_back( paramInfo );*/
836
837 /*paramInfo.name = "t";
838 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
839 paramInfo.unit = "s";
840 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
841 paramInfo.defaultValue = "";
842 paramInfo.description = "Time vector";
843 paramInfos.push_back( paramInfo );
844
845 paramInfo.name = aPrefix;
846 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
847 paramInfo.unit = aUnit;
848 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
849 paramInfo.defaultValue = "";
850 paramInfo.description = aQuantity + " vector";
851 paramInfos.push_back( paramInfo );
852
853 paramInfo.name = "repeat";
854 paramInfo.type = SIM_VALUE::TYPE_BOOL;
855 paramInfo.unit = "";
856 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
857 paramInfo.defaultValue = "";
858 paramInfo.description = "Repeat forever";
859 paramInfos.push_back( paramInfo );
860
861 paramInfo.name = "td";
862 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
863 paramInfo.unit = "s";
864 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
865 paramInfo.defaultValue = "0";
866 paramInfo.description = "Delay";
867 paramInfos.push_back( paramInfo );*/
868
869 appendAcParamInfos( paramInfos, aUnit );
870 appendSpParamInfos( paramInfos, aUnit );
871 return paramInfos;
872}
873
874
875std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix,
876 const std::string& aUnit )
877{
878 std::vector<PARAM::INFO> paramInfos;
879 PARAM::INFO paramInfo;
880
881 paramInfo.name = "rms";
882 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
883 paramInfo.unit = aUnit;
885 paramInfo.defaultValue = "0";
886 paramInfo.description = "White noise RMS amplitude";
887 paramInfos.push_back( paramInfo );
888
889 paramInfo.name = "dt";
890 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
891 paramInfo.unit = "s";
893 paramInfo.defaultValue = "0";
894 paramInfo.description = "Time step";
895 paramInfos.push_back( paramInfo );
896
897 appendAcParamInfos( paramInfos, aUnit );
898 appendSpParamInfos( paramInfos, aUnit );
899 return paramInfos;
900}
901
902
903std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix,
904 const std::string& aUnit )
905{
906 std::vector<PARAM::INFO> paramInfos;
907 PARAM::INFO paramInfo;
908
909 paramInfo.name = "rms";
910 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
911 paramInfo.unit = "";
913 paramInfo.defaultValue = "0";
914 paramInfo.description = "1/f noise RMS amplitude";
915 paramInfos.push_back( paramInfo );
916
917 paramInfo.name = "slope";
918 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
919 paramInfo.unit = "";
921 paramInfo.defaultValue = "1";
922 paramInfo.description = "1/f noise exponent";
923 paramInfos.push_back( paramInfo );
924
925 paramInfo.name = "dt";
926 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
927 paramInfo.unit = "s";
929 paramInfo.defaultValue = "0";
930 paramInfo.description = "Time step";
931 paramInfos.push_back( paramInfo );
932
933 appendAcParamInfos( paramInfos, aUnit );
934 appendSpParamInfos( paramInfos, aUnit );
935 return paramInfos;
936}
937
938
939std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix,
940 const std::string& aUnit )
941{
942 std::vector<PARAM::INFO> paramInfos;
943 PARAM::INFO paramInfo;
944
945 paramInfo.name = "ampl";
946 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
947 paramInfo.unit = aUnit;
949 paramInfo.defaultValue = "0";
950 paramInfo.description = "Burst noise amplitude";
951 paramInfos.push_back( paramInfo );
952
953 paramInfo.name = "tcapt";
954 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
955 paramInfo.unit = "s";
957 paramInfo.defaultValue = "0";
958 paramInfo.description = "Burst noise trap capture time";
959 paramInfos.push_back( paramInfo );
960
961 paramInfo.name = "temit";
962 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
963 paramInfo.unit = "s";
965 paramInfo.defaultValue = "0";
966 paramInfo.description = "Burst noise trap emission time";
967 paramInfos.push_back( paramInfo );
968
969 appendAcParamInfos( paramInfos, aUnit );
970 appendSpParamInfos( paramInfos, aUnit );
971 return paramInfos;
972}
973
974
975std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix,
976 const std::string& aUnit )
977{
978 std::vector<PARAM::INFO> paramInfos;
979 PARAM::INFO paramInfo;
980
981 paramInfo.name = "ts";
982 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
983 paramInfo.unit = "s";
985 paramInfo.defaultValue = "";
986 paramInfo.description = "Individual voltage duration";
987 paramInfos.push_back( paramInfo );
988
989 paramInfo.name = "td";
990 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
991 paramInfo.unit = "s";
993 paramInfo.defaultValue = "0";
994 paramInfo.description = "Delay";
995 paramInfos.push_back( paramInfo );
996
997 paramInfo.name = "range";
998 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
999 paramInfo.unit = aUnit;
1001 paramInfo.defaultValue = "1";
1002 paramInfo.description = "Range";
1003 paramInfos.push_back( paramInfo );
1004
1005 paramInfo.name = "offset";
1006 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1007 paramInfo.unit = aUnit;
1009 paramInfo.defaultValue = "0";
1010 paramInfo.description = "Offset";
1011 paramInfos.push_back( paramInfo );
1012
1013 appendAcParamInfos( paramInfos, aUnit );
1014 appendSpParamInfos( paramInfos, aUnit );
1015 return paramInfos;
1016}
1017
1018
1019std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix,
1020 const std::string& aUnit )
1021{
1022 std::vector<PARAM::INFO> paramInfos;
1023 PARAM::INFO paramInfo;
1024
1025 paramInfo.name = "ts";
1026 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1027 paramInfo.unit = "s";
1029 paramInfo.defaultValue = "";
1030 paramInfo.description = "Individual voltage duration";
1031 paramInfos.push_back( paramInfo );
1032
1033 paramInfo.name = "td";
1034 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1035 paramInfo.unit = "s";
1037 paramInfo.defaultValue = "0";
1038 paramInfo.description = "Delay";
1039 paramInfos.push_back( paramInfo );
1040
1041 paramInfo.name = "stddev";
1042 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1043 paramInfo.unit = aUnit;
1045 paramInfo.defaultValue = "1";
1046 paramInfo.description = "Standard deviation";
1047 paramInfos.push_back( paramInfo );
1048
1049 paramInfo.name = "mean";
1050 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1051 paramInfo.unit = aUnit;
1053 paramInfo.defaultValue = "0";
1054 paramInfo.description = "Mean";
1055 paramInfos.push_back( paramInfo );
1056
1057 appendAcParamInfos( paramInfos, aUnit );
1058 appendSpParamInfos( paramInfos, aUnit );
1059 return paramInfos;
1060}
1061
1062
1063std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix,
1064 const std::string& aUnit )
1065{
1066 std::vector<PARAM::INFO> paramInfos;
1067 PARAM::INFO paramInfo;
1068
1069 paramInfo.name = "ts";
1070 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1071 paramInfo.unit = "s";
1073 paramInfo.defaultValue = "";
1074 paramInfo.description = "Individual voltage duration";
1075 paramInfos.push_back( paramInfo );
1076
1077 paramInfo.name = "td";
1078 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1079 paramInfo.unit = "s";
1081 paramInfo.defaultValue = "0";
1082 paramInfo.description = "Delay";
1083 paramInfos.push_back( paramInfo );
1084
1085 paramInfo.name = "mean";
1086 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1087 paramInfo.unit = aUnit;
1089 paramInfo.defaultValue = "1";
1090 paramInfo.description = "Mean";
1091 paramInfos.push_back( paramInfo );
1092
1093 paramInfo.name = "offset";
1094 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1095 paramInfo.unit = aUnit;
1097 paramInfo.defaultValue = "0";
1098 paramInfo.description = "Offset";
1099 paramInfos.push_back( paramInfo );
1100
1101 appendAcParamInfos( paramInfos, aUnit );
1102 appendSpParamInfos( paramInfos, aUnit );
1103 return paramInfos;
1104}
1105
1106
1107std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix,
1108 const std::string& aUnit )
1109{
1110 std::vector<PARAM::INFO> paramInfos;
1111 PARAM::INFO paramInfo;
1112
1113 paramInfo.name = "ts";
1114 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1115 paramInfo.unit = "s";
1117 paramInfo.defaultValue = "";
1118 paramInfo.description = "Individual voltage duration";
1119 paramInfos.push_back( paramInfo );
1120
1121 paramInfo.name = "td";
1122 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1123 paramInfo.unit = "s";
1125 paramInfo.defaultValue = "0";
1126 paramInfo.description = "Delay";
1127 paramInfos.push_back( paramInfo );
1128
1129 paramInfo.name = "lambda";
1130 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1131 paramInfo.unit = aUnit;
1133 paramInfo.defaultValue = "1";
1134 paramInfo.description = "Lambda";
1135 paramInfos.push_back( paramInfo );
1136
1137 paramInfo.name = "offset";
1138 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1139 paramInfo.unit = aUnit;
1141 paramInfo.defaultValue = "0";
1142 paramInfo.description = "Offset";
1143 paramInfos.push_back( paramInfo );
1144
1145 appendAcParamInfos( paramInfos, aUnit );
1146 appendSpParamInfos( paramInfos, aUnit );
1147 return paramInfos;
1148}
1149
1150void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector<PARAM::INFO>& aParamInfos, const std::string& aUnit )
1151{
1152 PARAM::INFO paramInfo;
1153
1154 paramInfo.name = "ac";
1155 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1156 paramInfo.unit = aUnit;
1158 paramInfo.defaultValue = "0";
1159 paramInfo.description = "AC magnitude";
1160 aParamInfos.push_back( paramInfo );
1161
1162 paramInfo.name = "ph";
1163 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1164 paramInfo.unit = "°";
1166 paramInfo.defaultValue = "0";
1167 paramInfo.description = "AC phase";
1168 aParamInfos.push_back( paramInfo );
1169}
1170
1171void SIM_MODEL_SOURCE::appendSpParamInfos( std::vector<PARAM::INFO>& aParamInfos,
1172 const std::string& aUnit )
1173{
1174 PARAM::INFO paramInfo;
1175
1176 if( !strcmp( aUnit.c_str(), "V" ) )
1177 {
1178 paramInfo.name = "portnum";
1179 paramInfo.type = SIM_VALUE::TYPE_INT;
1180 paramInfo.unit = "";
1182 paramInfo.defaultValue = "";
1183 paramInfo.description = "Port number";
1184 aParamInfos.push_back( paramInfo );
1185
1186 paramInfo.name = "z0";
1187 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1188 paramInfo.unit = "Ohm";
1190 paramInfo.defaultValue = "";
1191 paramInfo.description = "Internal impedance";
1192 aParamInfos.push_back( paramInfo );
1193 }
1194}
1195
1196
1197std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
1198{
1199 if( GetDeviceType() == SIM_MODEL::DEVICE_T::E || GetDeviceType() == SIM_MODEL::DEVICE_T::G )
1200 return { "+", "-", "C+", "C-" };
1201 else
1202 return { "+", "-" };
1203}
static void appendAcParamInfos(std::vector< PARAM::INFO > &aParamInfos, const std::string &aUnit)
static std::vector< PARAM::INFO > makeBurstNoiseParamInfos(const std::string &aPrefix, const std::string &aUnit)
std::vector< std::string > GetPinNames() const override
static const std::vector< PARAM::INFO > & makeParamInfos(TYPE aType)
static std::vector< PARAM::INFO > makeExpParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeAMParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeRandomNormalParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< SIM_MODEL::PARAM::INFO > makeVcParamInfos(const std::string &aGainUnit)
static void appendSpParamInfos(std::vector< PARAM::INFO > &aParamInfos, const std::string &aUnit)
SIM_MODEL_SOURCE(TYPE aType)
static std::vector< PARAM::INFO > makeRandomExpParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeSFFMParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeRandomUniformParamInfos(const std::string &aPrefix, const std::string &aUnit)
void doSetParamValue(int aParamIndex, const std::string &aValue) override
static std::vector< PARAM::INFO > makeRandomPoissonParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeDcParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makePulseParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makePinkNoiseParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makeSinParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< PARAM::INFO > makePwlParamInfos(const std::string &aPrefix, const std::string &aQuantity, const std::string &aUnit)
static std::vector< PARAM::INFO > makeWhiteNoiseParamInfos(const std::string &aPrefix, const std::string &aUnit)
static std::vector< SIM_MODEL::PARAM::INFO > makeCcParamInfos(const std::string &aGainUnit)
void AddParam(const PARAM::INFO &aInfo)
Definition: sim_model.cpp:737
virtual const PARAM & GetParam(unsigned aParamIndex) const
Definition: sim_model.cpp:796
int GetParamCount() const
Definition: sim_model.h:486
DEVICE_T GetDeviceType() const
Definition: sim_model.h:468
const PARAM * FindParam(const std::string &aParamName) const
Definition: sim_model.cpp:825
virtual void doSetParamValue(int aParamIndex, const std::string &aValue)
Definition: sim_model.cpp:859
std::vector< PARAM > m_params
Definition: sim_model.h:551
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
Definition: sim_model.cpp:865
SPICE_INFO GetSpiceInfo() const
Definition: sim_model.h:457
std::vector< std::reference_wrapper< const PARAM > > GetParams() const
Definition: sim_model.cpp:833
TYPE GetType() const
Definition: sim_model.h:469
static std::string ToSpice(const std::string &aString)
Definition: sim_value.h:84
@ TYPE_INT
Definition: sim_value.h:68
@ TYPE_FLOAT
Definition: sim_value.h:69
@ TYPE_STRING
Definition: sim_value.h:71
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::string ItemLine(const SPICE_ITEM &aItem) const override
std::string getParamValueString(const std::string &aParamName, const std::string &aDefaultValue) const
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
const SIM_MODEL & m_model
static bool empty(const wxTextEntryBase *aCtrl)
STL namespace.
SIM_MODEL::TYPE TYPE
Definition: sim_model.cpp:53
std::vector< FAB_LAYER_COLOR > dummy
SIM_VALUE::TYPE type
Definition: sim_model.h:379
std::string defaultValue
Definition: sim_model.h:382
std::string description
Definition: sim_model.h:383
std::string value
Definition: sim_model.h:400
std::string functionName
Definition: sim_model.h:297
std::string modelName