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
91 auto copy = Transformer::make(name, mLogLevel);
93 **mRatedPower, std::abs(**mRatio), std::arg(**mRatio),
95 copy->setTapRatio(tapRatio());
96 return copy;
97}
98
99void SP::Ph1::Transformer::resolveWindingRoles() {
100 switch (mReferenceWinding) {
102 mReferenceTerminal = 0;
103 break;
105 mReferenceTerminal = 1;
106 break;
108 SPDLOG_LOGGER_ERROR(mSLog,
109 "Transformer {}: three-winding transformers are "
110 "not implemented",
111 this->name());
114 mReferenceTerminal =
115 (mNominalVoltagePrimary >= mNominalVoltageSecondary) ? 0 : 1;
116 break;
117 }
118 mRatioFromReference =
119 (mReferenceTerminal == 0) ? effectiveRatio() : 1. / effectiveRatio();
120 mOrientationSign = (mReferenceTerminal == 0) ? 1. : -1.;
121
122 if ((mReferenceTerminal == 0) != (Math::abs(effectiveRatio()) >= 1.) &&
123 Math::abs(Math::abs(effectiveRatio()) - 1.) > 1e-9)
124 SPDLOG_LOGGER_WARN(
125 mSLog,
126 "Nominal voltages put the higher-voltage winding at terminal {} ({} "
127 "[V] against {} [V]) but the turns ratio {} points the other way; "
128 "check the argument order of setParameters()",
129 mReferenceTerminal, nominalVoltageAt(mReferenceTerminal),
130 nominalVoltageAt(nonReferenceTerminal()),
131 Logger::complexToString(effectiveRatio()));
132}
133
135 if (mSubCompCreated)
136 return;
137 mSubCompCreated = true;
138
139 resolveWindingRoles();
140
141 auto midpoint = mVirtualNodes[2];
142
143 mSubInductor = std::make_shared<SP::Ph1::Inductor>(
144 **mUID + "_ind", **mName + "_ind", Logger::Level::off);
145 mSubInductor->setParameters(**mInductance / 2.);
148
149 mSubInductor2 = std::make_shared<SP::Ph1::Inductor>(
150 **mUID + "_ind2", **mName + "_ind2", Logger::Level::off);
151 mSubInductor2->setParameters(**mInductance / 2.);
154
155 if (mNumVirtualNodes == 5) {
156 mSubResistor = std::make_shared<SP::Ph1::Resistor>(
157 **mUID + "_res", **mName + "_res", Logger::Level::off);
158 mSubResistor->setParameters(**mResistance / 2.);
159 mSubResistor->connect({node(mReferenceTerminal), mVirtualNodes[3]});
160 mSubInductor->connect({mVirtualNodes[3], midpoint});
163
164 mSubResistor2 = std::make_shared<SP::Ph1::Resistor>(
165 **mUID + "_res2", **mName + "_res2", Logger::Level::off);
166 mSubResistor2->setParameters(**mResistance / 2.);
167 mSubResistor2->connect({midpoint, mVirtualNodes[4]});
168 mSubInductor2->connect({mVirtualNodes[4], mVirtualNodes[0]});
169 addMNASubComponent(mSubResistor2,
172 } else {
173 mSubInductor->connect({node(mReferenceTerminal), midpoint});
174 mSubInductor2->connect({midpoint, mVirtualNodes[0]});
175 }
176
177 bool magnetizingEnabled =
180 if (!magnetizingEnabled)
181 return;
182
183 if (**mRatedPower <= 0) {
184 SPDLOG_LOGGER_WARN(mSLog,
185 "Transformer {}: rated power is {} [VA], so the "
186 "magnetizing branch cannot be sized and is omitted",
187 this->name(), **mRatedPower);
188 return;
189 }
190
191 if (mNoLoadCurrent <= mNoLoadLoss) {
192 SPDLOG_LOGGER_ERROR(mSLog,
193 "Transformer {}: no-load current {} must exceed the "
194 "no-load loss {}",
195 this->name(), mNoLoadCurrent, mNoLoadLoss);
197 }
198
199 mSubMagnetizingResistor = std::make_shared<SP::Ph1::Resistor>(
200 **mUID + "_mag_res", **mName + "_mag_res", Logger::Level::off);
201 mSubMagnetizingResistor->connect({midpoint, SP::SimNode::GND});
202 addMNASubComponent(mSubMagnetizingResistor,
205
206 mSubMagnetizingInductor = std::make_shared<SP::Ph1::Inductor>(
207 **mUID + "_mag_ind", **mName + "_mag_ind", Logger::Level::off);
208 mSubMagnetizingInductor->connect({midpoint, SP::SimNode::GND});
209 addMNASubComponent(mSubMagnetizingInductor,
212}
213
215 Real frequency) {
216 mNominalOmega = 2. * PI * frequency;
217 mReactance = mNominalOmega * **mInductance;
218 SPDLOG_LOGGER_INFO(mSLog, "Reactance={} [Ohm] (referred to primary side)",
219 mReactance);
220
221 if (mSubMagnetizingResistor) {
222 mMagnetizingResistance = std::pow(nominalVoltageAt(mReferenceTerminal), 2) /
223 (mNoLoadLoss * **mRatedPower);
224 mSubMagnetizingResistor->setParameters(mMagnetizingResistance);
225 mSubMagnetizingResistor->setBaseVoltage(
226 nominalVoltageAt(mReferenceTerminal));
227
228 Real magnetizingSusceptance =
229 std::sqrt(std::pow(mNoLoadCurrent, 2) - std::pow(mNoLoadLoss, 2)) *
230 **mRatedPower / std::pow(nominalVoltageAt(mReferenceTerminal), 2);
231 mMagnetizingInductance = 1. / (mNominalOmega * magnetizingSusceptance);
232 mSubMagnetizingInductor->setParameters(mMagnetizingInductance);
233
234 SPDLOG_LOGGER_INFO(mSLog,
235 "Magnetizing resistance = {} [Ohm], inductance = {} [H]",
236 Logger::realToString(mMagnetizingResistance),
237 Logger::realToString(mMagnetizingInductance));
238 }
239
240 // Set initial voltage of virtual node in between
241 mVirtualNodes[0]->setInitialVoltage(
242 initialSingleVoltage(nonReferenceTerminal()) * mRatioFromReference);
243
244 // Static calculations from load flow data
245 Complex impedance = {**mResistance, mReactance};
246 Complex impedanceVoltage =
247 mOrientationSign * (mVirtualNodes[0]->initialSingleVoltage() -
248 initialSingleVoltage(mReferenceTerminal));
249 (**mIntfVoltage)(0, 0) = initialSingleVoltage(1) - initialSingleVoltage(0);
250 (**mIntfCurrent)(0, 0) = impedanceVoltage / impedance;
251
252 if (mNumVirtualNodes == 3)
253 mVirtualNodes[2]->setInitialVoltage(
254 initialSingleVoltage(mReferenceTerminal));
255
256 SPDLOG_LOGGER_INFO(
257 mSLog,
258 "\n--- Initialization from powerflow ---"
259 "\nVoltage across: {:s}"
260 "\nCurrent: {:s}"
261 "\nTerminal 0 voltage: {:s}"
262 "\nTerminal 1 voltage: {:s}"
263 "\nVirtual Node 1 voltage: {:s}"
264 "\n--- Initialization from powerflow finished ---",
270}
271
272// #### Powerflow section ####
273
277
281
283 // Note: to be consistent set base voltage to higher voltage (and impedance values must be referred to high voltage side)
284 // TODO: use attribute setter for setting base voltage
285 **mBaseVoltage = baseVoltage;
286}
287
289 Real baseOmega) {
290 SPDLOG_LOGGER_INFO(mSLog, "#### Calculate Per Unit Parameters for {}",
291 **mName);
292 mBaseApparentPower = baseApparentPower;
293 mBaseOmega = baseOmega;
294 SPDLOG_LOGGER_INFO(mSLog, "Base Power={} [VA] Base Omega={} [1/s]",
295 baseApparentPower, baseOmega);
296
297 resolveWindingRoles();
298
299 Real referenceVoltage = nominalVoltageAt(mReferenceTerminal);
300 if (**mBaseVoltage <= 0) {
301 SPDLOG_LOGGER_INFO(mSLog,
302 "Transformer {}: no base voltage was set, using the "
303 "reference winding {} [V]",
304 this->name(), referenceVoltage);
305 **mBaseVoltage = referenceVoltage;
306 } else if (std::abs(**mBaseVoltage - referenceVoltage) >
307 DOUBLE_EPSILON * referenceVoltage) {
308 SPDLOG_LOGGER_WARN(mSLog,
309 "Transformer {}: base voltage {} [V] does not match the "
310 "reference winding {} [V]; the impedances are referred "
311 "to the reference winding, so that is used as the base",
312 this->name(), **mBaseVoltage, referenceVoltage);
313 **mBaseVoltage = referenceVoltage;
314 }
315
316 mBaseImpedance = **mBaseVoltage * **mBaseVoltage / mBaseApparentPower;
317 mBaseAdmittance = 1.0 / mBaseImpedance;
318 mBaseCurrent = baseApparentPower /
319 (**mBaseVoltage *
320 sqrt(3)); // I_base=(S_threephase/3)/(V_line_to_line/sqrt(3))
321 SPDLOG_LOGGER_INFO(mSLog, "Base Voltage={} [V] Base Impedance={} [Ohm]",
322 **mBaseVoltage, mBaseImpedance);
323
324 mResistancePerUnit = **mResistance / mBaseImpedance;
325 mReactancePerUnit = mReactance / mBaseImpedance;
326 SPDLOG_LOGGER_INFO(mSLog, "Resistance={} [pu] Reactance={} [pu]",
327 mResistancePerUnit, mReactancePerUnit);
328
329 mBaseInductance = mBaseImpedance / mBaseOmega;
330 mInductancePerUnit = **mInductance / mBaseInductance;
331 // omega per unit=1, hence 1.0*mInductancePerUnit.
332 mLeakagePerUnit = Complex(mResistancePerUnit, 1. * mInductancePerUnit);
333 SPDLOG_LOGGER_INFO(mSLog, "Leakage Impedance={} [pu] ", mLeakagePerUnit);
334
335 mRatioAbsPerUnit = std::abs(effectiveRatio()) / mNominalVoltagePrimary *
337 mRatioPerUnit = mRatioFromReference /
338 Complex(nominalVoltageAt(mReferenceTerminal) /
339 nominalVoltageAt(nonReferenceTerminal()),
340 0.);
341 SPDLOG_LOGGER_INFO(mSLog, "Tap Ratio={} [pu]", mRatioAbsPerUnit);
342
343 // Calculate per unit parameters of subcomps
344 bool magnetizingEnabled =
347 if (magnetizingEnabled && **mRatedPower > 0 && mNoLoadCurrent > mNoLoadLoss)
348 mMagnetizingPerUnit =
349 Complex(mNoLoadLoss, -std::sqrt(std::pow(mNoLoadCurrent, 2) -
350 std::pow(mNoLoadLoss, 2))) *
351 **mRatedPower / std::pow(nominalVoltageAt(mReferenceTerminal), 2) *
352 mBaseImpedance;
353 else
354 mMagnetizingPerUnit = Complex(0, 0);
355}
356
359 // calculate matrix stamp
360 mY_element = MatrixComp(2, 2);
361 Complex halfLeakage = mLeakagePerUnit / 2.;
362 Complex determinant =
363 mLeakagePerUnit + halfLeakage * halfLeakage * mMagnetizingPerUnit;
364 Complex yShunted = (1. + halfLeakage * mMagnetizingPerUnit) / determinant;
365 Complex ySeries = 1. / determinant;
366
367 mY_element(0, 0) = yShunted;
368 mY_element(0, 1) = -ySeries * mRatioPerUnit;
369 mY_element(1, 0) = -ySeries * std::conj(mRatioPerUnit);
370 mY_element(1, 1) = yShunted * std::norm(mRatioPerUnit);
371
372 //check for inf or nan
373 for (int i = 0; i < 2; i++)
374 for (int j = 0; j < 2; j++)
375 if (!Math::isFinite(mY_element.coeff(i, j))) {
376 SPDLOG_LOGGER_ERROR(
377 mSLog,
378 "Transformer {}: non-finite per-unit admittance {} "
379 "in element Y({},{}) (leakage {}, tap {})",
380 this->name(), Logger::complexToString(mY_element.coeff(i, j)), i, j,
381 Logger::complexToString(mLeakage), mRatioAbsPerUnit);
383 }
384
385 //set the circuit matrix values
386 Math::addToMatrixElement(Y, this->matrixNodeIndex(mReferenceTerminal),
387 this->matrixNodeIndex(mReferenceTerminal),
388 mY_element.coeff(0, 0));
389 Math::addToMatrixElement(Y, this->matrixNodeIndex(mReferenceTerminal),
390 this->matrixNodeIndex(nonReferenceTerminal()),
391 mY_element.coeff(0, 1));
392 Math::addToMatrixElement(Y, this->matrixNodeIndex(nonReferenceTerminal()),
393 this->matrixNodeIndex(nonReferenceTerminal()),
394 mY_element.coeff(1, 1));
395 Math::addToMatrixElement(Y, this->matrixNodeIndex(nonReferenceTerminal()),
396 this->matrixNodeIndex(mReferenceTerminal),
397 mY_element.coeff(1, 0));
398
399 SPDLOG_LOGGER_INFO(mSLog, "#### Y matrix stamping: {}", mY_element);
400}
401
403 VectorComp &powerflow) {
404 **mCurrent = current * mBaseCurrent;
405 **mActivePowerBranch = powerflow.real() * mBaseApparentPower;
406 **mReactivePowerBranch = powerflow.imag() * mBaseApparentPower;
407}
408
410 **mActivePowerInjection = std::real(powerInjection) * mBaseApparentPower;
411 **mReactivePowerInjection = std::imag(powerInjection) * mBaseApparentPower;
412}
413
415
416// #### MNA Section ####
417
419 Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector) {
420 SPDLOG_LOGGER_INFO(
421 mSLog,
422 "\nTerminal 0 connected to {:s} = sim node {:d}"
423 "\nTerminal 1 connected to {:s} = sim node {:d}",
426}
427
429 SparseMatrixRow &systemMatrix) {
430 // Ideal transformer equations
431 if (terminalNotGrounded(mReferenceTerminal)) {
434 Complex(-1.0, 0));
437 Complex(1.0, 0));
438 }
439 if (terminalNotGrounded(nonReferenceTerminal())) {
441 systemMatrix, matrixNodeIndex(nonReferenceTerminal()),
442 mVirtualNodes[1]->matrixNodeIndex(), std::conj(mRatioFromReference));
444 matrixNodeIndex(nonReferenceTerminal()),
445 -mRatioFromReference);
446 }
447
448 // Add subcomps to system matrix
449 for (auto subcomp : mSubComponents)
450 if (auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
451 mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix);
452
453 if (terminalNotGrounded(0)) {
454 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
458 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
462 }
463 if (terminalNotGrounded(1)) {
464 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
467 SPDLOG_LOGGER_INFO(mSLog, "Add {:s} to system at ({:d},{:d})",
470 }
471}
472
474 AttributeBase::List &prevStepDependencies,
475 AttributeBase::List &attributeDependencies,
476 AttributeBase::List &modifiedAttributes) {
477 prevStepDependencies.push_back(mIntfCurrent);
478 prevStepDependencies.push_back(mIntfVoltage);
479 modifiedAttributes.push_back(mRightVector);
480}
481
485
487 AttributeBase::List &prevStepDependencies,
488 AttributeBase::List &attributeDependencies,
489 AttributeBase::List &modifiedAttributes,
490 Attribute<Matrix>::Ptr &leftVector) {
491 attributeDependencies.push_back(leftVector);
492 modifiedAttributes.push_back(mIntfVoltage);
493 modifiedAttributes.push_back(mIntfCurrent);
494}
495
497 Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) {
498 this->mnaUpdateVoltage(**leftVector);
499 this->mnaUpdateCurrent(**leftVector);
500}
501
503 (**mIntfCurrent)(0, 0) = mOrientationSign * mSubInductor->intfCurrent()(0, 0);
504 SPDLOG_LOGGER_DEBUG(mSLog, "Current {:s}",
506}
507
509 // v1 - v0
510 (**mIntfVoltage)(0, 0) = 0;
511 if (terminalNotGrounded(1))
512 (**mIntfVoltage)(0, 0) =
514 if (terminalNotGrounded(0))
515 (**mIntfVoltage)(0, 0) =
516 (**mIntfVoltage)(0, 0) -
518
519 SPDLOG_LOGGER_DEBUG(mSLog, "Voltage {:s}",
521}
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)
static void setMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
static bool isFinite(Real value)
static Real abs(Complex value)
Definition MathUtils.cpp:71
static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
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