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;
244 Real init_pf = atan2(init_Q, init_P);
246 Real init_delta = atan2((
mLmq + **
mLl) * init_it_abs * cos(init_pf) -
247 **
mRs * init_it_abs * sin(init_pf),
248 init_vt_abs + **
mRs * init_it_abs * cos(init_pf) +
249 (
mLmq + **
mLl) * init_it_abs * sin(init_pf));
256 Real init_vd = init_vt_abs * sin(init_delta);
257 Real init_vq = init_vt_abs * cos(init_delta);
258 Real init_id = init_it_abs * sin(init_delta + init_pf);
259 Real init_iq = init_it_abs * cos(init_delta + init_pf);
266 Real init_psid = init_vq + **
mRs * init_iq;
267 Real init_psiq = -init_vd - **
mRs * init_id;
269 Real init_psikd =
mLmd * (init_ifd - init_id);
281 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0, 0;
282 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0, 0;
283 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1,
286 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0;
287 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0;
288 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1, 0;
292 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0, 0;
293 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0, 0;
294 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1,
297 mVsr << init_vd, init_vfd, 0, init_vq, 0, 0;
298 mIsr << -init_id, init_ifd, 0, -init_iq, 0, 0;
299 mPsisr << init_psid, init_psifd, init_psikd, init_psiq, init_psiq1, 0;
321 mPsisr = Matrix::Zero(7, 1);
324 mOmegaFluxMat << 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
325 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
360 mPsisr = Matrix::Zero(6, 1);
363 mOmegaFluxMat << 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
364 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
387 0, 0, 0, 0, 1. / **
mLl;
392 Int polePairNumber) {
393 return J * 0.5 * omegaNominal * omegaNominal / polePairNumber;
401 CPS::Logger::Level::off,
402 CPS::Logger::Level::info);
405 log,
"Deprecated API addExciter(Ta,Ka,Te,Ke,Tf,Kf,Tr) called. "
406 "This overload will be removed in the future. "
407 "Please create an ExciterDC1Simp and parameters explicitly.");
409 auto params = std::make_shared<CPS::Signal::ExciterDC1SimpParameters>();
420 params->MinVa = -0.9;
426 mExciter = std::make_shared<CPS::Signal::ExciterDC1Simp>(
427 "Exciter", CPS::Logger::Level::info);
433 "Attached ExciterDC1Simp (Ka={:.3g}, Ta={:.3g}, Kef={:.3g}, Tef={:.3g}, "
434 "Kf={:.3g}, Tf={:.3g}, Tr={:.3g}, MaxVa={:.3g}, MinVa={:.3g})",
435 params->Ka, params->Ta, params->Kef, params->Tef, params->Kf, params->Tf,
436 params->Tr, params->MaxVa, params->MinVa);
443 CPS::Logger::Level::info);
445 log,
"addGovernor(Ta, Tb, ...) uses the legacy TurbineGovernor "
446 "model; prefer addGovernor(shared_ptr<TurbineGovernorType1>)");
448 CPS::Logger::Level::info);
455 std::shared_ptr<Signal::TurbineGovernorType1> turbineGovernor) {
457 CPS::Logger::Level::info);
458 if (!turbineGovernor) {
459 SPDLOG_LOGGER_ERROR(log,
460 "addGovernor called with null TurbineGovernorType1");
471 CPS::Logger::Level::info);
472 SPDLOG_LOGGER_WARN(log,
473 "Scalar addGovernor(T3, T4, ...) is deprecated; create a "
474 "TurbineGovernorType1 and use "
475 "addGovernor(shared_ptr<TurbineGovernorType1>) instead");
477 CPS::Logger::Level::info);
478 gov->setParameters(T3, T4, T5, Tc, Ts, R, Tmin, Tmax, OmRef);
479 gov->initializeStates(TmRef);
484 std::shared_ptr<Base::Governor> governor,
485 std::shared_ptr<Base::GovernorParameters> govParams,
486 std::shared_ptr<Base::Turbine> turbine,
487 std::shared_ptr<Base::TurbineParameters> turbineParams) {
489 CPS::Logger::Level::info);
491 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null governor");
495 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null turbine");
498 governor->setParameters(govParams);
499 turbine->setParameters(turbineParams);
506 std::shared_ptr<Base::Governor> governor,
507 std::shared_ptr<Base::Turbine> turbine) {
509 CPS::Logger::Level::info);
511 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null governor");
515 SPDLOG_LOGGER_ERROR(log,
"addGovernorAndTurbine called with null turbine");
524 std::shared_ptr<Base::PSS> pss,
525 std::shared_ptr<Base::PSSParameters> parameters) {
527 CPS::Logger::Level::info);
530 log,
"Cannot attach PSS: no exciter present. Attach an exciter first.");
534 SPDLOG_LOGGER_ERROR(log,
535 "addPSS called with null PSS on SynchronGenerator");
539 mPSS->setParameters(parameters);
545 CPS::Logger::Level::info);
548 log,
"Cannot attach PSS: no exciter present. Attach an exciter first.");
552 SPDLOG_LOGGER_ERROR(log,
553 "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