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.unit = "";
778 paramInfo.description = "Controlling voltage source";
779 paramInfos.push_back( paramInfo );
780
781 return paramInfos;
782}
783
784
785std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit )
786{
787 std::vector<PARAM::INFO> paramInfos;
788 PARAM::INFO paramInfo;
789
790 paramInfo.name = "gain";
791 paramInfo.id = 1;
792 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
793 paramInfo.unit = aGainUnit;
794 paramInfo.description = "Gain";
795 paramInfos.push_back( paramInfo );
796
797 return paramInfos;
798}
799
800
801std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix,
802 const std::string& aQuantity,
803 const std::string& aUnit )
804{
805 std::vector<PARAM::INFO> paramInfos;
806 PARAM::INFO paramInfo;
807
808 paramInfo.name = "pwl";
809 paramInfo.type = SIM_VALUE::TYPE_STRING;
810 paramInfo.unit = "s," + aUnit;
812 paramInfo.defaultValue = "";
813 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
814 paramInfos.push_back( paramInfo );
815
816 // TODO: Ngspice doesn't support "td" and "r" for current sources, so let's disable that for
817 // now.
818
819 /*paramInfo.name = "td";
820 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
821 paramInfo.unit = "s";
822 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
823 paramInfo.defaultValue = "0";
824 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
825 paramInfo.isSpiceInstanceParam = true;
826 paramInfos.push_back( paramInfo );
827
828 paramInfo.name = "repeat";
829 paramInfo.type = SIM_VALUE::TYPE_BOOL;
830 paramInfo.unit = "";
831 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
832 paramInfo.defaultValue = "0";
833 paramInfo.description = "Repeat forever";
834 paramInfo.isSpiceInstanceParam = true;
835 paramInfo.spiceInstanceName = "r";
836 paramInfos.push_back( paramInfo );*/
837
838 /*paramInfo.name = "t";
839 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
840 paramInfo.unit = "s";
841 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
842 paramInfo.defaultValue = "";
843 paramInfo.description = "Time vector";
844 paramInfos.push_back( paramInfo );
845
846 paramInfo.name = aPrefix;
847 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
848 paramInfo.unit = aUnit;
849 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
850 paramInfo.defaultValue = "";
851 paramInfo.description = aQuantity + " vector";
852 paramInfos.push_back( paramInfo );
853
854 paramInfo.name = "repeat";
855 paramInfo.type = SIM_VALUE::TYPE_BOOL;
856 paramInfo.unit = "";
857 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
858 paramInfo.defaultValue = "";
859 paramInfo.description = "Repeat forever";
860 paramInfos.push_back( paramInfo );
861
862 paramInfo.name = "td";
863 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
864 paramInfo.unit = "s";
865 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
866 paramInfo.defaultValue = "0";
867 paramInfo.description = "Delay";
868 paramInfos.push_back( paramInfo );*/
869
870 appendAcParamInfos( paramInfos, aUnit );
871 appendSpParamInfos( paramInfos, aUnit );
872 return paramInfos;
873}
874
875
876std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix,
877 const std::string& aUnit )
878{
879 std::vector<PARAM::INFO> paramInfos;
880 PARAM::INFO paramInfo;
881
882 paramInfo.name = "rms";
883 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
884 paramInfo.unit = aUnit;
886 paramInfo.defaultValue = "0";
887 paramInfo.description = "White noise RMS amplitude";
888 paramInfos.push_back( paramInfo );
889
890 paramInfo.name = "dt";
891 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
892 paramInfo.unit = "s";
894 paramInfo.defaultValue = "0";
895 paramInfo.description = "Time step";
896 paramInfos.push_back( paramInfo );
897
898 appendAcParamInfos( paramInfos, aUnit );
899 appendSpParamInfos( paramInfos, aUnit );
900 return paramInfos;
901}
902
903
904std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix,
905 const std::string& aUnit )
906{
907 std::vector<PARAM::INFO> paramInfos;
908 PARAM::INFO paramInfo;
909
910 paramInfo.name = "rms";
911 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
912 paramInfo.unit = "";
914 paramInfo.defaultValue = "0";
915 paramInfo.description = "1/f noise RMS amplitude";
916 paramInfos.push_back( paramInfo );
917
918 paramInfo.name = "slope";
919 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
920 paramInfo.unit = "";
922 paramInfo.defaultValue = "1";
923 paramInfo.description = "1/f noise exponent";
924 paramInfos.push_back( paramInfo );
925
926 paramInfo.name = "dt";
927 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
928 paramInfo.unit = "s";
930 paramInfo.defaultValue = "0";
931 paramInfo.description = "Time step";
932 paramInfos.push_back( paramInfo );
933
934 appendAcParamInfos( paramInfos, aUnit );
935 appendSpParamInfos( paramInfos, aUnit );
936 return paramInfos;
937}
938
939
940std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix,
941 const std::string& aUnit )
942{
943 std::vector<PARAM::INFO> paramInfos;
944 PARAM::INFO paramInfo;
945
946 paramInfo.name = "ampl";
947 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
948 paramInfo.unit = aUnit;
950 paramInfo.defaultValue = "0";
951 paramInfo.description = "Burst noise amplitude";
952 paramInfos.push_back( paramInfo );
953
954 paramInfo.name = "tcapt";
955 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
956 paramInfo.unit = "s";
958 paramInfo.defaultValue = "0";
959 paramInfo.description = "Burst noise trap capture time";
960 paramInfos.push_back( paramInfo );
961
962 paramInfo.name = "temit";
963 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
964 paramInfo.unit = "s";
966 paramInfo.defaultValue = "0";
967 paramInfo.description = "Burst noise trap emission time";
968 paramInfos.push_back( paramInfo );
969
970 appendAcParamInfos( paramInfos, aUnit );
971 appendSpParamInfos( paramInfos, aUnit );
972 return paramInfos;
973}
974
975
976std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix,
977 const std::string& aUnit )
978{
979 std::vector<PARAM::INFO> paramInfos;
980 PARAM::INFO paramInfo;
981
982 paramInfo.name = "ts";
983 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
984 paramInfo.unit = "s";
986 paramInfo.defaultValue = "";
987 paramInfo.description = "Individual voltage duration";
988 paramInfos.push_back( paramInfo );
989
990 paramInfo.name = "td";
991 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
992 paramInfo.unit = "s";
994 paramInfo.defaultValue = "0";
995 paramInfo.description = "Delay";
996 paramInfos.push_back( paramInfo );
997
998 paramInfo.name = "range";
999 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1000 paramInfo.unit = aUnit;
1002 paramInfo.defaultValue = "1";
1003 paramInfo.description = "Range";
1004 paramInfos.push_back( paramInfo );
1005
1006 paramInfo.name = "offset";
1007 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1008 paramInfo.unit = aUnit;
1010 paramInfo.defaultValue = "0";
1011 paramInfo.description = "Offset";
1012 paramInfos.push_back( paramInfo );
1013
1014 appendAcParamInfos( paramInfos, aUnit );
1015 appendSpParamInfos( paramInfos, aUnit );
1016 return paramInfos;
1017}
1018
1019
1020std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix,
1021 const std::string& aUnit )
1022{
1023 std::vector<PARAM::INFO> paramInfos;
1024 PARAM::INFO paramInfo;
1025
1026 paramInfo.name = "ts";
1027 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1028 paramInfo.unit = "s";
1030 paramInfo.defaultValue = "";
1031 paramInfo.description = "Individual voltage duration";
1032 paramInfos.push_back( paramInfo );
1033
1034 paramInfo.name = "td";
1035 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1036 paramInfo.unit = "s";
1038 paramInfo.defaultValue = "0";
1039 paramInfo.description = "Delay";
1040 paramInfos.push_back( paramInfo );
1041
1042 paramInfo.name = "stddev";
1043 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1044 paramInfo.unit = aUnit;
1046 paramInfo.defaultValue = "1";
1047 paramInfo.description = "Standard deviation";
1048 paramInfos.push_back( paramInfo );
1049
1050 paramInfo.name = "mean";
1051 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1052 paramInfo.unit = aUnit;
1054 paramInfo.defaultValue = "0";
1055 paramInfo.description = "Mean";
1056 paramInfos.push_back( paramInfo );
1057
1058 appendAcParamInfos( paramInfos, aUnit );
1059 appendSpParamInfos( paramInfos, aUnit );
1060 return paramInfos;
1061}
1062
1063
1064std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix,
1065 const std::string& aUnit )
1066{
1067 std::vector<PARAM::INFO> paramInfos;
1068 PARAM::INFO paramInfo;
1069
1070 paramInfo.name = "ts";
1071 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1072 paramInfo.unit = "s";
1074 paramInfo.defaultValue = "";
1075 paramInfo.description = "Individual voltage duration";
1076 paramInfos.push_back( paramInfo );
1077
1078 paramInfo.name = "td";
1079 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1080 paramInfo.unit = "s";
1082 paramInfo.defaultValue = "0";
1083 paramInfo.description = "Delay";
1084 paramInfos.push_back( paramInfo );
1085
1086 paramInfo.name = "mean";
1087 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1088 paramInfo.unit = aUnit;
1090 paramInfo.defaultValue = "1";
1091 paramInfo.description = "Mean";
1092 paramInfos.push_back( paramInfo );
1093
1094 paramInfo.name = "offset";
1095 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1096 paramInfo.unit = aUnit;
1098 paramInfo.defaultValue = "0";
1099 paramInfo.description = "Offset";
1100 paramInfos.push_back( paramInfo );
1101
1102 appendAcParamInfos( paramInfos, aUnit );
1103 appendSpParamInfos( paramInfos, aUnit );
1104 return paramInfos;
1105}
1106
1107
1108std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix,
1109 const std::string& aUnit )
1110{
1111 std::vector<PARAM::INFO> paramInfos;
1112 PARAM::INFO paramInfo;
1113
1114 paramInfo.name = "ts";
1115 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1116 paramInfo.unit = "s";
1118 paramInfo.defaultValue = "";
1119 paramInfo.description = "Individual voltage duration";
1120 paramInfos.push_back( paramInfo );
1121
1122 paramInfo.name = "td";
1123 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1124 paramInfo.unit = "s";
1126 paramInfo.defaultValue = "0";
1127 paramInfo.description = "Delay";
1128 paramInfos.push_back( paramInfo );
1129
1130 paramInfo.name = "lambda";
1131 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1132 paramInfo.unit = aUnit;
1134 paramInfo.defaultValue = "1";
1135 paramInfo.description = "Lambda";
1136 paramInfos.push_back( paramInfo );
1137
1138 paramInfo.name = "offset";
1139 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1140 paramInfo.unit = aUnit;
1142 paramInfo.defaultValue = "0";
1143 paramInfo.description = "Offset";
1144 paramInfos.push_back( paramInfo );
1145
1146 appendAcParamInfos( paramInfos, aUnit );
1147 appendSpParamInfos( paramInfos, aUnit );
1148 return paramInfos;
1149}
1150
1151void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector<PARAM::INFO>& aParamInfos, const std::string& aUnit )
1152{
1153 PARAM::INFO paramInfo;
1154
1155 paramInfo.name = "ac";
1156 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1157 paramInfo.unit = aUnit;
1159 paramInfo.defaultValue = "0";
1160 paramInfo.description = "AC magnitude";
1161 aParamInfos.push_back( paramInfo );
1162
1163 paramInfo.name = "ph";
1164 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1165 paramInfo.unit = "°";
1167 paramInfo.defaultValue = "0";
1168 paramInfo.description = "AC phase";
1169 aParamInfos.push_back( paramInfo );
1170}
1171
1172void SIM_MODEL_SOURCE::appendSpParamInfos( std::vector<PARAM::INFO>& aParamInfos,
1173 const std::string& aUnit )
1174{
1175 PARAM::INFO paramInfo;
1176
1177 if( !strcmp( aUnit.c_str(), "V" ) )
1178 {
1179 paramInfo.name = "portnum";
1180 paramInfo.type = SIM_VALUE::TYPE_INT;
1181 paramInfo.unit = "";
1183 paramInfo.defaultValue = "";
1184 paramInfo.description = "Port number";
1185 aParamInfos.push_back( paramInfo );
1186
1187 paramInfo.name = "z0";
1188 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1189 paramInfo.unit = "Ohm";
1191 paramInfo.defaultValue = "";
1192 paramInfo.description = "Internal impedance";
1193 aParamInfos.push_back( paramInfo );
1194 }
1195}
1196
1197
1198std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
1199{
1200 if( GetDeviceType() == SIM_MODEL::DEVICE_T::E || GetDeviceType() == SIM_MODEL::DEVICE_T::G )
1201 return { "+", "-", "C+", "C-" };
1202 else
1203 return { "+", "-" };
1204}
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:779
int GetParamCount() const
Definition: sim_model.h:482
DEVICE_T GetDeviceType() const
Definition: sim_model.h:464
const PARAM * FindParam(const std::string &aParamName) const
Definition: sim_model.cpp:808
virtual void doSetParamValue(int aParamIndex, const std::string &aValue)
Definition: sim_model.cpp:842
std::vector< PARAM > m_params
Definition: sim_model.h:541
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
Definition: sim_model.cpp:848
SPICE_INFO GetSpiceInfo() const
Definition: sim_model.h:453
std::vector< std::reference_wrapper< const PARAM > > GetParams() const
Definition: sim_model.cpp:816
TYPE GetType() const
Definition: sim_model.h:465
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:380
std::string defaultValue
Definition: sim_model.h:383
std::string description
Definition: sim_model.h:384
std::string value
Definition: sim_model.h:401
std::string functionName
Definition: sim_model.h:298
std::string modelName