9#include <dpsim-models/SP/SP_Ph1_Inductor.h>
22 auto copy = Inductor::make(name,
mLogLevel);
29 Real omega = 2 * PI * frequency;
31 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
34 SPDLOG_LOGGER_INFO(
mSLog,
35 "\nInductance [H]: {:s}"
36 "\nImpedance [Ohm]: {:s}",
39 SPDLOG_LOGGER_INFO(
mSLog,
40 "\n--- Initialization from powerflow ---"
41 "\nVoltage across: {:s}"
43 "\nTerminal 0 voltage: {:s}"
44 "\nTerminal 1 voltage: {:s}"
45 "\n--- Initialization from powerflow finished ---",
48 Logger::phasorToString(initialSingleVoltage(0)),
49 Logger::phasorToString(initialSingleVoltage(1)));
55 Attribute<Matrix>::Ptr leftVector) {
58 SPDLOG_LOGGER_INFO(
mSLog,
59 "\n--- MNA initialization ---"
60 "\nInitial voltage {:s}"
61 "\nInitial current {:s}"
62 "\n--- MNA initialization finished ---",
68 SparseMatrixRow &systemMatrix) {
69 MNAStampUtils::stampAdmittance(
mSusceptance, systemMatrix, matrixNodeIndex(0),
70 matrixNodeIndex(1), terminalNotGrounded(0),
71 terminalNotGrounded(1),
mSLog);
75 AttributeBase::List &prevStepDependencies,
76 AttributeBase::List &attributeDependencies,
77 AttributeBase::List &modifiedAttributes,
78 Attribute<Matrix>::Ptr &leftVector) {
79 attributeDependencies.push_back(leftVector);
85 Attribute<Matrix>::Ptr &leftVector) {
93 if (terminalNotGrounded(1)) {
94 (**mIntfVoltage)(0, 0) =
95 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1));
97 if (terminalNotGrounded(0)) {
98 (**mIntfVoltage)(0, 0) =
100 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0));
109void SP::Ph1::Inductor::mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) {
110 Math::addToMatrixElement(tearMatrix, mTearIdx, mTearIdx, 1. / mSusceptance);
const CPS::Attribute< Real >::Ptr mInductance
Inductance [H].
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
void mnaUpdateCurrent(const Matrix &leftVector) final
void mnaUpdateVoltage(const Matrix &leftVector) final
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)
Initializes internal variables of the component.
SimPowerComp< Complex >::Ptr clone(String name)
Returns a modified copy of the component with the given suffix added to the name and without.
Complex mSusceptance
susceptance [S]
void initializeFromNodesAndTerminals(Real frequency)
Initializes component from power flow data.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)
MNA post step operations.
void mnaCompUpdateCurrent(const Matrix &leftVector)
Update interface current from MNA system results.
Inductor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and log level.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)
Add MNA post step dependencies.
void mnaCompUpdateVoltage(const Matrix &leftVector)
Update interface voltage from MNA system results.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix)
Stamps system matrix.
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
void updateMatrixNodeIndices()
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.