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

A network node connecting one or more element terminals. More...

#include <Bus.h>

Public Member Functions

 Bus (const std::string &name, const std::string &location, int number)
 Construct a bus with name, grid location, and pin/phase count.
 
 ~Bus ()
 Clear connected-element references; does not delete elements.
 
std::string getBusName ()
 Get the bus name.
 
int getPinNumber ()
 Get the number of pins/phases on this bus.
 
std::string getBusLocation ()
 Get the bus location label (e.g.
 
vector< Element * > getConnectedElements ()
 Get a copy of the list of elements connected to this bus.
 
bool operator== (const char *name)
 Compare this bus name to a C-string.
 
void setBusName (const std::string &name)
 Replace the bus name.
 
bool isGround () const
 Check whether this bus represents ground.
 
void attachElement (Element *elem)
 Append an element to the connected-elements list.
 
void detachElement (Element *elem)
 Remove an element from the connected-elements list without deleting it.
 
void printConnectedElements ()
 Print connected element information to standard output.
 
void computePowerFlowAC (std::map< std::string, double > &busAC, std::map< std::string, double > &globalParams) const
 Compute AC bus quantities for optimal power flow.
 
void computePowerFlowDC (std::map< std::string, double > &busDC, std::map< std::string, double > &globalParams) const
 Compute DC bus quantities for optimal power flow.
 
void setOPFInfo (const std::map< std::string, double > &info)
 Store OPF-related metadata for this bus (area, voltage limits, etc.).
 
std::map< std::string, double > getOPFInfo () const
 Retrieve stored OPF metadata.
 

Detailed Description

A network node connecting one or more element terminals.

Tracks connected elements, location (AC/DC), optional OPF parameters, and supports ground detection by name. Does not own connected elements.

Constructor & Destructor Documentation

◆ Bus()

Bus::Bus ( const std::string &  name,
const std::string &  location,
int  number 
)

Construct a bus with name, grid location, and pin/phase count.

Parameters
nameBus identifier (e.g. node name).
locationGrid context string (e.g. "AC" or "DC").
numberNumber of pins/phases; must be greater than zero.
Exceptions
std::invalid_argumentif number is not positive.

◆ ~Bus()

Bus::~Bus ( )

Clear connected-element references; does not delete elements.

Member Function Documentation

◆ attachElement()

void Bus::attachElement ( Element elem)

Append an element to the connected-elements list.

Parameters
elemNon-owning pointer to the element; must not be null.

Referenced by Network::connectElementToBus().

◆ computePowerFlowAC()

void Bus::computePowerFlowAC ( std::map< std::string, double > &  busAC,
std::map< std::string, double > &  globalParams 
) const

Compute AC bus quantities for optimal power flow.

Parameters
busACOutput map of AC bus OPF results keyed by quantity name.
globalParamsShared global OPF parameters.

Referenced by PowerFlow::addBusAC().

◆ computePowerFlowDC()

void Bus::computePowerFlowDC ( std::map< std::string, double > &  busDC,
std::map< std::string, double > &  globalParams 
) const

Compute DC bus quantities for optimal power flow.

Parameters
busDCOutput map of DC bus OPF results keyed by quantity name.
globalParamsShared global OPF parameters.

Referenced by PowerFlow::addBusDC().

◆ detachElement()

void Bus::detachElement ( Element elem)

Remove an element from the connected-elements list without deleting it.

Parameters
elemElement pointer to detach.

◆ getBusLocation()

std::string Bus::getBusLocation ( )
inline

Get the bus location label (e.g.

AC or DC grid).

Returns
Location string.

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

◆ getBusName()

◆ getConnectedElements()

vector< Element * > Bus::getConnectedElements ( )
inline

Get a copy of the list of elements connected to this bus.

Returns
Vector of non-owning element pointers.

◆ getOPFInfo()

std::map< std::string, double > Bus::getOPFInfo ( ) const
inline

Retrieve stored OPF metadata.

Returns
Copy of the bus OPF info map.

◆ getPinNumber()

int Bus::getPinNumber ( )
inline

Get the number of pins/phases on this bus.

Returns
Pin count.

Referenced by Network::addBusView(), Network::connectElementToBus(), Network::deleteBus(), StateSpaceModel::formState(), and PowerFlow::make_OPF().

◆ isGround()

bool Bus::isGround ( ) const
inline

Check whether this bus represents ground.

Ground is detected when the bus name equals "gnd" (case-insensitive).

Returns
True if this bus is ground.

Referenced by Network::addBusView(), StabilityEstimate::compute_equivalent_admittance_parameters_num(), Network::deleteBus(), and StateSpaceModel::formState().

◆ operator==()

bool Bus::operator== ( const char *  name)

Compare this bus name to a C-string.

Parameters
nameName to compare against.
Returns
True if names are equal.

◆ printConnectedElements()

void Bus::printConnectedElements ( )

Print connected element information to standard output.

◆ setBusName()

void Bus::setBusName ( const std::string &  name)
inline

Replace the bus name.

Parameters
nameNew bus identifier.

◆ setOPFInfo()

void Bus::setOPFInfo ( const std::map< std::string, double > &  info)
inline

Store OPF-related metadata for this bus (area, voltage limits, etc.).

Parameters
infoMap of OPF parameter names to values.

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