DPsim
TopologicalNode.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/IdentifiedObject.h>
12 #include <dpsim-models/MathUtils.h>
13 #include <dpsim-models/PtrFactory.h>
14 
15 namespace CPS {
16 
18 protected:
19  PhaseType mPhaseType = PhaseType::Single;
20  Bool mIsGround = false;
21 
22 public:
23  typedef std::shared_ptr<TopologicalNode> Ptr;
24  typedef std::vector<Ptr> List;
25 
26  const Attribute<MatrixComp>::Ptr mInitialVoltage;
27 
28  TopologicalNode() {}
30  TopologicalNode(String uid, String name, PhaseType phaseType,
31  const std::vector<Complex> &initialVoltage);
33  virtual ~TopologicalNode() {}
34 
36  Bool isGround() const;
38  MatrixComp initialVoltage() const;
40  void setInitialVoltage(MatrixComp voltage) const;
42  void setInitialVoltage(Complex voltage) const;
44  void setInitialVoltage(Complex voltage, Int phaseIndex) const;
46  Complex initialSingleVoltage(PhaseType phaseType = PhaseType::Single);
48  PhaseType phaseType() const;
50  virtual UInt matrixNodeIndex(PhaseType phaseType = PhaseType::Single) = 0;
52  virtual std::vector<UInt> matrixNodeIndices() = 0;
54  virtual void setMatrixNodeIndex(UInt phase, UInt matrixNodeIndex) = 0;
55 };
56 } // namespace CPS
String uid()
Returns unique id.