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 if( ac != "" && ( param.Matches( "ac" ) || param.Matches( "ph" ) ) )
181 continue;
182
183 std::string argStr = SIM_VALUE::ToSpice( param.value );
184
185 if( argStr != "" )
186 args.append( argStr + " " );
187 }
188
189 break;
190 }
191
192 emptyLine = false;
193 item.modelName += fmt::format( "{}( {}) ", m_model.GetSpiceInfo().functionName, args );
194 }
195 else
196 {
197 switch( m_model.GetType() )
198 case SIM_MODEL::TYPE::V_VCL:
199 case SIM_MODEL::TYPE::I_VCL:
200 {
201 item.modelName += fmt::format( "{} ", getParamValueString( "gain", "1.0" ) );
202 emptyLine = false;
203
204 break;
205
206 case SIM_MODEL::TYPE::V_CCL:
207 case SIM_MODEL::TYPE::I_CCL:
208 item.modelName += fmt::format( "{} {} ",
209 getParamValueString( "control", "V?" ),
210 getParamValueString( "gain", "1.0" ) );
211 emptyLine = false;
212 break;
213
214 default:
215 break;
216 }
217 }
218
219 if( ac != "" )
220 {
221 std::string ph = "";
222
223 if( const SIM_MODEL::PARAM* ph_param = m_model.FindParam( "ph" ) )
224 ph = SIM_VALUE::ToSpice( ph_param->value );
225
226 emptyLine = false;
227 item.modelName += fmt::format( "AC {} {} ", ac, ph );
228 }
229
230 std::string portnum = "";
231
232 if( const SIM_MODEL::PARAM* portnum_param = m_model.FindParam( "portnum" ) )
233 portnum = SIM_VALUE::ToSpice( portnum_param->value );
234
235 if( portnum != "" )
236 {
237 item.modelName += fmt::format( "portnum {} ", portnum );
238
239 std::string z0 = "";
240
241 if( const SIM_MODEL::PARAM* z0_param = m_model.FindParam( "z0" ) )
242 z0 = SIM_VALUE::ToSpice( z0_param->value );
243
244 if( z0 != "" )
245 item.modelName += fmt::format( "z0 {} ", z0 );
246 }
247
248 if( emptyLine )
249 {
251 }
252
253 return SPICE_GENERATOR::ItemLine( item );
254}
255
256
257std::string SPICE_GENERATOR_SOURCE::getParamValueString( const std::string& aParamName,
258 const std::string& aDefaultValue ) const
259{
260 std::string result = "";
261
262 if ( m_model.FindParam( aParamName ) )
263 result = SIM_VALUE::ToSpice( m_model.FindParam( aParamName )->value );
264
265 if( result == "" )
266 result = aDefaultValue;
267
268 return result;
269}
270
271
273 SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_SOURCE>( *this ),
274 std::make_unique<SIM_MODEL_SOURCE_SERIALIZER>( *this ) )
275{
276 for( const SIM_MODEL::PARAM::INFO& paramInfo : makeParamInfos( aType ) )
277 AddParam( paramInfo );
278}
279
280
281void SIM_MODEL_SOURCE::doSetParamValue( int aParamIndex, const std::string& aValue )
282{
283 // Sources are special. All preceding parameter values must be filled. If they are not, fill
284 // them out automatically. If a value is nulled, delete everything after it.
285 if( aValue.empty() )
286 {
287 for( int paramIndex = aParamIndex; paramIndex < GetParamCount(); ++paramIndex )
288 {
289 m_params.at( aParamIndex ).value = "";
290 }
291 }
292 else
293 {
294 for( int paramIndex = 0; paramIndex < aParamIndex; ++paramIndex )
295 {
296 if( GetParam( paramIndex ).value == "" )
297 {
298 double dummy;
299 wxString defaultValue = m_params.at( aParamIndex ).info.defaultValue;
300
301 if( !defaultValue.ToDouble( &dummy ) )
302 defaultValue = wxT( "0" );
303
304 m_params.at( aParamIndex ).value = defaultValue;
305 SIM_MODEL::SetParamValue( paramIndex, defaultValue.ToStdString() );
306 }
307 }
308 }
309
310 return SIM_MODEL::doSetParamValue( aParamIndex, aValue );
311}
312
313
314const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYPE aType )
315{
316 static std::vector<PARAM::INFO> vdc = makeDcParamInfos( "y", "V" );
317 static std::vector<PARAM::INFO> idc = makeDcParamInfos( "y", "A" );
318
319 static std::vector<PARAM::INFO> vsin = makeSinParamInfos( "y", "V" );
320 static std::vector<PARAM::INFO> isin = makeSinParamInfos( "y", "A" );
321
322 static std::vector<PARAM::INFO> vpulse = makePulseParamInfos( "y", "V" );
323 static std::vector<PARAM::INFO> ipulse = makePulseParamInfos( "y", "A" );
324
325 static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" );
326 static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" );
327
328 static std::vector<PARAM::INFO> vam = makeAMParamInfos( "y", "V" );
329 static std::vector<PARAM::INFO> iam = makeAMParamInfos( "y", "A" );
330
331 static std::vector<PARAM::INFO> vsffm = makeSFFMParamInfos( "y", "V" );
332 static std::vector<PARAM::INFO> isffm = makeSFFMParamInfos( "y", "A" );
333
334 static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" );
335 static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" );
336 static std::vector<PARAM::INFO> vpwl = makePwlParamInfos( "y", "Voltage", "V" );
337
338 static std::vector<PARAM::INFO> vccs = makeVcParamInfos( "S" );
339 static std::vector<PARAM::INFO> cccs = makeCcParamInfos( "" );
340 static std::vector<PARAM::INFO> ipwl = makePwlParamInfos( "y", "Current", "A" );
341
342 static std::vector<PARAM::INFO> vwhitenoise = makeWhiteNoiseParamInfos( "y", "V" );
343 static std::vector<PARAM::INFO> iwhitenoise = makeWhiteNoiseParamInfos( "y", "A" );
344
345 static std::vector<PARAM::INFO> vpinknoise = makePinkNoiseParamInfos( "y", "V" );
346 static std::vector<PARAM::INFO> ipinknoise = makePinkNoiseParamInfos( "y", "A" );
347
348 static std::vector<PARAM::INFO> vburstnoise = makeBurstNoiseParamInfos( "y", "V" );
349 static std::vector<PARAM::INFO> iburstnoise = makeBurstNoiseParamInfos( "y", "A" );
350
351 static std::vector<PARAM::INFO> vrandomuniform = makeRandomUniformParamInfos( "y", "V" );
352 static std::vector<PARAM::INFO> irandomuniform = makeRandomUniformParamInfos( "y", "A" );
353
354 static std::vector<PARAM::INFO> vrandomnormal = makeRandomNormalParamInfos( "y", "V" );
355 static std::vector<PARAM::INFO> irandomnormal = makeRandomNormalParamInfos( "y", "A" );
356
357 static std::vector<PARAM::INFO> vrandomexp = makeRandomExpParamInfos( "y", "V" );
358 static std::vector<PARAM::INFO> irandomexp = makeRandomExpParamInfos( "y", "A" );
359
360 static std::vector<PARAM::INFO> vrandompoisson = makeRandomPoissonParamInfos( "y", "V" );
361 static std::vector<PARAM::INFO> irandompoisson = makeRandomPoissonParamInfos( "y", "A" );
362
363 switch( aType )
364 {
365 case TYPE::V: return vdc;
366 case TYPE::I: return idc;
367 case TYPE::V_SIN: return vsin;
368 case TYPE::I_SIN: return isin;
369 case TYPE::V_PULSE: return vpulse;
370 case TYPE::I_PULSE: return ipulse;
371 case TYPE::V_EXP: return vexp;
372 case TYPE::I_EXP: return iexp;
373 case TYPE::V_AM: return vam;
374 case TYPE::I_AM: return iam;
375 case TYPE::V_SFFM: return vsffm;
376 case TYPE::I_SFFM: return isffm;
377 case TYPE::V_VCL: return vcvs;
378 case TYPE::V_CCL: return ccvs;
379 case TYPE::V_PWL: return vpwl;
380 case TYPE::I_VCL: return vccs;
381 case TYPE::I_CCL: return cccs;
382 case TYPE::I_PWL: return ipwl;
383 case TYPE::V_WHITENOISE: return vwhitenoise;
384 case TYPE::I_WHITENOISE: return iwhitenoise;
385 case TYPE::V_PINKNOISE: return vpinknoise;
386 case TYPE::I_PINKNOISE: return ipinknoise;
387 case TYPE::V_BURSTNOISE: return vburstnoise;
388 case TYPE::I_BURSTNOISE: return iburstnoise;
389 case TYPE::V_RANDUNIFORM: return vrandomuniform;
390 case TYPE::I_RANDUNIFORM: return irandomuniform;
391 case TYPE::V_RANDGAUSSIAN: return vrandomnormal;
392 case TYPE::I_RANDGAUSSIAN: return irandomnormal;
393 case TYPE::V_RANDEXP: return vrandomexp;
394 case TYPE::I_RANDEXP: return irandomexp;
395 case TYPE::V_RANDPOISSON: return vrandompoisson;
396 case TYPE::I_RANDPOISSON: return irandompoisson;
397 default:
398 wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SOURCE" );
399 static std::vector<SIM_MODEL::PARAM::INFO> empty;
400 return empty;
401 }
402}
403
404
405std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeDcParamInfos( const std::string& aPrefix,
406 const std::string& aUnit )
407{
408 std::vector<PARAM::INFO> paramInfos;
409 PARAM::INFO paramInfo;
410
411 paramInfo.name = "dc";
412 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
413 paramInfo.unit = aUnit;
415 paramInfo.defaultValue = "0";
416 paramInfo.description = "DC value";
417 paramInfos.push_back( paramInfo );
418
419 appendAcParamInfos( paramInfos, aUnit );
420 appendSpParamInfos( paramInfos, aUnit );
421 return paramInfos;
422}
423
424
425std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSinParamInfos( const std::string& aPrefix,
426 const std::string& aUnit )
427{
428 std::vector<PARAM::INFO> paramInfos;
429 PARAM::INFO paramInfo;
430
431 paramInfo.name = "dc";
432 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
433 paramInfo.unit = aUnit;
435 paramInfo.defaultValue = "";
436 paramInfo.description = "DC offset";
437 paramInfos.push_back( paramInfo );
438
439 paramInfo.name = "ampl";
440 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
441 paramInfo.unit = aUnit;
443 paramInfo.defaultValue = "";
444 paramInfo.description = "Amplitude";
445 paramInfos.push_back( paramInfo );
446
447 paramInfo.name = "f";
448 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
449 paramInfo.unit = "Hz";
451 paramInfo.defaultValue = "1/tstop";
452 paramInfo.description = "Frequency";
453 paramInfos.push_back( paramInfo );
454
455 paramInfo.name = "td";
456 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
457 paramInfo.unit = "s";
459 paramInfo.defaultValue = "0";
460 paramInfo.description = "Delay";
461 paramInfos.push_back( paramInfo );
462
463 paramInfo.name = "theta";
464 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
465 paramInfo.unit = "1/s";
467 paramInfo.defaultValue = "0";
468 paramInfo.description = "Damping factor";
469 paramInfos.push_back( paramInfo );
470
471 paramInfo.name = "phase";
472 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
473 paramInfo.unit = "°";
475 paramInfo.defaultValue = "0";
476 paramInfo.description = "Phase";
477 paramInfos.push_back( paramInfo );
478
479 appendAcParamInfos( paramInfos, aUnit );
480 appendSpParamInfos( paramInfos, aUnit );
481 return paramInfos;
482}
483
484
485std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePulseParamInfos( const std::string& aPrefix,
486 const std::string& aUnit )
487{
488 std::vector<PARAM::INFO> paramInfos;
489 PARAM::INFO paramInfo;
490
491 paramInfo.name = aPrefix + "1";
492 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
493 paramInfo.unit = aUnit;
495 paramInfo.defaultValue = "";
496 paramInfo.description = "Initial value";
497 paramInfos.push_back( paramInfo );
498
499 paramInfo.name = aPrefix + "2";
500 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
501 paramInfo.unit = aUnit;
503 paramInfo.defaultValue = "";
504 paramInfo.description = "Pulsed value";
505 paramInfos.push_back( paramInfo );
506
507 paramInfo.name = "td";
508 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
509 paramInfo.unit = "s";
511 paramInfo.defaultValue = "0";
512 paramInfo.description = "Delay";
513 paramInfos.push_back( paramInfo );
514
515 paramInfo.name = "tr";
516 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
517 paramInfo.unit = "s";
519 paramInfo.defaultValue = "tstep";
520 paramInfo.description = "Rise time";
521 paramInfos.push_back( paramInfo );
522
523 paramInfo.name = "tf";
524 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
525 paramInfo.unit = "s";
527 paramInfo.defaultValue = "tstep";
528 paramInfo.description = "Fall time";
529 paramInfos.push_back( paramInfo );
530
531 paramInfo.name = "tw"; // Ngspice calls it "pw".
532 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
533 paramInfo.unit = "s";
535 paramInfo.defaultValue = "tstop";
536 paramInfo.description = "Pulse width";
537 paramInfos.push_back( paramInfo );
538
539 paramInfo.name = "per";
540 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
541 paramInfo.unit = "s";
543 paramInfo.defaultValue = "tstop";
544 paramInfo.description = "Period";
545 paramInfos.push_back( paramInfo );
546
547 paramInfo.name = "np";
548 paramInfo.type = SIM_VALUE::TYPE_INT;
549 paramInfo.unit = "";
551 paramInfo.defaultValue = "";
552 paramInfo.description = "Number of pulses";
553 paramInfos.push_back( paramInfo );
554
555 appendAcParamInfos( paramInfos, aUnit );
556 appendSpParamInfos( paramInfos, aUnit );
557 return paramInfos;
558}
559
560
561std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const std::string& aPrefix,
562 const std::string& aUnit )
563{
564 std::vector<PARAM::INFO> paramInfos;
565 PARAM::INFO paramInfo;
566
567 paramInfo.name = aPrefix + "1";
568 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
569 paramInfo.unit = aUnit;
571 paramInfo.defaultValue = "";
572 paramInfo.description = "Initial value";
573 paramInfos.push_back( paramInfo );
574
575 paramInfo.name = aPrefix + "2";
576 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
577 paramInfo.unit = aUnit;
579 paramInfo.defaultValue = "";
580 paramInfo.description = "Pulsed value";
581 paramInfos.push_back( paramInfo );
582
583 paramInfo.name = "td1";
584 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
585 paramInfo.unit = "s";
587 paramInfo.defaultValue = "0";
588 paramInfo.description = "Rise delay time";
589 paramInfos.push_back( paramInfo );
590
591 paramInfo.name = "tau1";
592 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
593 paramInfo.unit = "s";
595 paramInfo.defaultValue = "tstep";
596 paramInfo.description = "Rise time constant";
597 paramInfos.push_back( paramInfo );
598
599 paramInfo.name = "td2";
600 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
601 paramInfo.unit = "s";
603 paramInfo.defaultValue = "td1+tstep";
604 paramInfo.description = "Fall delay time";
605 paramInfos.push_back( paramInfo );
606
607 paramInfo.name = "tau2";
608 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
609 paramInfo.unit = "s";
611 paramInfo.defaultValue = "tstep";
612 paramInfo.description = "Fall time constant";
613 paramInfos.push_back( paramInfo );
614
615 appendAcParamInfos( paramInfos, aUnit );
616 appendSpParamInfos( paramInfos, aUnit );
617 return paramInfos;
618}
619
620
621std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeAMParamInfos( const std::string& aPrefix,
622 const std::string& aUnit )
623{
624 std::vector<PARAM::INFO> paramInfos;
625 PARAM::INFO paramInfo;
626
627 paramInfo.name = "vo";
628 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
629 paramInfo.unit = aUnit;
631 paramInfo.defaultValue = "";
632 paramInfo.description = "Overall offset";
633 paramInfos.push_back( paramInfo );
634
635 paramInfo.name = "vmo";
636 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
637 paramInfo.unit = aUnit;
639 paramInfo.defaultValue = "";
640 paramInfo.description = "Modulation signal offset";
641 paramInfos.push_back( paramInfo );
642
643 paramInfo.name = "vma";
644 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
645 paramInfo.unit = aUnit;
647 paramInfo.defaultValue = "";
648 paramInfo.description = "Modulation signal amplitude";
649 paramInfos.push_back( paramInfo );
650
651 paramInfo.name = "fm";
652 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
653 paramInfo.unit = "Hz";
655 paramInfo.defaultValue = "5/tstop";
656 paramInfo.description = "Modulation signal frequency";
657 paramInfos.push_back( paramInfo );
658
659 paramInfo.name = "fc";
660 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
661 paramInfo.unit = "Hz";
663 paramInfo.defaultValue = "500/tstop";
664 paramInfo.description = "Carrier signal frequency";
665 paramInfos.push_back( paramInfo );
666
667 paramInfo.name = "td";
668 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
669 paramInfo.unit = "s";
671 paramInfo.defaultValue = "0";
672 paramInfo.description = "Overall delay";
673 paramInfos.push_back( paramInfo );
674
675 paramInfo.name = "phasem";
676 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
677 paramInfo.unit = "°";
679 paramInfo.defaultValue = "0";
680 paramInfo.description = "Modulation signal phase";
681 paramInfos.push_back( paramInfo );
682
683 paramInfo.name = "phasec";
684 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
685 paramInfo.unit = "°";
687 paramInfo.defaultValue = "0";
688 paramInfo.description = "Carrier signal phase";
689 paramInfos.push_back( paramInfo );
690
691 appendAcParamInfos( paramInfos, aUnit );
692 appendSpParamInfos( paramInfos, aUnit );
693 return paramInfos;
694}
695
696
697std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSFFMParamInfos( const std::string& aPrefix,
698 const std::string& aUnit )
699{
700 std::vector<PARAM::INFO> paramInfos;
701 PARAM::INFO paramInfo;
702
703 paramInfo.name = "vo";
704 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
705 paramInfo.unit = aUnit;
707 paramInfo.defaultValue = "";
708 paramInfo.description = "DC offset";
709 paramInfos.push_back( paramInfo );
710
711 paramInfo.name = "va";
712 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
713 paramInfo.unit = aUnit;
715 paramInfo.defaultValue = "";
716 paramInfo.description = "Amplitude";
717 paramInfos.push_back( paramInfo );
718
719 paramInfo.name = "fm";
720 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
721 paramInfo.unit = "Hz";
723 paramInfo.defaultValue = "5/tstop";
724 paramInfo.description = "Modulating frequency";
725 paramInfos.push_back( paramInfo );
726
727 paramInfo.name = "mdi";
728 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
729 paramInfo.unit = "";
731 paramInfo.defaultValue = "";
732 paramInfo.description = "Modulation index";
733 paramInfos.push_back( paramInfo );
734
735 paramInfo.name = "fc";
736 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
737 paramInfo.unit = "Hz";
739 paramInfo.defaultValue = "500/tstop";
740 paramInfo.description = "Carrier frequency";
741 paramInfos.push_back( paramInfo );
742
743 paramInfo.name = "phasem";
744 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
745 paramInfo.unit = "°";
747 paramInfo.defaultValue = "0";
748 paramInfo.description = "Modulating signal phase";
749 paramInfos.push_back( paramInfo );
750
751 paramInfo.name = "phasec";
752 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
753 paramInfo.unit = "°";
755 paramInfo.defaultValue = "0";
756 paramInfo.description = "Carrier signal phase";
757 paramInfos.push_back( paramInfo );
758
759 appendAcParamInfos( paramInfos, aUnit );
760 appendSpParamInfos( paramInfos, aUnit );
761 return paramInfos;
762}
763
764
765std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit )
766{
767 std::vector<PARAM::INFO> paramInfos;
768 PARAM::INFO paramInfo;
769
770 paramInfo.name = "gain";
771 paramInfo.id = 1;
772 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
773 paramInfo.unit = aGainUnit;
774 paramInfo.description = "Gain";
775 paramInfos.push_back( paramInfo );
776
777 paramInfo.name = "control";
778 paramInfo.id = 2;
779 paramInfo.type = SIM_VALUE::TYPE_STRING;
780 paramInfo.unit = "";
781 paramInfo.description = "Controlling voltage source";
782 paramInfos.push_back( paramInfo );
783
784 return paramInfos;
785}
786
787
788std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit )
789{
790 std::vector<PARAM::INFO> paramInfos;
791 PARAM::INFO paramInfo;
792
793 paramInfo.name = "gain";
794 paramInfo.id = 1;
795 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
796 paramInfo.unit = aGainUnit;
797 paramInfo.description = "Gain";
798 paramInfos.push_back( paramInfo );
799
800 return paramInfos;
801}
802
803
804std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix,
805 const std::string& aQuantity,
806 const std::string& aUnit )
807{
808 std::vector<PARAM::INFO> paramInfos;
809 PARAM::INFO paramInfo;
810
811 paramInfo.name = "pwl";
812 paramInfo.type = SIM_VALUE::TYPE_STRING;
813 paramInfo.unit = "s," + aUnit;
815 paramInfo.defaultValue = "";
816 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
817 paramInfos.push_back( paramInfo );
818
819 // TODO: Ngspice doesn't support "td" and "r" for current sources, so let's disable that for
820 // now.
821
822 /*paramInfo.name = "td";
823 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
824 paramInfo.unit = "s";
825 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
826 paramInfo.defaultValue = "0";
827 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
828 paramInfo.isSpiceInstanceParam = true;
829 paramInfos.push_back( paramInfo );
830
831 paramInfo.name = "repeat";
832 paramInfo.type = SIM_VALUE::TYPE_BOOL;
833 paramInfo.unit = "";
834 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
835 paramInfo.defaultValue = "0";
836 paramInfo.description = "Repeat forever";
837 paramInfo.isSpiceInstanceParam = true;
838 paramInfo.spiceInstanceName = "r";
839 paramInfos.push_back( paramInfo );*/
840
841 /*paramInfo.name = "t";
842 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
843 paramInfo.unit = "s";
844 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
845 paramInfo.defaultValue = "";
846 paramInfo.description = "Time vector";
847 paramInfos.push_back( paramInfo );
848
849 paramInfo.name = aPrefix;
850 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
851 paramInfo.unit = aUnit;
852 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
853 paramInfo.defaultValue = "";
854 paramInfo.description = aQuantity + " vector";
855 paramInfos.push_back( paramInfo );
856
857 paramInfo.name = "repeat";
858 paramInfo.type = SIM_VALUE::TYPE_BOOL;
859 paramInfo.unit = "";
860 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
861 paramInfo.defaultValue = "";
862 paramInfo.description = "Repeat forever";
863 paramInfos.push_back( paramInfo );
864
865 paramInfo.name = "td";
866 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
867 paramInfo.unit = "s";
868 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
869 paramInfo.defaultValue = "0";
870 paramInfo.description = "Delay";
871 paramInfos.push_back( paramInfo );*/
872
873 appendAcParamInfos( paramInfos, aUnit );
874 appendSpParamInfos( paramInfos, aUnit );
875 return paramInfos;
876}
877
878
879std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix,
880 const std::string& aUnit )
881{
882 std::vector<PARAM::INFO> paramInfos;
883 PARAM::INFO paramInfo;
884
885 paramInfo.name = "rms";
886 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
887 paramInfo.unit = aUnit;
889 paramInfo.defaultValue = "0";
890 paramInfo.description = "White noise RMS amplitude";
891 paramInfos.push_back( paramInfo );
892
893 paramInfo.name = "dt";
894 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
895 paramInfo.unit = "s";
897 paramInfo.defaultValue = "0";
898 paramInfo.description = "Time step";
899 paramInfos.push_back( paramInfo );
900
901 appendAcParamInfos( paramInfos, aUnit );
902 appendSpParamInfos( paramInfos, aUnit );
903 return paramInfos;
904}
905
906
907std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix,
908 const std::string& aUnit )
909{
910 std::vector<PARAM::INFO> paramInfos;
911 PARAM::INFO paramInfo;
912
913 paramInfo.name = "rms";
914 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
915 paramInfo.unit = "";
917 paramInfo.defaultValue = "0";
918 paramInfo.description = "1/f noise RMS amplitude";
919 paramInfos.push_back( paramInfo );
920
921 paramInfo.name = "slope";
922 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
923 paramInfo.unit = "";
925 paramInfo.defaultValue = "1";
926 paramInfo.description = "1/f noise exponent";
927 paramInfos.push_back( paramInfo );
928
929 paramInfo.name = "dt";
930 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
931 paramInfo.unit = "s";
933 paramInfo.defaultValue = "0";
934 paramInfo.description = "Time step";
935 paramInfos.push_back( paramInfo );
936
937 appendAcParamInfos( paramInfos, aUnit );
938 appendSpParamInfos( paramInfos, aUnit );
939 return paramInfos;
940}
941
942
943std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix,
944 const std::string& aUnit )
945{
946 std::vector<PARAM::INFO> paramInfos;
947 PARAM::INFO paramInfo;
948
949 paramInfo.name = "ampl";
950 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
951 paramInfo.unit = aUnit;
953 paramInfo.defaultValue = "0";
954 paramInfo.description = "Burst noise amplitude";
955 paramInfos.push_back( paramInfo );
956
957 paramInfo.name = "tcapt";
958 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
959 paramInfo.unit = "s";
961 paramInfo.defaultValue = "0";
962 paramInfo.description = "Burst noise trap capture time";
963 paramInfos.push_back( paramInfo );
964
965 paramInfo.name = "temit";
966 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
967 paramInfo.unit = "s";
969 paramInfo.defaultValue = "0";
970 paramInfo.description = "Burst noise trap emission time";
971 paramInfos.push_back( paramInfo );
972
973 appendAcParamInfos( paramInfos, aUnit );
974 appendSpParamInfos( paramInfos, aUnit );
975 return paramInfos;
976}
977
978
979std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix,
980 const std::string& aUnit )
981{
982 std::vector<PARAM::INFO> paramInfos;
983 PARAM::INFO paramInfo;
984
985 paramInfo.name = "ts";
986 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
987 paramInfo.unit = "s";
989 paramInfo.defaultValue = "";
990 paramInfo.description = "Individual voltage duration";
991 paramInfos.push_back( paramInfo );
992
993 paramInfo.name = "td";
994 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
995 paramInfo.unit = "s";
997 paramInfo.defaultValue = "0";
998 paramInfo.description = "Delay";
999 paramInfos.push_back( paramInfo );
1000
1001 paramInfo.name = "range";
1002 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1003 paramInfo.unit = aUnit;
1005 paramInfo.defaultValue = "1";
1006 paramInfo.description = "Range";
1007 paramInfos.push_back( paramInfo );
1008
1009 paramInfo.name = "offset";
1010 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1011 paramInfo.unit = aUnit;
1013 paramInfo.defaultValue = "0";
1014 paramInfo.description = "Offset";
1015 paramInfos.push_back( paramInfo );
1016
1017 appendAcParamInfos( paramInfos, aUnit );
1018 appendSpParamInfos( paramInfos, aUnit );
1019 return paramInfos;
1020}
1021
1022
1023std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix,
1024 const std::string& aUnit )
1025{
1026 std::vector<PARAM::INFO> paramInfos;
1027 PARAM::INFO paramInfo;
1028
1029 paramInfo.name = "ts";
1030 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1031 paramInfo.unit = "s";
1033 paramInfo.defaultValue = "";
1034 paramInfo.description = "Individual voltage duration";
1035 paramInfos.push_back( paramInfo );
1036
1037 paramInfo.name = "td";
1038 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1039 paramInfo.unit = "s";
1041 paramInfo.defaultValue = "0";
1042 paramInfo.description = "Delay";
1043 paramInfos.push_back( paramInfo );
1044
1045 paramInfo.name = "stddev";
1046 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1047 paramInfo.unit = aUnit;
1049 paramInfo.defaultValue = "1";
1050 paramInfo.description = "Standard deviation";
1051 paramInfos.push_back( paramInfo );
1052
1053 paramInfo.name = "mean";
1054 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1055 paramInfo.unit = aUnit;
1057 paramInfo.defaultValue = "0";
1058 paramInfo.description = "Mean";
1059 paramInfos.push_back( paramInfo );
1060
1061 appendAcParamInfos( paramInfos, aUnit );
1062 appendSpParamInfos( paramInfos, aUnit );
1063 return paramInfos;
1064}
1065
1066
1067std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix,
1068 const std::string& aUnit )
1069{
1070 std::vector<PARAM::INFO> paramInfos;
1071 PARAM::INFO paramInfo;
1072
1073 paramInfo.name = "ts";
1074 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1075 paramInfo.unit = "s";
1077 paramInfo.defaultValue = "";
1078 paramInfo.description = "Individual voltage duration";
1079 paramInfos.push_back( paramInfo );
1080
1081 paramInfo.name = "td";
1082 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1083 paramInfo.unit = "s";
1085 paramInfo.defaultValue = "0";
1086 paramInfo.description = "Delay";
1087 paramInfos.push_back( paramInfo );
1088
1089 paramInfo.name = "mean";
1090 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1091 paramInfo.unit = aUnit;
1093 paramInfo.defaultValue = "1";
1094 paramInfo.description = "Mean";
1095 paramInfos.push_back( paramInfo );
1096
1097 paramInfo.name = "offset";
1098 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1099 paramInfo.unit = aUnit;
1101 paramInfo.defaultValue = "0";
1102 paramInfo.description = "Offset";
1103 paramInfos.push_back( paramInfo );
1104
1105 appendAcParamInfos( paramInfos, aUnit );
1106 appendSpParamInfos( paramInfos, aUnit );
1107 return paramInfos;
1108}
1109
1110
1111std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix,
1112 const std::string& aUnit )
1113{
1114 std::vector<PARAM::INFO> paramInfos;
1115 PARAM::INFO paramInfo;
1116
1117 paramInfo.name = "ts";
1118 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1119 paramInfo.unit = "s";
1121 paramInfo.defaultValue = "";
1122 paramInfo.description = "Individual voltage duration";
1123 paramInfos.push_back( paramInfo );
1124
1125 paramInfo.name = "td";
1126 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1127 paramInfo.unit = "s";
1129 paramInfo.defaultValue = "0";
1130 paramInfo.description = "Delay";
1131 paramInfos.push_back( paramInfo );
1132
1133 paramInfo.name = "lambda";
1134 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1135 paramInfo.unit = aUnit;
1137 paramInfo.defaultValue = "1";
1138 paramInfo.description = "Lambda";
1139 paramInfos.push_back( paramInfo );
1140
1141 paramInfo.name = "offset";
1142 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1143 paramInfo.unit = aUnit;
1145 paramInfo.defaultValue = "0";
1146 paramInfo.description = "Offset";
1147 paramInfos.push_back( paramInfo );
1148
1149 appendAcParamInfos( paramInfos, aUnit );
1150 appendSpParamInfos( paramInfos, aUnit );
1151 return paramInfos;
1152}
1153
1154void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector<PARAM::INFO>& aParamInfos, const std::string& aUnit )
1155{
1156 PARAM::INFO paramInfo;
1157
1158 paramInfo.name = "ac";
1159 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1160 paramInfo.unit = aUnit;
1162 paramInfo.defaultValue = "0";
1163 paramInfo.description = "AC magnitude";
1164 aParamInfos.push_back( paramInfo );
1165
1166 paramInfo.name = "ph";
1167 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1168 paramInfo.unit = "°";
1170 paramInfo.defaultValue = "0";
1171 paramInfo.description = "AC phase";
1172 aParamInfos.push_back( paramInfo );
1173}
1174
1175void SIM_MODEL_SOURCE::appendSpParamInfos( std::vector<PARAM::INFO>& aParamInfos,
1176 const std::string& aUnit )
1177{
1178 PARAM::INFO paramInfo;
1179
1180 if( !strcmp( aUnit.c_str(), "V" ) )
1181 {
1182 paramInfo.name = "portnum";
1183 paramInfo.type = SIM_VALUE::TYPE_INT;
1184 paramInfo.unit = "";
1186 paramInfo.defaultValue = "";
1187 paramInfo.description = "Port number";
1188 aParamInfos.push_back( paramInfo );
1189
1190 paramInfo.name = "z0";
1191 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1192 paramInfo.unit = "Ohm";
1194 paramInfo.defaultValue = "";
1195 paramInfo.description = "Internal impedance";
1196 aParamInfos.push_back( paramInfo );
1197 }
1198}
1199
1200
1201std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
1202{
1203 if( GetDeviceType() == SIM_MODEL::DEVICE_T::E || GetDeviceType() == SIM_MODEL::DEVICE_T::G )
1204 return { "+", "-", "C+", "C-" };
1205 else
1206 return { "+", "-" };
1207}
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:720
virtual const PARAM & GetParam(unsigned aParamIndex) const
Definition: sim_model.cpp:780
int GetParamCount() const
Definition: sim_model.h:481
DEVICE_T GetDeviceType() const
Definition: sim_model.h:463
const PARAM * FindParam(const std::string &aParamName) const
Definition: sim_model.cpp:809
virtual void doSetParamValue(int aParamIndex, const std::string &aValue)
Definition: sim_model.cpp:843
std::vector< PARAM > m_params
Definition: sim_model.h:540
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
Definition: sim_model.cpp:849
SPICE_INFO GetSpiceInfo() const
Definition: sim_model.h:452
std::vector< std::reference_wrapper< const PARAM > > GetParams() const
Definition: sim_model.cpp:817
TYPE GetType() const
Definition: sim_model.h:464
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:306
std::string modelName