DPsim
Loading...
Searching...
No Matches
SP_Ph1_RXLine.h
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
11#include "dpsim-models/Solver/PFSolverInterfaceBranch.h"
12#include <dpsim-models/Base/Base_Ph1_PiLine.h>
13#include <dpsim-models/CompositePowerComp.h>
14#include <dpsim-models/SP/SP_Ph1_Inductor.h>
15#include <dpsim-models/SP/SP_Ph1_Resistor.h>
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 ####
56 MatrixComp mY_element;
57
60 std::shared_ptr<Inductor> mSubInductor;
62 std::shared_ptr<Resistor> mSubResistor;
64 std::shared_ptr<Resistor> mInitialResistor;
65
66public:
69 const Attribute<Real>::Ptr mInductance;
70
72 const Attribute<Real>::Ptr mActivePowerInjection;
74 const Attribute<Real>::Ptr mReactivePowerInjection;
75
76 // #### Power flow results ####
78 const Attribute<MatrixComp>::Ptr mCurrent;
79
81 const Attribute<Matrix>::Ptr mActivePowerBranch;
82
84 const Attribute<Matrix>::Ptr mReactivePowerBranch;
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;
109 void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override;
111 void updateBranchFlow(VectorComp &current, VectorComp &powerflow);
113 void storeNodalInjection(Complex powerInjection);
114
115 // #### Getter ####
117 MatrixComp Y_element();
118
119 // #### MNA Section ####
120
121 SimPowerComp<Complex>::Ptr clone(String name) override;
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
137 void mnaParentAddPreStepDependencies(
138 AttributeBase::List &prevStepDependencies,
139 AttributeBase::List &attributeDependencies,
140 AttributeBase::List &modifiedAttributes) override;
141 void
142 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
143 AttributeBase::List &attributeDependencies,
144 AttributeBase::List &modifiedAttributes,
145 Attribute<Matrix>::Ptr &leftVector) override;
146};
147} // namespace Ph1
148} // namespace SP
149} // namespace CPS
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
String uid()
Returns unique id.
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.
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]
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 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.
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