-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR covers the implementation of iterative reduced-order synchronous generator models, namely the PCM and TPM models. Besides, it removes the DCIM implementations, which are covered now by PCM models with zero iterations in the DP domain. It also refactors the VBR model implementations and involves a new DP-DQ interface, which is used by all DP reduced-order synchronous generator models (PCM, TPM, VBR) and shall be reused by other DQ based components in the future. Furthermore, it adds several validation notebooks to compare the different reduced-order models against each other and to compare the results of the 4th order VBR model in the WSCC benchmark system against results from PSAT. Based on #199 Rebase of #207 Related to #75, #221 and #225
- Loading branch information
Showing
74 changed files
with
4,122 additions
and
735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
dpsim-models/include/dpsim-models/DP/DP_Ph1_DPDQInterface.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Copyright 2017-2021 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/Definitions.h> | ||
|
||
namespace CPS { | ||
namespace DP { | ||
namespace Ph1 { | ||
/// @brief Class providing interface with DP domain for all components in DQ domain | ||
class DPDQInterface { | ||
|
||
protected: | ||
/// Transform from DQ to DP domain | ||
MatrixFixedSize<2,2> mDQToDPTransform; | ||
/// Transform from DP to DQ domain | ||
MatrixFixedSize<2,2> mDPToDQTransform; | ||
|
||
/// Shifting frequency of the DP domain (assumed to be constant) | ||
Real mOmegaShift; | ||
|
||
public: | ||
/// Constructor | ||
DPDQInterface() {} | ||
|
||
/// Setter for shit frequency | ||
void setDPShiftFrequency(const Real & omegaShift); | ||
|
||
/// Getter for transform from DQ to DP domain | ||
MatrixFixedSize<2,2> DQToDPTransform() { return mDQToDPTransform; }; | ||
/// Getter for transform from DP to DQ domain | ||
MatrixFixedSize<2,2> DPToDQTransform() { return mDPToDQTransform; }; | ||
|
||
/// Update transformation matrix from DQ to DP | ||
void updateDQToDPTransform(const Real & thetaDQ, const Real & simTime); | ||
/// Update transformation matrix from DP to DQ | ||
void updateDPToDQTransform(const Real & thetaDQ, const Real & simTime); | ||
|
||
/// Apply transform to obtain current complex DP | ||
Complex applyDQToDPTransform(const MatrixFixedSize<2,1> & dqMatrix); | ||
/// Apply transform to obtain current DQ vector | ||
MatrixFixedSize<2,1> applyDPToDQTransform(const Complex& dpComplex); | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
dpsim-models/include/dpsim-models/DP/DP_Ph1_SynchronGenerator4OrderPCM.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* Copyright 2017-2021 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/MNASyncGenInterface.h> | ||
#include <dpsim-models/Base/Base_ReducedOrderSynchronGenerator.h> | ||
#include <dpsim-models/DP/DP_Ph1_DPDQInterface.h> | ||
|
||
namespace CPS { | ||
namespace DP { | ||
namespace Ph1 { | ||
/// @brief 4 Order Synchronous generator model for transient stability analysis | ||
/// | ||
/// This model is based on Eremia section 2.1.6. | ||
/// Modeling approach: delayed current injection + predictor corrector method | ||
class SynchronGenerator4OrderPCM : | ||
public Base::ReducedOrderSynchronGenerator<Complex>, | ||
public MNASyncGenInterface, | ||
public SharedFactory<SynchronGenerator4OrderPCM> { | ||
public: | ||
/// | ||
SynchronGenerator4OrderPCM(const String& uid, const String& name, Logger::Level logLevel = Logger::Level::off); | ||
/// | ||
SynchronGenerator4OrderPCM(const String& name, Logger::Level logLevel = Logger::Level::off); | ||
/// | ||
SimPowerComp<Complex>::Ptr clone(const String& name); | ||
|
||
// #### General Functions #### | ||
/// | ||
void specificInitialization() override; | ||
/// | ||
void calculateStateSpaceMatrices(); | ||
/// | ||
void stepInPerUnit() override; | ||
// | ||
void correctorStep() override; | ||
/// | ||
void updateVoltage(const Matrix& leftVector) override; | ||
/// | ||
bool requiresIteration() override; | ||
/// | ||
void initializeResistanceMatrix() final {}; | ||
|
||
/// Warning if this method is applied: the model is exclusively implemented as current source and this setter will have no impact! | ||
void setModelAsNortonSource(Bool modelAsCurrentSource) override { | ||
SPDLOG_LOGGER_WARN(mSLog, "This model can exclusively be used as current source. The setter setModelAsNortonSource will have no impact on the model!"); | ||
} | ||
|
||
// #### MNA Functions #### | ||
/// | ||
void mnaCompApplyRightSideVectorStamp(Matrix& rightVector) final; | ||
/// | ||
void mnaCompPostStep(const Matrix& leftVector) final; | ||
/// | ||
void mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) final {}; | ||
|
||
protected: | ||
/// Interface used to transform between DP and DQ vars | ||
DPDQInterface mDomainInterface; | ||
|
||
// #### Model specific variables #### | ||
/// Transient emf | ||
const Attribute<Matrix>::Ptr mEdq_t; | ||
|
||
// Variables saving values for later use | ||
/// Trapedzoidal based state space matrix Ad | ||
Matrix mAdTrapezoidal; | ||
/// Trapedzoidal based state space matrix Bd | ||
Matrix mBdTrapezoidal; | ||
/// Trapedzoidal based state space matrix Cd | ||
Matrix mCdTrapezoidal; | ||
/// Edqt at k | ||
Matrix mEdqtPrevStep; | ||
/// Idq at k | ||
Matrix mIdqPrevStep; | ||
/// Vdq at k | ||
Matrix mVdqPrevStep; | ||
/// Vdq at j-1 | ||
Matrix mVdqPrevIter; | ||
|
||
/// A matrix of continuous time state space model | ||
Matrix mAStateSpace = Matrix::Zero(2,2); | ||
/// B matrix of continuous time state space model | ||
Matrix mBStateSpace = Matrix::Zero(2,2); | ||
/// C matrix of continuous time state space model | ||
Matrix mCStateSpace = Matrix::Zero(2,1); | ||
}; | ||
} | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
dpsim-models/include/dpsim-models/DP/DP_Ph1_SynchronGenerator4OrderTPM.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* Copyright 2017-2021 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/MNASyncGenInterface.h> | ||
#include <dpsim-models/Base/Base_ReducedOrderSynchronGenerator.h> | ||
#include <dpsim-models/DP/DP_Ph1_DPDQInterface.h> | ||
|
||
namespace CPS { | ||
namespace DP { | ||
namespace Ph1 { | ||
/// @brief 4 Order Synchronous generator model for transient stability analysis | ||
/// | ||
/// This model is based on Eremia section 2.1.6. | ||
/// Modeling approach: thevenin prediction method | ||
class SynchronGenerator4OrderTPM : | ||
public Base::ReducedOrderSynchronGenerator<Complex>, | ||
public MNASyncGenInterface, | ||
public SharedFactory<SynchronGenerator4OrderTPM> { | ||
protected: | ||
/// Interface used to transform between DP and DQ vars | ||
DPDQInterface mDomainInterface; | ||
|
||
/// Constant part as conductance matrix | ||
Matrix mConductanceMatrixConst = Matrix::Zero(2,2); | ||
/// Varying part as resistance matrix | ||
Matrix mResistanceMatrixVarying = Matrix::Zero(2,2); | ||
|
||
// #### Model specific variables #### | ||
/// Transient emf | ||
const Attribute<Matrix>::Ptr mEdq_t; | ||
/// Original history voltage of VBR model | ||
Matrix mEh = Matrix::Zero(2,1); | ||
/// Modified history voltage of TPM model | ||
const Attribute<Complex>::Ptr mEhMod; | ||
/// Norton equivalent current of EhMod | ||
Complex mIhMod; | ||
|
||
// Variables saving values for later use | ||
/// Trapedzoidal based state space matrix Ad | ||
Matrix mAdStateSpace; | ||
/// Trapedzoidal based state space matrix Bd | ||
Matrix mBdStateSpace; | ||
/// Trapedzoidal based state space matrix Cd | ||
Matrix mCdStateSpace; | ||
/// Idp at k-1 | ||
MatrixComp mIdpTwoPrevStep; | ||
/// Vdq at k | ||
Matrix mVdqPrevStep; | ||
/// Vdq at j-1 | ||
Matrix mVdqPrevIter; | ||
/// Edq_t at k | ||
Matrix mEdqtPrevStep; | ||
|
||
/// A matrix of continuous time state space model | ||
Matrix mAStateSpace = Matrix::Zero(2,2); | ||
/// B matrix of continuous time state space model | ||
Matrix mBStateSpace = Matrix::Zero(2,2); | ||
/// C matrix of continuous time state space model | ||
Matrix mCStateSpace = Matrix::Zero(2,1); | ||
public: | ||
/// | ||
SynchronGenerator4OrderTPM(String uid, String name, Logger::Level logLevel = Logger::Level::off); | ||
/// | ||
SynchronGenerator4OrderTPM(String name, Logger::Level logLevel = Logger::Level::off); | ||
/// | ||
SimPowerComp<Complex>::Ptr clone(String name); | ||
|
||
// #### General Functions #### | ||
/// Initializes component from power flow data | ||
void specificInitialization() override; | ||
/// | ||
void calculateStateSpaceMatrices(); | ||
/// | ||
void calculateConstantConductanceMatrix(); | ||
/// | ||
void stepInPerUnit() override; | ||
/// | ||
void correctorStep() override; | ||
/// | ||
void updateVoltage(const Matrix& leftVector) override; | ||
/// | ||
bool requiresIteration() override; | ||
|
||
/// | ||
void initializeResistanceMatrix() final {}; | ||
|
||
// #### MNA Functions #### | ||
/// | ||
void mnaCompApplyRightSideVectorStamp(Matrix& rightVector) override; | ||
/// | ||
void mnaCompPostStep(const Matrix& leftVector) override; | ||
/// | ||
void mnaCompApplySystemMatrixStamp(SparseMatrixRow& systemMatrix) override; | ||
|
||
void setOperationalParametersPerUnit(Real nomPower, | ||
Real nomVolt, Real nomFreq, Real H, Real Ld, Real Lq, Real L0, | ||
Real Ld_t, Real Lq_t, Real Td0_t, Real Tq0_t); | ||
}; | ||
} | ||
} | ||
} |
Oops, something went wrong.