DPsim
Loading...
Searching...
No Matches
EMT_DC_CurrentSource.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Institute for Automation of Complex Power Systems, EONERC, RWTH Aachen University
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
7
8namespace CPS {
9namespace EMT {
10namespace DC {
11
14class CurrentSource final : public MNASimPowerComp<Real>,
15 public SharedFactory<CurrentSource> {
16public:
18
20
22 Logger::Level logLevel = Logger::Level::off);
23 CurrentSource(String name, Logger::Level logLevel = Logger::Level::off)
24 : CurrentSource(name, name, logLevel) {}
25
27 void setParameters(Real current);
28 void initializeFromNodesAndTerminals(Real frequency) override;
29
30 void mnaCompInitialize(Real omega, Real timeStep,
31 Attribute<Matrix>::Ptr leftVector) override;
33 void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override final;
34 void mnaCompUpdateVoltage(const Matrix &leftVector) override final;
35 void mnaCompPreStep(Real time, Int timeStepCount) override final;
36 void mnaCompPostStep(Real time, Int timeStepCount,
37 Attribute<Matrix>::Ptr &leftVector) override final;
39 AttributeBase::List &prevStepDependencies,
40 AttributeBase::List &attributeDependencies,
41 AttributeBase::List &modifiedAttributes) override final;
43 AttributeBase::List &prevStepDependencies,
44 AttributeBase::List &attributeDependencies,
45 AttributeBase::List &modifiedAttributes,
46 Attribute<Matrix>::Ptr &leftVector) override final;
47
48private:
49 void validateDCTerminals() const;
50};
51
52} // namespace DC
53} // namespace EMT
54} // namespace CPS
std::vector< Ptr > List
Definition Attribute.h:123
AttributePointer< Attribute< T > > Ptr
Definition Attribute.h:250
CurrentSource(String name, Logger::Level logLevel=Logger::Level::off)
void mnaCompApplyRightSideVectorStamp(Matrix &rightVector) override final
void mnaCompInitialize(Real omega, Real timeStep, Attribute< Matrix >::Ptr leftVector) override
void initializeFromNodesAndTerminals(Real frequency) override
Initializes Component variables according to power flow data stored in Nodes.
void mnaCompPreStep(Real time, Int timeStepCount) override final
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector) override final
void mnaCompAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes) override final
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector) override final
void mnaCompUpdateVoltage(const Matrix &leftVector) override final
SimPowerComp< Real >::Ptr clone(String name) override final
Returns a modified copy of the component with the given suffix added to the name and without.
const Attribute< Real >::Ptr mCurrentRef
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &) override final
CurrentSource(String uid, String name, Logger::Level logLevel=Logger::Level::off)
String uid()
Returns unique id.
spdlog::level::level_enum Level
Definition Logger.h:33
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)
std::shared_ptr< SimPowerComp< VarType > > Ptr
static std::shared_ptr< CurrentSource > make(Args &&...args)
Definition PtrFactory.h:19
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Definition Definitions.h:81
std::string String
Definition Definitions.h:65
double Real
Definition Definitions.h:62
int Int
Definition Definitions.h:61
Eigen::SparseMatrix< Real, Eigen::RowMajor > SparseMatrixRow
Sparse matrix for real numbers (row major).
Definition Definitions.h:74