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