9#include <dpsim-models/DP/DP_Ph3_SynchronGeneratorVBR.h>
19 : SynchronGeneratorBase(
name, nomPower, nomVolt, nomFreq, poleNumber,
20 nomFieldCur, Rs, Ll, Lmd, Lmd0, Lmq, Lmq0, Rfd,
21 Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2, Llkq2, inertia,
34 mExciter = Exciter(Ta, Ka, Te, Ke, Tf, Kf, Tr, Lad, Rfd);
51 Real initTerminalVolt,
Real initVoltAngle,
Real initMechPower) {
66 K1a = Matrix::Zero(2, 1);
67 K1 = Matrix::Zero(2, 1);
77 initStatesInPerUnit(initActivePower, initReactivePower, initTerminalVolt,
78 initVoltAngle, initMechPower);
106 K_DP <<
K, Matrix::Zero(3, 3), Matrix::Zero(3, 3),
K;
136 Int systemSize = systemMatrix.rows();
239 SPDLOG_LOGGER_DEBUG(mLog, time, logValues);
265 K_DP <<
K, Matrix::Zero(3, 3), Matrix::Zero(3, 3),
K;
277 Real dt = mSystemTimeStep;
318 mVfd =
mExciter.step(mVd, mVq, 1, dt);
399 K <<
K1,
K2, Matrix::Zero(2, 1), 0, 0, 0;
405 2. / 3. * sin(
mThetaMech2 + 2. *
M_PI / 3.), 1. / 3., 1. / 3., 1. / 3.;
423 Matrix Knew = Matrix::Zero(3, 3);
424 Knew <<
K1a *
E1,
K2a *
F1, Matrix::Zero(2, 1), 0, 0, 0;
427 Matrix KDPnew = Matrix::Zero(6, 6);
428 KDPnew << Knew, Matrix::Zero(3, 3), Matrix::Zero(3, 3), Knew;
509 L1_Re << cos(a), cos(-2. *
PI / 3 + a), cos(2. *
PI / 3 + a),
510 cos(-2 *
PI / 3 + a), cos(-4 *
PI / 3 + a), cos(a), cos(2 *
PI / 3 + a),
511 cos(a), cos(4 *
PI / 3 + a);
513 L1_Im << sin(a), sin(-2. *
PI / 3 + a), sin(2. *
PI / 3 + a),
514 sin(-2 *
PI / 3 + a), sin(-4 *
PI / 3 + a), sin(a), sin(2 *
PI / 3 + a),
515 sin(a), sin(4 *
PI / 3 + a);
520 Im_R =
LD0 - (2 * **
mOmMech + 1) / 2. * (L1_Re * b_Re - L1_Im * b_Im);
521 Re_L =
LD0 - 1. / 2. * (L1_Re * b_Re - L1_Im * b_Im);
522 Im_L = -1. / 2. * (L1_Re * b_Im + L1_Im * b_Re);
523 Re_R2 = 1. / 2. * (2 * **
mOmMech - 1) * (L1_Im * c_Re + L1_Re * c_Im);
524 Im_R2 = -1. / 2. * (2 * **
mOmMech - 1) * (L1_Re * c_Re - L1_Im * c_Im);
525 Re_L2 = -1. / 2. * (L1_Re * c_Re - L1_Im * c_Im);
526 Im_L2 = -1. / 2. * (L1_Im * c_Re + L1_Re * c_Im);
528 R_EQ << Re_R + Re_R2, -Im_R + Im_R2, Im_R + Im_R2, Re_R - Re_R2;
529 L_EQ << Re_L + Re_L2, -Im_L + Im_L2, Im_L + Im_L2, Re_L - Re_L2;
533 Var1 =
B.inverse() * ((2 / dt) * Matrix::Identity(6, 6) -
A);
534 Var2 = -
B.inverse() * ((2 / dt) * Matrix::Identity(6, 6) +
A);
542 Complex alpha(cos(2. / 3. *
PI), sin(2. / 3. *
PI));
543 Complex thetaCompInv(cos(-theta), sin(-theta));
545 AbcToPnz << 1, 1, 1, 1, alpha, pow(alpha, 2), 1, pow(alpha, 2), alpha;
546 AbcToPnz = (1. / 3.) * AbcToPnz;
552 pnzVector = AbcToPnz * abcVector * thetaCompInv;
555 dq0Vector << pnzVector(1, 0).real(), -pnzVector(1, 0).imag(), 0;
563 Complex alpha(cos(2. / 3. *
PI), sin(2. / 3. *
PI));
564 Complex thetaComp(cos(theta), sin(theta));
566 PnzToAbc << 1, 1, 1, 1, pow(alpha, 2), alpha, 1, alpha, pow(alpha, 2);
572 abcCompVector = PnzToAbc * pnzVector * thetaComp;
575 abcVector << abcCompVector(0, 0).real(), abcCompVector(1, 0).real(),
576 abcCompVector(2, 0).real(), abcCompVector(0, 0).imag(),
577 abcCompVector(1, 0).imag(), abcCompVector(2, 0).imag();
Real mSystemOmega
Simulation angular system speed.
Real mRkq1
q-axis damper resistance 1 Rkq1 [Ohm]
Real mLmd
d-axis mutual inductance Lmd [H]
Real mBase_I
base stator current peak
Bool mHasExciter
Determines if Exciter is activated.
const Attribute< Real >::Ptr mMechTorque
mechanical torque
Real mLmq
q-axis mutual inductance Lmq [H]
std::shared_ptr< Base::Exciter > mExciter
Signal component modelling voltage regulator and exciter.
Real mLlfd
field leakage inductance Llfd [H]
Real mLlkd
d-axis damper leakage inductance Llkd [H]
Real mBase_Z
base stator impedance
const Attribute< Real >::Ptr mRs
stator resistance Rs [Ohm]
Matrix mResistanceMat
resistance matrix
std::shared_ptr< Signal::TurbineGovernor > mTurbineGovernor
Signal component modelling governor control and steam turbine (legacy)
Real mLlkq1
q-axis damper leakage inductance 1 Llkq1 [H]
Real mRkd
d-axis damper resistance Rkd [Ohm]
Real mRfd
field resistance Rfd [Ohm]
NumericalMethod mNumericalMethod
Real mBase_OmElec
base electrical angular frequency
const Attribute< Real >::Ptr mLl
leakage inductance Ll [H]
Real mBase_OmMech
base mechanical angular frequency
Real mRkq2
q-axis damper resistance 2 Rkq2 [Ohm]
Int mNumDampingWindings
Number of damping windings in q.
Real mBase_V
base stator voltage (phase-to-ground peak)
const Attribute< Real >::Ptr mOmMech
rotor speed omega_r
Bool mHasTurbineGovernor
Determines if legacy TurbineGovernor is activated.
Real mLlkq2
q-axis damper leakage inductance 2 Llkq2 [H]
const Attribute< Real >::Ptr mElecTorque
electrical torque
void mnaCompPostStep(Matrix &rightVector, Matrix &leftVector, Real time)
Retrieves calculated voltage from simulation for next step.
Real mVaIm
Interface voltage phase a _ Imaginary part.
Real c21_omega
Auxiliar variables.
Matrix R_EQ
Equivalent stator resistance matrix.
Real mVbIm
Interface voltage phase b _ Imaginary part.
Real mPsimd
Magnetizing flux linkage in d axis.
Matrix mKrs_teta
Park Transformation Matrix.
Real c11
Auxiliar constants.
Matrix & statorCurrents()
Real mIbIm
Interface current phase b _ Imaginary part.
Matrix LD0
Constant part of equivalent stator inductance.
Real mIbRe
Interface current phase b _ Real part.
Real mIcIm
Interface current phase c _ Imaginary part.
Matrix R_eq_DP
Equivalent VBR resistance matrix.
Matrix E_eq_DP
Equivalent VBR voltage source vector.
void mnaStep(Matrix &systemMatrix, Matrix &rightVector, Matrix &leftVector, Real time)
Matrix mKrs_teta_inv
Inverse Park Transformation Matrix.
Real mIaRe
Interface current phase a _ Real part.
Real mVbRe
Interface voltage phase b _ Real part.
Real mVaRe
Interface voltage phase a _ Real part.
Matrix mConductanceMat
Equivalent Stator Conductance Matrix.
Real mVcRe
Interface voltage phase c _ Real part.
Matrix mPsifdkd
D axis rotor flux.
void CalculateAuxiliarVariables(Real time)
void stepInPerUnit(Real om, Real dt, Real time, NumericalMethod numMethod)
Real mIcRe
Interface current phase c _ Real part.
Real mIaIm
Interface current phase a _ Imaginary part.
Real mTheta0
initial theta
Real mIq_hist
stator current in q axis (last time step)
Matrix dq0ToAbcTransform(Real theta, Real d, Real q, Real zero)
dq to abc
Real mLa
Auxiliar inductance.
void CalculateLandR(Real time, Real dt)
Matrix abcToDq0Transform(Real theta, Real aRe, Real bRe, Real cRe, Real aIm, Real bIm, Real cIm)
abc to dq
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)
Function to initialize Governor and Turbine.
Real mDLmd
d dynamic inductance
void initialize(Matrix frequencies) override
Initialize components with correct network frequencies.
Matrix mIabc
Interfase phase current vector.
void addExciter(Real Ta, Real Ka, Real Te, Real Ke, Real Tf, Real Kf, Real Tr, Real Lad, Real Rfd)
Function to initialize Exciter.
Real mPsimq
Magnetizing flux linkage in q axis.
Matrix mPsikq1kq2
Q axis Rotor flux.
Matrix mISourceEq
Equivalent Stator Current Source.
void CalculateAuxiliarConstants(Real dt)
Real mVcIm
Interface voltage phase c _ Imaginary part.
Real mDLmq
q dynamic inductance
Real mLb
Auxiliar inductance.
SynchronGeneratorVBR(String name, Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber, Real nomFieldCur, Real Rs, Real Ll, Real Lmd, Real Lmd0, Real Lmq, Real Lmq0, Real Rfd, Real Llfd, Real Rkd, Real Llkd, Real Rkq1, Real Llkq1, Real Rkq2, Real Llkq2, Real inertia, Logger::Level logLevel=Logger::Level::off)
FIXME: SynchronGeneratorBase does not exist!
Matrix mDVabc
Dynamic Voltage vector.
Matrix L_EQ
Equivalent stator inductance matrix.
Matrix mDqStatorCurrents
Dq stator current vector.
Matrix & dqStatorCurrents()
Real mId_hist
stator current in d axis (last time step)
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, Int maxFreq=1, Int freqIdx=0)
static void addToVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0)
static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
UInt matrixNodeIndex(UInt nodeIndex)
Bool terminalNotGrounded(UInt index)
Logger::Level mLogLevel
Component logger control for internal variables.
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.