66 if (Math::abs(**
mRatio) < 1.) {
68 std::shared_ptr<SimTerminal<Real>> tmp =
mTerminals[0];
74 SPDLOG_LOGGER_INFO(
mSLog,
"Switching terminals to have first terminal at "
75 "higher voltage side. Updated parameters: ");
77 mSLog,
"Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]",
79 SPDLOG_LOGGER_INFO(
mSLog,
"Tap Ratio = {} [ ] Phase Shift = {} [deg]",
88 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
94 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
107 mSnubberResistance1 =
110 std::make_shared<EMT::Ph3::Resistor>(**
mName +
"_snub_res1",
mLogLevel);
111 mSubSnubResistor1->setParameters(mSnubberResistance1);
112 mSubSnubResistor1->connect({
node(0), EMT::SimNode::GND});
115 "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]",
116 node(0)->name(), Logger::matrixToString(mSnubberResistance1));
118 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
119 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
123 mSnubberResistance2 =
126 std::make_shared<EMT::Ph3::Resistor>(**
mName +
"_snub_res2",
mLogLevel);
127 mSubSnubResistor2->setParameters(mSnubberResistance2);
128 mSubSnubResistor2->connect({
node(1), EMT::SimNode::GND});
131 "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]",
132 node(1)->name(), Logger::matrixToString(mSnubberResistance2));
134 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
135 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
139 std::make_shared<EMT::Ph3::Capacitor>(**
mName +
"_snub_cap2",
mLogLevel);
140 mSubSnubCapacitor2->connect({
node(1), EMT::SimNode::GND});
142 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
143 MNA_SUBCOMP_TASK_ORDER::TASK_BEFORE_PARENT,
true);
152 Real omega = 2. * PI * frequency;
165 Real snubberCapacitance2 =
167 mSnubberCapacitance2 =
169 mSubSnubCapacitor2->setParameters(mSnubberCapacitance2);
172 "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]",
173 node(1)->name(), Logger::matrixToString(mSnubberCapacitance2));
174 MatrixComp impedance = MatrixComp::Zero(3, 3);
185 SPDLOG_LOGGER_INFO(
mSLog,
186 "Resistance (referred to higher voltage side) = {} [Ohm]",
188 SPDLOG_LOGGER_INFO(
mSLog,
189 "Inductance (referred to higher voltage side) = {} [H]",
191 SPDLOG_LOGGER_INFO(
mSLog,
192 "Reactance (referred to higher voltage side) = {} [Ohm]",
195 MatrixComp vInitABC = MatrixComp::Zero(3, 1);
198 (
mVirtualNodes[0]->initialSingleVoltage() - initialSingleVoltage(0));
199 vInitABC(1, 0) = vInitABC(0, 0) * SHIFT_TO_PHASE_B;
200 vInitABC(2, 0) = vInitABC(0, 0) * SHIFT_TO_PHASE_C;
202 MatrixComp iInit = impedance.inverse() * vInitABC;
207 mVirtualNodes[2]->setInitialVoltage(initialSingleVoltage(0));
211 "\n--- Initialization from powerflow ---"
212 "\nVoltage across: {:s}"
214 "\nTerminal 0 voltage: {:s}"
215 "\nTerminal 1 voltage: {:s}"
216 "\nVirtual Node 1 voltage: {:s}"
217 "\n--- Initialization from powerflow finished ---",
220 Logger::phasorToString(RMS3PH_TO_PEAK1PH * initialSingleVoltage(0)),
221 Logger::phasorToString(RMS3PH_TO_PEAK1PH * initialSingleVoltage(1)),
222 Logger::phasorToString(RMS3PH_TO_PEAK1PH *
237 SparseMatrixRow &systemMatrix) {
239 if (terminalNotGrounded(0)) {
240 Math::setMatrixElement(
241 systemMatrix,
mVirtualNodes[0]->matrixNodeIndex(PhaseType::A),
243 Math::setMatrixElement(
244 systemMatrix,
mVirtualNodes[0]->matrixNodeIndex(PhaseType::B),
246 Math::setMatrixElement(
247 systemMatrix,
mVirtualNodes[0]->matrixNodeIndex(PhaseType::C),
250 Math::setMatrixElement(systemMatrix,
253 Math::setMatrixElement(systemMatrix,
256 Math::setMatrixElement(systemMatrix,
260 if (terminalNotGrounded(1)) {
261 Math::setMatrixElement(systemMatrix, matrixNodeIndex(1, 0),
264 Math::setMatrixElement(systemMatrix, matrixNodeIndex(1, 1),
267 Math::setMatrixElement(systemMatrix, matrixNodeIndex(1, 2),
270 Math::setMatrixElement(systemMatrix,
272 matrixNodeIndex(1, 0), -(**mRatio).real());
273 Math::setMatrixElement(systemMatrix,
275 matrixNodeIndex(1, 1), -(**mRatio).real());
276 Math::setMatrixElement(systemMatrix,
278 matrixNodeIndex(1, 2), -(**mRatio).real());
283 if (
auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
284 mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix);
286 if (terminalNotGrounded(0)) {
287 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
288 Logger::complexToString(Complex(-1.0, 0)),
291 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
292 Logger::complexToString(Complex(-1.0, 0)),
295 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
296 Logger::complexToString(Complex(-1.0, 0)),
300 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
301 Logger::complexToString(Complex(1.0, 0)),
304 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
305 Logger::complexToString(Complex(1.0, 0)),
308 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
309 Logger::complexToString(Complex(1.0, 0)),
313 if (terminalNotGrounded(1)) {
314 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
315 Logger::complexToString(**
mRatio), matrixNodeIndex(1, 0),
317 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
318 Logger::complexToString(**
mRatio), matrixNodeIndex(1, 1),
320 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
321 Logger::complexToString(**
mRatio), matrixNodeIndex(1, 2),
324 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
325 Logger::complexToString(-**
mRatio),
327 matrixNodeIndex(1, 0));
328 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
329 Logger::complexToString(-**
mRatio),
331 matrixNodeIndex(1, 1));
332 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
333 Logger::complexToString(-**
mRatio),
335 matrixNodeIndex(1, 2));