13template <
typename VarType>
22template <
typename VarType>
31template <
typename VarType>
36template <
typename VarType>
44template <
typename VarType>
49template <
typename VarType>
54template <
typename VarType>
56 return node(index)->matrixNodeIndices();
71template <
typename VarType>
76template <
typename VarType>
81template <
typename VarType>
86template <
typename VarType>
91template <
typename VarType>
96template <
typename VarType>
101template <
typename VarType>
106template <
typename VarType>
111template <
typename VarType>
116template <
typename VarType>
121template <
typename VarType>
127template <
typename VarType>
133template <
typename VarType>
138template <
typename VarType>
145template <
typename VarType>
153template <
typename VarType>
162template <
typename VarType>
170template <
typename VarType>
175 mSLog,
"Number of Terminals is too large for Component {} - Ignoring",
182template <
typename VarType>
187 mSLog,
"Terminal position number too large for Component {} - Ignoring",
193 mSLog,
"Set Terminal at position {} to Node {}, simulation node {}",
198template <
typename VarType>
213 return static_cast<UInt>(
217template <
typename VarType>
221 nodes.push_back(term->node());
227template <
typename VarType>
233 String nodeName = **
mName +
"_vnode_" + std::to_string(idx);
239template <
typename VarType>
245 "Virtual Node position number too large for Component {} - Ignoring",
250 mSLog,
"Set virtual Node at position {} to Node {}, simulation node {}",
255template <
typename VarType>
264template <
typename VarType>
268 mSLog,
"Number of Nodes is too large for Component {} - Ignoring",
272 for (
UInt i = 0; i < nodes.size(); i++) {
273 if (nodes[i] ==
nullptr) {
275 fmt::format(
"Node is nullptr for Component {}", **
mName));
285template <
typename VarType>
299 node->initialize(frequencies);
const Attribute< String >::Ptr mName
Human readable name.
String uid()
Returns unique id.
const Attribute< String >::Ptr mUID
Unique identifier.
AttributeList::Ptr mAttributes
Attribute List.
spdlog::level::level_enum Level
std::shared_ptr< SimNode< VarType > > Ptr
Base class for all components that are transmitting power.
UInt mNumFreqs
Number of network frequencies.
UInt matrixNodeIndex(UInt nodeIndex)
void setVirtualNodeAt(typename SimNode< VarType >::Ptr virtualNode, UInt nodeNum)
Sets the virtual node at index nodeNum.
const Attribute< MatrixVar< VarType > >::Ptr mIntfCurrent
Current through component.
SimTerminal< VarType >::List mTerminals
List of Terminals.
const MatrixVar< VarType > & intfVoltage()
Bool hasVirtualNodes()
Returns true if virtual node number is greater than zero.
std::vector< bool > mMatrixNodeIndexIsGround
"Cached" flags for whether the connected nodes are grounded
UInt terminalNumber()
Returns nominal number of Terminals for this component type.
UInt virtualSimNode(UInt nodeIndex, UInt phaseIndex=0)
Get simulation node number from virtual node.
SimPowerComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Basic constructor that takes UID, name and log level.
UInt nodeNumber()
Returns the actual number of Nodes / Terminals that are already set to valid Nodes.
void checkForUnconnectedTerminals()
SimNode< VarType >::Ptr node(UInt index)
Get pointer to node.
std::vector< UInt > mMatrixNodeIndices
"Cached" list of simulation nodes (to avoid shared_ptr accesses during simulation)
Matrix mFrequencies
List of considered network frequencies.
virtual void initialize(Matrix frequencies)
Initialize components with correct network frequencies.
SimTerminal< VarType >::Ptr terminal(UInt index)
Get pointer to Terminal.
const MatrixVar< VarType > & intfCurrent()
SimTerminal< VarType >::List terminals()
Return list of Terminal pointers.
std::vector< UInt > virtualMatrixNodeIndices(UInt index)
Get vector of simulation node numbers from virtual Node.
void setVirtualNodeNumber(UInt num)
Bool hasUnconnectedTerminals()
const Attribute< MatrixVar< VarType > >::Ptr mIntfVoltage
Voltage between terminals.
void connect(typename SimNode< VarType >::List nodes)
Sets all nodes and checks for nominal number of Nodes for this Component.
SimPowerComp< VarType >::List subComponents()
Get list of subcomponents.
UInt virtualNodesNumber()
Returns nominal number of virtual nodes for this component type.
void setTerminalAt(typename SimTerminal< VarType >::Ptr terminal, UInt terminalPosition)
Sets Terminal at index terminalPosition.
void setIntfVoltage(MatrixVar< VarType > voltage)
MatrixComp initialVoltage(UInt index)
SimNode< Complex >::Ptr virtualNode(UInt index)
void setIntfCurrent(MatrixVar< VarType > current)
TopologicalNode::List topologicalNodes()
Get nodes as base type TopologicalNode.
UInt terminalNumberConnected()
Returns the number of connected Terminals.
std::shared_ptr< SimPowerComp< VarType > > Ptr
SimNode< Complex >::List mVirtualNodes
std::vector< std::shared_ptr< SimPowerComp< VarType > > > mSubComponents
void setTerminals(typename SimTerminal< VarType >::List terminals)
SimNode< VarType >::List & virtualNodes()
Bool terminalNotGrounded(UInt index)
Bool hasSubComponents()
Returns true if subcomponents included in this component.
Complex initialSingleVoltage(UInt index)
void updateMatrixNodeIndices()
Update the "cached" mMatrixNodeIndices and mMatrixNodeIndexIsGround members.
void setTerminalNumber(UInt num)
virtual SimPowerComp< VarType >::Ptr clone(String name)
Returns a modified copy of the component with the given suffix added to the name and without.
TopologicalTerminal::List topologicalTerminals()
Returns the list of terminals as TopologicalTerminal pointers.
std::vector< UInt > matrixNodeIndices(UInt index)
TODO replace with access to mMatrixNodeIndices.
std::shared_ptr< SimTerminal< VarType > > Ptr
UInt mNumTerminals
Determines the number of Terminals which can be connected to network Nodes.
UInt mNumVirtualNodes
Determines the number of virtual or internal Nodes.
Logger::Log mSLog
Component logger.
TopologicalPowerComp(String uid, String name, Logger::Level logLevel=Logger::Level::off)
Basic constructor that takes UID, name and log level.
static std::shared_ptr< SimTerminal< VarType > > make(Args &&...args)
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > Matrix
Dense matrix for real numbers.
Eigen::Matrix< VarType, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixVar
std::complex< Real > Complex
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > MatrixComp
Dense matrix for complex numbers.