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

Named sub-network that inherits Network topology APIs but acts as a non-owning view. More...

#include <SubNetwork.h>

Inheritance diagram for SubNetwork:
Collaboration diagram for SubNetwork:

Public Member Functions

 SubNetwork ()
 Construct an unnamed sub-network with default name "Unnamed_SubNetwork".
 
 SubNetwork (const std::string &name)
 Construct a named sub-network.
 
 ~SubNetwork ()
 Release sub-network maps without deleting buses or elements.
 
std::string getSubNetworkName () const
 Get the sub-network name.
 
void setSubNetworkName (const std::string &name)
 Set the sub-network name.
 
void addOutput (const std::string &busName, Bus *bus)
 Register an output (interface) bus for this sub-network.
 
void setTransformation (bool flag)
 Enable or disable coordinate transformation (e.g.
 
bool getTransformation () const
 Query whether coordinate transformation is enabled.
 
const std::unordered_map< std::string, Bus * > & getOutputs () const
 Const access to the output-bus map.
 
const int getNumberOfOutputs () const
 Get the number of registered output buses.
 
const string getName () const
 Get the sub-network name (alias for getSubNetworkName).
 
void printInfo () const
 Print sub-network summary (name, bus/element counts, output bus count).
 
- Public Member Functions inherited from Network
 Network ()
 Construct an empty network with zero pins.
 
virtual ~Network ()
 Destroy the network and all owned buses, elements, and grid sub-networks.
 
void addBus (const std::string &busName, std::unique_ptr< Bus > bus)
 Register an owned bus (transfers ownership on root networks).
 
void addBus (Bus *bus)
 Register a bus using its own name as the map key.
 
void addBus (const std::string &busName, Bus *bus)
 Register a bus under an explicit name (transfers ownership on root networks).
 
void addBusView (const std::string &busName, Bus *bus)
 Register a non-owning bus pointer (used by SubNetwork views).
 
void addElement (const std::string &designator, std::unique_ptr< Element > elem)
 Register an owned element.
 
void addElement (Element *elem)
 Register an element using an auto-generated designator.
 
void addElement (const std::string &designator, Element *elem)
 Register an element under a specific designator string.
 
void addElementView (const std::string &designator, Element *elem)
 Register a non-owning element pointer (used by SubNetwork views).
 
void connectElementToBus (Element *elem, int terminal, Bus *bus)
 Connect an element terminal to a bus and record the association in both directions.
 
void deleteElement (const std::string &designator)
 Remove and destroy an element by designator.
 
void deleteBus (const std::string &busName)
 Remove and destroy a bus by name.
 
void printConnections ()
 Print bus-to-element connection listing to standard output.
 
void printBuses ()
 Print all registered buses to standard output.
 
void printElements ()
 Print all registered elements to standard output.
 
void print_summary () const
 Print a concise summary of network contents (counts and names).
 
const std::unordered_map< std::string, Bus * > & getBuses () const
 Const access to the bus name-to-pointer map.
 
const std::unordered_map< std::string, Element * > & getElements () const
 Const access to the element designator-to-pointer map.
 
std::unordered_map< std::string, Element * > & getElements ()
 Mutable access to the element designator-to-pointer map.
 
const std::unordered_map< Bus *, std::vector< Element * > > & getConnections () const
 Const access to the bus-to-connected-elements map.
 
std::unordered_map< Bus *, std::vector< Element * > > & getConnections ()
 Mutable access to the bus-to-connected-elements map.
 
void add_areas ()
 Populate AC and DC grid sub-networks from the current flat network topology.
 
void empty_areas ()
 Destroy all grid sub-networks and clear grid/converter registries.
 
bool is_area_empty ()
 Check whether both AC and DC grid maps are empty.
 
vector< string > get_ac_grid_names ()
 Return ordered names of registered AC grids.
 
vector< string > get_dc_grid_names ()
 Return ordered names of registered DC grids.
 
std::unordered_map< std::string, SubNetwork * > & get_ac_grids ()
 Mutable access to the AC grid sub-network map.
 
std::unordered_map< std::string, SubNetwork * > & get_dc_grids ()
 Mutable access to the DC grid sub-network map.
 
std::unordered_map< std::string, Element * > & get_converters ()
 Mutable access to the converter element map.
 

Additional Inherited Members

- Protected Attributes inherited from Network
std::unordered_map< std::string, Bus * > buses
 
std::unordered_map< std::string, Element * > elements
 
std::unordered_map< Bus *, std::vector< Element * > > connections
 
int pins = 0
 
std::vector< std::string > ac_grid_names
 
std::vector< std::string > dc_grid_names
 
std::unordered_map< std::string, SubNetwork * > ac_grids
 
std::unordered_map< std::string, SubNetwork * > dc_grids
 
std::unordered_map< std::string, Element * > converters
 
bool ownsResources_ = true
 When true, buses/elements registered via addBus/addElement are owned.
 

Detailed Description

Named sub-network that inherits Network topology APIs but acts as a non-owning view.

Used to represent AC grids, DC grids, and modular partitions. Buses and elements registered here typically live in a parent Network; SubNetwork maps hold pointers without ownership. Output buses mark interface nodes at sub-network boundaries.

Constructor & Destructor Documentation

◆ SubNetwork() [1/2]

SubNetwork::SubNetwork ( )

Construct an unnamed sub-network with default name "Unnamed_SubNetwork".

References Network::ownsResources_.

◆ SubNetwork() [2/2]

SubNetwork::SubNetwork ( const std::string &  name)
explicit

Construct a named sub-network.

Parameters
nameHuman-readable sub-network identifier.

References Network::ownsResources_.

◆ ~SubNetwork()

SubNetwork::~SubNetwork ( )

Release sub-network maps without deleting buses or elements.

Clears internal maps (buses, elements, connections, output buses, grids, converters) only. Pointers refer to objects owned by the parent Network; they are not deleted here.

References Network::ac_grid_names, Network::ac_grids, Network::buses, Network::connections, Network::converters, Network::dc_grid_names, Network::dc_grids, and Network::elements.

Member Function Documentation

◆ addOutput()

void SubNetwork::addOutput ( const std::string &  busName,
Bus bus 
)
inline

Register an output (interface) bus for this sub-network.

Parameters
busNameKey for the output bus in the local map.
busNon-owning pointer to the interface bus; ignored if null.

◆ getName()

const string SubNetwork::getName ( ) const
inline

Get the sub-network name (alias for getSubNetworkName).

Returns
Sub-network identifier string.

Referenced by StabilityEstimate::compute_equivalent_admittance_parameters_num().

◆ getNumberOfOutputs()

const int SubNetwork::getNumberOfOutputs ( ) const
inline

Get the number of registered output buses.

Returns
Count of entries in the output-bus map.

◆ getOutputs()

const std::unordered_map< std::string, Bus * > & SubNetwork::getOutputs ( ) const
inline

Const access to the output-bus map.

Returns
Map of output bus names to non-owning bus pointers.

Referenced by StabilityEstimate::compute_closing_impedance(), and StabilityEstimate::compute_equivalent_admittance_parameters_num().

◆ getSubNetworkName()

std::string SubNetwork::getSubNetworkName ( ) const
inline

Get the sub-network name.

Returns
Current sub-network identifier string.

◆ getTransformation()

bool SubNetwork::getTransformation ( ) const
inline

Query whether coordinate transformation is enabled.

Returns
Current transformation flag.

Referenced by Network::add_areas(), and StabilityEstimate::compute_equivalent_admittance_parameters_num().

◆ printInfo()

void SubNetwork::printInfo ( ) const

Print sub-network summary (name, bus/element counts, output bus count).

References Network::getBuses(), and Network::getElements().

◆ setSubNetworkName()

void SubNetwork::setSubNetworkName ( const std::string &  name)
inline

Set the sub-network name.

Parameters
nameNew identifier string.

◆ setTransformation()

void SubNetwork::setTransformation ( bool  flag)
inline

Enable or disable coordinate transformation (e.g.

abc to dq) for this sub-network.

Parameters
flagTrue to apply transformation; false otherwise.

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