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 Logger::Level logLevel = Logger::Level::off);
29 SynchronGeneratorDQ(String name, Logger::Level logLevel = Logger::Level::off);
30
35
40
41 // #### Deprecated ###
44 // calculate current states using trapezoidal rule - depcrecated
46
47public:
48 virtual ~SynchronGeneratorDQ();
49
54 Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber,
55 Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd,
56 Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2,
57 Real Llkq2, Real inertia, Real initActivePower, Real initReactivePower,
58 Real initTerminalVolt, Real initVoltAngle, Real initMechPower);
59
62 void initialize(Real omega, Real timeStep);
64 void initialize(Matrix frequencies) override;
66 Real electricalTorque() const;
68 Real rotationalSpeed() const;
70 Real rotorPosition() const;
72 void step(MatrixComp &voltage, Real time);
73
74 // #### MNA Functions ####
76 virtual void
77 mnaCompInitialize(Real omega, Real timeStep,
78 Attribute<Matrix>::Ptr leftVector) override = 0;
81 void mnaStep(Matrix &systemMatrix, Matrix &rightVector, Matrix &leftVector,
82 Real time);
84 void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override;
86 void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
87
89 virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override;
90
92 void
94 AttributeBase::List &attributeDependencies,
95 AttributeBase::List &modifiedAttributes,
96 Attribute<Matrix>::Ptr &leftVector) override;
97 void mnaCompPostStep(Real time, Int timeStepCount,
98 Attribute<Matrix>::Ptr &leftVector) override;
99};
100} // namespace Ph3
101} // namespace DP
102} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
Base synchronous generator model.
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
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
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.
Matrix abcToDq0Transform(Real theta, MatrixComp &abc)
Park transform as described in Krause.
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 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
MatrixComp dq0ToAbcTransform(Real theta, Matrix &dq0)
Inverse Park transform as described in Krause.
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:81
std::string String
Definition Definitions.h:65
double Real
Definition Definitions.h:62
int Int
Definition Definitions.h:61
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.
Definition Definitions.h:84
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74