|
Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
|
Root network model holding buses, elements, and AC/DC grid hierarchy. More...
#include <network.h>


Public Member Functions | |
| 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. | |
Protected Attributes | |
| 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. | |
Root network model holding buses, elements, and AC/DC grid hierarchy.
Owns buses and elements registered via addBus/addElement and deletes them in the destructor. Sub-networks (AC/DC grids) are owned separately and released through empty_areas().
|
default |
Construct an empty network with zero pins.
|
virtual |
Destroy the network and all owned buses, elements, and grid sub-networks.
References buses, connections, elements, and empty_areas().
| void Network::add_areas | ( | ) |
Populate AC and DC grid sub-networks from the current flat network topology.
References ac_grid_names, ac_grids, addBusView(), addElementView(), buses, connections, converters, dc_grid_names, dc_grids, Bus::getBusLocation(), Bus::getBusName(), Element::getConnections(), Element::getElementLocation(), Element::getElementSymbol(), and SubNetwork::getTransformation().
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
| void Network::addBus | ( | Bus * | bus | ) |
Register a bus using its own name as the map key.
References addBus(), and Bus::getBusName().
| void Network::addBus | ( | const std::string & | busName, |
| Bus * | bus | ||
| ) |
Register a bus under an explicit name (transfers ownership on root networks).
References addBus().
| void Network::addBus | ( | const std::string & | busName, |
| std::unique_ptr< Bus > | bus | ||
| ) |
Register an owned bus (transfers ownership on root networks).
References addBusView(), and ownsResources_.
Referenced by addBus(), addBus(), example_DQsym_MMC_controlled(), example_DQsym_Simple_MMC(), and example_state_space().
| void Network::addBusView | ( | const std::string & | busName, |
| Bus * | bus | ||
| ) |
Register a non-owning bus pointer (used by SubNetwork views).
References buses, Bus::getPinNumber(), Bus::isGround(), and pins.
Referenced by add_areas(), and addBus().
| void Network::addElement | ( | const std::string & | designator, |
| Element * | elem | ||
| ) |
Register an element under a specific designator string.
References addElement().
| void Network::addElement | ( | const std::string & | designator, |
| std::unique_ptr< Element > | elem | ||
| ) |
Register an owned element.
References addElementView(), and ownsResources_.
Referenced by addElement(), addElement(), SimulationBuilder::buildFromJSON(), example_DQsym_MMC_controlled(), example_DQsym_Simple_MMC(), and example_state_space().
| void Network::addElement | ( | Element * | elem | ) |
Register an element using an auto-generated designator.
References addElement(), and Element::getElementSymbol().
| void Network::addElementView | ( | const std::string & | designator, |
| Element * | elem | ||
| ) |
Register a non-owning element pointer (used by SubNetwork views).
References elements.
Referenced by add_areas(), and addElement().
Connect an element terminal to a bus and record the association in both directions.
| elem | Element whose terminal is being wired. |
| terminal | Terminal index on the element (0-based). |
| bus | Target bus. |
References Element::attachBus(), Bus::attachElement(), buses, connections, elements, Bus::getBusName(), Element::getElementSymbol(), Element::getInputPins(), Element::getOutputPins(), and Bus::getPinNumber().
Referenced by example_DQsym_MMC_controlled(), example_DQsym_Simple_MMC(), example_OPF_double_area(), example_OPF_PV(), example_OPF_single_area(), example_OPF_WT(), example_point2point_case(), example_stability_check(), and example_state_space().
| void Network::deleteBus | ( | const std::string & | busName | ) |
Remove and destroy a bus by name.
| busName | Name of the bus to delete. |
References buses, connections, Bus::getPinNumber(), Bus::isGround(), and pins.
| void Network::deleteElement | ( | const std::string & | designator | ) |
Remove and destroy an element by designator.
| designator | Designator of the element to delete. |
References buses, connections, converters, and elements.
| void Network::empty_areas | ( | ) |
Destroy all grid sub-networks and clear grid/converter registries.
Populates AC and DC grid subnetworks from the main network.
Deletes owned SubNetwork shells in ac_grids and dc_grids; does not delete buses or elements referenced by those views.
This function iterates through all buses in the provided network, categorizes them into AC or DC areas based on their location string, and groups them into SubNetwork objects. It also identifies and separates MMC converters.
| net | Pointer to the main Network object. |
References ac_grid_names, ac_grids, converters, dc_grid_names, and dc_grids.
Referenced by ~Network().
|
inline |
Return ordered names of registered AC grids.
References ac_grid_names.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
|
inline |
Mutable access to the AC grid sub-network map.
References ac_grids.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
|
inline |
Mutable access to the converter element map.
References converters.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
|
inline |
Return ordered names of registered DC grids.
References dc_grid_names.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
|
inline |
Mutable access to the DC grid sub-network map.
References dc_grids.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
|
inline |
Const access to the bus name-to-pointer map.
References buses.
Referenced by StabilityEstimate::compute_equivalent_admittance_parameters_num(), PowerFlow::make_OPF(), and SubNetwork::printInfo().
Mutable access to the bus-to-connected-elements map.
References connections.
|
inline |
Const access to the bus-to-connected-elements map.
References connections.
|
inline |
Mutable access to the element designator-to-pointer map.
References elements.
|
inline |
Const access to the element designator-to-pointer map.
References elements.
Referenced by extendBusAC(), StateSpaceModel::formState(), PowerFlow::make_OPF(), and SubNetwork::printInfo().
|
inline |
Check whether both AC and DC grid maps are empty.
References ac_grids, and dc_grids.
Referenced by StabilityEstimate::add_areas(), and DQsym::initialize().
| void Network::print_summary | ( | ) | const |
Print a concise summary of network contents (counts and names).
Prints a summary of the detected AC/DC grids and converters.
References ac_grids, converters, and dc_grids.
| void Network::printBuses | ( | ) |
Print all registered buses to standard output.
References buses.
| void Network::printConnections | ( | ) |
Print bus-to-element connection listing to standard output.
References connections, and Bus::getBusName().
Referenced by runJsonSimulation().
| void Network::printElements | ( | ) |
Print all registered elements to standard output.
References elements.
Referenced by runJsonSimulation().
|
protected |
Referenced by SubNetwork::~SubNetwork(), add_areas(), empty_areas(), and get_ac_grid_names().
|
protected |
Referenced by SubNetwork::~SubNetwork(), add_areas(), empty_areas(), get_ac_grids(), is_area_empty(), and print_summary().
|
protected |
Referenced by ~Network(), SubNetwork::~SubNetwork(), add_areas(), addBusView(), connectElementToBus(), deleteBus(), deleteElement(), getBuses(), and printBuses().
|
protected |
Referenced by SubNetwork::~SubNetwork(), add_areas(), deleteElement(), empty_areas(), get_converters(), and print_summary().
|
protected |
Referenced by SubNetwork::~SubNetwork(), add_areas(), empty_areas(), and get_dc_grid_names().
|
protected |
Referenced by SubNetwork::~SubNetwork(), add_areas(), empty_areas(), get_dc_grids(), is_area_empty(), and print_summary().
|
protected |
Referenced by ~Network(), SubNetwork::~SubNetwork(), addElementView(), connectElementToBus(), deleteElement(), getElements(), getElements(), and printElements().
|
protected |
When true, buses/elements registered via addBus/addElement are owned.
Referenced by SubNetwork::SubNetwork(), SubNetwork::SubNetwork(), addBus(), and addElement().
|
protected |
Referenced by addBusView(), and deleteBus().