56 "\n--- Initialization from powerflow ---"
57 "\nDP convention: phase-peak complex envelopes"
62 "\nTerminal 0 PF voltage converted to phase peak: {:s}"
63 "\nTerminal 1 PF voltage converted to phase peak: {:s}"
64 "\n--- Initialization from powerflow finished ---",
74 mConductance.real() = (**mResistance).inverse();
90 attributeDependencies.push_back(leftVector);
104 const Matrix::Index imaginaryOffset = leftVector.rows() / 2;
105 for (
UInt phase = 0; phase < 3; ++phase) {
107 if (terminal1Connected) {
110 Complex(leftVector(row, 0), leftVector(row + imaginaryOffset, 0));
112 if (terminal0Connected) {
115 Complex(leftVector(row, 0), leftVector(row + imaginaryOffset, 0));
117 (**mIntfVoltage)(phase, 0) = voltage;
120 SPDLOG_LOGGER_DEBUG(
mSLog,
"Voltage A: {} < {}",
130 for (
Int phase = 0; phase < 3; ++phase)
131 current(phase, 0) = mConductance(phase, 0) * voltage(0, 0) +
132 mConductance(phase, 1) * voltage(1, 0) +
133 mConductance(phase, 2) * voltage(2, 0);
135 SPDLOG_LOGGER_DEBUG(
mSLog,
"Current A: {} < {}",
145 for (
UInt row = 0; row < 3; ++row) {
146 for (
UInt col = 0; col < 3; ++col) {
AttributePointer< Attribute< T > > Ptr
const CPS::Attribute< Matrix >::Ptr mResistance
Resistance [ohm].
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
void mnaCompUpdateCurrent(const Matrix &leftVector) override
SimPowerComp< Complex >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
void initializeFromNodesAndTerminals(Real frequency) override
Initialize DP phase-peak envelopes from line-line RMS PF node voltages.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Resistor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String matrixCompToString(const MatrixComp &mat)
static String phasorToString(const Complex &num)
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Attribute< Matrix >::Ptr mRightVector
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 addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
std::shared_ptr< SimPowerComp< VarType > > Ptr
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void updateMatrixNodeIndices()
void setTerminalNumber(UInt num)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
static std::shared_ptr< Resistor > make(Args &&...args)
#define RMS3PH_TO_PEAK1PH
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).