42 static constexpr Int mStateSize = 17;
43 static constexpr Int mInputSize = 3;
44 static constexpr Int mOutputSize = 3;
46 enum StateIndex :
Int {
53 VoltageIntegratorD = 5,
54 VoltageIntegratorQ = 6,
56 CurrentIntegratorD = 7,
57 CurrentIntegratorQ = 8,
85 Real mDampingCoefficient;
86 Real mVoltageDroopGain;
87 Real mReactiveIntegralGain;
98 Real mActiveDampingGain;
99 Real mPowerFilterCutoff;
100 Real mDelayBandwidth;
103 Real mVirtualResistance;
104 Real mVirtualReactance;
107 Real mGridCurrentFeedforward;
111 Real mReactivePowerDroop;
112 Real mReactiveDroopCutoff;
113 Real mVoltageSetpoint;
116 Real mJacobianRelativeStep;
117 Real mJacobianAbsoluteStep;
138 std::vector<Attribute<Real>::Ptr> mStateLogAttributes;
141 Matrix mStateDerivativeWorkspace = Matrix::Zero(mStateSize, 1);
142 Matrix mOutputWorkspace = Matrix::Zero(mOutputSize, 1);
143 Matrix mStateOffsetWorkspace = Matrix::Zero(mStateSize, 1);
144 Matrix mOutputOffsetWorkspace = Matrix::Zero(mOutputSize, 1);
148 Bool mImplicitNewtonActive =
false;
150 Matrix mNewtonBaseVoltage;
151 Matrix mNewtonBaseDerivative;
153 Matrix mNewtonGuessVoltage;
160 void evaluateStateDerivative(
const Matrix &x,
const Matrix &u,
161 Matrix &stateDerivative)
const;
172 Real regularizedOmega(
Real omega)
const;
210 Real dampingCoefficient,
Real voltageDroopGain,
211 Real reactiveIntegralGain,
Real kpVoltage,
Real kiVoltage,
213 Real powerFilterCutoff,
Real delayBandwidth);
AttributePointer< Attribute< T > > Ptr
void beginImplicitNewtonStep()
void calculateNumericalJacobians(const Matrix &x, const Matrix &u, Matrix &A, Matrix &B, Matrix &C, Matrix &D) const
Numerically calculate A, B, C and D by central differences, as the reference for EMT_Ph3_SSN_GFM_Jaco...
void setImplicitNewtonGuess(const Matrix &state, const Matrix &voltage)
void setNumericalLinearizationParameters(Real relativeStep, Real absoluteStep)
Configure finite-difference steps for local linearization.
SSN_GFM(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Matrix getStateDerivative() const
void restoreImplicitNewtonBase()
Bool updateComponentParameters() override final
Matrix getInterfaceCurrent() const
std::vector< SSNComp::LocalAbcStateBlock > getLocalAbcStateBlocks() const override final
Matrix getInterfaceVoltage() const
void updateLogAttributes(const Matrix &u) const override final
Update derived attributes used for logging/inspection.
void setReactivePowerDroop(Real droopGain, Real cutoff)
Opt-in proportional Q-V droop replacing the integral excitation. droopGain is Dq [V/var]; cutoff [rad...
void setParameters(Real lf, Real cf, Real rf, Real rc, Real nominalVoltage, Real omegaN, Real pRef, Real qRef, Real virtualInertia, Real dampingCoefficient, Real voltageDroopGain, Real reactiveIntegralGain, Real kpVoltage, Real kiVoltage, Real kpCurrent, Real kiCurrent, Real activeDampingGain, Real powerFilterCutoff, Real delayBandwidth)
Configure the GFM model.
std::vector< String > getLocalStateNames() const override final
void endImplicitNewtonStep()
void calculateAnalyticalJacobians(const Matrix &x, const Matrix &u, Matrix &A, Matrix &B, Matrix &C, Matrix &D) const
Analytically calculate A, B, C and D, as the simulation does.
Real implicitNewtonResidual() const
void setGridCurrentFeedforward(Real scale)
Scale on the voltage-loop grid-current feedforward (default 1).
void setVirtualImpedance(Real virtualResistance, Real virtualReactance=0.0)
Opt-in virtual output impedance Zv = Rv + jXv, subtracted from the EMF reference across the filter cu...
void initializeFromNodesAndTerminals(Real frequency) override final
Initializes Component variables according to power flow data stored in Nodes.
SSN_GFM(String name, Logger::Level logLevel=Logger::Level::off)
TwoTerminalVTypeVariableSSNComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Abstract base class for EMT state-space nodal (SSN) components.
String uid()
Returns unique id.
spdlog::level::level_enum Level
static std::shared_ptr< SSN_GFM > make(Args &&...args)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Eigen::Matrix< Real, rows, cols, Eigen::ColMajor > MatrixFixedSize
Dense matrix for real numbers with fixed dimension.