DPsim
Loading...
Searching...
No Matches
DP_Ph3_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 Ph3 {
22class PiLine : public CompositePowerComp<Complex>,
23 public MNATearInterface,
24 public Base::Ph3::PiLine,
25 public SharedFactory<PiLine> {
26protected:
29 std::shared_ptr<Inductor> mSubSeriesInductor;
31 std::shared_ptr<Resistor> mSubSeriesResistor;
33 std::shared_ptr<Resistor> mSubParallelResistor0;
34 // Parallel Capacitor submodel at Terminal 0
35 std::shared_ptr<Capacitor> mSubParallelCapacitor0;
37 std::shared_ptr<Resistor> mSubParallelResistor1;
39 std::shared_ptr<Capacitor> mSubParallelCapacitor1;
41 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(MatrixComp voltage, MatrixComp current) override;
83};
84} // namespace Ph3
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< Resistor > mSubSeriesResistor
Series Resistor submodel.
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void mnaTearInitialize(Real omega, Real timeStep) override
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
void mnaTearPostStep(MatrixComp voltage, MatrixComp current) override
std::shared_ptr< Capacitor > mSubParallelCapacitor1
Parallel capacitor submodel at Terminal 1.
std::shared_ptr< Capacitor > mSubParallelCapacitor0
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
std::vector< const Matrix * > mRightVectorStamps
Right side vectors of subcomponents.
void mnaTearApplyVoltageStamp(Matrix &voltageVector) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
SimPowerComp< Complex >::Ptr clone(String copySuffix) override
DEPRECATED: Remove method.
std::shared_ptr< Inductor > mSubSeriesInductor
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
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 createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
MNAInterface::List mnaTearGroundComponents() override
PiLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
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
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:84
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74