25 copy->setParameters(mActivePower, mReactivePower, mNominalVoltage,
26 mShuntConductance, mShuntSusceptance);
33 Real shuntConductance,
34 Real shuntSusceptance) {
35 if (!std::isfinite(activePower) || !std::isfinite(reactivePower) ||
36 !std::isfinite(nominalVoltage) || !std::isfinite(shuntConductance) ||
37 !std::isfinite(shuntSusceptance) ||
38 ((activePower != 0. || reactivePower != 0.) && nominalVoltage <= 0.))
39 throw std::invalid_argument(
"Invalid impedance-load parameters.");
40 mActivePower = activePower;
41 mReactivePower = reactivePower;
42 mNominalVoltage = nominalVoltage;
43 mShuntConductance = shuntConductance;
44 mShuntSusceptance = shuntSusceptance;
45 mLoadConductance = nominalVoltage > 0.
46 ? activePower / (nominalVoltage * nominalVoltage)
48 const Matrix zero = Matrix::Zero(3, 3);
50 (mLoadConductance + mShuntConductance) *
51 Matrix::Identity(3, 3));
57 throw std::invalid_argument(
"Frequency must be positive.");
58 const Real omega = 2. *
PI * frequency;
59 const Real loadSusceptance =
61 ? mReactivePower / (mNominalVoltage * mNominalVoltage)
63 const Real inductiveSusceptance =
64 std::max(loadSusceptance, 0.) + std::max(-mShuntSusceptance, 0.);
65 const Real capacitiveSusceptance =
66 std::max(-loadSusceptance, 0.) + std::max(mShuntSusceptance, 0.);
68 inductiveSusceptance > 0. ? 1. / (omega * inductiveSusceptance) : 0.;
69 mLoadCapacitance = capacitiveSusceptance / omega;
71 const Matrix identity = Matrix::Identity(3, 3);
72 Matrix inverseInductance = Matrix::Zero(3, 3);
73 Matrix c = Matrix::Zero(3, 3);
74 if (mLoadInductance > 0.) {
75 inverseInductance = (1. / mLoadInductance) * identity;
79 (mLoadConductance + mShuntConductance) * identity,
80 mLoadCapacitance * identity);
87 voltage(0, 0) = phaseA;
103 for (
UInt phase = 0; phase < 3; ++phase)
109 const Matrix &leftVector) {
110 (**mIntfVoltage).setZero();
112 for (
UInt phase = 0; phase < 3; ++phase)
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void setParameters(Real activePower, Real reactivePower, Real nominalVoltage, Real shuntConductance=0., Real shuntSusceptance=0.)
MatrixComp buildInitialInputFromNodes(Real frequency) override
Reconstruct the initial input voltage from node/terminal phasors.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
ImpedanceLoad(String uid, String name, Logger::Level logLevel=Logger::Level::off)
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
SimPowerComp< Complex >::Ptr clone(String copySuffix) override
Returns a modified copy of the component with the given suffix added to the name and without.
MatrixComp mYHist
Complex history term.
MatrixComp mW
Complex Norton matrix W = C dB + D + (2 / dt + j omega) D1.
void setParameters(const Matrix &A, const Matrix &B, const Matrix &C, const Matrix &D, const Matrix &D1=Matrix())
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
VTypeSSNComp(String uid, String name, Int inputSize, Int outputSize, Logger::Level logLevel=Logger::Level::off)
String uid()
Returns unique id.
spdlog::level::level_enum Level
static void stampAdmittanceMatrix(const MatrixComp &admittanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog, Int maxFreq=1, Int freqIdx=0)
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)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Complex > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Complex > >::Ptr mIntfVoltage
std::shared_ptr< SimPowerComp< VarType > > Ptr
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void setTerminalNumber(UInt num)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
static std::shared_ptr< T > make(Args &&...args)
#define RMS3PH_TO_PEAK1PH
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).