DPsim
Loading...
Searching...
No Matches
SP_Ph1_Resistor.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
13#include <dpsim-models/Logger.h>
17
18namespace CPS {
19namespace SP {
20namespace Ph1 {
22class Resistor : public MNASimPowerComp<Complex>,
24 public MNATearInterface,
25 public SharedFactory<Resistor>,
27
28private:
30 Real mBaseApparentPower;
32 Real mBaseImpedance;
34 Real mBaseAdmittance;
36 Real mBaseVoltage;
38 Real mBaseCurrent;
39
41 Real mResistancePerUnit;
43 Real mConductancePerUnit;
44
45public:
48 Logger::Level logLevel = Logger::Level::off);
50 Resistor(String name, Logger::Level logLevel = Logger::Level::off)
51 : Resistor(name, name, logLevel) {}
52
54
55 // #### General ####
58
59 // #### Powerflow section ####
61 void setBaseVoltage(Real baseVoltage);
63 void calculatePerUnitParameters(Real baseApparentPower);
66
67 // #### MNA section ####
69 void mnaCompInitialize(Real omega, Real timeStep,
70 Attribute<Matrix>::Ptr leftVector);
74 void mnaCompUpdateVoltage(const Matrix &leftVector);
76 void mnaCompUpdateCurrent(const Matrix &leftVector);
78 void mnaCompPostStep(Real time, Int timeStepCount,
79 Attribute<Matrix>::Ptr &leftVector);
81 void
83 AttributeBase::List &attributeDependencies,
84 AttributeBase::List &modifiedAttributes,
85 Attribute<Matrix>::Ptr &leftVector);
86
87 // #### MNA Tear Section ####
89};
90} // namespace Ph1
91} // namespace SP
92} // 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)
Common base class of all Component templates.
void mnaCompUpdateCurrent(const Matrix &leftVector)
Update interface current from MNA system result.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)
add MNA pre and post step dependencies
SimPowerComp< Complex >::Ptr clone(String name)
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector)
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)
MNA pre and post step operations.
void mnaCompUpdateVoltage(const Matrix &leftVector)
Update interface voltage from MNA system result.
Resistor(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
void setBaseVoltage(Real baseVoltage)
Set base voltage.
Resistor(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix)
void initializeFromNodesAndTerminals(Real frequency)
Initializes component from power flow data.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix)
Stamps system matrix.
void pfApplyAdmittanceMatrixStamp(SparseMatrixCompRow &Y)
Stamps admittance matrix.
void calculatePerUnitParameters(Real baseApparentPower)
Initializes component from power flow data.
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
int Int
Definition Definitions.h:61
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74