DPsim
MNATearInterface.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/Definitions.h>
12 #include <dpsim-models/Solver/MNAInterface.h>
13 
14 namespace CPS {
16 public:
17  // Returns a list of additional components connected to ground that
18  // need to be considered for the original systems.
19  virtual MNAInterface::List mnaTearGroundComponents() {
20  return MNAInterface::List();
21  }
22  // Initialize the internal state of the component
23  virtual void mnaTearInitialize(Real omega, Real timeStep) {}
24  // Apply the stamp to the impedance matrix of the removed network
25  virtual void mnaTearApplyMatrixStamp(SparseMatrixRow &tearMatrix) = 0;
26  // TODO: if we're consequent, these should be implemented as tasks
27  // Apply the stamp to the vector of additional voltages in the removed network
28  virtual void mnaTearApplyVoltageStamp(Matrix &currentVector) {}
29  // Update the internal state based on the solution of the complete system
30  virtual void mnaTearPostStep(Complex voltage, Complex current) {}
31 
32  void mnaTearSetIdx(UInt compIdx) { mTearIdx = compIdx; }
33 
34 protected:
35  UInt mTearIdx;
36 };
37 } // namespace CPS