DPsim
Loading...
Searching...
No Matches
Base_SynchronGenerator.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
19
20namespace CPS {
21namespace Base {
30public:
38
39 // Deprecated — uses legacy TurbineGovernor; prefer addGovernor(TurbineGovernorType1)
40 void addGovernor(Real Ta, Real Tb, Real Tc, Real Fa, Real Fb, Real Fc, Real K,
41 Real Tsr, Real Tsm, Real Tm_init, Real PmRef);
43 void
44 addGovernor(std::shared_ptr<Signal::TurbineGovernorType1> turbineGovernor);
45 // Deprecated scalar convenience — creates TurbineGovernorType1 internally; use object overload instead
46 void addGovernor(Real T3, Real T4, Real T5, Real Tc, Real Ts, Real R,
47 Real Tmin, Real Tmax, Real OmRef, Real TmRef);
48
50 void
51 addGovernorAndTurbine(std::shared_ptr<Base::Governor> governor,
52 std::shared_ptr<Base::GovernorParameters> govParams,
53 std::shared_ptr<Base::Turbine> turbine,
54 std::shared_ptr<Base::TurbineParameters> turbineParams);
56 void addGovernorAndTurbine(std::shared_ptr<Base::Governor> governor,
57 std::shared_ptr<Base::Turbine> turbine);
58
60 void addExciter(std::shared_ptr<Base::Exciter> exciter,
61 std::shared_ptr<Base::ExciterParameters> params);
63 void addExciter(std::shared_ptr<Base::Exciter> exciter);
64
65 // Deprecated method
66 void addExciter(Real Ta, Real Ka, Real Te, Real Ke, Real Tf, Real Kf,
67 Real Tr);
69 void addPSS(std::shared_ptr<Base::PSS> pss,
70 std::shared_ptr<Base::PSSParameters> parameters);
72 void addPSS(std::shared_ptr<Base::PSS> pss);
73
74protected:
77 mNumericalMethod; //not needed if sundials used; could instead determine implicit / explicit solve
88
89 // ### Machine parameters ###
104
135
136public:
145
146 // Operational parameters
163
164protected:
165 // #### Initial Values ####
169
170 // ### Stator base values ###
191
200
201 // ### Useful Matrices ### (still needed? )
208
209 // ### State variables ###
212
213public:
230
231protected:
261 Matrix mPsisr; //equivalent to Fluxes
264
265 // #### dq-frame specific variables ####
284
289
292 void initPerUnitStates();
293
294 // #### Controllers ####
304 Bool mHasPSS = false;
305
306 // Deprecated
309
312 : mRs(attributeList->create<Real>("Rs", 0)),
313 mLl(attributeList->create<Real>("Ll", 0)),
314 mLd(attributeList->create<Real>("Ld", 0)),
315 mLq(attributeList->create<Real>("Lq", 0)),
316 mLd_t(attributeList->create<Real>("Ld_t", 0)),
317 mLq_t(attributeList->create<Real>("Lq_t", 0)),
318 mLd_s(attributeList->create<Real>("Ld_s", 0)),
319 mLq_s(attributeList->create<Real>("Lq_s", 0)),
320 mTd0_t(attributeList->create<Real>("Td0_t", 0)),
321 mTq0_t(attributeList->create<Real>("Tq0_t", 0)),
322 mTd0_s(attributeList->create<Real>("Td0_s", 0)),
323 mTq0_s(attributeList->create<Real>("Tq0_s", 0)),
324 mDelta(attributeList->create<Real>("delta_r", 0)),
325 mMechTorque(attributeList->create<Real>("T_m", 0)),
326 mInertia(attributeList->create<Real>("inertia", 0)),
327 mOmMech(attributeList->create<Real>("w_r", 0)),
328 mElecActivePower(attributeList->create<Real>("P_elec", 0)),
329 mElecReactivePower(attributeList->create<Real>("Q_elec", 0)),
330 mMechPower(attributeList->create<Real>("P_mech", 0)),
331 mElecTorque(attributeList->create<Real>("T_e", 0)){};
332
334 void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq);
336 void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq,
337 Real nomFieldCur);
338
342 Real calcHfromJ(Real J, Real omegaNominal, Int polePairNumber);
343
344public:
347
349 void setBaseAndFundamentalPerUnitParameters(Real nomPower, Real nomVolt,
350 Real nomFreq, Real nomFieldCur,
351 Int poleNumber, Real Rs, Real Ll,
352 Real Lmd, Real Lmq, Real Rfd,
353 Real Llfd, Real Rkd, Real Llkd,
354 Real Rkq1, Real Llkq1, Real Rkq2,
355 Real Llkq2, Real inertia);
356
360 Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber,
361 Real nomFieldCur, Real Rs, Real Ld, Real Lq, Real Ld_t, Real Lq_t,
362 Real Ld_s, Real Lq_s, Real Ll, Real Td0_t, Real Tq0_t, Real Td0_s,
363 Real Tq0_s, Real inertia);
364
366 void setFundamentalPerUnitParameters(Int poleNumber, Real Rs, Real Ll,
367 Real Lmd, Real Lmq, Real Rfd, Real Llfd,
368 Real Rkd, Real Llkd, Real Rkq1,
369 Real Llkq1, Real Rkq2, Real Llkq2,
370 Real inertia);
371
374
377 Real Lmd, Real Lmq, Real Rfd,
378 Real Llfd, Real Rkd, Real Llkd,
379 Real Rkq1, Real Llkq1, Real Rkq2,
380 Real Llkq2, Real inertia);
381
383 void setOperationalPerUnitParameters(Int poleNumber, Real inertia, Real Rs,
384 Real Ld, Real Lq, Real Ll, Real Ld_t,
385 Real Lq_t, Real Ld_s, Real Lq_s,
386 Real Td0_t, Real Tq0_t, Real Td0_s,
387 Real Tq0_s);
388
391
393 void setInitialValues(Real initActivePower, Real initReactivePower,
394 Real initTerminalVolt, Real initVoltAngle,
395 Real initMechPower);
396
399
401 std::shared_ptr<Signal::TurbineGovernor> mTurbineGovernor;
403 std::shared_ptr<Signal::TurbineGovernorType1> mTurbineGovernorType1;
405 std::shared_ptr<Base::Governor> mGovernor;
407 std::shared_ptr<Base::Turbine> mTurbine;
409 std::shared_ptr<Base::Exciter> mExciter;
411 std::shared_ptr<Base::PSS> mPSS;
412};
413} // namespace Base
414} // namespace CPS
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
std::shared_ptr< AttributeList > Ptr
Matrix mIsr
Vector of stator and rotor currents.
StateType
State type of machine variables.
Real mNomFreq
nominal frequency fn [Hz]
Bool mHasTurbineGovernorType1
Determines if TurbineGovernorType1 is activated.
Real mTimeStep
Simulation time step.
Real mDetLd
Determinant of d-axis inductance matrix.
Real mSystemOmega
Simulation angular system speed.
const Attribute< Real >::Ptr mLq_t
Transient q-axis inductance [H].
Real mRkq1
q-axis damper resistance 1 Rkq1 [Ohm]
Real mRcomp
Compensation Resistance.
Real mLmd
d-axis mutual inductance Lmd [H]
Real mBase_I
base stator current peak
void addExciter(std::shared_ptr< Base::Exciter > exciter)
Add already constructed regulator and exciter.
Bool mHasExciter
Determines if Exciter is activated.
Real mLf
field winding inductance Lf [H]
Real mLad
Inductance to calculate magnetizing flux linkage from winding flux linkages.
const Attribute< Real >::Ptr mMechTorque
mechanical torque
void setInitialValues(Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
Bool mCompensationOn
Determines if compensation elements are used.
const Attribute< Real >::Ptr mTq0_s
Subtransient time constant of q-axis [s].
Matrix mFluxToCurrentMat
Calculates currents from fluxes.
Real mLmq
q-axis mutual inductance Lmq [H]
void setOperationalPerUnitParameters(Int poleNumber, Real inertia, Real Rs, Real Ld, Real Lq, Real Ll, Real Ld_t, Real Lq_t, Real Ld_s, Real Lq_s, Real Td0_t, Real Tq0_t, Real Td0_s, Real Tq0_s)
std::shared_ptr< Base::Exciter > mExciter
Signal component modelling voltage regulator and exciter.
SynchronGenerator(CPS::AttributeList::Ptr attributeList)
Constructor.
Real mLkq1
q-axis damper inductance 1 Lkq1 [H]
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)
Real mBase_I_RMS
base stator current RMS
void setNumericalMethod(NumericalMethod method)
Switch to determine the integration method for the machine model.
Real mLkd
d-axis damper inductance Lkd [H]
std::shared_ptr< Base::Turbine > mTurbine
Modular turbine (SteamTurbine / HydroTurbine)
Real mLlfd
field leakage inductance Llfd [H]
Bool mInitialValuesSet
Flag to remember when initial values are set.
Matrix mFluxStateSpaceMat
Flux state space matrix excluding omega term.
void addPSS(std::shared_ptr< Base::PSS > pss, std::shared_ptr< Base::PSSParameters > parameters)
Attach a PSS (initialised separately) to this generator.
const Attribute< Real >::Ptr mTq0_t
Transient time constant of q-axis [s].
Real mLlkd
d-axis damper leakage inductance Llkd [H]
ParameterType
Machine parameters type.
const Attribute< Real >::Ptr mMechPower
mechanical Power Pm [W]
Real mNomVolt
nominal voltage Vn [V] (phase-to-phase RMS)
Matrix mVsr
Vector of stator and rotor voltages.
Matrix mPsisr
Vector of stator and rotor fluxes.
Real mBase_L
base stator inductance
const Attribute< Real >::Ptr mLq
q-axis inductance Lq [H]
Real mBase_Z
base stator impedance
const Attribute< Real >::Ptr mRs
stator resistance Rs [Ohm]
Matrix mResistanceMat
resistance matrix
Bool mHasGovernorAndTurbine
Determines if modular Governor + Turbine pair is activated.
Real mLkq2
q-axis damper inductance 2 Lkq2 [H]
std::shared_ptr< Base::PSS > mPSS
Power system stabilizer.
Real mDetLq
Determinant of q-axis inductance matrix.
void addGovernor(Real Ta, Real Tb, Real Tc, Real Fa, Real Fb, Real Fc, Real K, Real Tsr, Real Tsm, Real Tm_init, Real PmRef)
const Attribute< Real >::Ptr mElecReactivePower
Reactive part of the electrical power.
const Attribute< Real >::Ptr mElecActivePower
Active part of the electrical power.
std::shared_ptr< Signal::TurbineGovernor > mTurbineGovernor
Signal component modelling governor control and steam turbine (legacy)
Matrix mOmegaFluxMat
Omega-flux matrix for state space system.
Real mLlkq1
q-axis damper leakage inductance 1 Llkq1 [H]
Matrix mIdq0
dq0 current calculated from terminal current
void addExciter(std::shared_ptr< Base::Exciter > exciter, std::shared_ptr< Base::ExciterParameters > params)
Add voltage regulator and exciter.
const Attribute< Real >::Ptr mLq_s
Subtransient q-axis inductance [H].
std::shared_ptr< Base::Governor > mGovernor
Modular governor (SteamTurbineGovernor / HydroTurbineGovernor)
void setBaseAndFundamentalPerUnitParameters(Real nomPower, Real nomVolt, Real nomFreq, Real nomFieldCur, Int poleNumber, 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)
Initializes the base and fundamental machine parameters in per unit.
Real mRkd
d-axis damper resistance Rkd [Ohm]
StateType mStateType
specifies if the machine parameters are transformed to per unit
Real mNomFieldCur
nominal field current Ifn [A]
Real mRfd
field resistance Rfd [Ohm]
Real mNomOmega
nominal angular frequency wn [Hz]
Real mLaq
Inductance to calculate magnetizing flux linkage from winding flux linkages.
Real mBase_OmElec
base electrical angular frequency
Matrix mVdq0
dq0 voltage calculated from terminal voltage
const Attribute< Real >::Ptr mLl
leakage inductance Ll [H]
const Attribute< Real >::Ptr mTd0_s
Subtransient time constant of d-axis [s].
void setBaseParameters(Real nomPower, Real nomVolt, Real nomFreq)
Real mBase_OmMech
base mechanical angular frequency
Real mBase_Zfd
base field impedance
virtual ~SynchronGenerator()
Destructor - does nothing.
const Attribute< Real >::Ptr mDelta
rotor angle delta
Real mRkq2
q-axis damper resistance 2 Rkq2 [Ohm]
Real mLfd
field inductance Lfd [H]
const Attribute< Real >::Ptr mTd0_t
Transient time constant of d-axis [s].
Bool mHasPSS
Determines if PSS is activated.
void setAndApplyFundamentalPerUnitParameters(Int poleNumber, 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)
Int mNumDampingWindings
Number of damping windings in q.
Real mBase_V
base stator voltage (phase-to-ground peak)
const Attribute< Real >::Ptr mLd
d-axis inductance Ld [H]
Matrix mInvInductanceMat
Inverse of the inductance matrix.
Real mNomPower
nominal power Pn [VA]
void setBaseAndOperationalPerUnitParameters(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)
Real mBase_Lfd
base field inductance
const Attribute< Real >::Ptr mOmMech
rotor speed omega_r
Bool mHasTurbineGovernor
Determines if legacy TurbineGovernor is activated.
const Attribute< Real >::Ptr mLd_t
Transient d-axis inductance [H].
Real mLlkq2
q-axis damper leakage inductance 2 Llkq2 [H]
Real calcHfromJ(Real J, Real omegaNominal, Int polePairNumber)
const Attribute< Real >::Ptr mLd_s
Subtransient d-axis inductance [H].
std::shared_ptr< Signal::TurbineGovernorType1 > mTurbineGovernorType1
Signal component modelling governor control and steam turbine (TurbineGovernorType1)
Matrix mInductanceMat
Inductance matrix which is numerically equal to the reactance matrix in per unit.
const Attribute< Real >::Ptr mInertia
inertia constant H [s] for per unit or moment of inertia J [kg*m^2]
const Attribute< Real >::Ptr mElecTorque
electrical torque
Real mBase_V_RMS
base stator voltage (phase-to-ground RMS)
void setFundamentalPerUnitParameters(Int poleNumber, 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)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81
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
NumericalMethod