VICUS Library
Documentation of Vicus library
|
#include <VICUS_Network.h>
Public Types | |
enum | PipeModel { PM_SimplePipe , PM_DynamicPipe , NUM_PM } |
enum | ModelType { MT_HydraulicNetwork , MT_ThermalHydraulicNetwork , NUM_MT } |
enum | NetworkType { NET_SinglePipe , NET_DoublePipe , NUM_NET } |
enum | para_t { P_TemperatureSetpoint , P_TemperatureDifference , P_MaxPressureLoss , P_ReferencePressure , P_DefaultFluidTemperature , P_InitialFluidTemperature , P_MaxPipeDiscretization , NUM_P } |
Public Member Functions | |
const char * | typeinfo () const override |
Network () | |
Network | copyWithBaseParameters (unsigned int newID) |
void | addEdge (const unsigned id, const unsigned nodeId1, const unsigned nodeId2, const bool supply, unsigned int pipePropId) |
void | addEdge (const NetworkEdge &edge) |
unsigned int | addNode (unsigned int preferedId, const IBKMK::Vector3D &v, const NetworkNode::NodeType type, const bool considerCoordinates=true) |
void | generateIntersections (unsigned int nextUnusedId, std::vector< unsigned int > &addedNodes, std::vector< unsigned int > &addedEdges) |
void | updateNodeEdgeConnectionPointers () |
bool | checkConnectedGraph () const |
void | connectBuildings (unsigned int nextUnusedId, const bool extendSupplyPipes) |
int | nextUnconnectedBuilding () const |
void | cleanDeadEnds () |
void | cleanRedundantEdges (unsigned int nextUnusedId, Network &cleanNetwork) const |
void | removeShortEdges (const double &thresholdLength) |
void | findShortestPathForBuildings (std::map< unsigned int, std::vector< NetworkEdge * > > &minPathMap) const |
void | sizePipeDimensions (const NetworkFluid *fluid, std::vector< const NetworkPipe * > &availablePipes) |
void | calcTemperatureChangeIndicator (const NetworkFluid &fluid, const Database< NetworkPipe > &pipeDB, std::map< unsigned int, std::vector< NetworkEdge * > > &shortestPaths) const |
void | findSourceNodes (std::vector< NetworkNode > &sources) const |
void | writeNetworkEdgesCSV (const IBK::Path &file) const |
void | writeNetworkNodesCSV (const IBK::Path &file) const |
void | writePathCSV (const IBK::Path &file, const NetworkNode &nodeById, const std::vector< NetworkEdge * > &path) const |
void | writeBuildingsCSV (const IBK::Path &file) const |
void | dijkstraShortestPathToSource (const NetworkNode &startNode, const NetworkNode &endNode, std::vector< NetworkEdge * > &pathEndToStart) const |
void | updateExtends () |
IBKMK::Vector3D | origin () const |
void | setOrigin (const IBKMK::Vector3D &origin) |
double | totalLength () const |
void | clear () |
NetworkEdge * | edge (unsigned nodeId1, unsigned nodeId2) |
NetworkEdge * | edgeById (unsigned id) |
unsigned int | indexOfEdge (unsigned nodeId1, unsigned nodeId2) |
unsigned int | indexOfEdge (unsigned edgeId) |
size_t | numberOfBuildings () const |
void | updateVisualizationRadius (const VICUS::Database< VICUS::NetworkPipe > &pipeDB) |
void | setDefaultColors () const |
void | setVisible (bool visible) |
NetworkNode * | nodeById (unsigned int id) |
const NetworkNode * | nodeById (unsigned int id) const |
unsigned int | indexOfNode (unsigned int id) const |
Public Member Functions inherited from VICUS::Object | |
Object ()=default | |
Object (Object const &)=default | |
virtual | ~Object () |
Object * | findChild (unsigned int ID) |
const Object * | findChild (unsigned int ID) const |
void | collectChildIDs (std::set< unsigned int > &nodeContainer) const |
QString | info () const |
Static Public Member Functions | |
static QColor | colorHeatExchangeType (NANDRAD::HydraulicNetworkHeatExchange::ModelType heatExchangeType) |
Public Attributes | |
unsigned int | m_idFluid = INVALID_ID |
std::vector< NetworkNode > | m_nodes |
std::vector< NetworkEdge > | m_edges |
std::vector< unsigned int > | m_availablePipes |
IBKMK::Vector3D | m_origin = IBKMK::Vector3D(0.0, 0.0, 0.0) |
NetworkType | m_type = NET_DoublePipe |
IBK::Parameter | m_para [NUM_P] |
double | m_scaleNodes = 30 |
double | m_scaleEdges = 30 |
ModelType | m_modelType = MT_ThermalHydraulicNetwork |
unsigned int | m_selectedForSimulation = true |
bool | m_hasHeatExchangeWithGround = false |
NetworkBuriedPipeProperties | m_buriedPipeProperties |
PipeModel | m_pipeModel = PM_DynamicPipe |
IBK::rectangle< double > | m_extends |
Public Attributes inherited from VICUS::Object | |
Object * | m_parent = nullptr |
unsigned int | m_id = INVALID_ID |
bool | m_selected = false |
bool | m_visible = true |
QString | m_displayName |
std::string | m_ifcGUID |
Additional Inherited Members | |
Protected Attributes inherited from VICUS::Object | |
std::vector< Object * > | m_children |
Defines wether this network represents a Single or DoublePipe Network (where each edges represents 2 pipes)
Enumerator | |
---|---|
NET_SinglePipe | |
NET_DoublePipe | |
NUM_NET |
VICUS::Network::Network | ( | ) |
void VICUS::Network::addEdge | ( | const NetworkEdge & | edge | ) |
add Edge using edge constructor
void VICUS::Network::addEdge | ( | const unsigned | id, |
const unsigned | nodeId1, | ||
const unsigned | nodeId2, | ||
const bool | supply, | ||
unsigned int | pipePropId | ||
) |
add Edge based on node ids
unsigned int VICUS::Network::addNode | ( | unsigned int | preferedId, |
const IBKMK::Vector3D & | v, | ||
const NetworkNode::NodeType | type, | ||
const bool | considerCoordinates = true |
||
) |
add node to network based on coordinates and type and return the node id. When considerCoordinates==true and the given coordinates exist already in the network: return the id of this existing node ALWAYS use this function if you add nodes with coordinates that where calculated based on already existing coordinates
void VICUS::Network::calcTemperatureChangeIndicator | ( | const NetworkFluid & | fluid, |
const Database< NetworkPipe > & | pipeDB, | ||
std::map< unsigned int, std::vector< NetworkEdge * > > & | shortestPaths | ||
) | const |
Calculate the temperature change indicator for each edge. Therefore the massflow under nominal conditions for each edge is calculated using the shortest Path algorithm. Valid pipeIds must be specified in advance for each edge.
bool VICUS::Network::checkConnectedGraph | ( | ) | const |
Checks that all edges and nodes are connected with each other (i.e. single graph network).
void VICUS::Network::cleanDeadEnds | ( | ) |
remove all nodes and their adjacent edges when the respective node is a "dead end", meaning that none of the neighboring nodes is a building or source
void VICUS::Network::cleanRedundantEdges | ( | unsigned int | nextUnusedId, |
Network & | cleanNetwork | ||
) | const |
stores a copy of the network without any redundant edges
|
inline |
clear nodes, edges
|
static |
returns a specific color for each heat exchange type
void VICUS::Network::connectBuildings | ( | unsigned int | nextUnusedId, |
const bool | extendSupplyPipes | ||
) |
iterates through all building nodes, finds closest supply edge and connects the building node to the network
Network VICUS::Network::copyWithBaseParameters | ( | unsigned int | newID | ) |
Copies basic information except nodes and edges. This is a convenience function and equivalent with copying the entire network, setting the new ID and removing all nodes and edges.
void VICUS::Network::dijkstraShortestPathToSource | ( | const NetworkNode & | startNode, |
const NetworkNode & | endNode, | ||
std::vector< NetworkEdge * > & | pathEndToStart | ||
) | const |
find shortest Path from given startNode (e.g. a building) to Node with type source using dijkstra-algorithm, implemented according to Wikipedia and return path as vector of edges
NetworkEdge * VICUS::Network::edge | ( | unsigned | nodeId1, |
unsigned | nodeId2 | ||
) |
returns pointer to edge, which is identified by its two nodeIds
NetworkEdge * VICUS::Network::edgeById | ( | unsigned | id | ) |
Returns pointer to edge, which is identified by its id
void VICUS::Network::findShortestPathForBuildings | ( | std::map< unsigned int, std::vector< NetworkEdge * > > & | minPathMap | ) | const |
For each building node: Find shortest path to the closest source node and store the pointers to the edges along that path. The result is a map with keys being the ids of the building nodes
void VICUS::Network::findSourceNodes | ( | std::vector< NetworkNode > & | sources | ) | const |
void VICUS::Network::generateIntersections | ( | unsigned int | nextUnusedId, |
std::vector< unsigned int > & | addedNodes, | ||
std::vector< unsigned int > & | addedEdges | ||
) |
generate all intersections between edges in the network, hence connects all edges which intersect each other
unsigned int VICUS::Network::indexOfEdge | ( | unsigned | edgeId | ) |
returns the index of the according edge in the m_edges vector
unsigned int VICUS::Network::indexOfEdge | ( | unsigned | nodeId1, |
unsigned | nodeId2 | ||
) |
returns the index of the according edge in the m_edges vector
unsigned int VICUS::Network::indexOfNode | ( | unsigned int | id | ) | const |
Identifies node by its id and returns according index in m_nodes vector. Throws an IBK::Exception if node ID doesn't exist (call this function only on consistent data model).
int VICUS::Network::nextUnconnectedBuilding | ( | ) | const |
returns the first id in m_nodes, which is an unconnected building
NetworkNode * VICUS::Network::nodeById | ( | unsigned int | id | ) |
Identifies node by its id (in m_nodes vector) and returns according pointer. Throws an IBK::Exception if node ID doesn't exist (call this function only on consistent data model).
const NetworkNode * VICUS::Network::nodeById | ( | unsigned int | id | ) | const |
Identifies node by its id (in m_nodes vector) and returns according const pointer. Throws an IBK::Exception if node ID doesn't exist (call this function only on consistent data model).
size_t VICUS::Network::numberOfBuildings | ( | ) | const |
returns the number of nodes with type NT_Building
IBKMK::Vector3D VICUS::Network::origin | ( | ) | const |
void VICUS::Network::removeShortEdges | ( | const double & | thresholdLength | ) |
iteratively removes edges which have a length below thresholdLength in [m]
void VICUS::Network::setDefaultColors | ( | ) | const |
sets default colors
void VICUS::Network::setOrigin | ( | const IBKMK::Vector3D & | origin | ) |
set m_origin and normalize all position to this origin
void VICUS::Network::setVisible | ( | bool | visible | ) |
sets the network object as well as all edges and nodes visible
void VICUS::Network::sizePipeDimensions | ( | const NetworkFluid * | fluid, |
std::vector< const NetworkPipe * > & | availablePipes | ||
) |
calculate pipe dimensions using a maximum pressure loss per length and fixed temperature difference the mass flow rate of each pipe will be calculated based on the heatDemand of connected consumer loads (e.g. buildings)
double VICUS::Network::totalLength | ( | ) | const |
return sum of length of all edges
|
inlineoverridevirtual |
Type-info string.
Implements VICUS::Object.
void VICUS::Network::updateExtends | ( | ) |
Recomputes the min/max coordinates of the network and updates m_extends.
void VICUS::Network::updateNodeEdgeConnectionPointers | ( | ) |
Should be called whenever m_nodes or m_edges has been modified. Checks for correct node/edge IDs and throws IBK::Exceptions, if invalid IDs are found.
void VICUS::Network::updateVisualizationRadius | ( | const VICUS::Database< VICUS::NetworkPipe > & | pipeDB | ) |
Sets the visualization radius for edges and nodes based on the respective pipe diameters (edges) and heat demands (nodes)
void VICUS::Network::writeBuildingsCSV | ( | const IBK::Path & | file | ) | const |
void VICUS::Network::writeNetworkEdgesCSV | ( | const IBK::Path & | file | ) | const |
void VICUS::Network::writeNetworkNodesCSV | ( | const IBK::Path & | file | ) | const |
void VICUS::Network::writePathCSV | ( | const IBK::Path & | file, |
const NetworkNode & | nodeById, | ||
const std::vector< NetworkEdge * > & | path | ||
) | const |
std::vector<unsigned int> VICUS::Network::m_availablePipes |
List of pipes (ids) that may be used in this network.
NetworkBuriedPipeProperties VICUS::Network::m_buriedPipeProperties |
Describes all properties for a buried pipe in the ground
std::vector<NetworkEdge> VICUS::Network::m_edges |
Vector with edges
IBK::rectangle<double> VICUS::Network::m_extends |
Stores the extends of the network. Use the function updateExtends() to compute these.
bool VICUS::Network::m_hasHeatExchangeWithGround = false |
Determines wether the entire network has heat exchange with the ground
unsigned int VICUS::Network::m_idFluid = INVALID_ID |
Fluid id
ModelType VICUS::Network::m_modelType = MT_ThermalHydraulicNetwork |
std::vector<NetworkNode> VICUS::Network::m_nodes |
Nodes id must not match index in vector. To obtain a node by id use nodeById() function
IBKMK::Vector3D VICUS::Network::m_origin = IBKMK::Vector3D(0.0, 0.0, 0.0) |
Origin of the network.
PipeModel VICUS::Network::m_pipeModel = PM_DynamicPipe |
Defines which pipe model will be used for all edges, when transforming them to Nandrad
double VICUS::Network::m_scaleEdges = 30 |
double VICUS::Network::m_scaleNodes = 30 |
unsigned int VICUS::Network::m_selectedForSimulation = true |
Determines if this network is currently selected for simulation
NetworkType VICUS::Network::m_type = NET_DoublePipe |