35 (**mIntfVoltage)(0, 0) = phasorA.real();
36 Complex alpha(cos(2. / 3. *
PI), sin(2. / 3. *
PI));
37 (**mIntfVoltage)(1, 0) =
Complex(phasorA * pow(alpha, 2)).real();
38 (**mIntfVoltage)(2, 0) =
Complex(phasorA * alpha).real();
42 SPDLOG_LOGGER_INFO(
mSLog,
43 "\n--- Initialization from powerflow ---"
44 "\nVoltage across amplitude and phase: \n{}"
45 "\nCurrent amplitude and phase: \n{}"
46 "\nTerminal 0 voltage amplitude and phase: \n{}"
47 "\nTerminal 1 voltage amplitude and phase: \n{}"
48 "\n--- Initialization from powerflow finished ---",
88 attributeDependencies.push_back(leftVector);
103 (**mIntfVoltage)(0, 0) =
105 (**mIntfVoltage)(1, 0) =
107 (**mIntfVoltage)(2, 0) =
111 (**mIntfVoltage)(0, 0) =
114 (**mIntfVoltage)(1, 0) =
117 (**mIntfVoltage)(2, 0) =
AttributePointer< Attribute< T > > Ptr
const Attribute< Real >::Ptr mClosedResistance
Resistance if switch is closed [ohm].
Switch(CPS::AttributeList::Ptr attributeList)
const Attribute< Real >::Ptr mOpenResistance
Resistance if switch is open [ohm].
const Attribute< Bool >::Ptr mIsClosed
Defines if Switch is open or closed.
Bool mnaIsClosed() override
Check if switch is closed.
void mnaCompUpdateCurrent(const Matrix &leftVector) override
Update interface voltage from MNA system results.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override
Add MNA post step dependencies.
Bool hasParameterChanged() override
Returns true if one of the element paramters has changed.
SeriesSwitch(String uid, String name, Logger::Level loglevel=Logger::Level::off)
Defines UID, name and log level.
void initializeFromNodesAndTerminals(Real frequency) override
Initializes states from power flow data.
void mnaCompUpdateVoltage(const Matrix &leftVector) override
Update interface voltage from MNA system results.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) override
Stamps system matrix.
SimPowerComp< Real >::Ptr clone(String name) override
Return new instance with the same parameters.
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
Initializes MNA specific variables.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override
void mnaCompApplySwitchSystemMatrixStamp(Bool closed, SparseMatrixRow &systemMatrix, Int freqIdx) override
Stamps system matrix considering the defined switch position.
String uid()
Returns unique id.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
static String phasorMatrixToString(const MatrixComp &mat)
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
Attribute< Matrix >::Ptr mRightVector
static void stampConductanceAs3x3ScalarMatrix(Real conductance, SparseMatrixRow &mat, UInt node1Index, UInt node2Index, Bool isTerminal1NotGrounded, Bool isTerminal2NotGrounded, const Logger::Log &mSLog)
Stamps conductance as a 3x3 scalar matrix (a diagonal matrix, where all diagonal elements are equal t...
static Real realFromVectorElement(const Matrix &mat, Matrix::Index row)
UInt matrixNodeIndex(UInt nodeIndex)
const Attribute< MatrixVar< Real > >::Ptr mIntfCurrent
const Attribute< MatrixVar< Real > >::Ptr mIntfVoltage
MatrixComp initialVoltage(UInt index)
std::shared_ptr< SimPowerComp< VarType > > Ptr
Bool terminalNotGrounded(UInt index)
Complex initialSingleVoltage(UInt index)
void updateMatrixNodeIndices()
void setTerminalNumber(UInt num)
Logger::Level mLogLevel
Component logger control for internal variables.
Logger::Log mSLog
Component logger.
static std::shared_ptr< SeriesSwitch > make(Args &&...args)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
std::complex< Real > Complex
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).