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 Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index,
55 Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded,
56 const Logger::Log &mSLog);
57
60 Complex admittance, SparseMatrixRow &mat, UInt node1Index,
61 UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded,
62 const Logger::Log &mSLog, Int maxFreq = 1, Int freqIdx = 0);
63
64private:
65 template <typename T>
66 static void stampValue(T value, SparseMatrixRow &mat, UInt node1Index,
67 UInt node2Index, Bool isTerminal1NotGrounded,
68 Bool isTerminal2NotGrounded, Int maxFreq, Int freqIdx,
69 const Logger::Log &mSLog);
70
71 template <typename T>
72 static void stampMatrix(const MatrixVar<T> &matrix, SparseMatrixRow &mat,
73 UInt node1Index, UInt node2Index,
74 Bool isTerminal1NotGrounded,
75 Bool isTerminal2NotGrounded, Int maxFreq, Int freqIdx,
76 const Logger::Log &mSLog);
77
78 template <typename T>
79 static void stampMatrixBetween2Nodes(const MatrixVar<T> &matrix,
80 UInt sizeOfMatrix, SparseMatrixRow &mat,
81 UInt node1Index, UInt node2Index,
82 Int maxFreq, Int freqIdx,
83 const Logger::Log &mSLog);
84
85 template <typename T>
86 static void stampMatrixNodeToGround(const MatrixVar<T> &matrix,
87 UInt sizeOfMatrix, SparseMatrixRow &mat,
88 UInt nodeIndex, Int maxFreq, Int freqIdx,
89 const Logger::Log &mSLog);
90
91 template <typename T>
92 static void stampValueAsScalarMatrix(T value, UInt sizeOfScalarMatrix,
93 SparseMatrixRow &mat, UInt node1Index,
94 UInt node2Index,
95 Bool isTerminal1NotGrounded,
96 Bool isTerminal2NotGrounded, Int maxFreq,
97 Int freqIdx, const Logger::Log &mSLog);
98
99 template <typename T>
100 static void stampToMatrix(T value, SparseMatrixRow &mat, UInt row1,
101 UInt column1, UInt row2, UInt column2, Int maxFreq,
102 Int freqIdx, const Logger::Log &mSLog);
103
104 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
105 Matrix::Index column, Real value, Int maxFreq,
106 Int freqIdx, const Logger::Log &mSLog);
107
108 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
109 Matrix::Index column, Complex value,
110 Int maxFreq, Int freqIdx,
111 const Logger::Log &mSLog);
112
113 static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row,
114 Matrix::Index column, const Matrix &value,
115 Int maxFreq, Int freqIdx,
116 const Logger::Log &mSLog);
117};
118} // 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