DPsim
Loading...
Searching...
No Matches
DP_Ph1_SVC.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
18
19namespace CPS {
20namespace DP {
21namespace Ph1 {
30class SVC : public CompositePowerComp<Complex>,
31 public Base::Ph1::SVC,
33 public SharedFactory<SVC> {
34protected:
37 std::shared_ptr<DP::Ph1::Inductor> mSubInductor;
38 std::shared_ptr<DP::Ph1::Switch> mSubInductorSwitch;
40 std::shared_ptr<DP::Ph1::Capacitor> mSubCapacitor;
41 std::shared_ptr<DP::Ph1::Switch> mSubCapacitorSwitch;
42
45
46 // has state changed? (allow this only once)
47 // could be redundant with internal status of switch element (mnaIsClosed)
52
54
55 // values of PT1 for measurement of voltage at PCC
56 Real mTm = 0.01;
57 Real mKm = 1;
60
61 // variables for protection
82
83public:
86
88 SVC(String uid, String name, Logger::Level logLevel = Logger::Level::off);
89 SVC(String uid, String name, Bool useSubcomponents,
90 Logger::Level logLevel = Logger::Level::off);
91 SVC(String name, Bool useSubcomponents,
92 Logger::Level logLevel = Logger::Level::off)
93 : SVC(name, name, useSubcomponents, logLevel) {}
94
95 SVC(String name, Logger::Level logLevel = Logger::Level::off)
96 : SVC(name, name, logLevel) {}
97
98 // #### General ####
100 void createSubComponents() override;
102 void initializeParentFromNodesAndTerminals(Real frequency) override;
103 void mnaParentInitialize(Real omega, Real timeStep,
104 Attribute<Matrix>::Ptr leftVector) override;
105 void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
106 void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override;
107
108 // #### MNA section ####
110 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
112 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
114 void mnaParentPreStep(Real time, Int timeStepCount) override;
116 void mnaParentPostStep(Real time, Int timeStepCount,
117 Attribute<Matrix>::Ptr &leftVector) override;
120 AttributeBase::List &prevStepDependencies,
121 AttributeBase::List &attributeDependencies,
122 AttributeBase::List &modifiedAttributes) override;
124 void
126 AttributeBase::List &attributeDependencies,
127 AttributeBase::List &modifiedAttributes,
128 Attribute<Matrix>::Ptr &leftVector) override;
129
130 // #### Variable component interface ####
131 Bool hasParameterChanged() override { return mValueChange; }
132
133 // #### Tearing methods ####
135 void setSwitchState();
136
137 void updateSusceptance();
139 // check protection function
140 void checkProtection(Real time);
141};
142} // namespace Ph1
143} // namespace DP
144} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
Static VAR compensator (SVC)
CompositePowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
void initializeParentFromNodesAndTerminals(Real frequency) override
Initializes states from power flow data (parent-specific part).
void mnaParentPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MNA post step operations (parent-specific)
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface current from MNA system results.
Bool mDirectCapacitorClosed
Definition DP_Ph1_SVC.h:67
SVC(String name, Bool useSubcomponents, Logger::Level logLevel=Logger::Level::off)
Definition DP_Ph1_SVC.h:91
MatrixComp mDirectInductorAdmittance
Definition DP_Ph1_SVC.h:71
const Attribute< Real >::Ptr mVpcc
Definition DP_Ph1_SVC.h:84
void createSubComponents() override
Constructs subcomponents; idempotent.
std::shared_ptr< DP::Ph1::Capacitor > mSubCapacitor
Internal capacitor.
Definition DP_Ph1_SVC.h:40
std::shared_ptr< DP::Ph1::Switch > mSubCapacitorSwitch
Definition DP_Ph1_SVC.h:41
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system results.
MatrixComp mDirectCapacitorCurrent
Definition DP_Ph1_SVC.h:78
MatrixComp mDirectCapacitorAdmittance
Definition DP_Ph1_SVC.h:76
const Attribute< Real >::Ptr mVmeasPrev
Definition DP_Ph1_SVC.h:85
Bool mDirectInductorClosed
Definition DP_Ph1_SVC.h:66
void updateDirectCompanions()
void mechanicalModelUpdateSusceptance(Real time)
void mnaParentInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void mnaParentApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
MatrixComp mDirectInductorPrevCurrentFactor
Definition DP_Ph1_SVC.h:72
void mnaParentApplyRightSideVectorStamp(Matrix &rightVector) override
void checkProtection(Real time)
std::shared_ptr< DP::Ph1::Inductor > mSubInductor
Internal inductor.
Definition DP_Ph1_SVC.h:37
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
Definition DP_Ph1_SVC.h:131
MatrixComp mDirectInductorCurrent
Definition DP_Ph1_SVC.h:73
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
add MNA post step dependencies (parent-specific)
MatrixComp mDirectCapacitorPrevVoltageFactor
Definition DP_Ph1_SVC.h:77
MatrixComp mDirectInductorHistory
Definition DP_Ph1_SVC.h:75
SVC(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and log level.
Definition DP_Ph1_SVC.h:95
MatrixComp mDirectCapacitorVoltage
Definition DP_Ph1_SVC.h:79
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations (parent-specific)
MatrixComp mDirectInductorVoltage
Definition DP_Ph1_SVC.h:74
std::shared_ptr< DP::Ph1::Switch > mSubInductorSwitch
Definition DP_Ph1_SVC.h:38
SVC(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and log level.
MatrixComp mDirectCapacitorHistory
Definition DP_Ph1_SVC.h:80
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
add MNA pre step dependencies (parent-specific)
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
MNA interface to be used by elements that require recomputing of the system matrix.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:79
std::string String
Definition Definitions.h:63
double Real
Definition Definitions.h:60
int Int
Definition Definitions.h:59
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:82
bool Bool
Definition Definitions.h:62
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72