DPsim
MNAInterface.h
1 /* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #pragma once
10 
11 #include <dpsim-models/AttributeList.h>
12 #include <dpsim-models/Config.h>
13 #include <dpsim-models/Definitions.h>
14 #include <dpsim-models/Task.h>
15 
16 namespace CPS {
18 class MNAInterface {
19 public:
20  typedef std::shared_ptr<MNAInterface> Ptr;
21  typedef std::vector<Ptr> List;
22 
23  // #### MNA Base Functions ####
25  virtual void mnaInitialize(Real omega, Real timeStep) = 0;
26  virtual void mnaInitialize(Real omega, Real timeStep,
27  Attribute<Matrix>::Ptr leftVector) = 0;
29  virtual void mnaApplySystemMatrixStamp(SparseMatrixRow &systemMatrix) = 0;
31  virtual void mnaApplyRightSideVectorStamp(Matrix &rightVector) = 0;
33  virtual void mnaUpdateVoltage(const Matrix &leftVector) = 0;
35  virtual void mnaUpdateCurrent(const Matrix &leftVector) = 0;
37  virtual void mnaPreStep(Real time, Int timeStepCount) = 0;
39  virtual void mnaPostStep(Real time, Int timeStepCount,
40  Attribute<Matrix>::Ptr &leftVector) = 0;
42  virtual void
43  mnaAddPreStepDependencies(AttributeBase::List &prevStepDependencies,
44  AttributeBase::List &attributeDependencies,
45  AttributeBase::List &modifiedAttributes) = 0;
47  virtual void
48  mnaAddPostStepDependencies(AttributeBase::List &prevStepDependencies,
49  AttributeBase::List &attributeDependencies,
50  AttributeBase::List &modifiedAttributes,
51  Attribute<Matrix>::Ptr &leftVector) = 0;
52 
53  // #### MNA Harmonic Base Functions ####
55  virtual void
56  mnaInitializeHarm(Real omega, Real timeStep,
57  std::vector<Attribute<Matrix>::Ptr> leftVector) = 0;
59  virtual void mnaApplySystemMatrixStampHarm(SparseMatrixRow &systemMatrix,
60  Int freqIdx) = 0;
62  virtual void mnaApplyRightSideVectorStampHarm(Matrix &sourceVector) = 0;
63  virtual void mnaApplyRightSideVectorStampHarm(Matrix &sourceVector,
64  Int freqIdx) = 0;
66  virtual const Task::List &mnaTasks() const = 0;
67  // Return right vector attribute
68  virtual Attribute<Matrix>::Ptr getRightVector() const = 0;
69 };
70 } // namespace CPS
Interface to be implemented by all models used by the MNA solver.
Definition: MNAInterface.h:18
virtual void mnaAddPostStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes, Attribute< Matrix >::Ptr &leftVector)=0
Add MNA post step dependencies.
virtual void mnaUpdateCurrent(const Matrix &leftVector)=0
Update interface current from MNA system result.
virtual void mnaAddPreStepDependencies(AttributeBase::List &prevStepDependencies, AttributeBase::List &attributeDependencies, AttributeBase::List &modifiedAttributes)=0
Add MNA pre step dependencies.
virtual void mnaInitialize(Real omega, Real timeStep)=0
Initializes variables of components.
virtual const Task::List & mnaTasks() const =0
Return list of MNA tasks.
virtual void mnaPostStep(Real time, Int timeStepCount, Attribute< Matrix >::Ptr &leftVector)=0
MNA post step operations.
virtual void mnaApplySystemMatrixStamp(SparseMatrixRow &systemMatrix)=0
Stamps system matrix.
virtual void mnaPreStep(Real time, Int timeStepCount)=0
MNA pre step operations.
virtual void mnaApplyRightSideVectorStamp(Matrix &rightVector)=0
Stamps right side (source) vector.
virtual void mnaApplySystemMatrixStampHarm(SparseMatrixRow &systemMatrix, Int freqIdx)=0
Stamps system matrix considering the frequency index.
virtual void mnaApplyRightSideVectorStampHarm(Matrix &sourceVector)=0
Stamps right side (source) vector considering the frequency index.
virtual void mnaUpdateVoltage(const Matrix &leftVector)=0
Update interface voltage from MNA system result.
virtual void mnaInitializeHarm(Real omega, Real timeStep, std::vector< Attribute< Matrix >::Ptr > leftVector)=0
Initializes variables of components.