15 Bool withResistiveLosses)
18 if (withResistiveLosses)
25 SPDLOG_LOGGER_INFO(
mSLog,
"Create {} {}", this->
type(), name);
45 ratioAbs, ratioPhase, resistance,
49 mSLog,
"Nominal Voltage End 1={} [V] Nominal Voltage End 2={} [V]",
53 "Resistance={} [Ohm] Inductance={} [Ohm] (referred to primary side)",
55 SPDLOG_LOGGER_INFO(
mSLog,
"Tap Ratio={} [ ] Phase Shift={} [deg]",
63 Real nomVoltageEnd2,
Real ratedPower,
71 ratioPhase, resistance, inductance);
83 std::shared_ptr<SimTerminal<Complex>> tmp =
mTerminals[0];
89 SPDLOG_LOGGER_INFO(
mSLog,
"Switching terminals to have first terminal at "
90 "higher voltage side. Updated parameters: ");
92 mSLog,
"Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]",
94 SPDLOG_LOGGER_INFO(
mSLog,
"Tap Ratio = {} [ ] Phase Shift = {} [deg]",
121 std::make_shared<DP::Ph1::Resistor>(**
mName +
"_snub_res1",
mLogLevel);
122 mSubSnubResistor1->setParameters(mSnubberResistance1);
126 "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]",
134 std::make_shared<DP::Ph1::Resistor>(**
mName +
"_snub_res2",
mLogLevel);
135 mSubSnubResistor2->setParameters(mSnubberResistance2);
139 "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]",
147 std::make_shared<DP::Ph1::Capacitor>(**
mName +
"_snub_cap2",
mLogLevel);
156 Real omega = 2. *
PI * frequency;
158 mSnubberCapacitance2 =
160 mSubSnubCapacitor2->setParameters(mSnubberCapacitance2);
163 "Snubber Capacitance 2 (connected to lower voltage side {}) = {} [F]",
174 SPDLOG_LOGGER_INFO(
mSLog,
"Reactance={} [Ohm] (referred to primary side)",
176 (**mIntfVoltage)(0, 0) =
178 (**mIntfCurrent)(0, 0) = (**
mIntfVoltage)(0, 0) / impedance;
182 "\n--- Initialization from powerflow ---"
183 "\nVoltage across: {:s}"
185 "\nTerminal 0 voltage: {:s}"
186 "\nTerminal 1 voltage: {:s}"
187 "\nVirtual Node 1 voltage: {:s}"
188 "\n--- Initialization from powerflow finished ---",
200 "\nTerminal 0 connected to {:s} = sim node {:d}"
201 "\nTerminal 1 connected to {:s} = sim node {:d}",
226 if (
auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
227 mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix);
230 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
234 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
240 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
243 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
267 attributeDependencies.push_back(leftVector);
279 (**mIntfCurrent)(0, 0) = mSubInductor->intfCurrent()(0, 0);
284 (**mIntfVoltage)(0, 0) = 0;
285 (**mIntfVoltage)(0, 0) =
290 SPDLOG_LOGGER_DEBUG(
mSLog,
"Voltage {:s}",
AttributePointer< Attribute< T > > Ptr
void addMNASubComponent(typename SimPowerComp< Complex >::Ptr subc, MNA_SUBCOMP_TASK_ORDER preStepOrder, MNA_SUBCOMP_TASK_ORDER postStepOrder, Bool contributeToRightVector)
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)
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String complexToString(const Complex &num)
static String realToString(const Real &num)
static String phasorToString(const Complex &num)
void mnaUpdateCurrent(const Matrix &leftVector) final
void mnaUpdateVoltage(const Matrix &leftVector) final
Attribute< Matrix >::Ptr mRightVector
void mnaApplyRightSideVectorStamp(Matrix &rightVector) final
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 Real abs(Complex value)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
SimTerminal< Complex >::List mTerminals
SimNode< Complex >::Ptr node(UInt index)
void setVirtualNodeNumber(UInt num)
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)
void setTerminalNumber(UInt num)
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)
#define Q_SNUB_TRANSFORMER
#define P_SNUB_TRANSFORMER
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).