9 #include <dpsim-models/SP/SP_Ph1_Inductor.h>
22 auto copy = Inductor::make(name, mLogLevel);
23 copy->setParameters(**mInductance);
29 Real omega = 2 * PI * frequency;
30 mSusceptance = Complex(0, -1 / omega / **mInductance);
31 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
32 **mIntfCurrent = mSusceptance * **mIntfVoltage;
34 SPDLOG_LOGGER_INFO(mSLog,
35 "\nInductance [H]: {:s}"
36 "\nImpedance [Ohm]: {:s}",
37 Logger::realToString(**mInductance),
38 Logger::complexToString(1. / mSusceptance));
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 ---",
46 Logger::phasorToString((**mIntfVoltage)(0, 0)),
47 Logger::phasorToString((**mIntfCurrent)(0, 0)),
48 Logger::phasorToString(initialSingleVoltage(0)),
49 Logger::phasorToString(initialSingleVoltage(1)));
56 updateMatrixNodeIndices();
58 SPDLOG_LOGGER_INFO(mSLog,
59 "\n--- MNA initialization ---"
60 "\nInitial voltage {:s}"
61 "\nInitial current {:s}"
62 "\n--- MNA initialization finished ---",
63 Logger::phasorToString((**mIntfVoltage)(0, 0)),
64 Logger::phasorToString((**mIntfCurrent)(0, 0)));
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,
79 attributeDependencies.push_back(leftVector);
80 modifiedAttributes.push_back(mIntfVoltage);
81 modifiedAttributes.push_back(mIntfCurrent);
86 this->mnaUpdateVoltage(**leftVector);
87 this->mnaUpdateCurrent(**leftVector);
92 **mIntfVoltage = Matrix::Zero(3, 1);
93 if (terminalNotGrounded(1)) {
94 (**mIntfVoltage)(0, 0) =
95 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1));
97 if (terminalNotGrounded(0)) {
98 (**mIntfVoltage)(0, 0) =
99 (**mIntfVoltage)(0, 0) -
100 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0));
105 **mIntfCurrent = mSusceptance * **mIntfVoltage;
109 void SP::Ph1::Inductor::mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) {
110 Math::addToMatrixElement(tearMatrix, mTearIdx, mTearIdx, 1. / mSusceptance);
Base class for all MNA components that are transmitting power.
Static phasor inductor model.
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.
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.
Base class for all components that are transmitting power.
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
Current through component.
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
Voltage between terminals.