DPsim
Loading...
Searching...
No Matches
SP_Ph1_Transformer.cpp
Go to the documentation of this file.
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
11
12using namespace CPS;
13
14// #### General ####
16 Logger::Level logLevel,
17 Bool withResistiveLosses)
19 CompositePowerComp<Complex>(uid, name, true, true, logLevel),
20 mBaseVoltage(mAttributes->create<Real>("base_Voltage")),
21 mCurrent(mAttributes->create<MatrixComp>("current_vector")),
22 mActivePowerBranch(mAttributes->create<Matrix>("p_branch_vector")),
23 mReactivePowerBranch(mAttributes->create<Matrix>("q_branch_vector")),
24 mActivePowerInjection(mAttributes->create<Real>("p_inj")),
25 mReactivePowerInjection(mAttributes->create<Real>("q_inj")) {
26 if (withResistiveLosses)
28 else
30
31 SPDLOG_LOGGER_INFO(mSLog, "Create {} {}", this->type(), name);
32 **mIntfVoltage = MatrixComp::Zero(1, 1);
33 **mIntfCurrent = MatrixComp::Zero(1, 1);
35
36 **mCurrent = MatrixComp::Zero(2, 1);
37 **mActivePowerBranch = Matrix::Zero(2, 1);
38 **mReactivePowerBranch = Matrix::Zero(2, 1);
39}
40
42 Real nomVoltageSecondary,
43 Real ratioAbs, Real ratioPhase,
44 Real resistance, Real inductance) {
45
46 // Note: to be consistent impedance values must be referred to high voltage side (and base voltage set to higher voltage)
47 Base::Ph1::Transformer::setParameters(nomVoltagePrimary, nomVoltageSecondary,
48 ratioAbs, ratioPhase, resistance,
49 inductance);
50
51 SPDLOG_LOGGER_INFO(
52 mSLog, "Nominal Voltage Primary={} [V] Nominal Voltage Secondary={} [V]",
54 SPDLOG_LOGGER_INFO(
55 mSLog, "Resistance={} [Ohm] Inductance={} [H] (referred to primary side)",
57 SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio={} [/] Phase Shift={} [deg]",
58 std::abs(**mRatio), std::arg(**mRatio));
59 SPDLOG_LOGGER_INFO(mSLog, "Rated Power ={} [VA]", **mRatedPower);
60
61 mRatioAbs = std::abs(**mRatio);
62 mRatioPhase = std::arg(**mRatio);
63
64 mParametersSet = true;
65}
66
68 Real nomVoltageSecondary,
69 Real ratedPower, Real ratioAbs,
70 Real ratioPhase, Real resistance,
71 Real inductance) {
72
73 // Rated power is the nameplate apparent-power magnitude |S|, so it cannot be
74 // negative (a negative value is a caller error, not the unset default of 0).
75 if (ratedPower < 0) {
76 SPDLOG_LOGGER_ERROR(mSLog, "Rated power {} [VA] is negative; must be >= 0",
77 ratedPower);
79 }
80
81 **mRatedPower = ratedPower;
82 SPDLOG_LOGGER_INFO(mSLog, "Rated Power ={} [VA]", **mRatedPower);
83
84 SP::Ph1::Transformer::setParameters(nomVoltagePrimary, nomVoltageSecondary,
85 ratioAbs, ratioPhase, resistance,
86 inductance);
87}
88
97
98void SP::Ph1::Transformer::resolveWindingRoles() {
99 switch (mReferenceWinding) {
101 mReferenceTerminal = 0;
102 break;
104 mReferenceTerminal = 1;
105 break;
107 SPDLOG_LOGGER_ERROR(mSLog,
108 "Transformer {}: three-winding transformers are "
109 "not implemented",
110 this->name());
113 mReferenceTerminal =
114 (mNominalVoltagePrimary >= mNominalVoltageSecondary) ? 0 : 1;
115 break;
116 }
117 mRatioFromReference = (mReferenceTerminal == 0) ? **mRatio : 1. / **mRatio;
118 mOrientationSign = (mReferenceTerminal == 0) ? 1. : -1.;
119
120 if ((mReferenceTerminal == 0) != (Math::abs(**mRatio) >= 1.) &&
121 Math::abs(Math::abs(**mRatio) - 1.) > 1e-9)
122 SPDLOG_LOGGER_WARN(
123 mSLog,
124 "Nominal voltages put the higher-voltage winding at terminal {} ({} "
125 "[V] against {} [V]) but the turns ratio {} points the other way; "
126 "check the argument order of setParameters()",
127 mReferenceTerminal, nominalVoltageAt(mReferenceTerminal),
128 nominalVoltageAt(nonReferenceTerminal()),
129 Logger::complexToString(**mRatio));
130}
131
133 if (mSubCompCreated)
134 return;
135 mSubCompCreated = true;
136
137 resolveWindingRoles();
138
139 auto midpoint = mVirtualNodes[2];
140
141 mSubInductor = std::make_shared<SP::Ph1::Inductor>(
142 **mUID + "_ind", **mName + "_ind", Logger::Level::off);
143 mSubInductor->setParameters(**mInductance / 2.);
146
147 mSubInductor2 = std::make_shared<SP::Ph1::Inductor>(
148 **mUID + "_ind2", **mName + "_ind2", Logger::Level::off);
149 mSubInductor2->setParameters(**mInductance / 2.);
152
153 if (mNumVirtualNodes == 5) {
154 mSubResistor = std::make_shared<SP::Ph1::Resistor>(
155 **mUID + "_res", **mName + "_res", Logger::Level::off);
156 mSubResistor->setParameters(**mResistance / 2.);
157 mSubResistor->connect({node(mReferenceTerminal), mVirtualNodes[3]});
158 mSubInductor->connect({mVirtualNodes[3], midpoint});
161
162 mSubResistor2 = std::make_shared<SP::Ph1::Resistor>(
163 **mUID + "_res2", **mName + "_res2", Logger::Level::off);
164 mSubResistor2->setParameters(**mResistance / 2.);
165 mSubResistor2->connect({midpoint, mVirtualNodes[4]});
166 mSubInductor2->connect({mVirtualNodes[4], mVirtualNodes[0]});
167 addMNASubComponent(mSubResistor2,
170 } else {
171 mSubInductor->connect({node(mReferenceTerminal), midpoint});
172 mSubInductor2->connect({midpoint, mVirtualNodes[0]});
173 }
174
175 bool magnetizingEnabled =
178 if (!magnetizingEnabled)
179 return;
180
181 if (**mRatedPower <= 0) {
182 SPDLOG_LOGGER_WARN(mSLog,
183 "Transformer {}: rated power is {} [VA], so the "
184 "magnetizing branch cannot be sized and is omitted",
185 this->name(), **mRatedPower);
186 return;
187 }
188
189 if (mNoLoadCurrent <= mNoLoadLoss) {
190 SPDLOG_LOGGER_ERROR(mSLog,
191 "Transformer {}: no-load current {} must exceed the "
192 "no-load loss {}",
193 this->name(), mNoLoadCurrent, mNoLoadLoss);
195 }
196
197 mSubMagnetizingResistor = std::make_shared<SP::Ph1::Resistor>(
198 **mUID + "_mag_res", **mName + "_mag_res", Logger::Level::off);
199 mSubMagnetizingResistor->connect({midpoint, SP::SimNode::GND});
200 addMNASubComponent(mSubMagnetizingResistor,
203
204 mSubMagnetizingInductor = std::make_shared<SP::Ph1::Inductor>(
205 **mUID + "_mag_ind", **mName + "_mag_ind", Logger::Level::off);
206 mSubMagnetizingInductor->connect({midpoint, SP::SimNode::GND});
207 addMNASubComponent(mSubMagnetizingInductor,
210}
211
213 Real frequency) {
214 mNominalOmega = 2. * PI * frequency;
215 mReactance = mNominalOmega * **mInductance;
216 SPDLOG_LOGGER_INFO(mSLog, "Reactance={} [Ohm] (referred to primary side)",
217 mReactance);
218
219 if (mSubMagnetizingResistor) {
220 mMagnetizingResistance = std::pow(nominalVoltageAt(mReferenceTerminal), 2) /
221 (mNoLoadLoss * **mRatedPower);
222 mSubMagnetizingResistor->setParameters(mMagnetizingResistance);
223 mSubMagnetizingResistor->setBaseVoltage(
224 nominalVoltageAt(mReferenceTerminal));
225
226 Real magnetizingSusceptance =
227 std::sqrt(std::pow(mNoLoadCurrent, 2) - std::pow(mNoLoadLoss, 2)) *
228 **mRatedPower / std::pow(nominalVoltageAt(mReferenceTerminal), 2);
229 mMagnetizingInductance = 1. / (mNominalOmega * magnetizingSusceptance);
230 mSubMagnetizingInductor->setParameters(mMagnetizingInductance);
231
232 SPDLOG_LOGGER_INFO(mSLog,
233 "Magnetizing resistance = {} [Ohm], inductance = {} [H]",
234 Logger::realToString(mMagnetizingResistance),
235 Logger::realToString(mMagnetizingInductance));
236 }
237
238 // Set initial voltage of virtual node in between
239 mVirtualNodes[0]->setInitialVoltage(
240 initialSingleVoltage(nonReferenceTerminal()) * mRatioFromReference);
241
242 // Static calculations from load flow data
243 Complex impedance = {**mResistance, mReactance};
244 Complex impedanceVoltage =
245 mOrientationSign * (mVirtualNodes[0]->initialSingleVoltage() -
246 initialSingleVoltage(mReferenceTerminal));
247 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
248 (**mIntfCurrent)(0, 0) = impedanceVoltage / impedance;
249
250 if (mNumVirtualNodes == 3)
251 mVirtualNodes[2]->setInitialVoltage(
252 initialSingleVoltage(mReferenceTerminal));
253
254 SPDLOG_LOGGER_INFO(
255 mSLog,
256 "\n--- Initialization from powerflow ---"
257 "\nVoltage across: {:s}"
258 "\nCurrent: {:s}"
259 "\nTerminal 0 voltage: {:s}"
260 "\nTerminal 1 voltage: {:s}"
261 "\nVirtual Node 1 voltage: {:s}"
262 "\n--- Initialization from powerflow finished ---",
268}
269
270// #### Powerflow section ####
271
275
279
281 // Note: to be consistent set base voltage to higher voltage (and impedance values must be referred to high voltage side)
282 // TODO: use attribute setter for setting base voltage
283 **mBaseVoltage = baseVoltage;
284}
285
287 Real baseOmega) {
288 SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}",
289 **mName);
290 mBaseApparentPower = baseApparentPower;
291 mBaseOmega = baseOmega;
292 SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]",
293 baseApparentPower, baseOmega);
294
295 resolveWindingRoles();
296
297 Real referenceVoltage = nominalVoltageAt(mReferenceTerminal);
298 if (**mBaseVoltage <= 0) {
299 SPDLOG_LOGGER_INFO(mSLog,
300 "Transformer {}: no base voltage was set, using the "
301 "reference winding {} [V]",
302 this->name(), referenceVoltage);
303 **mBaseVoltage = referenceVoltage;
304 } else if (std::abs(**mBaseVoltage - referenceVoltage) >
305 DOUBLE_EPSILON * referenceVoltage) {
306 SPDLOG_LOGGER_WARN(mSLog,
307 "Transformer {}: base voltage {} [V] does not match the "
308 "reference winding {} [V]; the impedances are referred "
309 "to the reference winding, so that is used as the base",
310 this->name(), **mBaseVoltage, referenceVoltage);
311 **mBaseVoltage = referenceVoltage;
312 }
313
314 mBaseImpedance = **mBaseVoltage * **mBaseVoltage / mBaseApparentPower;
315 mBaseAdmittance = 1.0 / mBaseImpedance;
316 mBaseCurrent = baseApparentPower /
317 (**mBaseVoltage *
318 sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3))
319 SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]",
320 **mBaseVoltage, mBaseImpedance);
321
322 mResistancePerUnit = **mResistance / mBaseImpedance;
323 mReactancePerUnit = mReactance / mBaseImpedance;
324 SPDLOG_LOGGER_INFO(mSLog, "Resistance={} [pu] Reactance={} [pu]",
325 mResistancePerUnit, mReactancePerUnit);
326
327 mBaseInductance = mBaseImpedance / mBaseOmega;
328 mInductancePerUnit = **mInductance / mBaseInductance;
329 // omega per unit=1, hence 1.0*mInductancePerUnit.
330 mLeakagePerUnit = Complex(mResistancePerUnit, 1. * mInductancePerUnit);
331 SPDLOG_LOGGER_INFO(mSLog, "Leakage Impedance={} [pu] ", mLeakagePerUnit);
332
333 mRatioAbsPerUnit =
335 mRatioPerUnit = mRatioFromReference /
336 Complex(nominalVoltageAt(mReferenceTerminal) /
337 nominalVoltageAt(nonReferenceTerminal()),
338 0.);
339 SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio={} [pu]", mRatioAbsPerUnit);
340
341 // Calculate per unit parameters of subcomps
342 bool magnetizingEnabled =
345 if (magnetizingEnabled && **mRatedPower > 0 && mNoLoadCurrent > mNoLoadLoss)
346 mMagnetizingPerUnit =
347 Complex(mNoLoadLoss, -std::sqrt(std::pow(mNoLoadCurrent, 2) -
348 std::pow(mNoLoadLoss, 2))) *
349 **mRatedPower / std::pow(nominalVoltageAt(mReferenceTerminal), 2) *
350 mBaseImpedance;
351 else
352 mMagnetizingPerUnit = Complex(0, 0);
353}
354
357 // calculate matrix stamp
358 mY_element = MatrixComp(2, 2);
359 Complex halfLeakage = mLeakagePerUnit / 2.;
360 Complex determinant =
361 mLeakagePerUnit + halfLeakage * halfLeakage * mMagnetizingPerUnit;
362 Complex yShunted = (1. + halfLeakage * mMagnetizingPerUnit) / determinant;
363 Complex ySeries = 1. / determinant;
364
365 mY_element(0, 0) = yShunted;
366 mY_element(0, 1) = -ySeries * mRatioPerUnit;
367 mY_element(1, 0) = -ySeries * std::conj(mRatioPerUnit);
368 mY_element(1, 1) = yShunted * std::norm(mRatioPerUnit);
369
370 //check for inf or nan
371 for (int i = 0; i < 2; i++)
372 for (int j = 0; j < 2; j++)
373 if (!Math::isFinite(mY_element.coeff(i, j))) {
374 SPDLOG_LOGGER_ERROR(
375 mSLog,
376 "Transformer {}: non-finite per-unit admittance {} "
377 "in element Y({},{}) (leakage {}, tap {})",
378 this->name(), Logger::complexToString(mY_element.coeff(i, j)), i, j,
379 Logger::complexToString(mLeakage), mRatioAbsPerUnit);
381 }
382
383 //set the circuit matrix values
384 Y.coeffRef(this->matrixNodeIndex(mReferenceTerminal),
385 this->matrixNodeIndex(mReferenceTerminal)) +=
386 mY_element.coeff(0, 0);
387 Y.coeffRef(this->matrixNodeIndex(mReferenceTerminal),
388 this->matrixNodeIndex(nonReferenceTerminal())) +=
389 mY_element.coeff(0, 1);
390 Y.coeffRef(this->matrixNodeIndex(nonReferenceTerminal()),
391 this->matrixNodeIndex(nonReferenceTerminal())) +=
392 mY_element.coeff(1, 1);
393 Y.coeffRef(this->matrixNodeIndex(nonReferenceTerminal()),
394 this->matrixNodeIndex(mReferenceTerminal)) +=
395 mY_element.coeff(1, 0);
396
397 SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", mY_element);
398}
399
401 VectorComp &powerflow) {
402 **mCurrent = current * mBaseCurrent;
403 **mActivePowerBranch = powerflow.real() * mBaseApparentPower;
404 **mReactivePowerBranch = powerflow.imag() * mBaseApparentPower;
405}
406
408 **mActivePowerInjection = std::real(powerInjection) * mBaseApparentPower;
409 **mReactivePowerInjection = std::imag(powerInjection) * mBaseApparentPower;
410}
411
413
414// #### MNA Section ####
415
417 Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
418 SPDLOG_LOGGER_INFO(
419 mSLog,
420 "\nTerminal 0 connected to {:s} = sim node {:d}"
421 "\nTerminal 1 connected to {:s} = sim node {:d}",
424}
425
427 SparseMatrixRow &systemMatrix) {
428 // Ideal transformer equations
429 if (terminalNotGrounded(mReferenceTerminal)) {
432 Complex(-1.0, 0));
435 Complex(1.0, 0));
436 }
437 if (terminalNotGrounded(nonReferenceTerminal())) {
439 systemMatrix, matrixNodeIndex(nonReferenceTerminal()),
440 mVirtualNodes[1]->matrixNodeIndex(), std::conj(mRatioFromReference));
442 matrixNodeIndex(nonReferenceTerminal()),
443 -mRatioFromReference);
444 }
445
446 // Add subcomps to system matrix
447 for (auto subcomp : mSubComponents)
448 if (auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
449 mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix);
450
451 if (terminalNotGrounded(0)) {
452 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
456 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
460 }
461 if (terminalNotGrounded(1)) {
462 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
465 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
468 }
469}
470
472 AttributeBase::List &prevStepDependencies,
473 AttributeBase::List &attributeDependencies,
474 AttributeBase::List &modifiedAttributes) {
475 prevStepDependencies.push_back(mIntfCurrent);
476 prevStepDependencies.push_back(mIntfVoltage);
477 modifiedAttributes.push_back(mRightVector);
478}
479
483
485 AttributeBase::List &prevStepDependencies,
486 AttributeBase::List &attributeDependencies,
487 AttributeBase::List &modifiedAttributes,
488 Attribute<Matrix>::Ptr &leftVector) {
489 attributeDependencies.push_back(leftVector);
490 modifiedAttributes.push_back(mIntfVoltage);
491 modifiedAttributes.push_back(mIntfCurrent);
492}
493
495 Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) {
496 this->mnaUpdateVoltage(**leftVector);
497 this->mnaUpdateCurrent(**leftVector);
498}
499
501 (**mIntfCurrent)(0, 0) = mOrientationSign * mSubInductor->intfCurrent()(0, 0);
502 SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}",
504}
505
507 // v1 - v0
508 (**mIntfVoltage)(0, 0) = 0;
509 if (terminalNotGrounded(1))
510 (**mIntfVoltage)(0, 0) =
512 if (terminalNotGrounded(0))
513 (**mIntfVoltage)(0, 0) =
514 (**mIntfVoltage)(0, 0) -
516
517 SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}",
519}
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
const Attribute< Real >::Ptr mRatedPower
Rated Apparent Power [VA].
const Attribute< Real >::Ptr mInductance
Inductance [H].
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Real mNominalVoltageSecondary
Nominal voltage of secondary side.
const Attribute< Real >::Ptr mResistance
Resistance [Ohm].
Real mNominalVoltagePrimary
Nominal voltage of primary side.
Real nominalVoltageAt(UInt terminal) const
Nominal voltage of the winding at the given terminal.
const Attribute< Complex >::Ptr mRatio
Complex transformer ratio.
void addMNASubComponent(typename SimPowerComp< Complex >::Ptr subc, MNA_SUBCOMP_TASK_ORDER preStepOrder, MNA_SUBCOMP_TASK_ORDER postStepOrder, Bool contributeToRightVector)
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
const Attribute< String >::Ptr mName
Human readable name.
String uid()
Returns unique id.
String type()
Get component type (cross-platform)
const Attribute< String >::Ptr mUID
Unique identifier.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
Definition Logger.h:33
static String complexToString(const Complex &num)
Definition Logger.cpp:63
static String realToString(const Real &num)
Definition Logger.cpp:69
static String phasorToString(const Complex &num)
Definition Logger.cpp:57
void mnaUpdateCurrent(const Matrix &leftVector) final
void mnaUpdateVoltage(const Matrix &leftVector) final
Attribute< Matrix >::Ptr mRightVector
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, Int maxFreq=1, Int freqIdx=0)
Definition MathUtils.cpp:94
static void setMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
static bool isFinite(Real value)
Definition MathUtils.cpp:63
static Real abs(Complex value)
Definition MathUtils.cpp:27
void storeNodalInjection(Complex powerInjection)
stores nodal injection power in this line object
Transformer(String uid, String name, Logger::Level logLevel=Logger::Level::off, Bool withResistiveLosses=false)
Defines UID, name and logging level.
const Attribute< Matrix >::Ptr mActivePowerBranch
branch active powerflow [W], coef(0) has data from node 0, coef(1) from node 1.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void calculatePerUnitParameters(Real baseApparentPower, Real baseOmega)
Initializes component from power flow data.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
const Attribute< Real >::Ptr mReactivePowerInjection
nodal reactive power injection
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
void updateBranchFlow(VectorComp &current, VectorComp &powerflow)
updates branch current and power flow, input pu value, update with real value
void setBaseVoltage(Real baseVoltage)
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override
Stamps admittance matrix.
Real getNominalVoltagePrimary() const
Get nominal voltage of the primary winding.
void setParameters(Real nomVoltagePrimary, Real nomVoltageSecondary, Real ratioAbs, Real ratioPhase, Real resistance, Real inductance)
Set transformer specific parameters (without rated power)
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
Real getNominalVoltageSecondary() const
Get nominal voltage of the secondary winding.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
void initializeParentFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
const Attribute< Matrix >::Ptr mReactivePowerBranch
branch reactive powerflow [Var], coef(0) has data from node 0, coef(1) from node 1.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
SimPowerComp< Complex >::Ptr clone(String name) override
DEPRECATED: Delete method.
MatrixComp Y_element()
get admittance matrix
const Attribute< MatrixComp >::Ptr mCurrent
branch Current flow [A], coef(0) has data from node 0, coef(1) from node 1.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
const Attribute< Real >::Ptr mBaseVoltage
base voltage [V]
const Attribute< Real >::Ptr mActivePowerInjection
nodal active power injection
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
SimTerminal< Complex >::List mTerminals
SimNode< Complex >::Ptr node(UInt index)
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
std::shared_ptr< SimPowerComp< VarType > > Ptr
SimNode< Complex >::List mVirtualNodes
std::vector< std::shared_ptr< SimPowerComp< Complex > > > mSubComponents
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(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 DOUBLE_EPSILON
Definition Definitions.h:14
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
Eigen::SparseMatrix< Complex, Eigen::RowMajor > SparseMatrixCompRow
Sparse matrix for complex numbers (row major).
Definition Definitions.h:76
double Real
Definition Definitions.h:60
Eigen::Matrix< Complex, Eigen::Dynamic, 1 > VectorComp
Dense vector for complex numbers.
Definition Definitions.h:66
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
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72