DPsim
Loading...
Searching...
No Matches
SimTerminal.h
Go to the documentation of this file.
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
13
14namespace CPS {
15
16template <typename VarType>
18 public SharedFactory<SimTerminal<VarType>> {
19protected:
21 std::weak_ptr<SimNode<VarType>> mNode;
22
23public:
24 typedef std::shared_ptr<SimTerminal<VarType>> Ptr;
25 typedef std::vector<Ptr> List;
31 typename SimNode<VarType>::Ptr node() { return mNode.lock(); }
34 mNode = node;
35 setPhaseType(node->phaseType());
36 }
37
40 VarType singleVoltage() {
41 if (node()->isGround())
42 return 0.;
43 else
44 return node()->singleVoltage(mPhaseType);
45 }
46
48 if (node()->isGround())
49 return {0., 0., 0.};
50 else
51 return node()->voltage();
52 }
53};
54} // namespace CPS
String uid()
Returns unique id.
std::shared_ptr< SimNode< VarType > > Ptr
Definition SimNode.h:32
SimNode< VarType >::Ptr node()
Definition SimTerminal.h:31
SimTerminal(String name)
Definition SimTerminal.h:27
void setNode(typename SimNode< VarType >::Ptr node)
Definition SimTerminal.h:33
MatrixVar< VarType > mCurrent
Definition SimTerminal.h:20
SimTerminal(String uid, String name)
Definition SimTerminal.h:29
std::shared_ptr< SimTerminal< VarType > > Ptr
Definition SimTerminal.h:24
std::vector< Ptr > List
Definition SimTerminal.h:25
MatrixVar< VarType > voltage()
Definition SimTerminal.h:47
VarType singleVoltage()
Definition SimTerminal.h:40
std::weak_ptr< SimNode< VarType > > mNode
Definition SimTerminal.h:21
TopologicalNode::Ptr topologicalNodes()
Returns reference to TopologicalNode.
Definition SimTerminal.h:38
std::shared_ptr< TopologicalNode > Ptr
void setPhaseType(PhaseType type)
TopologicalTerminal(String uid, String name, PhaseType phase=PhaseType::Single)
PhaseType mPhaseType
Determines the connection between Component and Node.
std::string String
Definition Definitions.h:65
Eigen::Matrix< VarType, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixVar
Definition Definitions.h:97