22using Net = std::unordered_map<Bus*, std::vector<Element*>>;
38 std::unordered_map<std::string, Bus*>
buses;
39 std::unordered_map<std::string, Element*>
elements;
47 std::unordered_map<std::string, SubNetwork*>
ac_grids;
48 std::unordered_map<std::string, SubNetwork*>
dc_grids;
55 std::unordered_map<std::string, std::unique_ptr<Bus>> ownedBuses_;
56 std::unordered_map<std::string, std::unique_ptr<Element>> ownedElements_;
57 std::unordered_map<std::string, std::unique_ptr<SubNetwork>> ownedGrids_;
72 void addBus(
const std::string& busName, std::unique_ptr<Bus> bus);
78 void addBus(
const std::string& busName,
Bus* bus);
84 void addElement(
const std::string& designator, std::unique_ptr<Element> elem);
113 void deleteBus(
const std::string& busName);
139 const std::unordered_map<std::string, Bus*>&
getBuses()
const {
return buses; }
Central include hub for Harmony: third-party libraries, standard headers, and shared type aliases.
A network node connecting one or more element terminals.
Definition Bus.h:21
Base class for multi-phase network elements with Y-parameters and MNA stamping hooks.
Definition Element.h:29
Root network model holding buses, elements, and AC/DC grid hierarchy.
Definition network.h:36
const std::unordered_map< Bus *, std::vector< Element * > > & getConnections() const
Const access to the bus-to-connected-elements map.
Definition network.h:157
bool is_area_empty()
Check whether both AC and DC grid maps are empty.
Definition network.h:182
void addBus(const std::string &busName, std::unique_ptr< Bus > bus)
Register an owned bus (transfers ownership on root networks).
Definition network.cpp:31
std::unordered_map< std::string, Bus * > buses
Definition network.h:38
void printConnections()
Print bus-to-element connection listing to standard output.
Definition network.cpp:158
bool ownsResources_
When true, buses/elements registered via addBus/addElement are owned.
Definition network.h:52
Network()
Construct an empty network with zero pins.
std::unordered_map< std::string, Element * > & get_converters()
Mutable access to the converter element map.
Definition network.h:212
void addElementView(const std::string &designator, Element *elem)
Register a non-owning element pointer (used by SubNetwork views).
Definition network.cpp:50
std::unordered_map< Bus *, std::vector< Element * > > & getConnections()
Mutable access to the bus-to-connected-elements map.
Definition network.h:163
void print_summary() const
Print a concise summary of network contents (counts and names).
Definition network.cpp:184
std::unordered_map< std::string, SubNetwork * > dc_grids
Definition network.h:48
const std::unordered_map< std::string, Element * > & getElements() const
Const access to the element designator-to-pointer map.
Definition network.h:145
const std::unordered_map< std::string, Bus * > & getBuses() const
Const access to the bus name-to-pointer map.
Definition network.h:139
void printBuses()
Print all registered buses to standard output.
Definition network.cpp:169
void addElement(const std::string &designator, std::unique_ptr< Element > elem)
Register an owned element.
Definition network.cpp:55
virtual ~Network()
Destroy the network and all owned buses, elements, and grid sub-networks.
Definition network.cpp:13
std::unordered_map< std::string, SubNetwork * > ac_grids
Definition network.h:47
vector< string > get_ac_grid_names()
Return ordered names of registered AC grids.
Definition network.h:188
std::unordered_map< std::string, SubNetwork * > & get_dc_grids()
Mutable access to the DC grid sub-network map.
Definition network.h:206
std::unordered_map< std::string, Element * > & getElements()
Mutable access to the element designator-to-pointer map.
Definition network.h:151
void addBusView(const std::string &busName, Bus *bus)
Register a non-owning bus pointer (used by SubNetwork views).
Definition network.cpp:23
std::vector< std::string > ac_grid_names
Definition network.h:44
void printElements()
Print all registered elements to standard output.
Definition network.cpp:175
void deleteBus(const std::string &busName)
Remove and destroy a bus by name.
Definition network.cpp:135
void deleteElement(const std::string &designator)
Remove and destroy an element by designator.
Definition network.cpp:113
std::unordered_map< Bus *, std::vector< Element * > > connections
Definition network.h:40
std::unordered_map< std::string, Element * > elements
Definition network.h:39
void empty_areas()
Destroy all grid sub-networks and clear grid/converter registries.
Definition network.cpp:253
std::vector< std::string > dc_grid_names
Definition network.h:45
vector< string > get_dc_grid_names()
Return ordered names of registered DC grids.
Definition network.h:194
int pins
Definition network.h:42
void connectElementToBus(Element *elem, int terminal, Bus *bus)
Connect an element terminal to a bus and record the association in both directions.
Definition network.cpp:74
std::unordered_map< std::string, Element * > converters
Definition network.h:49
std::unordered_map< std::string, SubNetwork * > & get_ac_grids()
Mutable access to the AC grid sub-network map.
Definition network.h:200
void add_areas()
Populate AC and DC grid sub-networks from the current flat network topology.
Definition network.cpp:263
Named sub-network that inherits Network topology APIs but acts as a non-owning view.
Definition SubNetwork.h:20
std::unordered_map< Bus *, std::vector< Element * > > Net
Maps each bus to the elements connected at its terminals.
Definition network.h:22