DPsim
Loading...
Searching...
No Matches
SP_Ph1_RXLine.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
16
17namespace CPS {
18namespace SP {
19namespace Ph1 {
20
21class RXLine : public CompositePowerComp<Complex>,
22 public SharedFactory<RXLine>,
24 public Base::Ph1::PiLine {
25private:
27 Real mBaseVoltage;
28
29protected:
47
54
55 // #### Admittance matrix stamp ####
57
60 std::shared_ptr<Inductor> mSubInductor;
62 std::shared_ptr<Resistor> mSubResistor;
64 std::shared_ptr<Resistor> mInitialResistor;
65
66public:
70
75
76 // #### Power flow results ####
79
82
85
86 // #### constructors ####
87 // power flow
88
90 RXLine(String uid, String name, Real baseVoltage, Real resistance,
91 Real inductance, Logger::Level logLevel = Logger::Level::off);
92 // MNA
94 RXLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
96 RXLine(String name, Logger::Level logLevel = Logger::Level::off)
97 : RXLine(name, name, logLevel) {}
98
99 // #### General ####
101 void setPerUnitSystem(Real baseApparentPower, Real baseOmega);
104
105 // #### Powerflow section ####
107 Real getBaseVoltage() const;
111 void updateBranchFlow(VectorComp &current, VectorComp &powerflow);
113 void storeNodalInjection(Complex powerInjection);
114
115 // #### Getter ####
118
119 // #### MNA Section ####
120
122
123 // #### General ####
125 void createSubComponents() override;
127 void initializeParentFromNodesAndTerminals(Real frequency) override;
128
129 // #### MNA section ####
130 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
131 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
132
133 void mnaParentPreStep(Real time, Int timeStepCount) override;
134 void mnaParentPostStep(Real time, Int timeStepCount,
135 Attribute<Matrix>::Ptr &leftVector) override;
136
138 AttributeBase::List &prevStepDependencies,
139 AttributeBase::List &attributeDependencies,
140 AttributeBase::List &modifiedAttributes) override;
141 void
143 AttributeBase::List &attributeDependencies,
144 AttributeBase::List &modifiedAttributes,
145 Attribute<Matrix>::Ptr &leftVector) override;
146};
147} // namespace Ph1
148} // namespace SP
149} // 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)
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
Common base class of all Component templates.
std::shared_ptr< Resistor > mInitialResistor
Inductor end to ground resistor to facilitate initialization.
const Attribute< Real >::Ptr mInductance
RXLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name, component parameters and logging level.
Real getBaseVoltage() const
Get base voltage.
Real mBaseApparentPower
base apparent power [VA]
void transformParametersToPerUnitSystem()
Transform component parameters to the specified per-unit system.
void initializeParentFromNodesAndTerminals(Real frequency) override
Derives values from power flow data and pushes them to subcomponents.
Real mParallelCapPerUnit
Capacitance of the line in [pu].
std::shared_ptr< Resistor > mSubResistor
Resistor submodel.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
const Attribute< Real >::Ptr mActivePowerInjection
nodal active power injection
SimPowerComp< Complex >::Ptr clone(String name) override
DEPRECATED: Delete method.
void createSubComponents() override
Constructs and registers MNA subcomponents; idempotent.
Real mSeriesResPerUnit
resistance in [pu]
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Real mBaseAdmittance
base admittance [S]
Real mBaseImpedance
base impedance [Ohm]
void setPerUnitSystem(Real baseApparentPower, Real baseOmega)
Specify per-unit system by base voltage, base apparent power and omega (rms value for voltage expecte...
const Attribute< Matrix >::Ptr mActivePowerBranch
branch active powerflow [W], coef(0) has data from node 0, coef(1) from node 1.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override
Stamps admittance matrix.
void updateBranchFlow(VectorComp &current, VectorComp &powerflow)
updates branch current and power flow, input pu value, update with real value
const Attribute< MatrixComp >::Ptr mCurrent
branch Current flow [A], coef(0) has data from node 0, coef(1) from node 1.
Real mBaseInductance
base inductance [H]
const Attribute< Matrix >::Ptr mReactivePowerBranch
branch reactive powerflow [Var], coef(0) has data from node 0, coef(1) from node 1.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
RXLine(String uid, String name, Real baseVoltage, Real resistance, Real inductance, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, base voltage, component parameters and logging level.
const Attribute< Real >::Ptr mReactivePowerInjection
nodal reactive power injection
Real mSeriesIndPerUnit
Inductance of the line in [pu].
std::shared_ptr< Inductor > mSubInductor
Real mBaseCapacitance
base capacitance [F]
Real mBaseCurrent
base current [V]
Real mBaseOmega
base omega [1/s]
void storeNodalInjection(Complex powerInjection)
stores nodal injection power in this line object
MatrixComp Y_element()
get admittance matrix
void mnaParentPreStep(Real time, Int timeStepCount) override
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
Eigen::SparseMatrix< Complex, Eigen::RowMajor > SparseMatrixCompRow
Sparse matrix for complex numbers (row major).
Definition Definitions.h:78
double Real
Definition Definitions.h:62
Eigen::Matrix< Complex, Eigen::Dynamic, 1 > VectorComp
Dense vector for complex numbers.
Definition Definitions.h:68
int Int
Definition Definitions.h:61
std::complex< Real > Complex
Definition Definitions.h:63
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:84