25 SPDLOG_LOGGER_INFO(
mSLog,
"Create {} {}", this->
type(), name);
47 Real defaultParallelCond = 1e-6;
73 std::make_shared<EMT::Ph1::Resistor>(**
mName +
"_con0",
mLogLevel);
82 std::make_shared<EMT::Ph1::Resistor>(**
mName +
"_con1",
mLogLevel);
92 std::make_shared<EMT::Ph1::Capacitor>(**
mName +
"_cap0",
mLogLevel);
101 std::make_shared<EMT::Ph1::Capacitor>(**
mName +
"_cap1",
mLogLevel);
113 Real omega = 2. *
PI * frequency;
117 Complex current = voltage / impedance;
118 (**mIntfVoltage)(0, 0) = voltage.real();
119 (**mIntfCurrent)(0, 0) = current.real();
126 SPDLOG_LOGGER_DEBUG(
mSLog,
130 "\n Impedance: {:s}",
137 "\n--- Initialization from powerflow ---"
138 "\nVoltage across: {:s}"
140 "\nTerminal 0 voltage: {:s}"
141 "\nTerminal 1 voltage: {:s}"
142 "\nVirtual Node 1 voltage: {:s}"
143 "\n--- Initialization from powerflow finished ---",
164 const Real initialSeriesCurrent = (**mIntfCurrent)(0, 0);
165 const Real initialInductorVoltage =
166 (**mIntfVoltage)(0, 0) - **
mSeriesRes * initialSeriesCurrent;
168 initialSeriesCurrent;
174 const Complex capacitorImpedance(0., -1. / (omega * capacitance));
177 const Real current0 = (initial0 / capacitorImpedance).real();
178 const Real current1 = (initial1 / capacitorImpedance).real();
214 const Real shuntAdmittance =
247 attributeDependencies.push_back(leftVector);
258 const Real seriesCurrent = (**mIntfCurrent)(0, 0);
259 const Real inductorVoltage =
260 (**mIntfVoltage)(0, 0) - **
mSeriesRes * seriesCurrent;
265 const Real terminal0Voltage =
269 const Real terminal1Voltage =
283 (**mIntfVoltage)(0, 0) = 0;
285 (**mIntfVoltage)(0, 0) =
288 (**mIntfVoltage)(0, 0) =
306 return gndComponents;
316 return gndComponents;
354 const Real realCurrent = current.real();
355 const Real inductorVoltage = voltage.real() - realCurrent * **
mSeriesRes;
358 (**mIntfVoltage)(0, 0) = voltage.real();
359 (**mIntfCurrent)(0, 0) = realCurrent;
AttributePointer< Attribute< T > > Ptr
const Attribute< Real >::Ptr mParallelCap
Capacitance in parallel to the line [F].
const Attribute< Real >::Ptr mParallelCond
Conductance in parallel to the line [S].
const Attribute< Real >::Ptr mSeriesInd
Inductance along the line [H].
const Attribute< Real >::Ptr mSeriesRes
Resistance along the line [ohms].
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)
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
Real mDirectInductorHistory
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
Real mDirectCapacitorHistory1
Real mDirectShuntConductance
std::shared_ptr< Inductor > mSubSeriesInductor
MNAInterface::List mnaTearGroundComponents() override
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
void mnaTearPostStep(Complex voltage, Complex current) override
Real mDirectCapacitorConductance
Bool mUseSubcomponents
Select the legacy component hierarchy or direct parent MNA stamps.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaTearApplyVoltageStamp(Matrix &voltageVector) override
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
Real mDirectInductorConductance
Companion-model coefficients used when subcomponents are disabled.
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
std::shared_ptr< Capacitor > mSubParallelCapacitor0
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
std::shared_ptr< Resistor > mSubSeriesResistor
Series Resistor submodel.
Real mDirectSeriesConductance
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
Real mDirectSeriesHistory
SimPowerComp< Real >::Ptr clone(String copySuffix) override
DEPRECATED: Delete method.
std::shared_ptr< Capacitor > mSubParallelCapacitor1
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void mnaTearInitialize(Real omega, Real timeStep) override
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
Real mDirectCapacitorHistory0
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 void stampConductance(Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
static Real realFromVectorElement(const Matrix &mat, Matrix::Index row)
static void addToVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0)
static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Real > >::Ptr mIntfCurrent
SimTerminal< Real >::List mTerminals
void setVirtualNodeNumber(UInt num)
const Attribute< MatrixVar< Real > >::Ptr mIntfVoltage
std::shared_ptr< SimPowerComp< VarType > > Ptr
SimNode< Real >::List mVirtualNodes
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void updateMatrixNodeIndices()
void setTerminalNumber(UInt num)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
static std::shared_ptr< PiLine > make(Args &&...args)
#define RMS3PH_TO_PEAK1PH
#define PEAK1PH_TO_RMS3PH
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).