31 Real omega = 2 *
PI * frequency;
52 SPDLOG_LOGGER_INFO(
mSLog,
53 "\nInductance [H]: {:s}"
54 "\nImpedance [Ohm]: {:s}",
59 "\n--- Initialization from powerflow ---"
60 "\nVoltage across: {:s}"
62 "\nTerminal 0 voltage: {:s}"
63 "\nTerminal 1 voltage: {:s}"
64 "\n--- Initialization from powerflow finished ---",
75 mEquivCond = timeStep / 2. * (**mInductance).inverse();
79 SPDLOG_LOGGER_INFO(
mSLog,
80 "\n--- MNA initialization ---"
81 "\nInitial voltage {:s}"
82 "\nInitial current {:s}"
83 "\nEquiv. current {:s}"
84 "\n--- MNA initialization finished ---",
97 SPDLOG_LOGGER_INFO(
mSLog,
"\nEquivalent Conductance: {:s}",
121 mSLog,
"\nEquivalent Current (mnaCompApplyRightSideVectorStamp): {:s}",
145 attributeDependencies.push_back(leftVector);
160 (**mIntfVoltage)(0, 0) =
162 (**mIntfVoltage)(1, 0) =
164 (**mIntfVoltage)(2, 0) =
168 (**mIntfVoltage)(0, 0) =
171 (**mIntfVoltage)(1, 0) =
174 (**mIntfVoltage)(2, 0) =
178 SPDLOG_LOGGER_DEBUG(
mSLog,
"\nUpdate Voltage: {:s}",
184 SPDLOG_LOGGER_DEBUG(
mSLog,
"\nUpdate Current: {:s}",
193 mEquivCond = timeStep / 2. * (**mInductance).inverse();
220 (**mIntfVoltage) = voltage.real();
AttributePointer< Attribute< T > > Ptr
const CPS::Attribute< Matrix >::Ptr mInductance
Inductance [H].
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
SimPowerComp< Real >::Ptr clone(String name) override
Returns a modified copy of the component with the given suffix added to the name and without.
Matrix mEquivCond
Equivalent conductance [S].
void mnaTearInitialize(Real omega, Real timestep) override
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
Stamps right side (source) vector.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
Matrix mEquivCurrent
DC equivalent current source [A].
void mnaTearApplyVoltageStamp(Matrix &voltageVector) override
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void mnaCompPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
void mnaTearPostStep(MatrixComp voltage, MatrixComp current) override
Inductor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, component parameters and logging level.
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String matrixCompToString(const MatrixComp &mat)
static String matrixToString(const Matrix &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 stampConductanceMatrix(const Matrix &conductanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
static Real realFromVectorElement(const Matrix &mat, Matrix::Index row)
static void setVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0, Matrix::Index colOffset=0)
static void addToVectorElement(Matrix &mat, Matrix::Index row, Complex value, 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< Real > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Real > >::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< Inductor > 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).