DPsim
Loading...
Searching...
No Matches
DP_Ph1_PiLine.h
Go to the documentation of this file.
1/* Author: Christoph Wirtz <christoph.wirtz@fgh-ma.de>
2 * SPDX-FileCopyrightText: 2025 FGH e.V.
3 * SPDX-License-Identifier: MPL-2.0
4 */
5
6#pragma once
7
14
15namespace CPS {
16namespace DP {
17namespace Ph1 {
22class PiLine : public CompositePowerComp<Complex>,
23 public MNATearInterface,
24 public Base::Ph1::PiLine,
25 public SharedFactory<PiLine> {
26protected:
28 std::shared_ptr<Inductor> mSubSeriesInductor;
30 std::shared_ptr<Resistor> mSubSeriesResistor;
32 std::shared_ptr<Resistor> mSubParallelResistor0;
33 // Parallel Capacitor submodel at Terminal 0
34 std::shared_ptr<Capacitor> mSubParallelCapacitor0;
36 std::shared_ptr<Resistor> mSubParallelResistor1;
38 std::shared_ptr<Capacitor> mSubParallelCapacitor1;
40 std::vector<const Matrix *> mRightVectorStamps;
42
43public:
45 PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
47 PiLine(String name, Logger::Level logLevel = Logger::Level::off)
48 : PiLine(name, name, logLevel) {}
49
50 SimPowerComp<Complex>::Ptr clone(String copySuffix) override;
51
52 // #### General ####
54 void createSubComponents() override;
56 void initializeParentFromNodesAndTerminals(Real frequency) override;
57
58 // #### MNA section ####
60 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
62 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
64 void mnaParentPreStep(Real time, Int timeStepCount) override;
65 void mnaParentPostStep(Real time, Int timeStepCount,
66 Attribute<Matrix>::Ptr &leftVector) override;
69 AttributeBase::List &prevStepDependencies,
70 AttributeBase::List &attributeDependencies,
71 AttributeBase::List &modifiedAttributes) override;
72 void
74 AttributeBase::List &attributeDependencies,
75 AttributeBase::List &modifiedAttributes,
76 Attribute<Matrix>::Ptr &leftVector) override;
77
79 void mnaTearInitialize(Real omega, Real timeStep) override;
80 void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override;
81 void mnaTearApplyVoltageStamp(Matrix &voltageVector) override;
82 void mnaTearPostStep(Complex voltage, Complex current) override;
83};
84} // namespace Ph1
85} // namespace DP
86} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre and post step operations.
std::shared_ptr< Capacitor > mSubParallelCapacitor1
Parallel capacitor submodel at Terminal 1.
SimPowerComp< Complex >::Ptr clone(String copySuffix) override
DEPRECATED: Remove method.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
std::shared_ptr< Resistor > mSubSeriesResistor
Series Resistor submodel.
std::shared_ptr< Inductor > mSubSeriesInductor
Series Inductance submodel.
PiLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
True after createSubComponents() runs; prevents double-construction.
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
MNAInterface::List mnaTearGroundComponents() override
void mnaTearApplyVoltageStamp(Matrix &voltageVector) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
void mnaTearPostStep(Complex voltage, Complex current) override
std::vector< const Matrix * > mRightVectorStamps
Right side vectors of subcomponents.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
std::shared_ptr< Capacitor > mSubParallelCapacitor0
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
add MNA pre and post step dependencies
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
void mnaTearInitialize(Real omega, Real timeStep) override
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
std::vector< Ptr > List
std::shared_ptr< SimPowerComp< VarType > > Ptr
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
std::complex< Real > Complex
Definition Definitions.h:63
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74