15 Bool withResistiveLosses)
19 if (withResistiveLosses)
26 SPDLOG_LOGGER_INFO(
mSLog,
"Create {} {}", this->
type(), name);
41 Real nomVoltageEnd2,
Real ratedPower,
47 ratedPower, ratioAbs, ratioPhase,
48 resistance, inductance);
51 mSLog,
"Nominal Voltage End 1 = {} [V] Nominal Voltage End 2 = {} [V]",
54 SPDLOG_LOGGER_INFO(
mSLog,
"Tap Ratio = {} [ ] Phase Shift = {} [deg]",
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]",
107 mSnubberResistance1 =
110 std::make_shared<EMT::Ph3::Resistor>(**
mName +
"_snub_res1",
mLogLevel);
111 mSubSnubResistor1->setParameters(mSnubberResistance1);
115 "Snubber Resistance 1 (connected to higher voltage side {}) = {} [Ohm]",
123 mSnubberResistance2 =
126 std::make_shared<EMT::Ph3::Resistor>(**
mName +
"_snub_res2",
mLogLevel);
127 mSubSnubResistor2->setParameters(mSnubberResistance2);
131 "Snubber Resistance 2 (connected to lower voltage side {}) = {} [Ohm]",
139 std::make_shared<EMT::Ph3::Capacitor>(**
mName +
"_snub_cap2",
mLogLevel);
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]",
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]",
202 MatrixComp iInit = impedance.inverse() * vInitABC;
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 ---",
230 "\nTerminal 0 connected to {:s} = sim node {:d}"
231 "\nTerminal 1 connected to {:s} = sim node {:d}",
283 if (
auto mnasubcomp = std::dynamic_pointer_cast<MNAInterface>(subcomp))
284 mnasubcomp->mnaApplySystemMatrixStamp(systemMatrix);
287 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
291 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
295 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
300 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
304 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
308 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
314 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
317 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
320 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
324 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
328 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
332 SPDLOG_LOGGER_INFO(
mSLog,
"Add {:s} to system at ({:d},{:d})",
357 attributeDependencies.push_back(leftVector);
376 (**mIntfVoltage)(0, 0) =
378 (**mIntfVoltage)(1, 0) =
380 (**mIntfVoltage)(2, 0) =
384 (**mIntfVoltage)(0, 0) =
387 (**mIntfVoltage)(1, 0) =
390 (**mIntfVoltage)(2, 0) =
AttributePointer< Attribute< T > > Ptr
void addMNASubComponent(typename SimPowerComp< Real >::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)
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String complexToString(const Complex &num)
static String matrixToString(const Matrix &mat)
static String phasorToString(const Complex &num)
Attribute< Matrix >::Ptr mRightVector
static Real realFromVectorElement(const Matrix &mat, Matrix::Index row)
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.
static Real abs(Complex value)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Real > >::Ptr mIntfCurrent
SimTerminal< Real >::List mTerminals
SimNode< Real >::Ptr node(UInt index)
void setVirtualNodeNumber(UInt num)
const Attribute< MatrixVar< Real > >::Ptr mIntfVoltage
std::shared_ptr< SimPowerComp< VarType > > Ptr
SimNode< Real >::List mVirtualNodes
std::vector< std::shared_ptr< SimPowerComp< Real > > > 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 RMS3PH_TO_PEAK1PH
#define P_SNUB_TRANSFORMER
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).