DPsim
Loading...
Searching...
No Matches
SP_Ph3_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 Ph3 {
20
21class RxLine : public MNASimPowerComp<Real>,
22 public Base::Ph3::PiLine,
23 public SharedFactory<RxLine> {
24protected:
30 std::shared_ptr<Inductor> mSubInductor;
32 std::shared_ptr<Resistor> mSubResistor;
34 std::shared_ptr<Resistor> mInitialResistor;
35
36public:
38 RxLine(String uid, String name, Logger::Level logLevel = Logger::Level::off);
40 RxLine(String name, Logger::Level logLevel = Logger::Level::off)
41 : RxLine(name, name, logLevel) {}
42
44
45 // #### General ####
48
49 // #### MNA section ####
51 void mnaCompInitialize(Real omega, Real timeStep,
52 Attribute<Matrix>::Ptr leftVector);
59 void mnaCompUpdateVoltage(const Matrix &leftVector);
60 void mnaCompUpdateCurrent(const Matrix &leftVector);
61
64 AttributeBase::List &prevStepDependencies,
65 AttributeBase::List &attributeDependencies,
66 AttributeBase::List &modifiedAttributes) override;
68 AttributeBase::List &attributeDependencies,
69 AttributeBase::List &modifiedAttributes) {
70 mAttributeDependencies.push_back(
71 line.mSubResistor->attribute("right_vector"));
72 mAttributeDependencies.push_back(
73 line.mSubInductor->attribute("right_vector"));
74 mModifiedAttributes.push_back(line.attribute("right_vector"));
75 }
76
78 void
80 AttributeBase::List &attributeDependencies,
81 AttributeBase::List &modifiedAttributes,
82 Attribute<Matrix>::Ptr &leftVector) override;
83 void
85 AttributeBase::List &attributeDependencies,
86 AttributeBase::List &modifiedAttributes,
87 Attribute<Matrix>::Ptr &leftVector) {
88 mAttributeDependencies.push_back(leftVector);
89 mAttributeDependencies.push_back(line.mSubInductor->attribute("i_intf"));
90 mModifiedAttributes.push_back(line.attribute("i_intf"));
91 mModifiedAttributes.push_back(line.attribute("v_intf"));
92 }
93};
94} // namespace Ph3
95} // namespace SP
96} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void initializeFromNodesAndTerminals(Real frequency)
Initializes component from power flow data.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)
void mnaCompUpdateCurrent(const Matrix &leftVector)
SimPowerComp< Real >::Ptr clone(String name)
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector)
Stamps right side (source) vector.
void mnaApplyInitialSystemMatrixStamp(SparseMatrixRow &systemMatrix)
Stamps system matrix.
RxLine(String name, Logger::Level logLevel=Logger::Level::off)
Defines name, component parameters and logging level.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)
Initializes internal variables of the component.
std::shared_ptr< Resistor > mInitialResistor
Inductor end to ground resistor to facilitate initialization.
RxLine(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name, logging level.
Matrix mVoltage
Voltage across the component [V].
void mnaCompUpdateVoltage(const Matrix &leftVector)
std::shared_ptr< Inductor > mSubInductor
Inductance submodel.
Matrix mCurrent
Current through the component [A].
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix)
Stamps system matrix.
std::shared_ptr< Resistor > mSubResistor
Resistor submodel.
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
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74