DPsim
Loading...
Searching...
No Matches
DP_Ph3_SynchronGeneratorDQ.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
14
15namespace CPS {
16namespace DP {
17namespace Ph3 {
19class SynchronGeneratorDQ : public MNASimPowerComp<Complex>,
21protected:
24
27
30 Logger::Level logLevel = Logger::Level::off);
32 SynchronGeneratorDQ(String name, Logger::Level logLevel = Logger::Level::off);
33
38
43 dq0ToAbcTransform(Real theta, const Eigen::Ref<const Matrix> &dq0);
44
45 // #### Deprecated ###
48 // calculate current states using trapezoidal rule - depcrecated
50
51public:
52 virtual ~SynchronGeneratorDQ();
53
57 Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber,
58 Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd,
59 Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2,
60 Real Llkq2, Real inertia);
61
66 Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber,
67 Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd,
68 Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2,
69 Real Llkq2, Real inertia, Real initActivePower, Real initReactivePower,
70 Real initTerminalVolt, Real initVoltAngle, Real initMechPower);
71
74 void initialize(Real omega, Real timeStep);
76 void initialize(Matrix frequencies) override;
78 void initializeFromNodesAndTerminals(Real frequency) override;
80 Real electricalTorque() const;
82 Real rotationalSpeed() const;
84 Real rotorPosition() const;
86 void step(MatrixComp &voltage, Real time);
87
88 // #### MNA Functions ####
90 virtual void
91 mnaCompInitialize(Real omega, Real timeStep,
92 Attribute<Matrix>::Ptr leftVector) override = 0;
95 void mnaStep(Matrix &systemMatrix, Matrix &rightVector, Matrix &leftVector,
96 Real time);
98 void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override;
100 void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
101
103 virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override;
104
106 void
108 AttributeBase::List &attributeDependencies,
109 AttributeBase::List &modifiedAttributes,
110 Attribute<Matrix>::Ptr &leftVector) override;
111 void mnaCompPostStep(Real time, Int timeStepCount,
112 Attribute<Matrix>::Ptr &leftVector) override;
113};
114} // namespace Ph3
115} // namespace DP
116} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:249
Base synchronous generator model.
MatrixFixedSizeComp< 3, 1 > dq0ToAbcTransform(Real theta, const Eigen::Ref< const Matrix > &dq0)
Inverse Park transform as described in Krause.
void step(MatrixComp &voltage, Real time)
Calculates flux and current from the voltage vector.
void initialize(Real omega, Real timeStep)
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void initializeMatrixAndStates()
Build the per-unit steady-state machine state after PF values are loaded.
SynchronGeneratorDQ(String name, String uid, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void trapezoidalFluxStates()
calculate flux states using trapezoidal rule - depcrecated
MatrixFixedSize< 3, 1 > abcToDq0Transform(Real theta, MatrixComp &abc)
Park transform as described in Krause.
virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override
Retrieves calculated voltage from simulation for next step.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void initializeFromNodesAndTerminals(Real frequency) override
Initialize the operating point from a connected power-flow solution.
virtual void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override=0
Initializes variables of component.
void mnaStep(Matrix &systemMatrix, Matrix &rightVector, Matrix &leftVector, Real time)
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
MatrixComp mCompensationCurrent
Compensation current source set point.
void setMachineParametersFundamentalPerUnit(Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber, Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd, Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2, Real Llkq2, Real inertia)
void setParametersFundamentalPerUnit(Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber, Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd, Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2, Real Llkq2, Real inertia, Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
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)
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
Eigen::Matrix< Real, rows, cols, Eigen::ColMajor > MatrixFixedSize
Dense matrix for real numbers with fixed dimension.
Definition Definitions.h:99
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
Eigen::Matrix< Complex, rows, cols, Eigen::ColMajor > MatrixFixedSizeComp
Dense matrix for complex numbers with fixed dimension.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:72