Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
Loading...
Searching...
No Matches
Bus.h
Go to the documentation of this file.
1
6#ifndef BUS_H
7#define BUS_H
8
9#include "Constants.h"
10
11class Element; // Forward declaration of the Element class
12
21class Bus {
22public:
23
31 Bus(const std::string& name, const std::string& location, int number);
32
36 ~Bus();
37
42 std::string getBusName() { return busName; }
43
48 int getPinNumber() { return numberPins; }
49
54 std::string getBusLocation() { return busLocation; }
55
60 vector<Element*> getConnectedElements() { return connectedElements; }
61
67 bool operator==(const char* name);
68
73 void setBusName(const std::string& name) {
74 busName = name;
75 }
76
84 bool isGround() const {
85 std::string lower = busName;
86 std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
87 return lower == "gnd";
88 }
89
94 void attachElement(Element* elem);
95
100 void detachElement(Element* elem);
101
106
112 void computePowerFlowAC(std::map<std::string, double>& busAC,
113 std::map<std::string, double>& globalParams) const;
114
120 void computePowerFlowDC(std::map<std::string, double>& busDC,
121 std::map<std::string, double>& globalParams) const;
122
127 void setOPFInfo(const std::map<std::string, double>& info) {
128 busOPFInfo = info;
129 }
130
135 std::map<std::string, double> getOPFInfo() const {
136 return busOPFInfo;
137 }
138
139private:
140 std::string busName; // The name of the bus
141 std::string busLocation; // The location of the bus (e.g., "AC" or "DC")
142 int numberPins; // The number of pins (phases) of the bus
143 std::vector<Element*> connectedElements; // Elements connected to this bus
144
145 std::map<std::string, double> busOPFInfo; // Additional information about the bus OPF model
146 // This includes area and voltage limits.
147};
148
149#endif // BUS_H
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
void setOPFInfo(const std::map< std::string, double > &info)
Store OPF-related metadata for this bus (area, voltage limits, etc.).
Definition Bus.h:127
void setBusName(const std::string &name)
Replace the bus name.
Definition Bus.h:73
bool isGround() const
Check whether this bus represents ground.
Definition Bus.h:84
std::map< std::string, double > getOPFInfo() const
Retrieve stored OPF metadata.
Definition Bus.h:135
void computePowerFlowDC(std::map< std::string, double > &busDC, std::map< std::string, double > &globalParams) const
Compute DC bus quantities for optimal power flow.
Definition Bus.cpp:53
void attachElement(Element *elem)
Append an element to the connected-elements list.
Definition Bus.cpp:27
vector< Element * > getConnectedElements()
Get a copy of the list of elements connected to this bus.
Definition Bus.h:60
void printConnectedElements()
Print connected element information to standard output.
Definition Bus.cpp:38
bool operator==(const char *name)
Compare this bus name to a C-string.
Definition Bus.cpp:22
int getPinNumber()
Get the number of pins/phases on this bus.
Definition Bus.h:48
std::string getBusName()
Get the bus name.
Definition Bus.h:42
~Bus()
Clear connected-element references; does not delete elements.
Definition Bus.cpp:17
void computePowerFlowAC(std::map< std::string, double > &busAC, std::map< std::string, double > &globalParams) const
Compute AC bus quantities for optimal power flow.
Definition Bus.cpp:46
void detachElement(Element *elem)
Remove an element from the connected-elements list without deleting it.
Definition Bus.cpp:31
std::string getBusLocation()
Get the bus location label (e.g.
Definition Bus.h:54
Base class for multi-phase network elements with Y-parameters and MNA stamping hooks.
Definition Element.h:29