30 const size_t currentSolutionIndex, T timestep = 0)
const {
31 const size_t bp =
b - 1;
32 const size_t cp =
c - 1;
33 const size_t ep =
e - 1;
39 v_be = solutionMatrix(bp, currentSolutionIndex);
40 v_bc = solutionMatrix(bp, currentSolutionIndex);
44 v_be -= solutionMatrix(ep, currentSolutionIndex);
48 v_bc -= solutionMatrix(cp, currentSolutionIndex);
54 T i_e = -
I_es * (std::exp(v_be /
V_Te) - 1) +
65 T I_e = i_e + g_ee * v_be - g_ec * v_bc;
66 T I_c = i_c - g_ce * v_be + g_cc * v_bc;
69 stamp.
G(ep, ep) += g_ee;
70 stamp.
s(ep, 0) += -I_e;
73 stamp.
G(ep, cp) += -g_ec;
77 stamp.
G(ep, bp) += (g_ec - g_ee);
82 stamp.
G(cp, cp) += g_cc;
83 stamp.
s(cp, 0) += -I_c;
86 stamp.
G(cp, ep) += -g_ce;
90 stamp.
G(cp, bp) += (g_ce - g_cc);
95 stamp.
G(bp, bp) += g_cc + g_ee - g_ce - g_ec;
96 stamp.
s(bp, 0) += I_e + I_c;
99 stamp.
G(bp, ep) += g_ce - g_ee;
103 stamp.
G(bp, cp) += (g_ec - g_cc);
109 const size_t currentSolutionIndex, T timestep,
114 size_t numCurrents)
const {
120 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
125 std::regex_match(line, matches, BJTRegex);
130 bjt.
c = std::stoi(matches.str(2));
131 bjt.
b = std::stoi(matches.str(3));
132 bjt.
e = std::stoi(matches.str(4));
134 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
135 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
136 numNodes = std::max(numNodes, std::stoull(matches.str(4)));
139 elements.nonLinearElements.emplace_back(std::make_shared<
BJTN<T> >(bjt));
141 {{bjt.
b,
elements.nonLinearElements.back()},
142 {bjt.
c,
elements.nonLinearElements.back()},
143 {bjt.
e,
elements.nonLinearElements.back()}});
171 const size_t currentSolutionIndex, T timestep = 0)
const {
172 const size_t bp =
b - 1;
173 const size_t cp =
c - 1;
174 const size_t ep =
e - 1;
180 v_be = solutionMatrix(bp, currentSolutionIndex);
181 v_bc = solutionMatrix(bp, currentSolutionIndex);
185 v_be -= solutionMatrix(ep, currentSolutionIndex);
189 v_bc -= solutionMatrix(cp, currentSolutionIndex);
195 T i_F =
I_cs * (std::exp(-v_bc /
V_Tc) - 1);
196 T i_R =
I_es * (std::exp(-v_be /
V_Te) - 1);
211 T I_e = i_e - g_ee * v_be - g_ec * v_bc;
212 T I_c = i_c - g_ce * v_be - g_cc * v_bc;
213 T I_b = i_b - g_be * v_be - g_bc * v_bc;
216 stamp.
G(ep, ep) += -g_ee;
217 stamp.
s(ep, 0) += -I_e;
220 stamp.
G(ep, cp) += -g_ec;
224 stamp.
G(ep, bp) += g_ec + g_ee;
229 stamp.
G(cp, cp) += -g_cc;
230 stamp.
s(cp, 0) += -I_c;
233 stamp.
G(cp, ep) += -g_ce;
237 stamp.
G(cp, bp) += g_ce + g_cc;
242 stamp.
G(bp, bp) += g_be + g_bc;
243 stamp.
s(bp, 0) += -I_b;
246 stamp.
G(bp, ep) += -g_be;
250 stamp.
G(bp, cp) += -g_bc;
256 const size_t currentSolutionIndex, T timestep,
261 size_t numCurrents)
const {
267 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
272 std::regex_match(line, matches, BJTRegex);
277 bjt.
c = std::stoi(matches.str(2));
278 bjt.
b = std::stoi(matches.str(3));
279 bjt.
e = std::stoi(matches.str(4));
281 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
282 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
283 numNodes = std::max(numNodes, std::stoull(matches.str(4)));
286 elements.nonLinearElements.emplace_back(std::make_shared<
BJTP<T> >(bjt));
288 {{bjt.
b,
elements.nonLinearElements.back()},
289 {bjt.
c,
elements.nonLinearElements.back()},
290 {bjt.
e,
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
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)
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 addDCAnalysisStampTo(Stamp< T > &stamp, const Matrix< T > &solutionVector, size_t numCurrents) const
adds this component's DC stamp to the target stamp.
void addDCAnalysisStampTo(Stamp< T > &stamp, const Matrix< T > &solutionVector, size_t numCurrents) const
adds this component's DC stamp to the target stamp.
static void addToElements(const std::string &line, CircuitElements< T > &elements, size_t &numNodes, size_t &numCurrents, size_t &numDCCurrents)
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.
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.
A helper struct to store the preallocated stamps for MNA.