24 copy->setParameters(mActivePower, mReactivePower, mNominalVoltage,
25 mShuntConductance, mShuntSusceptance);
32 Real shuntConductance,
33 Real shuntSusceptance) {
34 if (!std::isfinite(activePower) || !std::isfinite(reactivePower) ||
35 !std::isfinite(nominalVoltage) || !std::isfinite(shuntConductance) ||
36 !std::isfinite(shuntSusceptance) ||
37 ((activePower != 0. || reactivePower != 0.) && nominalVoltage <= 0.))
38 throw std::invalid_argument(
"Invalid impedance-load parameters.");
39 mActivePower = activePower;
40 mReactivePower = reactivePower;
41 mNominalVoltage = nominalVoltage;
42 mShuntConductance = shuntConductance;
43 mShuntSusceptance = shuntSusceptance;
44 mLoadConductance = nominalVoltage > 0.
45 ? activePower / (nominalVoltage * nominalVoltage)
47 mTotalConductance = mLoadConductance + shuntConductance;
48 const Matrix zero = Matrix::Zero(3, 3);
50 mTotalConductance * Matrix::Identity(3, 3));
56 throw std::invalid_argument(
"Frequency must be positive.");
57 const Real omega = 2. *
PI * frequency;
58 const Real loadSusceptance =
60 ? mReactivePower / (mNominalVoltage * mNominalVoltage)
62 const Real inductiveSusceptance =
63 std::max(loadSusceptance, 0.) + std::max(-mShuntSusceptance, 0.);
64 const Real capacitiveSusceptance =
65 std::max(-loadSusceptance, 0.) + std::max(mShuntSusceptance, 0.);
67 inductiveSusceptance > 0. ? 1. / (omega * inductiveSusceptance) : 0.;
68 mLoadCapacitance = capacitiveSusceptance / omega;
70 const Matrix identity = Matrix::Identity(3, 3);
71 Matrix inverseInductance = Matrix::Zero(3, 3);
72 Matrix c = Matrix::Zero(3, 3);
73 if (mLoadInductance > 0.) {
74 inverseInductance = (1. / mLoadInductance) * identity;
78 mTotalConductance * identity,
79 mLoadCapacitance * identity);
86 voltage(0, 0) = phaseA;
102 for (
UInt phase = 0; phase < 3; ++phase)
108 const Matrix &leftVector) {
111 for (
UInt phase = 0; phase < 3; ++phase)
SimPowerComp< Real >::Ptr clone(String copySuffix) override
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
ImpedanceLoad(String uid, String name, Logger::Level logLevel=Logger::Level::off)
MatrixComp buildInitialInputFromNodes(Real frequency) override
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
void setParameters(Real activePower, Real reactivePower, Real nominalVoltage, Real shuntConductance=0., Real shuntSusceptance=0.)
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
void setParameters(const Matrix &A, const Matrix &B, const Matrix &C, const Matrix &D, const Matrix &D1=Matrix())
VTypeSSNComp(String uid, String name, Int inputSize, Int outputSize, Logger::Level logLevel=Logger::Level::off)
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
String uid()
Returns unique id.
spdlog::level::level_enum Level
static void stampConductanceMatrix(const Matrix &conductanceMat, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
static Real realFromVectorElement(const Matrix &mat, Matrix::Index row)
static void setVectorElement(Matrix &mat, Matrix::Index row, Complex value, Int maxFreq=1, Int freqIdx=0, Matrix::Index colOffset=0)
UInt matrixNodeIndex(UInt nodeIndex)
MatrixVar< Real > * mIntfVoltageValue
MatrixVar< Real > * mIntfCurrentValue
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).