52 Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2,
65 Lq_t, Ld_s, Lq_s, Td0_t, Tq0_t, Td0_s, Tq0_s);
96 poleNumber, Rs, Ll, Lmd, Lmq, Rfd, Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2,
147 mVsr = Matrix::Zero(6, 1);
148 mIsr = Matrix::Zero(6, 1);
149 mPsisr = Matrix::Zero(6, 1);
159 mInductanceMat << **
mLd,
mLmd,
mLmd, 0, 0, 0,
mLmd,
mLfd,
mLmd, 0, 0, 0,
160 mLmd,
mLmd,
mLkd, 0, 0, 0, 0, 0, 0, **
mLq,
mLmq, 0, 0, 0, 0,
mLmq,
163 mResistanceMat << **
mRs, 0, 0, 0, 0, 0, 0,
mRfd, 0, 0, 0, 0, 0, 0,
mRkd, 0,
164 0, 0, 0, 0, 0, **
mRs, 0, 0, 0, 0, 0, 0,
mRkq1, 0, 0, 0, 0, 0, 0, **
mRs;
169 mVsr = Matrix::Zero(7, 1);
170 mIsr = Matrix::Zero(7, 1);
171 mPsisr = Matrix::Zero(7, 1);
181 mInductanceMat << **
mLd,
mLmd,
mLmd, 0, 0, 0, 0,
mLmd,
mLfd,
mLmd, 0, 0, 0,
182 0,
mLmd,
mLmd,
mLkd, 0, 0, 0, 0, 0, 0, 0, **
mLq,
mLmq,
mLmq, 0, 0, 0, 0,
183 mLmq,
mLkq1,
mLmq, 0, 0, 0, 0,
mLmq,
mLmq,
mLkq2, 0, 0, 0, 0, 0, 0, 0,
186 mResistanceMat << **
mRs, 0, 0, 0, 0, 0, 0, 0,
mRfd, 0, 0, 0, 0, 0, 0, 0,
187 mRkd, 0, 0, 0, 0, 0, 0, 0, **
mRs, 0, 0, 0, 0, 0, 0, 0,
mRkq1, 0, 0, 0,
188 0, 0, 0, 0,
mRkq2, 0, 0, 0, 0, 0, 0, 0, **
mRs;
217 Real initReactivePower,
218 Real initTerminalVolt,
220 Real initMechPower) {
232 Real init_S_abs = sqrt(pow(init_P, 2.) + pow(init_Q, 2.));
238 Real init_it_abs = init_S_abs / init_vt_abs;
241 Real init_pf = acos(init_P / init_S_abs);
243 Real init_delta = atan(((
mLmq + **
mLl) * init_it_abs * cos(init_pf) -
244 **
mRs * init_it_abs * sin(init_pf)) /
245 (init_vt_abs + **
mRs * init_it_abs * cos(init_pf) +
246 (
mLmq + **
mLl) * init_it_abs * sin(init_pf)));
253 Real init_vd = init_vt_abs * sin(init_delta);
254 Real init_vq = init_vt_abs * cos(init_delta);
255 Real init_id = init_it_abs * sin(init_delta + init_pf);
256 Real init_iq = init_it_abs * cos(init_delta + init_pf);
263 Real init_psid = init_vq + **
mRs * init_iq;
264 Real init_psiq = -init_vd - **
mRs * init_id;
266 Real init_psikd =
mLmd * (init_ifd - init_id);
278 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0, 0;
279 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0, 0;
280 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1,
283 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0;
284 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0;
285 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1, 0;
289 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0, 0;
290 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0, 0;
291 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1,
294 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0;
295 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0;
296 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1, 0;
318 mPsisr = Matrix::Zero(7, 1);
321 mOmegaFluxMat << 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
322 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
357 mPsisr = Matrix::Zero(6, 1);
360 mOmegaFluxMat << 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
361 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
384 0, 0, 0, 0, 1. / **
mLl;
389 Int polePairNumber) {
390 return J * 0.5 * omegaNominal * omegaNominal / polePairNumber;
398 CPS::Logger::Level::off,
399 CPS::Logger::Level::info);
402 log,
"Deprecated API addExciter(Ta,Ka,Te,Ke,Tf,Kf,Tr) called. "
403 "This overload will be removed in the future. "
404 "Please create an ExciterDC1Simp and parameters explicitly.");
406 auto params = std::make_shared<CPS::Signal::ExciterDC1SimpParameters>();
417 params->MinVa = -0.9;
423 mExciter = std::make_shared<CPS::Signal::ExciterDC1Simp>(
424 "Exciter", CPS::Logger::Level::info);
430 "Attached ExciterDC1Simp (Ka={:.3g}, Ta={:.3g}, Kef={:.3g}, Tef={:.3g}, "
431 "Kf={:.3g}, Tf={:.3g}, Tr={:.3g}, MaxVa={:.3g}, MinVa={:.3g})",
432 params->Ka, params->Ta, params->Kef, params->Tef, params->Kf, params->Tf,
433 params->Tr, params->MaxVa, params->MinVa);
440 CPS::Logger::Level::info);
442 log,
"addGovernor(Ta, Tb, ...) uses the legacy TurbineGovernor "
443 "model; prefer addGovernor(shared_ptr<TurbineGovernorType1>)");
445 CPS::Logger::Level::info);
452 std::shared_ptr<Signal::TurbineGovernorType1> turbineGovernor) {
454 CPS::Logger::Level::info);
455 if (!turbineGovernor) {
456 SPDLOG_LOGGER_ERROR(log,
457 "addGovernor called with null TurbineGovernorType1");
468 CPS::Logger::Level::info);
469 SPDLOG_LOGGER_WARN(log,
470 "Scalar addGovernor(T3, T4, ...) is deprecated; create a "
471 "TurbineGovernorType1 and use "
472 "addGovernor(shared_ptr<TurbineGovernorType1>) instead");
474 CPS::Logger::Level::info);
475 gov->setParameters(T3, T4, T5, Tc, Ts, R, Tmin, Tmax, OmRef);
476 gov->initializeStates(TmRef);
481 std::shared_ptr<Base::Governor> governor,
482 std::shared_ptr<Base::GovernorParameters> govParams,
483 std::shared_ptr<Base::Turbine> turbine,
484 std::shared_ptr<Base::TurbineParameters> turbineParams) {
486 CPS::Logger::Level::info);
488 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null governor");
492 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null turbine");
495 governor->setParameters(govParams);
496 turbine->setParameters(turbineParams);
503 std::shared_ptr<Base::Governor> governor,
504 std::shared_ptr<Base::Turbine> turbine) {
506 CPS::Logger::Level::info);
508 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null governor");
512 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null turbine");
521 std::shared_ptr<Base::PSS> pss,
522 std::shared_ptr<Base::PSSParameters> parameters) {
524 CPS::Logger::Level::info);
527 log,
"Cannot attach PSS: no exciter present. Attach an exciter first.");
531 SPDLOG_LOGGER_ERROR(log,
532 "addPSS called with null PSS on SynchronGenerator");
536 mPSS->setParameters(parameters);
542 CPS::Logger::Level::info);
545 log,
"Cannot attach PSS: no exciter present. Attach an exciter first.");
549 SPDLOG_LOGGER_ERROR(log,
550 "addPSS called with null PSS on SynchronGenerator");
Matrix mIsr
Vector of stator and rotor currents.
Real mNomFreq
nominal frequency fn [Hz]
Bool mHasTurbineGovernorType1
Determines if TurbineGovernorType1 is activated.
const Attribute< Real >::Ptr mLq_t
Transient q-axis inductance [H].
Real mRkq1
q-axis damper resistance 1 Rkq1 [Ohm]
void calculateFundamentalFromOperationalParameters()
Real mLmd
d-axis mutual inductance Lmd [H]
Real mBase_I
base stator current peak
Bool mHasExciter
Determines if Exciter is activated.
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)
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.
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_ifd
base field current
Real mBase_vfd
base field voltage
Real mBase_I_RMS
base stator current RMS
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]
Int mPoleNumber
mNumber of poles
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]
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.
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)
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]
void calcStateSpaceMatrixDQ()
void addExciter(std::shared_ptr< Base::Exciter > exciter, std::shared_ptr< Base::ExciterParameters > params)
Add voltage regulator and exciter.
ParameterType mParameterType
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]
Real mNomFieldCur
nominal field current Ifn [A]
Real mRfd
field resistance Rfd [Ohm]
NumericalMethod mNumericalMethod
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
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
const Attribute< Real >::Ptr mDelta
rotor angle delta
Real mRkq2
q-axis damper resistance 2 Rkq2 [Ohm]
Real mLfd
field inductance Lfd [H]
Real mInitTerminalVoltage
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]
void applyFundamentalPerUnitParameters()
Matrix mInvInductanceMat
Inverse of the inductance matrix.
Real mBase_Psi
base flux linkage
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)
static Log get(const std::string &name, Level filelevel=Level::info, Level clilevel=Level::off)
static std::shared_ptr< TurbineGovernor > make(Args &&...args)
std::complex< Real > Complex