DPsim
Loading...
Searching...
No Matches
EMT_Ph3_PiLine.h
Go to the documentation of this file.
1/* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2 * EONERC, RWTH Aachen University
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 *********************************************************************************/
8
9#pragma once
10
17
18namespace CPS {
19namespace EMT {
20namespace Ph3 {
25class PiLine : public CompositePowerComp<Real>,
26 public MNATearInterface,
27 public Base::Ph3::PiLine,
28 public SharedFactory<PiLine> {
29protected:
32 std::shared_ptr<Inductor> mSubSeriesInductor;
34 std::shared_ptr<Resistor> mSubSeriesResistor;
36 std::shared_ptr<Resistor> mSubParallelResistor0;
37 // Parallel Capacitor submodel at Terminal 0
38 std::shared_ptr<Capacitor> mSubParallelCapacitor0;
40 std::shared_ptr<Resistor> mSubParallelResistor1;
41 // Parallel capacitor submodel at Terminal 1
42 std::shared_ptr<Capacitor> mSubParallelCapacitor1;
44 std::vector<const Matrix *> mRightVectorStamps;
56
57public:
59 PiLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
61 PiLine(String uid, String name, Bool useSubcomponents,
62 Logger::Level logLevel = Logger::Level::off);
63 PiLine(String name, Bool useSubcomponents,
64 Logger::Level logLevel = Logger::Level::off)
65 : PiLine(name, name, useSubcomponents, logLevel) {}
66
67 PiLine(String name, Logger::Level logLevel = Logger::Level::off)
68 : PiLine(name, name, logLevel) {}
69
70 SimPowerComp<Real>::Ptr clone(String copySuffix) override;
71
72 // #### General ####
74 void createSubComponents() override;
76 void initializeParentFromNodesAndTerminals(Real frequency) override;
77 void mnaParentInitialize(Real omega, Real timeStep,
78 Attribute<Matrix>::Ptr leftVector) override;
79 void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
80 void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override;
82 void mnaAddCompactRightSideVectorStamp(Matrix &rightVector) override;
83
84 // #### MNA section ####
86 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
88 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
90 void mnaParentPreStep(Real time, Int timeStepCount) override;
92 void mnaParentPostStep(Real time, Int timeStepCount,
93 Attribute<Matrix>::Ptr &leftVector) override;
96 AttributeBase::List &prevStepDependencies,
97 AttributeBase::List &attributeDependencies,
98 AttributeBase::List &modifiedAttributes) override;
100 void
102 AttributeBase::List &attributeDependencies,
103 AttributeBase::List &modifiedAttributes,
104 Attribute<Matrix>::Ptr &leftVector) override;
105
107 void mnaTearInitialize(Real omega, Real timeStep) override;
108 void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override;
109 void mnaTearApplyVoltageStamp(Matrix &voltageVector) override;
110 void mnaTearPostStep(MatrixComp voltage, MatrixComp current) override;
111};
112} // namespace Ph3
113} // namespace EMT
114} // 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)
PiLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
SimPowerComp< Real >::Ptr clone(String copySuffix) override
DEPRECATED: Delete method.
MatrixFixedSize< 3, 3 > mDirectInductorAdmittance
void mnaAddCompactRightSideVectorStamp(Matrix &rightVector) override
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations.
MatrixFixedSize< 3, 3 > mDirectResistanceConductance
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Updates internal voltage variable of the component.
std::shared_ptr< Resistor > mSubParallelResistor0
Parallel Resistor submodel at Terminal 0.
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
MNAInterface::List mnaTearGroundComponents() override
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
PiLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Updates internal current variable of the component.
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations.
std::shared_ptr< Capacitor > mSubParallelCapacitor1
MatrixFixedSize< 3, 1 > mDirectCapHistory0
MatrixFixedSize< 3, 1 > mDirectInductorHistory
Bool mnaHasCompactRightSideVectorStamp() const override
Composite stamps touch only their cached terminal and virtual-node rows.
std::shared_ptr< Inductor > mSubSeriesInductor
MatrixFixedSize< 3, 3 > mDirectCapAdmittance
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
std::shared_ptr< Capacitor > mSubParallelCapacitor0
Attribute< Matrix >::Ptr mDirectState
MatrixFixedSize< 3, 1 > mDirectCapHistory1
void mnaTearApplyVoltageStamp(Matrix &voltageVector) override
MatrixFixedSize< 3, 1 > mDirectSeriesHistory
std::shared_ptr< Resistor > mSubSeriesResistor
Series Resistor submodel.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
std::vector< const Matrix * > mRightVectorStamps
solver
void mnaTearInitialize(Real omega, Real timeStep) override
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
PiLine(String name, Bool useSubcomponents, Logger::Level logLevel=Logger::Level::off)
void mnaTearPostStep(MatrixComp voltage, MatrixComp current) override
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
std::shared_ptr< Resistor > mSubParallelResistor1
Parallel resistor submodel at Terminal 1.
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: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
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:82
bool Bool
Definition Definitions.h:62
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72