42 SPDLOG_LOGGER_INFO(
mSLog,
43 "\n--- Initialization from powerflow ---"
44 "\nVoltage across amplitude and phase: \n{:s}"
45 "\nCurrent amplitude and phase: \n{:s}"
46 "\nTerminal 0 voltage amplitude and phase: \n{:s}"
47 "\nTerminal 1 voltage amplitude and phase: \n{:s}"
48 "\n--- Initialization from powerflow finished ---",
93 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", conductance,
96 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", conductance,
99 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", -conductance,
101 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", -conductance,
111 attributeDependencies.push_back(leftVector);
126 (**mIntfVoltage)(0, 0) =
128 (**mIntfVoltage)(1, 0) =
130 (**mIntfVoltage)(2, 0) =
134 (**mIntfVoltage)(0, 0) =
137 (**mIntfVoltage)(1, 0) =
140 (**mIntfVoltage)(2, 0) =
145 SPDLOG_LOGGER_DEBUG(
mSLog,
"Voltage A: {} < {}",
153 SPDLOG_LOGGER_DEBUG(
mSLog,
"Current A: {} < {}",
AttributePointer< Attribute< T > > Ptr
const CPS::Attribute< Real >::Ptr mResistance
Resistance [ohm].
Resistor(CPS::AttributeList::Ptr attributeList)
SeriesResistor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
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 mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String phasorMatrixToString(const MatrixComp &mat)
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Attribute< Matrix >::Ptr mRightVector
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, 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
SimTerminal< Complex >::List mTerminals
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
MatrixComp initialVoltage(UInt index)
std::shared_ptr< SimPowerComp< VarType > > Ptr
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void updateMatrixNodeIndices()
void setTerminalNumber(UInt num)
std::vector< UInt > matrixNodeIndices(UInt index)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
static std::shared_ptr< SeriesResistor > 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).