Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
Loading...
Searching...
No Matches
StateSpaceModel::Tree Class Reference

Spanning-tree node used during loop/cutset detection. More...

#include <State_Space_Model.h>

Public Member Functions

 Tree (Element *e, Bus *cur, Bus *r, std::shared_ptr< Tree > p=nullptr)
 Constructs a tree node for graph traversal.
 
void addPathElement (Element *e)
 Appends an element to the path from root to this node.
 
BusgetRoot () const
 
ElementgetElement () const
 
BusgetCurrentNode () const
 
const std::vector< Element * > & getSubelements () const
 
std::shared_ptr< TreegetParent () const
 
bool containsNode (Bus *node) const
 Checks whether a bus appears anywhere in this subtree.
 
std::vector< Element * > getPath () const
 Returns the full element path from root to this node.
 
std::string toString () const
 Returns a human-readable description of this tree node.
 

Detailed Description

Spanning-tree node used during loop/cutset detection.

Each node stores the element that connects to the current bus, the path of elements traversed so far, and a link back to the parent node in the search tree.

Constructor & Destructor Documentation

◆ Tree()

StateSpaceModel::Tree::Tree ( Element e,
Bus cur,
Bus r,
std::shared_ptr< Tree p = nullptr 
)
inline

Constructs a tree node for graph traversal.

Parameters
eElement associated with this node.
curCurrent bus being visited.
rRoot bus of the spanning tree.
pParent tree node (nullptr for the root).

Member Function Documentation

◆ addPathElement()

void StateSpaceModel::Tree::addPathElement ( Element e)
inline

Appends an element to the path from root to this node.

◆ containsNode()

bool StateSpaceModel::Tree::containsNode ( Bus node) const

Checks whether a bus appears anywhere in this subtree.

Parameters
nodeBus to search for.
Returns
True if node is the current node or a descendant.

◆ getCurrentNode()

Bus * StateSpaceModel::Tree::getCurrentNode ( ) const
inline
Returns
Bus currently being visited.

◆ getElement()

Element * StateSpaceModel::Tree::getElement ( ) const
inline
Returns
Element connected at this tree node.

◆ getParent()

std::shared_ptr< Tree > StateSpaceModel::Tree::getParent ( ) const
inline
Returns
Parent tree node, or nullptr at the root.

◆ getPath()

std::vector< Element * > StateSpaceModel::Tree::getPath ( ) const

Returns the full element path from root to this node.

Returns
Ordered list of elements along the path.

◆ getRoot()

Bus * StateSpaceModel::Tree::getRoot ( ) const
inline
Returns
Root bus of the spanning tree.

◆ getSubelements()

const std::vector< Element * > & StateSpaceModel::Tree::getSubelements ( ) const
inline
Returns
Elements on the path from root to this node (excluding self).

◆ toString()

std::string StateSpaceModel::Tree::toString ( ) const

Returns a human-readable description of this tree node.

Returns
String representation of the node and its path.

The documentation for this class was generated from the following files: