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
59 std::shared_ptr<Inductor> mSubInductor;
61 std::shared_ptr<Resistor> mSubResistor;
63 std::shared_ptr<Resistor> mInitialResistor;
64
65public:
68 const Attribute<Real>::Ptr mInductance;
69
71 const Attribute<Real>::Ptr mActivePowerInjection;
73 const Attribute<Real>::Ptr mReactivePowerInjection;
74
75 // #### Power flow results ####
77 const Attribute<MatrixComp>::Ptr mCurrent;
78
80 const Attribute<Matrix>::Ptr mActivePowerBranch;
81
83 const Attribute<Matrix>::Ptr mReactivePowerBranch;
84
85 // #### constructors ####
86 // power flow
87
89 RXLine(String uid, String name, Real baseVoltage, Real resistance,
90 Real inductance, Logger::Level logLevel = Logger::Level::off);
91 // MNA
93 RXLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
95 RXLine(String name, Logger::Level logLevel = Logger::Level::off)
96 : RXLine(name, name, logLevel) {}
97
98 // #### General ####
100 void setPerUnitSystem(Real baseApparentPower, Real baseOmega);
103
104 // #### Powerflow section ####
106 Real getBaseVoltage() const;
108 void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y) override;
110 void updateBranchFlow(VectorComp &current, VectorComp &powerflow);
112 void storeNodalInjection(Complex powerInjection);
113
114 // #### Getter ####
116 MatrixComp Y_element();
117
118 // #### MNA Section ####
119
120 SimPowerComp<Complex>::Ptr clone(String name) override;
121
122 // #### General ####
124 void initializeFromNodesAndTerminals(Real frequency) override;
125
126 // #### MNA section ####
127 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
128 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
129
130 void mnaParentPreStep(Real time, Int timeStepCount) override;
131 void mnaParentPostStep(Real time, Int timeStepCount,
132 Attribute<Matrix>::Ptr &leftVector) override;
133
134 void mnaParentAddPreStepDependencies(
135 AttributeBase::List &prevStepDependencies,
136 AttributeBase::List &attributeDependencies,
137 AttributeBase::List &modifiedAttributes) override;
138 void
139 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
140 AttributeBase::List &attributeDependencies,
141 AttributeBase::List &modifiedAttributes,
142 Attribute<Matrix>::Ptr &leftVector) override;
143};
144} // namespace Ph1
145} // namespace SP
146} // 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.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
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.
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.
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
Inductance submodel.
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