1 #ifndef _DIODE_HPP_INC_
2 #define _DIODE_HPP_INC_
17 const T
V_T = 25.8563e-3;
25 const size_t currentSolutionIndex, T timestep = 0)
const {
26 const size_t n1p =
n1 - 1;
27 const size_t n2p =
n2 - 1;
32 v = solutionMatrix(n1p, currentSolutionIndex);
36 v -= solutionMatrix(n2p, currentSolutionIndex);
45 stamp.
G(n1p, n1p) += G_eq;
46 stamp.
s(n1p, 0) += -I_eq;
50 stamp.
G(n2p, n2p) += G_eq;
51 stamp.
s(n2p, 0) += +I_eq;
54 if (
n1 > 0 &&
n2 > 0) {
55 stamp.
G(n1p, n2p) += -G_eq;
56 stamp.
G(n2p, n1p) += -G_eq;
61 const size_t currentSolutionIndex, T timestep,
66 size_t numCurrents)
const {
72 size_t & numNodes,
size_t & numCurrents,
size_t & numDCCurrents) {
77 std::regex_match(line, matches, diodeRegex);
82 diode.
n1 = std::stoi(matches.str(2));
83 diode.
n2 = std::stoi(matches.str(3));
85 numNodes = std::max(numNodes, std::stoull(matches.str(2)));
86 numNodes = std::max(numNodes, std::stoull(matches.str(3)));
90 {{diode.
n1,
elements.nonLinearElements.back()},
91 {diode.
n2,
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.
An ebbers moll diode model.
static void addToElements(const std::string &line, CircuitElements< T > &elements, size_t &numNodes, size_t &numCurrents, size_t &numDCCurrents)
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.
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.
A matrix class with support for LU-decomposition, and left division.
A helper struct to store the preallocated stamps for MNA.