DPsim
Loading...
Searching...
No Matches
DP_Ph3_Transformer.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
2// SPDX-License-Identifier: MPL-2.0
3
6
7using namespace CPS;
8
10 Logger::Level logLevel,
11 Bool withResistiveLosses)
12 : Transformer(uid, name, true, logLevel, withResistiveLosses) {}
13
15 Bool useSubcomponents, Logger::Level logLevel,
16 Bool withResistiveLosses)
18 CompositePowerComp<Complex>(uid, name, true, true, logLevel),
19 mUseSubcomponents(useSubcomponents) {
21 mWithResistiveLosses = withResistiveLosses;
22 if (withResistiveLosses)
24 else
27
28 SPDLOG_LOGGER_INFO(mSLog, "Create {} {}", this->type(), name);
29 **mIntfVoltage = MatrixComp::Zero(3, 1);
30 **mIntfCurrent = MatrixComp::Zero(3, 1);
31}
32
34 auto copy = Transformer::make(name, mUseSubcomponents, mLogLevel,
35 mNumVirtualNodes == 5);
37 mRatedPower, std::abs(**mRatio), std::arg(**mRatio),
39 copy->setTapRatio(tapRatio());
40 return copy;
41}
42
44 Real nomVoltageSecondary,
45 Real ratedPower, Real ratioAbs,
46 Real ratioPhase, Matrix resistance,
47 Matrix inductance) {
48 Base::Ph3::Transformer::setParameters(nomVoltagePrimary, nomVoltageSecondary,
49 ratedPower, ratioAbs, ratioPhase,
50 resistance, inductance);
51 mParametersSet = true;
52}
53
54void DP::Ph3::Transformer::resolveWindingRoles() {
55 switch (mReferenceWinding) {
57 mReferenceTerminal = 0;
58 break;
60 mReferenceTerminal = 1;
61 break;
63 SPDLOG_LOGGER_ERROR(mSLog,
64 "Transformer {}: three-winding transformers are "
65 "not implemented",
66 this->name());
69 mReferenceTerminal =
70 (mNominalVoltagePrimary >= mNominalVoltageSecondary) ? 0 : 1;
71 break;
72 }
73
74 mRatioFromReference =
75 (mReferenceTerminal == 0) ? effectiveRatio() : 1. / effectiveRatio();
76 mOrientationSign = (mReferenceTerminal == 0) ? 1. : -1.;
77
78 SPDLOG_LOGGER_INFO(
79 mSLog,
80 "Impedance referred to winding {} ({} [V]), remaining winding "
81 "at terminal {} ({} [V]), ratio = {}",
82 mReferenceTerminal + 1, nominalVoltageAt(mReferenceTerminal),
83 nonReferenceTerminal(), nominalVoltageAt(nonReferenceTerminal()),
84 Logger::complexToString(mRatioFromReference));
85}
86
87void DP::Ph3::Transformer::createSubComponents() {
88 if (!mUseSubcomponents)
89 return;
90 if (mSubCompCreated)
91 return;
92 mSubCompCreated = true;
93
94 resolveWindingRoles();
95
96 auto midpoint = mVirtualNodes[2];
97
98 mSubInductor =
99 std::make_shared<DP::Ph3::Inductor>(**mName + "_ind", mLogLevel);
100 mSubInductor->setParameters(mInductance / 2.);
101 addMNASubComponent(mSubInductor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
103
104 mSubInductor2 =
105 std::make_shared<DP::Ph3::Inductor>(**mName + "_ind2", mLogLevel);
106 mSubInductor2->setParameters(mInductance / 2.);
107 addMNASubComponent(mSubInductor2, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
109
110 if (mNumVirtualNodes == 5) {
111 mSubResistor =
112 std::make_shared<DP::Ph3::Resistor>(**mName + "_res", mLogLevel);
113 mSubResistor->setParameters(mResistance / 2.);
114 mSubResistor->connect({node(mReferenceTerminal), mVirtualNodes[3]});
115 mSubInductor->connect({mVirtualNodes[3], midpoint});
116 addMNASubComponent(mSubResistor, MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
118
119 mSubResistor2 =
120 std::make_shared<DP::Ph3::Resistor>(**mName + "_res2", mLogLevel);
121 mSubResistor2->setParameters(mResistance / 2.);
122 mSubResistor2->connect({midpoint, mVirtualNodes[4]});
123 mSubInductor2->connect({mVirtualNodes[4], mVirtualNodes[0]});
124 addMNASubComponent(mSubResistor2,
127 } else {
128 mSubInductor->connect({node(mReferenceTerminal), midpoint});
129 mSubInductor2->connect({midpoint, mVirtualNodes[0]});
130 }
131
132 if (mRatedPower <= 0) {
133 SPDLOG_LOGGER_WARN(mSLog,
134 "Transformer {}: rated power is {} [VA], so the "
135 "magnetizing branch cannot be sized and is omitted",
136 this->name(), mRatedPower);
137 return;
138 }
139
140 if (mNoLoadCurrent <= mNoLoadLoss) {
141 SPDLOG_LOGGER_ERROR(mSLog,
142 "Transformer {}: no-load current {} must exceed the "
143 "no-load loss {}",
144 this->name(), mNoLoadCurrent, mNoLoadLoss);
145 throw InvalidArgumentException();
146 }
147
148 Real magnetizingResistance =
149 std::pow(nominalVoltageAt(mReferenceTerminal), 2) /
150 (mNoLoadLoss * mRatedPower);
151 mMagnetizingResistance =
152 Math::singlePhaseParameterToThreePhase(magnetizingResistance);
153 mSubMagnetizingResistor =
154 std::make_shared<DP::Ph3::Resistor>(**mName + "_mag_res", mLogLevel);
155 mSubMagnetizingResistor->setParameters(mMagnetizingResistance);
156 mSubMagnetizingResistor->connect({midpoint, DP::SimNode::GND});
157 addMNASubComponent(mSubMagnetizingResistor,
160
161 mSubMagnetizingInductor =
162 std::make_shared<DP::Ph3::Inductor>(**mName + "_mag_ind", mLogLevel);
163 mSubMagnetizingInductor->connect({midpoint, DP::SimNode::GND});
164 addMNASubComponent(mSubMagnetizingInductor,
167}
168
170 Real frequency) {
171 Real omega = 2. * PI * frequency;
172 if (!mUseSubcomponents)
173 resolveWindingRoles();
174
175 // Keep the stored PF phasors on virtual nodes in RMS form so that the
176 // attached primitive components can apply their usual PF-to-DP conversion
177 // exactly once. Scale only the initialized node state itself.
178 for (auto &virtualNode : mVirtualNodes)
179 virtualNode->setComplexInitialVoltageScale(RMS3PH_TO_PEAK1PH);
180
181 if (mUseSubcomponents ? static_cast<Bool>(mSubMagnetizingInductor)
182 : mRatedPower > 0.) {
183 if (!mUseSubcomponents) {
184 if (mNoLoadCurrent <= mNoLoadLoss)
186 const Real resistance =
187 std::pow(nominalVoltageAt(mReferenceTerminal), 2) /
188 (mNoLoadLoss * mRatedPower);
189 mMagnetizingResistance =
191 }
192 Real magnetizingSusceptance =
193 std::sqrt(std::pow(mNoLoadCurrent, 2) - std::pow(mNoLoadLoss, 2)) *
194 mRatedPower / std::pow(nominalVoltageAt(mReferenceTerminal), 2);
195 Real magnetizingInductance = 1. / (omega * magnetizingSusceptance);
196 mMagnetizingInductance =
197 Math::singlePhaseParameterToThreePhase(magnetizingInductance);
198 if (mUseSubcomponents)
199 mSubMagnetizingInductor->setParameters(mMagnetizingInductance);
200 }
201
202 // Power-flow voltages are line-line RMS phasors. Keep these initial values
203 // raw for child components; their initializers convert their own states.
204 MatrixComp secondaryVoltage = initialVoltage(nonReferenceTerminal());
205 mVirtualNodes[0]->setInitialVoltage(secondaryVoltage * mRatioFromReference);
206
207 Complex halfImpedance =
208 Complex(mResistance(0, 0) / 2., omega * mInductance(0, 0) / 2.);
209 Complex magnetizingAdmittance = Complex(0, 0);
210 if (mUseSubcomponents ? static_cast<Bool>(mSubMagnetizingInductor)
211 : mRatedPower > 0.)
212 magnetizingAdmittance =
213 1. / mMagnetizingResistance(0, 0) +
214 1. / Complex(0, omega * mMagnetizingInductance(0, 0));
215
216 MatrixComp referenceVoltage = initialVoltage(mReferenceTerminal);
217 MatrixComp midpointVoltage =
218 (referenceVoltage + mVirtualNodes[0]->initialVoltage()) /
219 (2. + halfImpedance * magnetizingAdmittance);
220 mVirtualNodes[2]->setInitialVoltage(midpointVoltage);
221
222 if (mNumVirtualNodes == 5) {
223 MatrixComp referenceCurrent =
224 (referenceVoltage - midpointVoltage) / halfImpedance;
225 MatrixComp nonReferenceCurrent =
226 (midpointVoltage - mVirtualNodes[0]->initialVoltage()) / halfImpedance;
227 mVirtualNodes[3]->setInitialVoltage(
228 referenceVoltage - referenceCurrent * mResistance(0, 0) / 2.);
229 mVirtualNodes[4]->setInitialVoltage(
230 midpointVoltage - nonReferenceCurrent * mResistance(0, 0) / 2.);
231 }
232
234
235 MatrixComp impedance = MatrixComp::Zero(3, 3);
236 for (UInt row = 0; row < 3; row++)
237 for (UInt col = 0; col < 3; col++)
238 impedance(row, col) =
239 Complex(mResistance(row, col), omega * mInductance(row, col));
240
241 MatrixComp impedanceVoltage =
242 mOrientationSign * RMS3PH_TO_PEAK1PH *
243 (mVirtualNodes[0]->initialVoltage() - referenceVoltage);
244 **mIntfCurrent = impedance.inverse() * impedanceVoltage;
245}
246
248 Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
249 if (mUseSubcomponents)
250 return;
252 const Real b = timeStep * omega / 2.;
253 const Matrix halfInductance = mInductance / 2.;
254 const Matrix a = (timeStep / 2.) * halfInductance.inverse();
255 mDirectInductorAdmittance = MatrixComp::Zero(3, 3);
256 mDirectInductorAdmittance.real() = a / (1. + b * b);
257 mDirectInductorAdmittance.imag() = -a * b / (1. + b * b);
258 mDirectInductorPrevCurrentFactor =
259 Complex((1. - b * b) / (1. + b * b), -2. * b / (1. + b * b));
260 mDirectInductorCurrent0.setZero();
261 mDirectInductorCurrent1.setZero();
262 mDirectInductorVoltage0.setZero();
263 mDirectInductorVoltage1.setZero();
264 mDirectInductorHistory0.setZero();
265 mDirectInductorHistory1.setZero();
266 mDirectMagnetizingAdmittance.setZero();
267 mDirectMagnetizingCurrent.setZero();
268 mDirectMagnetizingVoltage.setZero();
269 mDirectMagnetizingHistory.setZero();
270 if (mRatedPower > 0.) {
271 const Matrix magA = (timeStep / 2.) * mMagnetizingInductance.inverse();
272 mDirectMagnetizingAdmittance.real() = magA / (1. + b * b);
273 mDirectMagnetizingAdmittance.imag() = -magA * b / (1. + b * b);
274 mDirectMagnetizingPrevCurrentFactor = mDirectInductorPrevCurrentFactor;
275 }
276
277 const MatrixComp midpoint = mVirtualNodes[2]->initialVoltage();
278 const MatrixComp ratioNode = mVirtualNodes[0]->initialVoltage();
279 const MatrixComp firstNode = mNumVirtualNodes == 5
280 ? mVirtualNodes[3]->initialVoltage()
281 : initialVoltage(mReferenceTerminal);
282 const MatrixComp secondNode =
283 mNumVirtualNodes == 5 ? mVirtualNodes[4]->initialVoltage() : midpoint;
284 // Virtual-node initial phasors are stored in RMS form. Match the primitive
285 // DP inductor initializers by converting them to phase-peak envelopes here.
286 mDirectInductorVoltage0 = RMS3PH_TO_PEAK1PH * (midpoint - firstNode);
287 mDirectInductorVoltage1 = RMS3PH_TO_PEAK1PH * (ratioNode - secondNode);
288 mDirectInductorCurrent0 =
289 (Complex(0., omega) * halfInductance.cast<Complex>()).inverse() *
290 mDirectInductorVoltage0;
291 mDirectInductorCurrent1 =
292 (Complex(0., omega) * halfInductance.cast<Complex>()).inverse() *
293 mDirectInductorVoltage1;
294 if (mRatedPower > 0.) {
295 mDirectMagnetizingVoltage = -RMS3PH_TO_PEAK1PH * midpoint;
296 mDirectMagnetizingCurrent =
297 (Complex(0., omega) * mMagnetizingInductance.cast<Complex>())
298 .inverse() *
299 mDirectMagnetizingVoltage;
300 }
301}
302
304 SparseMatrixRow &systemMatrix) {
305 if (terminalNotGrounded(mReferenceTerminal)) {
306 for (UInt phase = 0; phase < 3; phase++) {
308 systemMatrix,
309 mVirtualNodes[0]->matrixNodeIndex(static_cast<PhaseType>(phase)),
310 mVirtualNodes[1]->matrixNodeIndex(static_cast<PhaseType>(phase)),
311 Complex(-1.0, 0));
313 systemMatrix,
314 mVirtualNodes[1]->matrixNodeIndex(static_cast<PhaseType>(phase)),
315 mVirtualNodes[0]->matrixNodeIndex(static_cast<PhaseType>(phase)),
316 Complex(1.0, 0));
317 }
318 }
319 if (terminalNotGrounded(nonReferenceTerminal())) {
320 for (UInt phase = 0; phase < 3; phase++) {
322 systemMatrix, matrixNodeIndex(nonReferenceTerminal(), phase),
323 mVirtualNodes[1]->matrixNodeIndex(static_cast<PhaseType>(phase)),
324 std::conj(mRatioFromReference));
326 systemMatrix,
327 mVirtualNodes[1]->matrixNodeIndex(static_cast<PhaseType>(phase)),
328 matrixNodeIndex(nonReferenceTerminal(), phase), -mRatioFromReference);
329 }
330 }
331 if (!mUseSubcomponents) {
332 const UInt midpoint = mVirtualNodes[2]->matrixNodeIndex(PhaseType::A);
333 const UInt ratioNode = mVirtualNodes[0]->matrixNodeIndex(PhaseType::A);
334 const UInt firstNode = mNumVirtualNodes == 5
335 ? mVirtualNodes[3]->matrixNodeIndex(PhaseType::A)
336 : matrixNodeIndex(mReferenceTerminal, 0);
337 const UInt secondNode =
338 mNumVirtualNodes == 5 ? mVirtualNodes[4]->matrixNodeIndex(PhaseType::A)
339 : midpoint;
340 if (mNumVirtualNodes == 5) {
341 const MatrixComp resistorY = (mResistance / 2.).inverse().cast<Complex>();
343 resistorY, systemMatrix, matrixNodeIndex(mReferenceTerminal, 0),
344 firstNode, terminalNotGrounded(mReferenceTerminal), true, mSLog);
345 MNAStampUtils::stampAdmittanceMatrix(resistorY, systemMatrix, midpoint,
346 secondNode, true, true, mSLog);
347 }
348 MNAStampUtils::stampAdmittanceMatrix(mDirectInductorAdmittance,
349 systemMatrix, firstNode, midpoint,
350 true, true, mSLog);
351 MNAStampUtils::stampAdmittanceMatrix(mDirectInductorAdmittance,
352 systemMatrix, secondNode, ratioNode,
353 true, true, mSLog);
354 if (mRatedPower > 0.) {
356 mMagnetizingResistance.inverse().cast<Complex>(), systemMatrix,
357 midpoint, 0, true, false, mSLog);
358 MNAStampUtils::stampAdmittanceMatrix(mDirectMagnetizingAdmittance,
359 systemMatrix, midpoint, 0, true,
360 false, mSLog);
361 }
362 }
363}
364
366 Matrix &rightVector) {
367 if (mUseSubcomponents)
368 return;
369 const UInt midpoint = mVirtualNodes[2]->matrixNodeIndex(PhaseType::A);
370 const UInt ratioNode = mVirtualNodes[0]->matrixNodeIndex(PhaseType::A);
371 const UInt firstNode = mNumVirtualNodes == 5
372 ? mVirtualNodes[3]->matrixNodeIndex(PhaseType::A)
373 : matrixNodeIndex(mReferenceTerminal, 0);
374 const UInt secondNode = mNumVirtualNodes == 5
375 ? mVirtualNodes[4]->matrixNodeIndex(PhaseType::A)
376 : midpoint;
377 mDirectInductorHistory0 =
378 mDirectInductorAdmittance * mDirectInductorVoltage0 +
379 mDirectInductorPrevCurrentFactor * mDirectInductorCurrent0;
380 mDirectInductorHistory1 =
381 mDirectInductorAdmittance * mDirectInductorVoltage1 +
382 mDirectInductorPrevCurrentFactor * mDirectInductorCurrent1;
383 if (mRatedPower > 0.)
384 mDirectMagnetizingHistory =
385 mDirectMagnetizingAdmittance * mDirectMagnetizingVoltage +
386 mDirectMagnetizingPrevCurrentFactor * mDirectMagnetizingCurrent;
387 for (UInt phase = 0; phase < 3; ++phase) {
388 if (mNumVirtualNodes == 5 || terminalNotGrounded(mReferenceTerminal))
389 Math::setVectorElement(rightVector, firstNode + phase,
390 mDirectInductorHistory0(phase, 0));
391 Complex midpointHistory = -mDirectInductorHistory0(phase, 0);
392 if (mNumVirtualNodes == 5)
393 Math::setVectorElement(rightVector, secondNode + phase,
394 mDirectInductorHistory1(phase, 0));
395 else
396 midpointHistory += mDirectInductorHistory1(phase, 0);
397 if (mRatedPower > 0.)
398 midpointHistory += mDirectMagnetizingHistory(phase, 0);
399 Math::setVectorElement(rightVector, midpoint + phase, midpointHistory);
400 Math::setVectorElement(rightVector, ratioNode + phase,
401 -mDirectInductorHistory1(phase, 0));
402 }
403}
404
406 AttributeBase::List &prevStepDependencies,
407 AttributeBase::List &attributeDependencies,
408 AttributeBase::List &modifiedAttributes) {
409 prevStepDependencies.push_back(mIntfCurrent);
410 prevStepDependencies.push_back(mIntfVoltage);
411 modifiedAttributes.push_back(mRightVector);
412}
413
417
419 AttributeBase::List &prevStepDependencies,
420 AttributeBase::List &attributeDependencies,
421 AttributeBase::List &modifiedAttributes,
422 Attribute<Matrix>::Ptr &leftVector) {
423 attributeDependencies.push_back(leftVector);
424 modifiedAttributes.push_back(mIntfVoltage);
425 modifiedAttributes.push_back(mIntfCurrent);
426}
427
429 Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) {
430 mnaCompUpdateVoltage(**leftVector);
431 mnaCompUpdateCurrent(**leftVector);
432}
433
435 (**mIntfVoltage).setZero();
436 for (UInt phase = 0; phase < 3; phase++) {
437 if (terminalNotGrounded(1))
438 (**mIntfVoltage)(phase, 0) =
439 Math::complexFromVectorElement(leftVector, matrixNodeIndex(1, phase));
440 if (terminalNotGrounded(0))
441 (**mIntfVoltage)(phase, 0) =
442 (**mIntfVoltage)(phase, 0) -
443 Math::complexFromVectorElement(leftVector, matrixNodeIndex(0, phase));
444 }
445}
446
448 if (mUseSubcomponents) {
449 **mIntfCurrent = mOrientationSign * mSubInductor->intfCurrent();
450 return;
451 }
452 const UInt midpoint = mVirtualNodes[2]->matrixNodeIndex(PhaseType::A);
453 const UInt firstNode = mNumVirtualNodes == 5
454 ? mVirtualNodes[3]->matrixNodeIndex(PhaseType::A)
455 : matrixNodeIndex(mReferenceTerminal, 0);
456 const UInt secondNode = mNumVirtualNodes == 5
457 ? mVirtualNodes[4]->matrixNodeIndex(PhaseType::A)
458 : midpoint;
459 for (UInt phase = 0; phase < 3; ++phase) {
460 mDirectInductorVoltage0(phase, 0) =
461 Math::complexFromVectorElement(leftVector, midpoint + phase) -
462 (mNumVirtualNodes == 5 || terminalNotGrounded(mReferenceTerminal)
463 ? Math::complexFromVectorElement(leftVector, firstNode + phase)
464 : Complex(0., 0.));
465 mDirectInductorVoltage1(phase, 0) =
467 leftVector,
469 Math::complexFromVectorElement(leftVector, secondNode + phase);
470 mDirectMagnetizingVoltage(phase, 0) =
471 -Math::complexFromVectorElement(leftVector, midpoint + phase);
472 }
473 mDirectInductorCurrent0 =
474 mDirectInductorAdmittance * mDirectInductorVoltage0 +
475 mDirectInductorHistory0;
476 mDirectInductorCurrent1 =
477 mDirectInductorAdmittance * mDirectInductorVoltage1 +
478 mDirectInductorHistory1;
479 if (mRatedPower > 0.)
480 mDirectMagnetizingCurrent =
481 mDirectMagnetizingAdmittance * mDirectMagnetizingVoltage +
482 mDirectMagnetizingHistory;
483 **mIntfCurrent = mOrientationSign * mDirectInductorCurrent0;
484}
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
Real mNominalVoltagePrimary
Nominal voltage of primary side.
Real mNominalVoltageSecondary
Nominal voltage of secondary side.
const Attribute< Complex >::Ptr mRatio
Transformer ratio.
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratedPower, Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance)
Matrix mResistance
Resistance [Ohm].
Matrix mInductance
Inductance [H].
Real nominalVoltageAt(UInt terminal) const
Nominal voltage of the winding at the given terminal.
Real mRatedPower
Rated Apparent Power [VA].
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void initializeParentFromNodesAndTerminals(Real frequency) override
Transformer(String uid, String name, Logger::Level logLevel=Logger::Level::off, Bool withResistiveLosses=false)
Defines UID, name and logging level.
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratedPower, Real ratioAbs, Real ratioPhase, Matrix resistance, Matrix inductance)
Defines component parameters.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
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 mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void mnaParentPreStep(Real time, Int timeStepCount) override
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void mnaCompUpdateCurrent(const Matrix &leftVector) override
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
String uid()
Returns unique id.
String type()
Get component type (cross-platform)
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
Definition Logger.h:33
static String complexToString(const Complex &num)
Definition Logger.cpp:63
Attribute< Matrix >::Ptr mRightVector
void mnaApplyRightSideVectorStamp(Matrix &rightVector) final
static void stampAdmittanceMatrix(const MatrixComp &admittanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, Int maxFreq=1, Int freqIdx=0)
static void setVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0, Matrix::Index colOffset=0)
static void setMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
static Matrix singlePhaseParameterToThreePhase(Real parameter)
To convert single phase parameters to symmetrical three phase ones.
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
MatrixComp initialVoltage(UInt index)
SimNode< Complex >::Ptr virtualNode(UInt index)
std::shared_ptr< SimPowerComp< VarType > > Ptr
SimNode< Complex >::List mVirtualNodes
Bool terminalNotGrounded(UInt index)
Logger::Level mLogLevel
Component logger control for internal variables.
UInt mNumVirtualNodes
Determines the number of virtual or internal Nodes.
bool mParametersSet
Flag indicating that parameters are set via setParameters() function.
Logger::Log mSLog
Component logger.
static std::shared_ptr< Transformer > make(Args &&...args)
Definition PtrFactory.h:19
#define PI
Definition Definitions.h:43
#define RMS3PH_TO_PEAK1PH
Definition Definitions.h:50
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:79
std::string String
Definition Definitions.h:63
double Real
Definition Definitions.h:60
int Int
Definition Definitions.h:59
std::complex< Real > Complex
Definition Definitions.h:61
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:82
bool Bool
Definition Definitions.h:62
unsigned int UInt
Definition Definitions.h:58
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72