DPsim
Loading...
Searching...
No Matches
Base_ReducedOrderSynchronGenerator.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
18
19namespace CPS {
20namespace Base {
21
22template <typename VarType>
24
25public:
26 // ### State variables [p.u.]###
62
67 virtual void setModelAsNortonSource(Bool modelAsCurrentSource);
69 void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq);
71 void setOperationalParametersPerUnit(Real nomPower, Real nomVolt,
72 Real nomFreq, Real H, Real Ld, Real Lq,
73 Real L0, Real Ld_t, Real Td0_t);
75 void setOperationalParametersPerUnit(Real nomPower, Real nomVolt,
76 Real nomFreq, Real H, Real Ld, Real Lq,
77 Real L0, Real Ld_t, Real Lq_t,
78 Real Td0_t, Real Tq0_t);
81 void setOperationalParametersPerUnit(Real nomPower, Real nomVolt,
82 Real nomFreq, Real H, Real Ld, Real Lq,
83 Real L0, Real Ld_t, Real Lq_t,
84 Real Td0_t, Real Tq0_t, Real Ld_s,
85 Real Lq_s, Real Td0_s, Real Tq0_s,
86 Real Taa = 0);
88 void setInitialValues(Complex initComplexElectricalPower,
89 Real initMechanicalPower, Complex initTerminalVoltage);
90
92 void addGovernor(Real T3, Real T4, Real T5, Real Tc, Real Ts, Real R,
93 Real Pmin, Real Pmax, Real OmRef, Real TmRef);
94 void
95 addGovernor(std::shared_ptr<Signal::TurbineGovernorType1> turbineGovernor);
97 void
98 addGovernorAndTurbine(std::shared_ptr<Base::Governor> governor,
99 std::shared_ptr<Base::GovernorParameters> govParams,
100 std::shared_ptr<Base::Turbine> turbine,
101 std::shared_ptr<Base::TurbineParameters> turbineParams);
103 void addGovernorAndTurbine(std::shared_ptr<Base::Governor> governor,
104 std::shared_ptr<Base::Turbine> turbine);
106 void addExciter(std::shared_ptr<Base::Exciter> exciter,
107 std::shared_ptr<Base::ExciterParameters> params);
109 void addExciter(std::shared_ptr<Base::Exciter> exciter);
110
111 // Deprecated method
112 void addExciter(Real Ta, Real Ka, Real Te, Real Ke, Real Tf, Real Kf,
113 Real Tr);
115 void addPSS(std::shared_ptr<Base::PSS> pss,
116 std::shared_ptr<Base::PSSParameters> parameters);
118 void addPSS(std::shared_ptr<Base::PSS> pss);
119
121 void scaleInertiaConstant(Real scalingFactor);
122
123protected:
124 using MNASimPowerComp<VarType>::mRightVector;
125 using MNASimPowerComp<VarType>::mIntfVoltage;
126
129 Logger::Level logLevel);
135 virtual void initializeResistanceMatrix() = 0;
137 void initializeFromNodesAndTerminals(Real frequency) override;
139 virtual void specificInitialization() = 0;
141 virtual void stepInPerUnit() = 0;
142
143 // ### MNA Section ###
145 void mnaCompInitialize(Real omega, Real timeStep,
146 Attribute<Matrix>::Ptr leftVector) override;
149 AttributeBase::List &prevStepDependencies,
150 AttributeBase::List &attributeDependencies,
151 AttributeBase::List &modifiedAttributes) override;
152 void mnaCompPreStep(Real time, Int timeStepCount) override;
154 void
156 AttributeBase::List &attributeDependencies,
157 AttributeBase::List &modifiedAttributes,
158 Attribute<Matrix>::Ptr &leftVector) override;
159 void mnaCompPostStep(Real time, Int timeStepCount,
160 Attribute<Matrix>::Ptr &leftVector) final;
161 virtual void mnaCompPostStep(const Matrix &leftVector) = 0;
163 virtual void
167 // Model flag indicating the SG order to be used
169
170 // ### Base quantities (stator refered) ###
175 // Nominal frequency
197
198 // ### Operational Parameters (p.u.) ###
223
224 // ### VBR constants ###
253
254 // ### Constants of resistance matrix (VBR) ###
256 Real mA = 0;
258 Real mB = 0;
259
260 // ### Initial values ###
277
280
281 // #### Controllers ####
289 Bool mHasPSS = false;
291 std::shared_ptr<Signal::TurbineGovernorType1> mTurbineGovernor;
293 std::shared_ptr<Base::Governor> mGovernor;
295 std::shared_ptr<Base::Turbine> mTurbine;
297 std::shared_ptr<Base::Exciter> mExciter;
299 std::shared_ptr<Base::PSS> mPSS;
300
305};
306} // namespace Base
307} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
Bool mInitialValuesSet
Flag to remember when initial values are set.
void addGovernorAndTurbine(std::shared_ptr< Base::Governor > governor, std::shared_ptr< Base::GovernorParameters > govParams, std::shared_ptr< Base::Turbine > turbine, std::shared_ptr< Base::TurbineParameters > turbineParams)
Add a modular governor + turbine pair (new API for SteamTurbineGovernor / SteamTurbine)
Complex mInitVoltage
initial terminal voltage phase a (p.u.)
Real mTd0_s
Subtransient time constant of d-axis.
void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq)
virtual void specificInitialization()=0
Function to initialize the specific variables of each SG model.
virtual void mnaCompPostStep(const Matrix &leftVector)=0
Real mEf_prev
induced emf by the field current under no-load conditions at time k (p.u.)
void addPSS(std::shared_ptr< Base::PSS > pss, std::shared_ptr< Base::PSSParameters > parameters)
Attach a PSS (initialises parameters) to this generator.
void setInitialValues(Complex initComplexElectricalPower, Real initMechanicalPower, Complex initTerminalVoltage)
Complex mInitCurrent
initial armature voltage phase a (p.u.)
Bool mHasTurbineGovernor
Determines if TurbineGovernorType1 is activated.
void setOperationalParametersPerUnit(Real nomPower, Real nomVolt, Real nomFreq, Real H, Real Ld, Real Lq, Real L0, Real Ld_t, Real Td0_t)
Initialization for 3 Order SynGen.
Bool mHasGovernorAndTurbine
Determines if modular Governor + Turbine pair is activated.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
Bool mModelAsNortonSource
Model flag indicating whether the machine is modelled as Norton or Thevenin equivalent.
virtual ~ReducedOrderSynchronGenerator()
Destructor - does nothing.
virtual void setModelAsNortonSource(Bool modelAsCurrentSource)
const Attribute< Real >::Ptr mElecTorque
stator electrical torque
std::shared_ptr< Base::Governor > mGovernor
Modular governor (SteamTurbineGovernor / HydroTurbineGovernor)
void addExciter(std::shared_ptr< Base::Exciter > exciter, std::shared_ptr< Base::ExciterParameters > params)
Add voltage regulator and exciter.
Real mInitVoltageAngle
angle of initial armature voltage
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
const Attribute< Real >::Ptr mOmMech
Rotor speed.
std::shared_ptr< Base::PSS > mPSS
Power system stabilizer.
std::shared_ptr< Base::Exciter > mExciter
Signal component modelling voltage regulator and exciter.
Real mTaa
d-axis additional leakage time constant
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
Real mTq0_s
Subtransient time constant of q-axis.
void mnaCompPreStep(Real time, Int timeStepCount) override
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
virtual void stepInPerUnit()=0
Model specific step.
const Attribute< Real >::Ptr mDelta
Load angle (between q-axis and stator a-axis)
Real mInitCurrentAngle
angle of initial armature current
const Attribute< Real >::Ptr mMechTorque
Mechanical torque.
const Attribute< Real >::Ptr mEf
induced emf by the field current under no-load conditions at time k+1 (p.u.)
const Attribute< Complex >::Ptr mPower
Electrical power.
std::shared_ptr< Base::Turbine > mTurbine
Modular turbine (SteamTurbine / HydroTurbine)
const Attribute< Real >::Ptr mThetaMech
mechanical system angle (between d-axis and stator a-axis)
void addGovernor(Real T3, Real T4, Real T5, Real Tc, Real Ts, Real R, Real Pmin, Real Pmax, Real OmRef, Real TmRef)
Add governor and turbine (TurbineGovernorType1 legacy API)
virtual void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override=0
Stamps system matrix.
Bool mHasExciter
Determines if Exciter is activated.
ReducedOrderSynchronGenerator(String uid, String name, Logger::Level logLevel)
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) final
std::shared_ptr< Signal::TurbineGovernorType1 > mTurbineGovernor
TurbineGovernorType1 (legacy)
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
Base class for all MNA components that are transmitting power.
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Basic constructor that takes UID, name and log level.
Attribute< Matrix >::Ptr mRightVector
const Attribute< MatrixVar< VarType > >::Ptr mIntfVoltage
Voltage between terminals.
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
std::complex< Real > Complex
Definition Definitions.h:63
bool Bool
Definition Definitions.h:64
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74