DPsim
Loading...
Searching...
No Matches
EMT_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 EMT {
17namespace Ph3 {
21protected:
24
27 Logger::Level logLevel = Logger::Level::off);
29 SynchronGeneratorDQ(String name, Logger::Level logLevel = Logger::Level::off);
30
35
40
41public:
43 const std::vector<String> attrParamNames = {
44 "Rs", "Ll", "Ld", "Lq", "Ld_t", "Ld_s",
45 "Lq_t", "Lq_s", "Td0_t", "Td0_s", "Tq0_t", "Tq0_s"};
46
47 virtual ~SynchronGeneratorDQ();
48
53 Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber,
54 Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmq, Real Rfd,
55 Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2,
56 Real Llkq2, Real inertia, Real initActivePower, Real initReactivePower,
57 Real initTerminalVolt, Real initVoltAngle, Real initMechPower);
58
60 void setParametersOperationalPerUnit(Real nomPower, Real nomVolt,
61 Real nomFreq, Int poleNumber,
62 Real nomFieldCur, Real Rs, Real Ld,
63 Real Lq, Real Ld_t, Real Lq_t, Real Ld_s,
64 Real Lq_s, Real Ll, Real Td0_t,
65 Real Tq0_t, Real Td0_s, Real Tq0_s,
66 Real inertia);
67
69 void setInitialValues(Real initActivePower, Real initReactivePower,
70 Real initTerminalVolt, Real initVoltAngle,
71 Real initMechPower);
72
75
77 void initializeFromNodesAndTerminals(Real frequency) override;
80
82 void initialize(Matrix frequencies) override;
84 Real electricalTorque() const;
86 Real rotationalSpeed() const;
88 Real rotorPosition() const;
89
91 void step(Matrix &voltage, Real time);
92
93 // #### MNA Functions ####
94
96 void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override;
98 void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override;
99
101 virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override;
102 void mnaCompPostStep(Real time, Int timeStepCount,
103 Attribute<Matrix>::Ptr &leftVector) override;
104
106 void
108 AttributeBase::List &attributeDependencies,
109 AttributeBase::List &modifiedAttributes,
110 Attribute<Matrix>::Ptr &leftVector) override;
111};
112} // namespace Ph3
113} // namespace EMT
114} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
Base synchronous generator model.
void initialize(Matrix frequencies) override
Initialize components with correct network frequencies.
Matrix dq0ToAbcTransform(Real theta, Matrix &dq0)
Inverse Park transform as described in Krause.
virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override
Retrieves calculated voltage from simulation for next step.
void applyParametersOperationalPerUnit()
Calculates fundamental from operational parameters and applies them to the model.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
void initializeMatrixAndStates()
Initializes internal states and matrix.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void setParametersOperationalPerUnit(Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber, Real nomFieldCur, Real Rs, Real Ld, Real Lq, Real Ld_t, Real Lq_t, Real Ld_s, Real Lq_s, Real Ll, Real Td0_t, Real Tq0_t, Real Td0_s, Real Tq0_s, Real inertia)
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
void setInitialValues(Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
Initialize states according to desired initial electrical powerflow and mechanical input power.
Matrix 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
Matrix abcToDq0Transform(Real theta, Matrix &abc)
Park transform as described in Krause.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes component from power flow data.
void step(Matrix &voltage, Real time)
General step function for standalone simulation.
SynchronGeneratorDQ(String name, String uid, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
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::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74