103 const std::vector<Int> &modulHarms,
Real inputVoltage,
118 Int freqIdx)
override;
123 Int freqIdx)
override;
142 :
Task(**inverter.
mName +
".MnaPreStepHarm"), mInverter(inverter) {
156 :
Task(**inverter.
mName +
".MnaPostStepHarm"), mInverter(inverter),
157 mLeftVectors(leftVectors) {
158 for (
UInt i = 0; i < mLeftVectors.size(); i++)
166 std::vector<Attribute<Matrix>::Ptr> mLeftVectors;
AttributePointer< Attribute< T > > Ptr
MnaPostStepHarm(Inverter &inverter, const std::vector< Attribute< Matrix >::Ptr > &leftVectors)
void execute(Real time, Int timeStepCount)
MnaPreStepHarm(Inverter &inverter)
void execute(Real time, Int timeStepCount)
Int mMaxModulHarm
Maximum number of modulation signal harmonics.
void mnaCompInitializeHarm(Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVectors) override
void setParameters(const std::vector< Int > &carrierHarms, const std::vector< Int > &modulHarms, Real inputVoltage, Real ratio, Real phase)
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
std::vector< Int > mModHarms
Vector of modulation signal harmonics.
void mnaCompApplySystemMatrixStampHarm(SparseMatrixRow &systemMatrix, Int freqIdx) override
Real multInvIntGamma(Real n) const
Real mModIdx
Modulation Index.
Real mOmCar
switching angular frequency
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override
Add MNA pre step dependencies.
Inverter(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
Real mFreqMod
system frequency (should be updated every step)
void mnaCompApplyRightSideVectorStampHarm(Matrix &rightVector) override
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
Real multInvFactorial(Int n) const
void generateFrequencies()
UInt mHarNum
Number of harmonics.
Int mMaxCarrierHarm
Maximum number of carrier signal harmonics.
Matrix mPhasorPhases
Vector of phasor phases.
Real mPhaseCar
Carrier phase.
void initialize(Matrix frequencies) override
Initialize components with correct network frequencies.
Real besselFirstKind_n(Int n, Int k_max, Real x) const
Bessel function.
Real besselFirstKind_n_opt(Int n, Int k_max, Real x)
Bessel function using look up tables for factorials.
Inverter(String name, String uid, Logger::Level logLevel=Logger::Level::off)
Defines UID, name and logging level.
std::map< Int, Real > mMultInvFactorials
Real mOmMod
system angular frequency
Real mFreqCar
switching frequency (constant)
Matrix mPhasorMags
Vector of phasor magnitudes.
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override
Stamps right side (source) vector.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
std::vector< Real > mFactorials
long long factorial(Int n) const
Int mMaxBesselSumIdx
Maximum upper limit for Bessel function 1st kind summation.
void mnaCompPreStep(Real time, Int timeStepCount) override
Real mPhaseMod
Modulation phase.
std::vector< Int > mCarHarms
Vector of carrier signal harmonics.
Matrix mPhasorFreqs
Vector of phasor frequencies.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes internal variables of the component.
Real mVfund
voltage part of system fundamental
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
String uid()
Returns unique id.
spdlog::level::level_enum Level
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Tasks to be defined by every component.
std::vector< AttributeBase::Ptr > mModifiedAttributes
std::vector< AttributeBase::Ptr > mAttributeDependencies
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Eigen::Matrix< Int, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixInt
Dense matrix for integers.
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).