DPsim
Loading...
Searching...
No Matches
MNAStampUtils.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace CPS {
8public:
9 static void stampConductance(Real conductance, SparseMatrixRow &mat,
10 UInt node1Index, UInt node2Index,
11 Bool isTerminal1NotGrounded,
12 Bool isTerminal2NotGrounded,
13 const Logger::Log &mSLog);
14
15 static void stampAdmittance(Complex admittance, SparseMatrixRow &mat,
16 UInt node1Index, UInt node2Index,
17 Bool isTerminal1NotGrounded,
18 Bool isTerminal2NotGrounded,
19 const Logger::Log &mSLog, Int maxFreq = 1,
20 Int freqIdx = 0);
21
24 static void stampAdmittance(const Matrix &admittance, SparseMatrixRow &mat,
25 UInt node1Index, UInt node2Index,
26 Bool isTerminal1NotGrounded,
27 Bool isTerminal2NotGrounded,
28 const Logger::Log &mSLog, Int maxFreq = 1,
29 Int freqIdx = 0);
30
31 static void stampConductanceMatrix(const Matrix &conductanceMat,
32 SparseMatrixRow &mat, UInt node1Index,
33 UInt node2Index,
34 Bool isTerminal1NotGrounded,
35 Bool isTerminal2NotGrounded,
36 const Logger::Log &mSLog);
37
39 const Matrix &conductanceMat, SparseMatrixRow &mat, UInt node1Index,
40 UInt node2Index, const Logger::Log &mSLog);
41
42 static void
44 SparseMatrixRow &mat, UInt nodeIndex,
45 const Logger::Log &mSLog);
46
47 static void stampAdmittanceMatrix(
48 const MatrixComp &admittanceMat, SparseMatrixRow &mat, UInt node1Index,
49 UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded,
50 const Logger::Log &mSLog, Int maxFreq = 1, Int freqIdx = 0);
51
54 static void stampAdmittanceMatrix(const Matrix &admittanceMat,
55 UInt phaseCount, SparseMatrixRow &mat,
56 UInt node1Index, UInt node2Index,
57 Bool isTerminal1NotGrounded,
58 Bool isTerminal2NotGrounded,
59 const Logger::Log &mSLog, Int maxFreq = 1,
60 Int freqIdx = 0);
61
64 Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index,
65 Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded,
66 const Logger::Log &mSLog);
67
70 Complex admittance, SparseMatrixRow &mat, UInt node1Index,
71 UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded,
72 const Logger::Log &mSLog, Int maxFreq = 1, Int freqIdx = 0);
73
74private:
75 template <typename T>
76 static void stampValue(T value, SparseMatrixRow &mat, UInt node1Index,
77 UInt node2Index, Bool isTerminal1NotGrounded,
78 Bool isTerminal2NotGrounded, Int maxFreq, Int freqIdx,
79 const Logger::Log &mSLog);
80
81 template <typename T>
82 static void stampMatrix(const MatrixVar<T> &matrix, SparseMatrixRow &mat,
83 UInt node1Index, UInt node2Index,
84 Bool isTerminal1NotGrounded,
85 Bool isTerminal2NotGrounded, Int maxFreq, Int freqIdx,
86 const Logger::Log &mSLog);
87
88 template <typename T>
89 static void stampMatrixBetween2Nodes(const MatrixVar<T> &matrix,
90 UInt sizeOfMatrix, SparseMatrixRow &mat,
91 UInt node1Index, UInt node2Index,
92 Int maxFreq, Int freqIdx,
93 const Logger::Log &mSLog);
94
95 template <typename T>
96 static void stampMatrixNodeToGround(const MatrixVar<T> &matrix,
97 UInt sizeOfMatrix, SparseMatrixRow &mat,
98 UInt nodeIndex, Int maxFreq, Int freqIdx,
99 const Logger::Log &mSLog);
100
101 template <typename T>
102 static void stampValueAsScalarMatrix(T value, UInt sizeOfScalarMatrix,
103 SparseMatrixRow &mat, UInt node1Index,
104 UInt node2Index,
105 Bool isTerminal1NotGrounded,
106 Bool isTerminal2NotGrounded, Int maxFreq,
107 Int freqIdx, const Logger::Log &mSLog);
108
109 template <typename T>
110 static void stampToMatrix(T value, SparseMatrixRow &mat, UInt row1,
111 UInt column1, UInt row2, UInt column2, Int maxFreq,
112 Int freqIdx, const Logger::Log &mSLog);
113
114 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
115 Matrix::Index column, Real value, Int maxFreq,
116 Int freqIdx, const Logger::Log &mSLog);
117
118 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
119 Matrix::Index column, Complex value,
120 Int maxFreq, Int freqIdx,
121 const Logger::Log &mSLog);
122
123 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
124 Matrix::Index column, const Matrix &value,
125 Int maxFreq, Int freqIdx,
126 const Logger::Log &mSLog);
127};
128} // namespace CPS
std::shared_ptr< spdlog::logger > Log
Definition Logger.h:34
static void stampConductanceAs3x3ScalarMatrix(Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
Stamps conductance as a 3x3 scalar matrix (a diagonal matrix, where all diagonal elements are equal t...
static void stampConductance(Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
static void stampAdmittanceMatrix(const MatrixComp &admittanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
static void stampAdmittanceAs3x3ScalarMatrix(Complex admittance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
Stamps admittance as a 3x3 scalar matrix (a diagonal matrix, where all diagonal elements are equal to...
static void stampAdmittance(Complex admittance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
static void stamp3x3ConductanceMatrixBetween2Nodes(const Matrix &conductanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, const Logger::Log &mSLog)
static void stampConductanceMatrix(const Matrix &conductanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
static void stamp3x3ConductanceMatrixNodeToGround(const Matrix &conductanceMat, SparseMatrixRow &mat, UInt nodeIndex, const Logger::Log &mSLog)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81
double Real
Definition Definitions.h:62
int Int
Definition Definitions.h:61
Eigen::Matrix< VarType, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixVar
Definition Definitions.h:97
std::complex< Real > Complex
Definition Definitions.h:63
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:84
bool Bool
Definition Definitions.h:64
unsigned int UInt
Definition Definitions.h:60
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74