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);
27
28 // ### Electrical Subcomponents ###
30 std::shared_ptr<EMT::Ph3::ControlledCurrentSource> mSubCtrledCurrentSource;
32 std::shared_ptr<EMT::Ph3::Resistor> mSubRes;
33
39
42
43public:
44 typedef std::shared_ptr<HalfDecouplingLine> Ptr;
45
58
60 HalfDecouplingLine(String name, Logger::Level logLevel = Logger::Level::off)
61 : HalfDecouplingLine(name, name, logLevel) {}
62
64 Logger::Level logLevel = Logger::Level::off);
65
66 // #### General ####
68 void setParameters(Matrix resistance, Matrix inductance, Matrix capacitance);
72 Attribute<Matrix>::Ptr receivingCur);
74 void createSubComponents() override;
76 void initializeParentFromNodesAndTerminals(Real frequency) override;
77
79 void step(Real time, Int timeStepCount);
81 void postStep();
82
83 // #### MNA section ####
85 void mnaParentInitialize(Real omega, Real timeStep,
86 Attribute<Matrix>::Ptr leftVector) override;
88 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
90 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
92 void mnaParentPreStep(Real time, Int timeStepCount) override;
94 void mnaParentPostStep(Real time, Int timeStepCount,
95 Attribute<Matrix>::Ptr &leftVector) override;
98 AttributeBase::List &prevStepDependencies,
99 AttributeBase::List &attributeDependencies,
100 AttributeBase::List &modifiedAttributes) override;
102 void
104 AttributeBase::List &attributeDependencies,
105 AttributeBase::List &modifiedAttributes,
106 Attribute<Matrix>::Ptr &leftVector) override;
107};
108} // namespace Ph3
109} // namespace EMT
110} // 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)
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.
const Attribute< Matrix >::Ptr mSendingVolt
This end's voltage one travel time ago, for the other half to read.
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.
Matrix mVoltBuf
Ring buffers for the values of previous timesteps, one row per stored step.
Matrix interpolate(Matrix &data)
Reads a ring buffer one travel time back.
const Attribute< Matrix >::Ptr mSendingCur
This end's current one travel time ago, for the other half to read.
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:81
std::string String
Definition Definitions.h:65
double Real
Definition Definitions.h:62
int Int
Definition Definitions.h:61
unsigned int UInt
Definition Definitions.h:60