38 Real initActivePower,
Real initReactivePower,
Real initTerminalVolt,
39 Real initVoltAngle,
Real initMechPower) {
42 nomPower, nomVolt, nomFreq, nomFieldCur, poleNumber, Rs, Ll, Lmd, Lmq,
43 Rfd, Llfd, Rkd, Llkd, Rkq1, Llkq1, Rkq2, Llkq2, inertia);
45 initTerminalVolt, initVoltAngle,
66 mVdq0 = Matrix::Zero(3, 1);
67 mIdq0 = Matrix::Zero(3, 1);
94 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", conductance,
96 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", conductance,
98 SPDLOG_LOGGER_INFO(
mSLog,
"Add {} to {}, {}", conductance,
125 const Matrix &leftVector) {
126 (**mIntfVoltage)(0, 0) =
128 (**mIntfVoltage)(1, 0) =
130 (**mIntfVoltage)(2, 0) =
139 attributeDependencies.push_back(leftVector);
161 Complex alpha(cos(2. / 3. *
PI), sin(2. / 3. *
PI));
162 Complex thetaCompInv(cos(-theta), sin(-theta));
165 abcToPnz << 1, 1, 1, 1, alpha, pow(alpha, 2), 1, pow(alpha, 2), alpha;
166 abcToPnz = (1. / 3.) * abcToPnz;
169 pnzVector = abcToPnz * abcVector * thetaCompInv;
172 dq0Vector << pnzVector(1, 0).real(), pnzVector(1, 0).imag(), 0;
180 Complex alpha(cos(2. / 3. *
PI), sin(2. / 3. *
PI));
181 Complex thetaComp(cos(theta), sin(theta));
184 pnzToAbc << 1, 1, 1, 1, pow(alpha, 2), alpha, 1, alpha, pow(alpha, 2);
188 pnzVector << 0,
Complex(dq0(0, 0), dq0(1, 0)), 0;
191 abcCompVector = pnzToAbc * pnzVector * thetaComp;
193 return abcCompVector;
AttributePointer< Attribute< T > > Ptr
Matrix mIsr
Vector of stator and rotor currents.
Real mSystemOmega
Simulation angular system speed.
Real mRcomp
Compensation Resistance.
Real mBase_I
base stator current peak
void setInitialValues(Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
Bool mCompensationOn
Determines if compensation elements are used.
SynchronGenerator(CPS::AttributeList::Ptr attributeList)
Constructor.
Matrix mVsr
Vector of stator and rotor voltages.
Real mBase_Z
base stator impedance
void calcStateSpaceMatrixDQ()
Matrix mIdq0
dq0 current calculated from terminal current
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.
Matrix mVdq0
dq0 voltage calculated from terminal voltage
Real mBase_OmMech
base mechanical angular frequency
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
const Attribute< Real >::Ptr mElecTorque
electrical torque
void initialize(Real omega, Real timeStep)
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
SynchronGeneratorDQ(String name, String uid, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
void trapezoidalFluxStates()
calculate flux states using trapezoidal rule - depcrecated
Real electricalTorque() const
virtual void mnaCompUpdateVoltage(const Matrix &leftVector) override
Retrieves calculated voltage from simulation for next step.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
Matrix abcToDq0Transform(Real theta, MatrixComp &abc)
Park transform as described in Krause.
void trapezoidalCurrentStates()
Real rotationalSpeed() const
Real rotorPosition() const
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
virtual ~SynchronGeneratorDQ()
MatrixComp mCompensationCurrent
Compensation current source set point.
void setParametersFundamentalPerUnit(Real nomPower, Real nomVolt, Real nomFreq, Int poleNumber, Real nomFieldCur, 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, Real initActivePower, Real initReactivePower, Real initTerminalVolt, Real initVoltAngle, Real initMechPower)
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
MatrixComp dq0ToAbcTransform(Real theta, Matrix &dq0)
Inverse Park transform as described in Krause.
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
static Complex complexFromVectorElement(const Matrix &mat, Matrix::Index row, Int maxFreq=1, Int freqIdx=0)
static void setVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0, Matrix::Index colOffset=0)
static void addToMatrixElement(SparseMatrixRow &mat, Matrix::Index row, Matrix::Index column, Complex value, Int maxFreq=1, Int freqIdx=0)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
virtual void initialize(Matrix frequencies)
Initialize components with correct network frequencies.
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
Bool terminalNotGrounded(UInt index)
void setTerminalNumber(UInt num)
std::vector< UInt > matrixNodeIndices(UInt index)
Logger::Log mSLog
Component logger.
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.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).