-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emt syngen trstab #185
base: master
Are you sure you want to change the base?
Emt syngen trstab #185
Changes from all commits
cab7c3a
0f34b41
14961ab
cbb2b29
32b7462
dab4652
9ec4fdb
0d3ffa6
dac3a6c
c358b1a
dfff59f
801e572
d12cf28
eed69f5
862c1d2
e737682
617ba72
3c40464
97f8707
efe5e87
c681774
ad70800
38a061d
dbdc663
1d441ab
217dae7
f6bd2cf
0258838
02b4287
2dd95e2
bac8ad8
c5cb0f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* Copyright 2017-2020 Institute for Automation of Complex Power Systems, | ||
* EONERC, RWTH Aachen University | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*********************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <dpsim-models/Solver/MNAInterface.h> | ||
#include <dpsim-models/MNASimPowerComp.h> | ||
#include <dpsim-models/Solver/MNASwitchInterface.h> | ||
#include <dpsim-models/Solver/MNAVariableCompInterface.h> | ||
#include <dpsim-models/Definitions.h> | ||
#include <dpsim-models/Logger.h> | ||
#include <dpsim-models/Base/Base_Ph3_Switch.h> | ||
|
||
namespace CPS { | ||
namespace EMT { | ||
namespace Ph3 { | ||
/// \brief | ||
/// | ||
/// Switch with variable resistance to avoid numerical oscillations, when an inductive current is suddenly interrupted. | ||
/// It is useful as a fault switch especially on a faulted generator or transformer winding. | ||
|
||
/// The switch resistance changes at a defined fixed rate by multiplying previous resistance value with a factor for the rate of change | ||
/// The MNA variable component interface is used to recompute the system Matrix after each change. | ||
class varResSwitch : | ||
public MNASimPowerComp<Real>, | ||
public Base::Ph3::Switch, | ||
public MNAVariableCompInterface, | ||
public MNASwitchInterface, | ||
public SharedFactory<varResSwitch> { | ||
|
||
protected: | ||
|
||
Bool mPrevState=false; | ||
Real mDeltaResClosed = 0; | ||
Real mDeltaResOpen = 1.5; | ||
Matrix mPrevRes; // previous resistance value to multiply with rate of change | ||
// because we change the base value mClosedResistance & mOpenResistance to recompute the system Matrix | ||
// we need to save the initialisation values to use them as target values in the transition | ||
Matrix mInitClosedRes; | ||
Matrix mInitOpenRes; | ||
Comment on lines
+38
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improve code style, explanatory |
||
|
||
|
||
|
||
public: | ||
/// Defines UID, name, component parameters and logging level | ||
varResSwitch(String uid, String name, Logger::Level logLevel = Logger::Level::off); | ||
/// Defines name, component parameters and logging level | ||
varResSwitch(String name, Logger::Level logLevel = Logger::Level::off) | ||
: varResSwitch(name, name, logLevel) { } | ||
|
||
SimPowerComp<Real>::Ptr clone(String name); | ||
|
||
// #### General #### | ||
void setInitParameters(Real timestep); | ||
/// Initializes component from power flow data | ||
void initializeFromNodesAndTerminals(Real frequency); | ||
|
||
// #### General MNA section #### | ||
void mnaCompInitialize(Real omega, Real timeStep, Attribute<Matrix>::Ptr leftVector); | ||
/// Stamps system matrix | ||
void mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix); | ||
/// Stamps right side (source) vector | ||
void mnaCompApplyRightSideVectorStamp(Matrix& rightVector); | ||
/// Update interface voltage from MNA system result | ||
void mnaCompUpdateVoltage(const Matrix& leftVector); | ||
/// Update interface current from MNA system result | ||
void mnaCompUpdateCurrent(const Matrix& leftVector); | ||
|
||
// #### MNA section for switches #### | ||
/// Check if switch is closed | ||
Bool mnaIsClosed() { return isClosed(); } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Required? Why not use of |
||
/// Stamps system matrix considering the defined switch position | ||
void mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMatrixRow& systemMatrix, Int freqIdx); | ||
|
||
void mnaCompPostStep(Real time, Int timeStepCount, Attribute<Matrix>::Ptr &leftVector) override; | ||
|
||
/// Add MNA post step dependencies | ||
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute<Matrix>::Ptr &leftVector) override; | ||
|
||
Bool hasParameterChanged(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
}; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need inheritance from both classes? I would assume that we require always system recomputation with
varResSwitch
and consequently useMNAVariableCompInterface
. So can't we dropMNASwitchInterface
?