9#include <dpsim-models/SP/SP_Ph3_Capacitor.h>
16 mPhaseType = PhaseType::ABC;
23 auto copy = Capacitor::make(name,
mLogLevel);
30 Real omega = 2 * PI * frequency;
43 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
45 Complex(cos(-2. / 3. * M_PI), sin(-2. / 3. * M_PI));
47 Complex(cos(2. / 3. * M_PI), sin(2. / 3. * M_PI));
53 Attribute<Matrix>::Ptr leftVector) {
58 SparseMatrixRow &systemMatrix) {
59 MNAStampUtils::stampAdmittanceMatrix(
60 mSusceptance, systemMatrix, matrixNodeIndex(0), matrixNodeIndex(1),
61 terminalNotGrounded(0), terminalNotGrounded(1),
mSLog);
65 AttributeBase::List &prevStepDependencies,
66 AttributeBase::List &attributeDependencies,
67 AttributeBase::List &modifiedAttributes,
68 Attribute<Matrix>::Ptr &leftVector) {
69 attributeDependencies.push_back(leftVector);
74void SP::Ph3::Capacitor::mnaCompPostStep(Real time, Int timeStepCount,
75 Attribute<Matrix>::Ptr &leftVector) {
76 mnaCompUpdateVoltage(**leftVector);
77 mnaCompUpdateCurrent(**leftVector);
83 if (terminalNotGrounded(1)) {
84 (**mIntfVoltage)(0, 0) =
85 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1, 0));
86 (**mIntfVoltage)(1, 0) =
87 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1, 1));
88 (**mIntfVoltage)(2, 0) =
89 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1, 2));
91 if (terminalNotGrounded(0)) {
92 (**mIntfVoltage)(0, 0) =
94 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0, 0));
95 (**mIntfVoltage)(1, 0) =
97 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0, 1));
98 (**mIntfVoltage)(2, 0) =
100 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0, 2));
const CPS::Attribute< Matrix >::Ptr mCapacitance
Capacitance [F].
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Capacitor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system result.
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 mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system result.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
MatrixComp mSusceptance
Equivalent conductance [S].
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.