1 #ifndef _NLNMOS_HPP_INC_
2 #define _NLNMOS_HPP_INC_
41 const size_t currentSolutionIndex, T timestep = 0)
const {
42 const size_t gp =
g - 1;
43 const size_t dp =
d - 1;
44 const size_t sp =
s - 1;
50 u_gs = solutionMatrix(gp, currentSolutionIndex);
51 u_gd = solutionMatrix(gp, currentSolutionIndex);
55 u_gs -= solutionMatrix(sp, currentSolutionIndex);
59 u_gd -= solutionMatrix(dp, currentSolutionIndex);
70 std::pow(std::cosh(
alpha_DS * (u_gs - u_gd)), 2);
72 std::pow(std::cosh(
alpha_DS * (u_gs - u_gd)), 2);
85 2.0 * C_GD / timestep;
88 2.0 * C_GS / timestep;
90 T g_dd = -di_gd + di_ds_d;
95 T g_ss = -di_gs - di_ds_s;
98 T I_d = i_d - g_dd * u_gd - g_ds * u_gs;
99 T I_s = i_s - g_sd * u_gd - g_ss * u_gs;
100 T I_g = i_g - g_gd * u_gd - g_gs * u_gs;
103 stamp.
G(dp, dp) += -g_dd;
104 stamp.
s(dp, 0) += -I_d;
107 stamp.
G(dp, sp) += -g_ds;
111 stamp.
G(dp, gp) += g_dd + g_ds;
116 stamp.
G(sp, sp) += -g_ss;
117 stamp.
s(sp, 0) += -I_s;
120 stamp.
G(sp, dp) += -g_sd;
124 stamp.
G(sp, gp) += g_sd + g_ss;
129 stamp.
G(gp, gp) += g_gd + g_gs;
130 stamp.
s(gp, 0) += -I_g;
133 stamp.
G(gp, dp) += -g_gd;
137 stamp.
G(gp, sp) += -g_gs;
143 const size_t currentSolutionIndex, T timestep,
145 const size_t gp =
g - 1;
146 const size_t dp =
d - 1;
147 const size_t sp =
s - 1;
153 u_gs = solutionMatrix(gp, currentSolutionIndex);
154 u_gd = solutionMatrix(gp, currentSolutionIndex);
158 u_gs -= solutionMatrix(sp, currentSolutionIndex);
162 u_gd -= solutionMatrix(dp, currentSolutionIndex);
182 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
187 std::regex_match(line, matches, BJTRegex);
192 nmos.
d = std::stoi(matches.str(2));
193 nmos.
g = std::stoi(matches.str(3));
194 nmos.
s = std::stoi(matches.str(4));
196 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
197 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
198 numNodes = std::max(numNodes, std::stoull(matches.str(4)));
203 {{nmos.
d,
elements.nonLinearElements.back()},
204 {nmos.
g,
elements.nonLinearElements.back()},
205 {nmos.
s,
elements.nonLinearElements.back()}});
std::regex generateRegex(std::string indentifier, std::string simplifiedMatching, bool startAnchor=true, bool endAnchor=true)
a helper function to aid in the construction of regexes for parsing netlist files
common weighting for all matrix elements
a glorified container for the different types of components.
A template base class to define the fundamental things a component should define.
std::string designator
The designator as in the netlist for e.g.
A matrix class with support for LU-decomposition, and left division.
void addNonLinearStampTo(Stamp< T > &stamp, const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep=0) const
adds this component's non-linear stamp to the target stamp.
void updateStoredState(const Matrix< T > &solutionMatrix, const size_t currentSolutionIndex, T timestep, size_t sizeG_A)
Updates any stored state based on the current solution index.
static void addToElements(const std::string &line, CircuitElements< T > &elements, size_t &numNodes, size_t &numCurrents, size_t &numDCCurrents)
A helper struct to store the preallocated stamps for MNA.