DPsim
Loading...
Searching...
No Matches
DP_Ph1_SVC.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/Base/Base_Ph1_SVC.h>
12#include <dpsim-models/CompositePowerComp.h>
13#include <dpsim-models/DP/DP_Ph1_Capacitor.h>
14#include <dpsim-models/DP/DP_Ph1_Inductor.h>
15#include <dpsim-models/DP/DP_Ph1_Switch.h>
16#include <dpsim-models/Solver/MNAVariableCompInterface.h>
17
18namespace CPS {
19namespace DP {
20namespace Ph1 {
29class SVC : public CompositePowerComp<Complex>,
30 public Base::Ph1::SVC,
32 public SharedFactory<SVC> {
33protected:
35 std::shared_ptr<DP::Ph1::Inductor> mSubInductor;
36 std::shared_ptr<DP::Ph1::Switch> mSubInductorSwitch;
38 std::shared_ptr<DP::Ph1::Capacitor> mSubCapacitor;
39 std::shared_ptr<DP::Ph1::Switch> mSubCapacitorSwitch;
40
41 Bool mValueChange = false;
42 Bool mInductiveMode = false;
43
44 // has state changed? (allow this only once)
45 // could be redundant with internal status of switch element (mnaIsClosed)
46 Real mSwitchStateChange = false;
47 Real mSwitchROpen = 1e9;
48 Real mSwitchRClosed = 1e-9;
49 Real mCounter = 0;
50
51 Real mBSetCounter = 0;
52
53 // values of PT1 for measurement of voltage at PCC
54 Real mTm = 0.01;
55 Real mKm = 1;
56 Real mLPrev;
57 Real mCPrev;
58
59 // variables for protection
60 Real mProtCount1 = 0;
61 Real mProtCount2 = 0;
62 Real mProtCount3 = 0;
63 Bool mDisconnect = false;
64
65public:
66 const Attribute<Real>::Ptr mVpcc;
67 const Attribute<Real>::Ptr mVmeasPrev;
68
70 SVC(String uid, String name, Logger::Level logLevel = Logger::Level::off);
72 SVC(String name, Logger::Level logLevel = Logger::Level::off)
73 : SVC(name, name, logLevel) {}
74
75 // #### General ####
77 void createSubComponents() override;
79 void initializeParentFromNodesAndTerminals(Real frequency) override;
80
81 // #### MNA section ####
83 void mnaCompUpdateVoltage(const Matrix &leftVector) override;
85 void mnaCompUpdateCurrent(const Matrix &leftVector) override;
87 void mnaParentPreStep(Real time, Int timeStepCount) override;
89 void mnaParentPostStep(Real time, Int timeStepCount,
90 Attribute<Matrix>::Ptr &leftVector) override;
93 AttributeBase::List &prevStepDependencies,
94 AttributeBase::List &attributeDependencies,
95 AttributeBase::List &modifiedAttributes) override;
97 void
98 mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
99 AttributeBase::List &attributeDependencies,
100 AttributeBase::List &modifiedAttributes,
101 Attribute<Matrix>::Ptr &leftVector) override;
102
103 // #### Variable component interface ####
104 Bool hasParameterChanged() override { return mValueChange; }
105
106 // #### Tearing methods ####
107 Bool ValueChanged();
108 void setSwitchState();
109
110 void updateSusceptance();
111 void mechanicalModelUpdateSusceptance(Real time);
112 // check protection function
113 void checkProtection(Real time);
114};
115} // namespace Ph1
116} // namespace DP
117} // namespace CPS
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.
void createSubComponents() override
Constructs subcomponents; idempotent.
std::shared_ptr< DP::Ph1::Capacitor > mSubCapacitor
Internal capacitor.
Definition DP_Ph1_SVC.h:38
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system results.
std::shared_ptr< DP::Ph1::Inductor > mSubInductor
Internal inductor.
Definition DP_Ph1_SVC.h:35
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
Definition DP_Ph1_SVC.h:104
void mnaParentAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
add MNA post step dependencies (parent-specific)
SVC(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and log level.
Definition DP_Ph1_SVC.h:72
void mnaParentPreStep(Real time, Int timeStepCount) override
MNA pre step operations (parent-specific)
SVC(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and log level.
void mnaParentAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
add MNA pre step dependencies (parent-specific)
String uid()
Returns unique id.
MNA interface to be used by elements that require recomputing of the system matrix.