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
47std::string SPICE_GENERATOR_SOURCE::TunerCommand( const SPICE_ITEM& aItem, double aValue ) const
48{
49 std::string result = "";
50
51 switch( aItem.model->GetType() )
52 {
53 case SIM_MODEL::TYPE::V: // VDC/IDC: it is clear which parameter should be used
54 case SIM_MODEL::TYPE::I:
55 result = fmt::format( "alter @{}={:g}", aItem.model->SpiceGenerator().ItemName( aItem ),
56 aValue );
57 break;
58 default: break; // other sources: unclear which parameter the user wants
59 }
60 return result;
61}
62
63std::string SPICE_GENERATOR_SOURCE::ItemLine( const SPICE_ITEM& aItem ) const
64{
65 SPICE_ITEM item = aItem;
66
67 std::string ac = "";
68 std::string dc = "";
69
70 if( const SIM_MODEL::PARAM* ac_param = m_model.FindParam( "ac" ) )
71 ac = SIM_VALUE::ToSpice( ac_param->value );
72 if( const SIM_MODEL::PARAM* dc_param = m_model.FindParam( "dc" ) )
73 dc = SIM_VALUE::ToSpice( dc_param->value );
74
75 bool emptyLine = true;
76 item.modelName = "";
77
78 // @FIXME
79 // the keyword "DC" refers to both offset of a sine source, and value for DC analysis
80 // Because of this, both values are always equal in a sine source.
81 //
82 // suggestion: rename the sine parameter from "DC" to "offset"
83
84 if( dc != "" )
85 {
86 emptyLine = false;
87 item.modelName += fmt::format( "DC {} ", dc );
88 }
89
91 && m_model.GetType() != SIM_MODEL::TYPE::V // DC-only sources are already processed
92 && m_model.GetType() != SIM_MODEL::TYPE::I )
93 {
94 std::string args = "";
95
96 switch( m_model.GetType() )
97 {
98 case SIM_MODEL::TYPE::V_PWL:
99 case SIM_MODEL::TYPE::I_PWL:
100 {
101 tao::pegtl::string_input<> in( m_model.GetParam( 0 ).value, "from_content" );
102 std::unique_ptr<tao::pegtl::parse_tree::node> root;
103
104 try
105 {
106 root = tao::pegtl::parse_tree::parse<SIM_MODEL_SOURCE_PARSER::pwlValuesGrammar,
108 ( in );
109 }
110 catch( const tao::pegtl::parse_error& )
111 {
112 break;
113 }
114
115 if( root )
116 {
117 for( const auto& node : root->children )
118 {
120 SIM_VALUE::NOTATION::SI>>() )
121 {
122 args.append( SIM_VALUE::ToSpice( node->string() ) + " " );
123 }
124 }
125 }
126
127 break;
128 }
129
130 case SIM_MODEL::TYPE::V_WHITENOISE:
131 case SIM_MODEL::TYPE::I_WHITENOISE:
132 args.append( getParamValueString( "rms", "0" ) + " " );
133 args.append( getParamValueString( "dt", "0" ) + " " );
134 args.append( "0 0 0 0 0 " );
135 break;
136
137 case SIM_MODEL::TYPE::V_PINKNOISE:
138 case SIM_MODEL::TYPE::I_PINKNOISE:
139 args.append( "0 " );
140 args.append( getParamValueString( "dt", "0" ) + " " );
141 args.append( getParamValueString( "slope", "0" ) + " " );
142 args.append( getParamValueString( "rms", "0" ) + " " );
143 args.append( "0 0 0 " );
144 break;
145
146 case SIM_MODEL::TYPE::V_BURSTNOISE:
147 case SIM_MODEL::TYPE::I_BURSTNOISE:
148 args.append( "0 0 0 0 " );
149 args.append( getParamValueString( "ampl", "0" ) + " " );
150 args.append( getParamValueString( "tcapt", "0" ) + " " );
151 args.append( getParamValueString( "temit", "0" ) + " " );
152 break;
153
154 case SIM_MODEL::TYPE::V_RANDUNIFORM:
155 case SIM_MODEL::TYPE::I_RANDUNIFORM:
156 {
157 args.append( "1 " );
158 args.append( getParamValueString( "ts", "0" ) + " " );
159 args.append( getParamValueString( "td", "0" ) + " " );
160 args.append( getParamValueString( "range", "1" ) + " " );
161 args.append( getParamValueString( "offset", "0" ) + " " );
162 break;
163 }
164
165 case SIM_MODEL::TYPE::V_RANDGAUSSIAN:
166 case SIM_MODEL::TYPE::I_RANDGAUSSIAN:
167 args.append( "2 " );
168 args.append( getParamValueString( "ts", "0" ) + " " );
169 args.append( getParamValueString( "td", "0" ) + " " );
170 args.append( getParamValueString( "stddev", "1" ) + " " );
171 args.append( getParamValueString( "mean", "0" ) + " " );
172 break;
173
174 case SIM_MODEL::TYPE::V_RANDEXP:
175 case SIM_MODEL::TYPE::I_RANDEXP:
176 args.append( "3 " );
177 args.append( getParamValueString( "ts", "0" ) + " " );
178 args.append( getParamValueString( "td", "0" ) + " " );
179 args.append( getParamValueString( "mean", "1" ) + " " );
180 args.append( getParamValueString( "offset", "0" ) + " " );
181 break;
182
183 case SIM_MODEL::TYPE::V_RANDPOISSON:
184 case SIM_MODEL::TYPE::I_RANDPOISSON:
185 args.append( "4 " );
186 args.append( getParamValueString( "ts", "0" ) + " " );
187 args.append( getParamValueString( "td", "0" ) + " " );
188 args.append( getParamValueString( "lambda", "1" ) + " " );
189 args.append( getParamValueString( "offset", "0" ) + " " );
190 break;
191
192 default:
193 for( int ii = 0; ii < m_model.GetParamCount(); ++ii )
194 {
195 const SIM_MODEL::PARAM& param = m_model.GetParam( ii );
196
197 if( ac != "" && ( param.Matches( "ac" ) || param.Matches( "ph" ) ) )
198 continue;
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().functionName, 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 break;
222
223 case SIM_MODEL::TYPE::V_CCL:
224 case SIM_MODEL::TYPE::I_CCL:
225 item.modelName += fmt::format( "{} {} ",
226 getParamValueString( "control", "V?" ),
227 getParamValueString( "gain", "1.0" ) );
228 emptyLine = false;
229 break;
230
231 default:
232 break;
233 }
234 }
235
236 if( ac != "" )
237 {
238 std::string ph = "";
239
240 if( const SIM_MODEL::PARAM* ph_param = m_model.FindParam( "ph" ) )
241 ph = SIM_VALUE::ToSpice( ph_param->value );
242
243 emptyLine = false;
244 item.modelName += fmt::format( "AC {} {} ", ac, ph );
245 }
246
247 std::string portnum = "";
248
249 if( const SIM_MODEL::PARAM* portnum_param = m_model.FindParam( "portnum" ) )
250 portnum = SIM_VALUE::ToSpice( portnum_param->value );
251
252 if( portnum != "" )
253 {
254 item.modelName += fmt::format( "portnum {} ", portnum );
255
256 std::string z0 = "";
257
258 if( const SIM_MODEL::PARAM* z0_param = m_model.FindParam( "z0" ) )
259 z0 = SIM_VALUE::ToSpice( z0_param->value );
260
261 if( z0 != "" )
262 item.modelName += fmt::format( "z0 {} ", z0 );
263 }
264
265 if( emptyLine )
266 {
268 }
269
270 return SPICE_GENERATOR::ItemLine( item );
271}
272
273
274std::string SPICE_GENERATOR_SOURCE::getParamValueString( const std::string& aParamName,
275 const std::string& aDefaultValue ) const
276{
277 std::string result = "";
278
279 if ( m_model.FindParam( aParamName ) )
280 result = SIM_VALUE::ToSpice( m_model.FindParam( aParamName )->value );
281
282 if( result == "" )
283 result = aDefaultValue;
284
285 return result;
286}
287
288
290 SIM_MODEL( aType, std::make_unique<SPICE_GENERATOR_SOURCE>( *this ),
291 std::make_unique<SIM_MODEL_SOURCE_SERIALIZER>( *this ) )
292{
293 for( const SIM_MODEL::PARAM::INFO& paramInfo : makeParamInfos( aType ) )
294 AddParam( paramInfo );
295}
296
297
298void SIM_MODEL_SOURCE::doSetParamValue( int aParamIndex, const std::string& aValue )
299{
300 // Sources are special. All preceding parameter values must be filled. If they are not, fill
301 // them out automatically. If a value is nulled, delete everything after it.
302 if( aValue.empty() )
303 {
304 for( int paramIndex = aParamIndex; paramIndex < GetParamCount(); ++paramIndex )
305 {
306 m_params.at( aParamIndex ).value = "";
307 }
308 }
309 else
310 {
311 for( int paramIndex = 0; paramIndex < aParamIndex; ++paramIndex )
312 {
313 if( GetParam( paramIndex ).value == "" )
314 {
315 double dummy;
316 wxString defaultValue = m_params.at( aParamIndex ).info.defaultValue;
317
318 if( !defaultValue.ToDouble( &dummy ) )
319 defaultValue = wxT( "0" );
320
321 m_params.at( aParamIndex ).value = defaultValue;
322 SIM_MODEL::SetParamValue( paramIndex, defaultValue.ToStdString() );
323 }
324 }
325 }
326
327 return SIM_MODEL::doSetParamValue( aParamIndex, aValue );
328}
329
330
331const std::vector<SIM_MODEL::PARAM::INFO>& SIM_MODEL_SOURCE::makeParamInfos( TYPE aType )
332{
333 static std::vector<PARAM::INFO> vdc = makeDcParamInfos( "y", "V" );
334 static std::vector<PARAM::INFO> idc = makeDcParamInfos( "y", "A" );
335
336 static std::vector<PARAM::INFO> vsin = makeSinParamInfos( "y", "V" );
337 static std::vector<PARAM::INFO> isin = makeSinParamInfos( "y", "A" );
338
339 static std::vector<PARAM::INFO> vpulse = makePulseParamInfos( "y", "V" );
340 static std::vector<PARAM::INFO> ipulse = makePulseParamInfos( "y", "A" );
341
342 static std::vector<PARAM::INFO> vexp = makeExpParamInfos( "y", "V" );
343 static std::vector<PARAM::INFO> iexp = makeExpParamInfos( "y", "A" );
344
345 static std::vector<PARAM::INFO> vam = makeAMParamInfos( "y", "V" );
346 static std::vector<PARAM::INFO> iam = makeAMParamInfos( "y", "A" );
347
348 static std::vector<PARAM::INFO> vsffm = makeSFFMParamInfos( "y", "V" );
349 static std::vector<PARAM::INFO> isffm = makeSFFMParamInfos( "y", "A" );
350
351 static std::vector<PARAM::INFO> vcvs = makeVcParamInfos( "" );
352 static std::vector<PARAM::INFO> ccvs = makeCcParamInfos( "ohm" );
353 static std::vector<PARAM::INFO> vpwl = makePwlParamInfos( "y", "Voltage", "V" );
354
355 static std::vector<PARAM::INFO> vccs = makeVcParamInfos( "S" );
356 static std::vector<PARAM::INFO> cccs = makeCcParamInfos( "" );
357 static std::vector<PARAM::INFO> ipwl = makePwlParamInfos( "y", "Current", "A" );
358
359 static std::vector<PARAM::INFO> vwhitenoise = makeWhiteNoiseParamInfos( "y", "V" );
360 static std::vector<PARAM::INFO> iwhitenoise = makeWhiteNoiseParamInfos( "y", "A" );
361
362 static std::vector<PARAM::INFO> vpinknoise = makePinkNoiseParamInfos( "y", "V" );
363 static std::vector<PARAM::INFO> ipinknoise = makePinkNoiseParamInfos( "y", "A" );
364
365 static std::vector<PARAM::INFO> vburstnoise = makeBurstNoiseParamInfos( "y", "V" );
366 static std::vector<PARAM::INFO> iburstnoise = makeBurstNoiseParamInfos( "y", "A" );
367
368 static std::vector<PARAM::INFO> vrandomuniform = makeRandomUniformParamInfos( "y", "V" );
369 static std::vector<PARAM::INFO> irandomuniform = makeRandomUniformParamInfos( "y", "A" );
370
371 static std::vector<PARAM::INFO> vrandomnormal = makeRandomNormalParamInfos( "y", "V" );
372 static std::vector<PARAM::INFO> irandomnormal = makeRandomNormalParamInfos( "y", "A" );
373
374 static std::vector<PARAM::INFO> vrandomexp = makeRandomExpParamInfos( "y", "V" );
375 static std::vector<PARAM::INFO> irandomexp = makeRandomExpParamInfos( "y", "A" );
376
377 static std::vector<PARAM::INFO> vrandompoisson = makeRandomPoissonParamInfos( "y", "V" );
378 static std::vector<PARAM::INFO> irandompoisson = makeRandomPoissonParamInfos( "y", "A" );
379
380 switch( aType )
381 {
382 case TYPE::V: return vdc;
383 case TYPE::I: return idc;
384 case TYPE::V_SIN: return vsin;
385 case TYPE::I_SIN: return isin;
386 case TYPE::V_PULSE: return vpulse;
387 case TYPE::I_PULSE: return ipulse;
388 case TYPE::V_EXP: return vexp;
389 case TYPE::I_EXP: return iexp;
390 case TYPE::V_AM: return vam;
391 case TYPE::I_AM: return iam;
392 case TYPE::V_SFFM: return vsffm;
393 case TYPE::I_SFFM: return isffm;
394 case TYPE::V_VCL: return vcvs;
395 case TYPE::V_CCL: return ccvs;
396 case TYPE::V_PWL: return vpwl;
397 case TYPE::I_VCL: return vccs;
398 case TYPE::I_CCL: return cccs;
399 case TYPE::I_PWL: return ipwl;
400 case TYPE::V_WHITENOISE: return vwhitenoise;
401 case TYPE::I_WHITENOISE: return iwhitenoise;
402 case TYPE::V_PINKNOISE: return vpinknoise;
403 case TYPE::I_PINKNOISE: return ipinknoise;
404 case TYPE::V_BURSTNOISE: return vburstnoise;
405 case TYPE::I_BURSTNOISE: return iburstnoise;
406 case TYPE::V_RANDUNIFORM: return vrandomuniform;
407 case TYPE::I_RANDUNIFORM: return irandomuniform;
408 case TYPE::V_RANDGAUSSIAN: return vrandomnormal;
409 case TYPE::I_RANDGAUSSIAN: return irandomnormal;
410 case TYPE::V_RANDEXP: return vrandomexp;
411 case TYPE::I_RANDEXP: return irandomexp;
412 case TYPE::V_RANDPOISSON: return vrandompoisson;
413 case TYPE::I_RANDPOISSON: return irandompoisson;
414 default:
415 wxFAIL_MSG( "Unhandled SIM_MODEL type in SIM_MODEL_SOURCE" );
416 static std::vector<SIM_MODEL::PARAM::INFO> empty;
417 return empty;
418 }
419}
420
421
422std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeDcParamInfos( 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 = "0";
433 paramInfo.description = "DC value";
434 paramInfos.push_back( paramInfo );
435
436 appendAcParamInfos( paramInfos, aUnit );
437 appendSpParamInfos( paramInfos, aUnit );
438 return paramInfos;
439}
440
441
442std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSinParamInfos( const std::string& aPrefix,
443 const std::string& aUnit )
444{
445 std::vector<PARAM::INFO> paramInfos;
446 PARAM::INFO paramInfo;
447
448 paramInfo.name = "dc";
449 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
450 paramInfo.unit = aUnit;
452 paramInfo.defaultValue = "";
453 paramInfo.description = "DC offset";
454 paramInfos.push_back( paramInfo );
455
456 paramInfo.name = "ampl";
457 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
458 paramInfo.unit = aUnit;
460 paramInfo.defaultValue = "";
461 paramInfo.description = "Amplitude";
462 paramInfos.push_back( paramInfo );
463
464 paramInfo.name = "f";
465 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
466 paramInfo.unit = "Hz";
468 paramInfo.defaultValue = "1/tstop";
469 paramInfo.description = "Frequency";
470 paramInfos.push_back( paramInfo );
471
472 paramInfo.name = "td";
473 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
474 paramInfo.unit = "s";
476 paramInfo.defaultValue = "0";
477 paramInfo.description = "Delay";
478 paramInfos.push_back( paramInfo );
479
480 paramInfo.name = "theta";
481 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
482 paramInfo.unit = "1/s";
484 paramInfo.defaultValue = "0";
485 paramInfo.description = "Damping factor";
486 paramInfos.push_back( paramInfo );
487
488 paramInfo.name = "phase";
489 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
490 paramInfo.unit = "°";
492 paramInfo.defaultValue = "0";
493 paramInfo.description = "Phase";
494 paramInfos.push_back( paramInfo );
495
496 appendAcParamInfos( paramInfos, aUnit );
497 appendSpParamInfos( paramInfos, aUnit );
498 return paramInfos;
499}
500
501
502std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePulseParamInfos( const std::string& aPrefix,
503 const std::string& aUnit )
504{
505 std::vector<PARAM::INFO> paramInfos;
506 PARAM::INFO paramInfo;
507
508 paramInfo.name = aPrefix + "1";
509 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
510 paramInfo.unit = aUnit;
512 paramInfo.defaultValue = "";
513 paramInfo.description = "Initial value";
514 paramInfos.push_back( paramInfo );
515
516 paramInfo.name = aPrefix + "2";
517 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
518 paramInfo.unit = aUnit;
520 paramInfo.defaultValue = "";
521 paramInfo.description = "Pulsed value";
522 paramInfos.push_back( paramInfo );
523
524 paramInfo.name = "td";
525 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
526 paramInfo.unit = "s";
528 paramInfo.defaultValue = "0";
529 paramInfo.description = "Delay";
530 paramInfos.push_back( paramInfo );
531
532 paramInfo.name = "tr";
533 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
534 paramInfo.unit = "s";
536 paramInfo.defaultValue = "tstep";
537 paramInfo.description = "Rise time";
538 paramInfos.push_back( paramInfo );
539
540 paramInfo.name = "tf";
541 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
542 paramInfo.unit = "s";
544 paramInfo.defaultValue = "tstep";
545 paramInfo.description = "Fall time";
546 paramInfos.push_back( paramInfo );
547
548 paramInfo.name = "tw"; // Ngspice calls it "pw".
549 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
550 paramInfo.unit = "s";
552 paramInfo.defaultValue = "tstop";
553 paramInfo.description = "Pulse width";
554 paramInfos.push_back( paramInfo );
555
556 paramInfo.name = "per";
557 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
558 paramInfo.unit = "s";
560 paramInfo.defaultValue = "tstop";
561 paramInfo.description = "Period";
562 paramInfos.push_back( paramInfo );
563
564 paramInfo.name = "np";
565 paramInfo.type = SIM_VALUE::TYPE_INT;
566 paramInfo.unit = "";
568 paramInfo.defaultValue = "";
569 paramInfo.description = "Number of pulses";
570 paramInfos.push_back( paramInfo );
571
572 appendAcParamInfos( paramInfos, aUnit );
573 appendSpParamInfos( paramInfos, aUnit );
574 return paramInfos;
575}
576
577
578std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeExpParamInfos( const std::string& aPrefix,
579 const std::string& aUnit )
580{
581 std::vector<PARAM::INFO> paramInfos;
582 PARAM::INFO paramInfo;
583
584 paramInfo.name = aPrefix + "1";
585 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
586 paramInfo.unit = aUnit;
588 paramInfo.defaultValue = "";
589 paramInfo.description = "Initial value";
590 paramInfos.push_back( paramInfo );
591
592 paramInfo.name = aPrefix + "2";
593 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
594 paramInfo.unit = aUnit;
596 paramInfo.defaultValue = "";
597 paramInfo.description = "Pulsed value";
598 paramInfos.push_back( paramInfo );
599
600 paramInfo.name = "td1";
601 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
602 paramInfo.unit = "s";
604 paramInfo.defaultValue = "0";
605 paramInfo.description = "Rise delay time";
606 paramInfos.push_back( paramInfo );
607
608 paramInfo.name = "tau1";
609 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
610 paramInfo.unit = "s";
612 paramInfo.defaultValue = "tstep";
613 paramInfo.description = "Rise time constant";
614 paramInfos.push_back( paramInfo );
615
616 paramInfo.name = "td2";
617 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
618 paramInfo.unit = "s";
620 paramInfo.defaultValue = "td1+tstep";
621 paramInfo.description = "Fall delay time";
622 paramInfos.push_back( paramInfo );
623
624 paramInfo.name = "tau2";
625 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
626 paramInfo.unit = "s";
628 paramInfo.defaultValue = "tstep";
629 paramInfo.description = "Fall time constant";
630 paramInfos.push_back( paramInfo );
631
632 appendAcParamInfos( paramInfos, aUnit );
633 appendSpParamInfos( paramInfos, aUnit );
634 return paramInfos;
635}
636
637
638std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeAMParamInfos( const std::string& aPrefix,
639 const std::string& aUnit )
640{
641 std::vector<PARAM::INFO> paramInfos;
642 PARAM::INFO paramInfo;
643
644 paramInfo.name = "vo";
645 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
646 paramInfo.unit = aUnit;
648 paramInfo.defaultValue = "";
649 paramInfo.description = "Overall offset";
650 paramInfos.push_back( paramInfo );
651
652 paramInfo.name = "vmo";
653 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
654 paramInfo.unit = aUnit;
656 paramInfo.defaultValue = "";
657 paramInfo.description = "Modulation signal offset";
658 paramInfos.push_back( paramInfo );
659
660 paramInfo.name = "vma";
661 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
662 paramInfo.unit = aUnit;
664 paramInfo.defaultValue = "";
665 paramInfo.description = "Modulation signal amplitude";
666 paramInfos.push_back( paramInfo );
667
668 paramInfo.name = "fm";
669 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
670 paramInfo.unit = "Hz";
672 paramInfo.defaultValue = "5/tstop";
673 paramInfo.description = "Modulation signal frequency";
674 paramInfos.push_back( paramInfo );
675
676 paramInfo.name = "fc";
677 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
678 paramInfo.unit = "Hz";
680 paramInfo.defaultValue = "500/tstop";
681 paramInfo.description = "Carrier signal frequency";
682 paramInfos.push_back( paramInfo );
683
684 paramInfo.name = "td";
685 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
686 paramInfo.unit = "s";
688 paramInfo.defaultValue = "0";
689 paramInfo.description = "Overall delay";
690 paramInfos.push_back( paramInfo );
691
692 paramInfo.name = "phasem";
693 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
694 paramInfo.unit = "°";
696 paramInfo.defaultValue = "0";
697 paramInfo.description = "Modulation signal phase";
698 paramInfos.push_back( paramInfo );
699
700 paramInfo.name = "phasec";
701 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
702 paramInfo.unit = "°";
704 paramInfo.defaultValue = "0";
705 paramInfo.description = "Carrier signal phase";
706 paramInfos.push_back( paramInfo );
707
708 appendAcParamInfos( paramInfos, aUnit );
709 appendSpParamInfos( paramInfos, aUnit );
710 return paramInfos;
711}
712
713
714std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeSFFMParamInfos( const std::string& aPrefix,
715 const std::string& aUnit )
716{
717 std::vector<PARAM::INFO> paramInfos;
718 PARAM::INFO paramInfo;
719
720 paramInfo.name = "vo";
721 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
722 paramInfo.unit = aUnit;
724 paramInfo.defaultValue = "";
725 paramInfo.description = "DC offset";
726 paramInfos.push_back( paramInfo );
727
728 paramInfo.name = "va";
729 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
730 paramInfo.unit = aUnit;
732 paramInfo.defaultValue = "";
733 paramInfo.description = "Amplitude";
734 paramInfos.push_back( paramInfo );
735
736 paramInfo.name = "fm";
737 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
738 paramInfo.unit = "Hz";
740 paramInfo.defaultValue = "5/tstop";
741 paramInfo.description = "Modulating frequency";
742 paramInfos.push_back( paramInfo );
743
744 paramInfo.name = "mdi";
745 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
746 paramInfo.unit = "";
748 paramInfo.defaultValue = "";
749 paramInfo.description = "Modulation index";
750 paramInfos.push_back( paramInfo );
751
752 paramInfo.name = "fc";
753 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
754 paramInfo.unit = "Hz";
756 paramInfo.defaultValue = "500/tstop";
757 paramInfo.description = "Carrier frequency";
758 paramInfos.push_back( paramInfo );
759
760 paramInfo.name = "phasem";
761 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
762 paramInfo.unit = "°";
764 paramInfo.defaultValue = "0";
765 paramInfo.description = "Modulating signal phase";
766 paramInfos.push_back( paramInfo );
767
768 paramInfo.name = "phasec";
769 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
770 paramInfo.unit = "°";
772 paramInfo.defaultValue = "0";
773 paramInfo.description = "Carrier signal phase";
774 paramInfos.push_back( paramInfo );
775
776 appendAcParamInfos( paramInfos, aUnit );
777 appendSpParamInfos( paramInfos, aUnit );
778 return paramInfos;
779}
780
781
782std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeCcParamInfos( const std::string& aGainUnit )
783{
784 std::vector<PARAM::INFO> paramInfos;
785 PARAM::INFO paramInfo;
786
787 paramInfo.name = "gain";
788 paramInfo.id = 1;
789 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
790 paramInfo.unit = aGainUnit;
791 paramInfo.description = "Gain";
792 paramInfos.push_back( paramInfo );
793
794 paramInfo.name = "control";
795 paramInfo.id = 2;
796 paramInfo.type = SIM_VALUE::TYPE_STRING;
797 paramInfo.unit = "";
798 paramInfo.description = "Controlling voltage source";
799 paramInfos.push_back( paramInfo );
800
801 return paramInfos;
802}
803
804
805std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeVcParamInfos( const std::string& aGainUnit )
806{
807 std::vector<PARAM::INFO> paramInfos;
808 PARAM::INFO paramInfo;
809
810 paramInfo.name = "gain";
811 paramInfo.id = 1;
812 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
813 paramInfo.unit = aGainUnit;
814 paramInfo.description = "Gain";
815 paramInfos.push_back( paramInfo );
816
817 return paramInfos;
818}
819
820
821std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePwlParamInfos( const std::string& aPrefix,
822 const std::string& aQuantity,
823 const std::string& aUnit )
824{
825 std::vector<PARAM::INFO> paramInfos;
826 PARAM::INFO paramInfo;
827
828 paramInfo.name = "pwl";
829 paramInfo.type = SIM_VALUE::TYPE_STRING;
830 paramInfo.unit = "s," + aUnit;
832 paramInfo.defaultValue = "";
833 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
834 paramInfos.push_back( paramInfo );
835
836 // TODO: Ngspice doesn't support "td" and "r" for current sources, so let's disable that for
837 // now.
838
839 /*paramInfo.name = "td";
840 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
841 paramInfo.unit = "s";
842 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
843 paramInfo.defaultValue = "0";
844 paramInfo.description = aUnit == "V" ? "Time-voltage points" : "Time-current points";
845 paramInfo.isSpiceInstanceParam = true;
846 paramInfos.push_back( paramInfo );
847
848 paramInfo.name = "repeat";
849 paramInfo.type = SIM_VALUE::TYPE_BOOL;
850 paramInfo.unit = "";
851 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
852 paramInfo.defaultValue = "0";
853 paramInfo.description = "Repeat forever";
854 paramInfo.isSpiceInstanceParam = true;
855 paramInfo.spiceInstanceName = "r";
856 paramInfos.push_back( paramInfo );*/
857
858 /*paramInfo.name = "t";
859 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
860 paramInfo.unit = "s";
861 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
862 paramInfo.defaultValue = "";
863 paramInfo.description = "Time vector";
864 paramInfos.push_back( paramInfo );
865
866 paramInfo.name = aPrefix;
867 paramInfo.type = SIM_VALUE::TYPE_FLOAT_VECTOR;
868 paramInfo.unit = aUnit;
869 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
870 paramInfo.defaultValue = "";
871 paramInfo.description = aQuantity + " vector";
872 paramInfos.push_back( paramInfo );
873
874 paramInfo.name = "repeat";
875 paramInfo.type = SIM_VALUE::TYPE_BOOL;
876 paramInfo.unit = "";
877 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
878 paramInfo.defaultValue = "";
879 paramInfo.description = "Repeat forever";
880 paramInfos.push_back( paramInfo );
881
882 paramInfo.name = "td";
883 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
884 paramInfo.unit = "s";
885 paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
886 paramInfo.defaultValue = "0";
887 paramInfo.description = "Delay";
888 paramInfos.push_back( paramInfo );*/
889
890 appendAcParamInfos( paramInfos, aUnit );
891 appendSpParamInfos( paramInfos, aUnit );
892 return paramInfos;
893}
894
895
896std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeWhiteNoiseParamInfos( const std::string& aPrefix,
897 const std::string& aUnit )
898{
899 std::vector<PARAM::INFO> paramInfos;
900 PARAM::INFO paramInfo;
901
902 paramInfo.name = "rms";
903 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
904 paramInfo.unit = aUnit;
906 paramInfo.defaultValue = "0";
907 paramInfo.description = "White noise RMS amplitude";
908 paramInfos.push_back( paramInfo );
909
910 paramInfo.name = "dt";
911 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
912 paramInfo.unit = "s";
914 paramInfo.defaultValue = "0";
915 paramInfo.description = "Time step";
916 paramInfos.push_back( paramInfo );
917
918 appendAcParamInfos( paramInfos, aUnit );
919 appendSpParamInfos( paramInfos, aUnit );
920 return paramInfos;
921}
922
923
924std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makePinkNoiseParamInfos( const std::string& aPrefix,
925 const std::string& aUnit )
926{
927 std::vector<PARAM::INFO> paramInfos;
928 PARAM::INFO paramInfo;
929
930 paramInfo.name = "rms";
931 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
932 paramInfo.unit = "";
934 paramInfo.defaultValue = "0";
935 paramInfo.description = "1/f noise RMS amplitude";
936 paramInfos.push_back( paramInfo );
937
938 paramInfo.name = "slope";
939 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
940 paramInfo.unit = "";
942 paramInfo.defaultValue = "1";
943 paramInfo.description = "1/f noise exponent";
944 paramInfos.push_back( paramInfo );
945
946 paramInfo.name = "dt";
947 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
948 paramInfo.unit = "s";
950 paramInfo.defaultValue = "0";
951 paramInfo.description = "Time step";
952 paramInfos.push_back( paramInfo );
953
954 appendAcParamInfos( paramInfos, aUnit );
955 appendSpParamInfos( paramInfos, aUnit );
956 return paramInfos;
957}
958
959
960std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeBurstNoiseParamInfos( const std::string& aPrefix,
961 const std::string& aUnit )
962{
963 std::vector<PARAM::INFO> paramInfos;
964 PARAM::INFO paramInfo;
965
966 paramInfo.name = "ampl";
967 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
968 paramInfo.unit = aUnit;
970 paramInfo.defaultValue = "0";
971 paramInfo.description = "Burst noise amplitude";
972 paramInfos.push_back( paramInfo );
973
974 paramInfo.name = "tcapt";
975 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
976 paramInfo.unit = "s";
978 paramInfo.defaultValue = "0";
979 paramInfo.description = "Burst noise trap capture time";
980 paramInfos.push_back( paramInfo );
981
982 paramInfo.name = "temit";
983 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
984 paramInfo.unit = "s";
986 paramInfo.defaultValue = "0";
987 paramInfo.description = "Burst noise trap emission time";
988 paramInfos.push_back( paramInfo );
989
990 appendAcParamInfos( paramInfos, aUnit );
991 appendSpParamInfos( paramInfos, aUnit );
992 return paramInfos;
993}
994
995
996std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomUniformParamInfos( const std::string& aPrefix,
997 const std::string& aUnit )
998{
999 std::vector<PARAM::INFO> paramInfos;
1000 PARAM::INFO paramInfo;
1001
1002 paramInfo.name = "ts";
1003 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1004 paramInfo.unit = "s";
1006 paramInfo.defaultValue = "";
1007 paramInfo.description = "Individual voltage duration";
1008 paramInfos.push_back( paramInfo );
1009
1010 paramInfo.name = "td";
1011 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1012 paramInfo.unit = "s";
1014 paramInfo.defaultValue = "0";
1015 paramInfo.description = "Delay";
1016 paramInfos.push_back( paramInfo );
1017
1018 paramInfo.name = "range";
1019 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1020 paramInfo.unit = aUnit;
1022 paramInfo.defaultValue = "1";
1023 paramInfo.description = "Range";
1024 paramInfos.push_back( paramInfo );
1025
1026 paramInfo.name = "offset";
1027 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1028 paramInfo.unit = aUnit;
1030 paramInfo.defaultValue = "0";
1031 paramInfo.description = "Offset";
1032 paramInfos.push_back( paramInfo );
1033
1034 appendAcParamInfos( paramInfos, aUnit );
1035 appendSpParamInfos( paramInfos, aUnit );
1036 return paramInfos;
1037}
1038
1039
1040std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomNormalParamInfos( const std::string& aPrefix,
1041 const std::string& aUnit )
1042{
1043 std::vector<PARAM::INFO> paramInfos;
1044 PARAM::INFO paramInfo;
1045
1046 paramInfo.name = "ts";
1047 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1048 paramInfo.unit = "s";
1050 paramInfo.defaultValue = "";
1051 paramInfo.description = "Individual voltage duration";
1052 paramInfos.push_back( paramInfo );
1053
1054 paramInfo.name = "td";
1055 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1056 paramInfo.unit = "s";
1058 paramInfo.defaultValue = "0";
1059 paramInfo.description = "Delay";
1060 paramInfos.push_back( paramInfo );
1061
1062 paramInfo.name = "stddev";
1063 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1064 paramInfo.unit = aUnit;
1066 paramInfo.defaultValue = "1";
1067 paramInfo.description = "Standard deviation";
1068 paramInfos.push_back( paramInfo );
1069
1070 paramInfo.name = "mean";
1071 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1072 paramInfo.unit = aUnit;
1074 paramInfo.defaultValue = "0";
1075 paramInfo.description = "Mean";
1076 paramInfos.push_back( paramInfo );
1077
1078 appendAcParamInfos( paramInfos, aUnit );
1079 appendSpParamInfos( paramInfos, aUnit );
1080 return paramInfos;
1081}
1082
1083
1084std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomExpParamInfos( const std::string& aPrefix,
1085 const std::string& aUnit )
1086{
1087 std::vector<PARAM::INFO> paramInfos;
1088 PARAM::INFO paramInfo;
1089
1090 paramInfo.name = "ts";
1091 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1092 paramInfo.unit = "s";
1094 paramInfo.defaultValue = "";
1095 paramInfo.description = "Individual voltage duration";
1096 paramInfos.push_back( paramInfo );
1097
1098 paramInfo.name = "td";
1099 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1100 paramInfo.unit = "s";
1102 paramInfo.defaultValue = "0";
1103 paramInfo.description = "Delay";
1104 paramInfos.push_back( paramInfo );
1105
1106 paramInfo.name = "mean";
1107 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1108 paramInfo.unit = aUnit;
1110 paramInfo.defaultValue = "1";
1111 paramInfo.description = "Mean";
1112 paramInfos.push_back( paramInfo );
1113
1114 paramInfo.name = "offset";
1115 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1116 paramInfo.unit = aUnit;
1118 paramInfo.defaultValue = "0";
1119 paramInfo.description = "Offset";
1120 paramInfos.push_back( paramInfo );
1121
1122 appendAcParamInfos( paramInfos, aUnit );
1123 appendSpParamInfos( paramInfos, aUnit );
1124 return paramInfos;
1125}
1126
1127
1128std::vector<SIM_MODEL::PARAM::INFO> SIM_MODEL_SOURCE::makeRandomPoissonParamInfos( const std::string& aPrefix,
1129 const std::string& aUnit )
1130{
1131 std::vector<PARAM::INFO> paramInfos;
1132 PARAM::INFO paramInfo;
1133
1134 paramInfo.name = "ts";
1135 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1136 paramInfo.unit = "s";
1138 paramInfo.defaultValue = "";
1139 paramInfo.description = "Individual voltage duration";
1140 paramInfos.push_back( paramInfo );
1141
1142 paramInfo.name = "td";
1143 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1144 paramInfo.unit = "s";
1146 paramInfo.defaultValue = "0";
1147 paramInfo.description = "Delay";
1148 paramInfos.push_back( paramInfo );
1149
1150 paramInfo.name = "lambda";
1151 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1152 paramInfo.unit = aUnit;
1154 paramInfo.defaultValue = "1";
1155 paramInfo.description = "Lambda";
1156 paramInfos.push_back( paramInfo );
1157
1158 paramInfo.name = "offset";
1159 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1160 paramInfo.unit = aUnit;
1162 paramInfo.defaultValue = "0";
1163 paramInfo.description = "Offset";
1164 paramInfos.push_back( paramInfo );
1165
1166 appendAcParamInfos( paramInfos, aUnit );
1167 appendSpParamInfos( paramInfos, aUnit );
1168 return paramInfos;
1169}
1170
1171void SIM_MODEL_SOURCE::appendAcParamInfos( std::vector<PARAM::INFO>& aParamInfos, const std::string& aUnit )
1172{
1173 PARAM::INFO paramInfo;
1174
1175 paramInfo.name = "ac";
1176 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1177 paramInfo.unit = aUnit;
1179 paramInfo.defaultValue = "0";
1180 paramInfo.description = "AC magnitude";
1181 aParamInfos.push_back( paramInfo );
1182
1183 paramInfo.name = "ph";
1184 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1185 paramInfo.unit = "°";
1187 paramInfo.defaultValue = "0";
1188 paramInfo.description = "AC phase";
1189 aParamInfos.push_back( paramInfo );
1190}
1191
1192void SIM_MODEL_SOURCE::appendSpParamInfos( std::vector<PARAM::INFO>& aParamInfos,
1193 const std::string& aUnit )
1194{
1195 PARAM::INFO paramInfo;
1196
1197 if( !strcmp( aUnit.c_str(), "V" ) )
1198 {
1199 paramInfo.name = "portnum";
1200 paramInfo.type = SIM_VALUE::TYPE_INT;
1201 paramInfo.unit = "";
1203 paramInfo.defaultValue = "";
1204 paramInfo.description = "Port number";
1205 aParamInfos.push_back( paramInfo );
1206
1207 paramInfo.name = "z0";
1208 paramInfo.type = SIM_VALUE::TYPE_FLOAT;
1209 paramInfo.unit = "Ohm";
1211 paramInfo.defaultValue = "";
1212 paramInfo.description = "Internal impedance";
1213 aParamInfos.push_back( paramInfo );
1214 }
1215}
1216
1217
1218std::vector<std::string> SIM_MODEL_SOURCE::GetPinNames() const
1219{
1220 if( GetDeviceType() == SIM_MODEL::DEVICE_T::E || GetDeviceType() == SIM_MODEL::DEVICE_T::G )
1221 return { "+", "-", "C+", "C-" };
1222 else
1223 return { "+", "-" };
1224}
1225
1227{
1228 switch( GetType() )
1229 {
1230 case SIM_MODEL::TYPE::V: // VDC/IDC: it is clear which parameter should be used
1231 case SIM_MODEL::TYPE::I: return &GetParam( 0 ); break;
1232 default: break; // other sources: unclear which parameter the user wants
1233 }
1234 return nullptr;
1235}
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
const PARAM * GetTunerParam() 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:729
const SPICE_GENERATOR & SpiceGenerator() const
Definition: sim_model.h:435
virtual const PARAM & GetParam(unsigned aParamIndex) const
Definition: sim_model.cpp:789
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:816
virtual void doSetParamValue(int aParamIndex, const std::string &aValue)
Definition: sim_model.cpp:839
std::vector< PARAM > m_params
Definition: sim_model.h:538
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
Definition: sim_model.cpp:845
SPICE_INFO GetSpiceInfo() const
Definition: sim_model.h:452
TYPE GetType() const
Definition: sim_model.h:464
@ TYPE_INT
Definition: sim_value.h:68
@ TYPE_FLOAT
Definition: sim_value.h:69
@ TYPE_STRING
Definition: sim_value.h:71
static std::string ToSpice(const std::string &aString)
Definition: sim_value.cpp:419
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::string ItemLine(const SPICE_ITEM &aItem) const override
std::string TunerCommand(const SPICE_ITEM &aItem, double aValue) const override
std::string getParamValueString(const std::string &aParamName, const std::string &aDefaultValue) const
virtual std::string ItemName(const SPICE_ITEM &aItem) 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:57
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
const SIM_MODEL * model