DPsim
Loading...
Searching...
No Matches
EMT_Ph3_HalfDecouplingLine.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
2// SPDX-License-Identifier: MPL-2.0
3#pragma once
9
10namespace CPS {
11namespace EMT {
12namespace Ph3 {
18 public SharedFactory<HalfDecouplingLine> {
19protected:
22 Matrix mResistance = Matrix::Zero(3, 3);
23 Matrix mInductance = Matrix::Zero(3, 3);
24 Matrix mCapacitance = Matrix::Zero(3, 3);
26 Matrix mSurgeImpedance = Matrix::Zero(3, 3);
28 Matrix mSrcResInverse = Matrix::Zero(3, 3);
29 Matrix mSrcResSquaredInverse = Matrix::Zero(3, 3);
30
31 // ### Electrical Subcomponents ###
33 std::shared_ptr<EMT::Ph3::ControlledCurrentSource> mSubCtrledCurrentSource;
35 std::shared_ptr<EMT::Ph3::Resistor> mSubRes;
37
43
46
47public:
48 typedef std::shared_ptr<HalfDecouplingLine> Ptr;
49
62
64 HalfDecouplingLine(String name, Logger::Level logLevel = Logger::Level::off)
65 : HalfDecouplingLine(name, name, logLevel) {}
66
68 Logger::Level logLevel = Logger::Level::off);
70 HalfDecouplingLine(String uid, String name, Bool useSubcomponents,
71 Logger::Level logLevel = Logger::Level::off);
73 Logger::Level logLevel = Logger::Level::off)
74 : HalfDecouplingLine(name, name, useSubcomponents, logLevel) {}
75
76 // #### General ####
78 void setParameters(Matrix resistance, Matrix inductance, Matrix capacitance);
82 Attribute<Matrix>::Ptr receivingCur);
84 void createSubComponents() override;
85 void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
86 void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override;
88 void initializeParentFromNodesAndTerminals(Real frequency) override;
89
91 void step(Real time, Int timeStepCount);
93 void postStep();
94
95 // #### MNA section ####
97 void mnaParentInitialize(Real omega, Real timeStep,
98 Attribute<Matrix>::Ptr leftVector) override;
100 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
102 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
104 void mnaParentPreStep(Real time, Int timeStepCount) override;
106 void mnaParentPostStep(Real time, Int timeStepCount,
107 Attribute<Matrix>::Ptr &leftVector) override;
110 AttributeBase::List &prevStepDependencies,
111 AttributeBase::List &attributeDependencies,
112 AttributeBase::List &modifiedAttributes) override;
114 void
116 AttributeBase::List &attributeDependencies,
117 AttributeBase::List &modifiedAttributes,
118 Attribute<Matrix>::Ptr &leftVector) override;
119};
120} // namespace Ph3
121} // namespace EMT
122} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
const Attribute< Matrix >::Ptr mSrcCtrledCurrent
History current fed into the controlled current source.
Real mDelay
Travel time of the whole line.
std::shared_ptr< EMT::Ph3::ControlledCurrentSource > mSubCtrledCurrentSource
Controlled current source carrying the history term.
Matrix mSurgeImpedance
Surge impedance, sqrt(L/C)
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
std::shared_ptr< HalfDecouplingLine > Ptr
const Attribute< Matrix >::Ptr mReceivingCur
Far-end current one travel time ago, supplied by the other half.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
void createSubComponents() override
Creates the terminating resistor and the history current source.
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Sizes the ring buffers and seeds them from the steady state.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
const Attribute< Matrix >::Ptr mReceivingVolt
Far-end voltage one travel time ago, supplied by the other half.
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
MatrixFixedSize< 3, 1 > interpolate(const Matrix &data) const
Reads a ring buffer one travel time back.
const Attribute< Matrix >::Ptr mSendingVolt
This end's voltage one travel time ago, for the other half to read.
HalfDecouplingLine(String name, Bool useSubcomponents, Logger::Level logLevel=Logger::Level::off)
void setParameters(Matrix resistance, Matrix inductance, Matrix capacitance)
Line data. Give the parameters of the whole line, not of this half.
std::shared_ptr< EMT::Ph3::Resistor > mSubRes
Terminating impedance calculated from line parameters.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
HalfDecouplingLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
void initializeParentFromNodesAndTerminals(Real frequency) override
Seeds the interface quantities and the sending attributes.
const Attribute< Matrix >::Ptr mSrcRes
Terminating resistance.
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
Matrix mVoltBuf
Ring buffers for the values of previous timesteps, one row per stored step.
const Attribute< Matrix >::Ptr mSendingCur
This end's current one travel time ago, for the other half to read.
Matrix mSrcResInverse
Constant inverses used by the half-line history source update.
void step(Real time, Int timeStepCount)
Updates the history current from the exchanged quantities.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void setCouplingSource(Attribute< Matrix >::Ptr receivingVolt, Attribute< Matrix >::Ptr receivingCur)
void postStep()
Records this end's quantities and publishes them one travel time delayed.
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
struct dps_magma_data data
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::Matrix< Real, rows, cols, Eigen::ColMajor > MatrixFixedSize
Dense matrix for real numbers with fixed dimension.
Definition Definitions.h:99
double Real
Definition Definitions.h:60
int Int
Definition Definitions.h:59
bool Bool
Definition Definitions.h:62
unsigned int UInt
Definition Definitions.h:58
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72