KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_model_ngspice.h
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
25#ifndef SIM_MODEL_NGSPICE_H
26#define SIM_MODEL_NGSPICE_H
27
28#include <sim/sim_model_spice.h>
29#include <sim/spice_generator.h>
30
31
33{
34public:
35 using SPICE_GENERATOR_SPICE::SPICE_GENERATOR_SPICE;
36
37 std::vector<std::string> CurrentNames( const SPICE_ITEM& aItem ) const override;
38};
39
40
42{
43public:
45
46
47 SIM_MODEL_NGSPICE( TYPE aType );
48
49 void SetParamFromSpiceCode( const std::string& aParamName, const std::string& aValue,
50 SIM_VALUE_GRAMMAR::NOTATION aNotation ) override;
51
52 std::vector<std::string> GetPinNames() const override;
53
54 // Protected because it's accessed by QA tests.
55protected:
57 NONE,
58 //RESISTOR,
59 //CAPACITOR,
60 //INDUCTOR,
61 //LTRA,
62 //TRANLINE,
63 //URC,
64 //TRANSLINE,
65 //SWITCH,
66 //CSWITCH,
67 DIODE,
68 BJT,
69 VBIC,
70 HICUM2,
71 JFET,
72 JFET2,
73 MES,
74 MESA,
75 HFET1,
76 HFET2,
77 VDMOS,
78 MOS1,
79 MOS2,
80 MOS3,
81 BSIM1,
82 BSIM2,
83 MOS6,
84 BSIM3,
85 MOS9,
86 B4SOI,
87 BSIM4,
88 B3SOIFD,
89 B3SOIDD,
90 B3SOIPD,
91 HISIM2,
92 HISIMHV1,
93 HISIMHV2
94 )
95
96 struct MODEL_INFO
97 {
98 std::string name;
99 std::string variant1;
100 std::string variant2;
101 std::vector<std::string> pinNames;
102 std::string description;
103 std::vector<SIM_MODEL::PARAM::INFO> modelParams;
104 std::vector<SIM_MODEL::PARAM::INFO> instanceParams;
105 };
106
107 static const MODEL_INFO& ModelInfo( MODEL_TYPE aType );
108
109 int doFindParam( const std::string& aParamName ) const override;
110
111private:
112 bool canSilentlyIgnoreParam( const std::string& aParamName );
113
114 MODEL_TYPE getModelType() const;
115};
116
117
119{
120 using MODEL_TYPE = SIM_MODEL_NGSPICE::MODEL_TYPE;
121 using MODEL_INFO = SIM_MODEL_NGSPICE::MODEL_INFO;
122
123 std::unordered_map<MODEL_TYPE, MODEL_INFO> modelInfos;
124
126
127private:
128 void addBJT();
129 void addBSIM1();
130 void addBSIM2();
131 void addBSIM3();
132 void addBSIM4();
133 void addB3SOI();
134 void addB4SOI();
135 void addDIODE();
136 void addHFET();
137 void addHICUM2();
138 void addHSIM();
139 void addJFET();
140 void addMES();
141 void addMOS();
142 void addMOS6();
143 void addMOS9();
144 void addVBIC();
145};
146
147#endif /* SIM_MODEL_NGSPICE_H */
const char * name
Definition: DXF_plotter.cpp:57
bool canSilentlyIgnoreParam(const std::string &aParamName)
static const MODEL_INFO & ModelInfo(MODEL_TYPE aType)
std::vector< std::string > GetPinNames() const override
MODEL_TYPE getModelType() const
void SetParamFromSpiceCode(const std::string &aParamName, const std::string &aValue, SIM_VALUE_GRAMMAR::NOTATION aNotation) override
int doFindParam(const std::string &aParamName) const override
DEFINE_ENUM_CLASS_WITH_ITERATOR(MODEL_TYPE, NONE, DIODE, BJT, VBIC, HICUM2, JFET, JFET2, MES, MESA, HFET1, HFET2, VDMOS, MOS1, MOS2, MOS3, BSIM1, BSIM2, MOS6, BSIM3, MOS9, B4SOI, BSIM4, B3SOIFD, B3SOIDD, B3SOIPD, HISIM2, HISIMHV1, HISIMHV2) struct MODEL_INFO
std::vector< std::string > CurrentNames(const SPICE_ITEM &aItem) const override
@ NONE
Definition: kibis.h:54
SIM_MODEL::TYPE TYPE
Definition: sim_model.cpp:53
std::unordered_map< MODEL_TYPE, MODEL_INFO > modelInfos
SIM_MODEL_NGSPICE::MODEL_TYPE MODEL_TYPE
SIM_MODEL_NGSPICE::MODEL_INFO MODEL_INFO