11#include <dpsim-models/Base/Base_Ph1_Resistor.h>
12#include <dpsim-models/MNASimPowerComp.h>
13#include <dpsim-models/Solver/DAEInterface.h>
14#include <dpsim-models/Solver/MNATearInterface.h>
28 Logger::Level loglevel = Logger::Level::off);
30 Resistor(String name, Logger::Level logLevel = Logger::Level::off)
33 SimPowerComp<Complex>::Ptr
clone(String name);
40 void mnaCompInitialize(Real omega, Real timeStep,
41 Attribute<Matrix>::Ptr leftVector);
42 void mnaCompInitializeHarm(Real omega, Real timeStep,
43 std::vector<Attribute<Matrix>::Ptr> leftVector);
51 void mnaCompUpdateVoltageHarm(
const Matrix &leftVector, Int freqIdx);
54 void mnaCompUpdateCurrentHarm();
57 Attribute<Matrix>::Ptr &leftVector);
61 AttributeBase::List &attributeDependencies,
62 AttributeBase::List &modifiedAttributes,
63 Attribute<Matrix>::Ptr &leftVector);
65 class MnaPostStepHarm :
public Task {
68 std::vector<Attribute<Matrix>::Ptr> &leftVectors)
69 : Task(**resistor.
mName +
".MnaPostStepHarm"), mResistor(resistor),
70 mLeftVectors(leftVectors) {
71 for (UInt i = 0; i < mLeftVectors.size(); i++)
72 mAttributeDependencies.push_back(mLeftVectors[i]);
73 mModifiedAttributes.push_back(mResistor.attribute(
"v_intf"));
74 mModifiedAttributes.push_back(mResistor.attribute(
"i_intf"));
76 void execute(Real time, Int timeStepCount);
80 std::vector<Attribute<Matrix>::Ptr> mLeftVectors;
84 void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix);
88 void daeResidual(
double ttime,
const double state[],
const double dstate_dt[],
89 double resid[], std::vector<int> &off);
Complex daeInitialize()
Voltage Getter.
void mnaCompAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)
add MNA pre and post step dependencies
void mnaCompApplySystemMatrixStampHarm(SparseMatrixRow &systemMatrix, Int freqIdx)
Stamps system matrix considering the frequency index.
Resistor(String uid, String name, Logger::Level loglevel=Logger::Level::off)
Defines UID, name and logging level.
void mnaCompPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)
MNA pre and post step operations.
void daeResidual(double ttime, const double state[], const double dstate_dt[], double resid[], std::vector< int > &off)
Residual Function for DAE Solver.
void mnaCompUpdateCurrent(const Matrix &leftVector)
Update interface current from MNA system result.
void mnaCompApplySystemMatrixStamp(SparseMatrixRow &systemMatrix)
Stamps system matrix.
SimPowerComp< Complex >::Ptr clone(String name)
Returns a modified copy of the component with the given suffix added to the name and without.
void mnaCompUpdateVoltage(const Matrix &leftVector)
Update interface voltage from MNA system result.
void initializeFromNodesAndTerminals(Real frequency)
Initializes component from power flow data.
Resistor(String name, Logger::Level logLevel=Logger::Level::off)
Defines name and logging level.
const Attribute< String >::Ptr mName
Human readable name.
String uid()
Returns unique id.
MNASimPowerComp(String uid, String name, Bool hasPreStep, Bool hasPostStep, Logger::Level logLevel)