VICUS Library
Documentation of Vicus library
Loading...
Searching...
No Matches
VICUS::Network Class Reference

#include <VICUS_Network.h>

Inheritance diagram for VICUS::Network:
[legend]

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 ()
 
NetworkEdgeedge (unsigned nodeId1, unsigned nodeId2)
 
NetworkEdgeedgeById (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)
 
NetworkNodenodeById (unsigned int id)
 
const NetworkNodenodeById (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 ()
 
ObjectfindChild (unsigned int ID)
 
const ObjectfindChild (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< NetworkNodem_nodes
 
std::vector< NetworkEdgem_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
Objectm_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
 

Member Enumeration Documentation

◆ ModelType

The various types (equations) of the hydraulic component.

Enumerator
MT_HydraulicNetwork 
MT_ThermalHydraulicNetwork 
NUM_MT 

◆ NetworkType

Defines wether this network represents a Single or DoublePipe Network (where each edges represents 2 pipes)

Enumerator
NET_SinglePipe 
NET_DoublePipe 
NUM_NET 

◆ para_t

The parameters

Enumerator
P_TemperatureSetpoint 
P_TemperatureDifference 
P_MaxPressureLoss 
P_ReferencePressure 
P_DefaultFluidTemperature 
P_InitialFluidTemperature 
P_MaxPipeDiscretization 
NUM_P 

◆ PipeModel

Defines which model in Nandrad shall be used

Enumerator
PM_SimplePipe 
PM_DynamicPipe 
NUM_PM 

Constructor & Destructor Documentation

◆ Network()

VICUS::Network::Network ( )

Member Function Documentation

◆ addEdge() [1/2]

void VICUS::Network::addEdge ( const NetworkEdge edge)

add Edge using edge constructor

◆ addEdge() [2/2]

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

◆ addNode()

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

◆ calcTemperatureChangeIndicator()

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.

◆ checkConnectedGraph()

bool VICUS::Network::checkConnectedGraph ( ) const

Checks that all edges and nodes are connected with each other (i.e. single graph network).

◆ cleanDeadEnds()

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

◆ cleanRedundantEdges()

void VICUS::Network::cleanRedundantEdges ( unsigned int  nextUnusedId,
Network cleanNetwork 
) const

stores a copy of the network without any redundant edges

◆ clear()

void VICUS::Network::clear ( )
inline

clear nodes, edges

◆ colorHeatExchangeType()

QColor VICUS::Network::colorHeatExchangeType ( NANDRAD::HydraulicNetworkHeatExchange::ModelType  heatExchangeType)
static

returns a specific color for each heat exchange type

◆ connectBuildings()

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

◆ copyWithBaseParameters()

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.

◆ dijkstraShortestPathToSource()

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

◆ edge()

NetworkEdge * VICUS::Network::edge ( unsigned  nodeId1,
unsigned  nodeId2 
)

returns pointer to edge, which is identified by its two nodeIds

◆ edgeById()

NetworkEdge * VICUS::Network::edgeById ( unsigned  id)

Returns pointer to edge, which is identified by its id

◆ findShortestPathForBuildings()

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

◆ findSourceNodes()

void VICUS::Network::findSourceNodes ( std::vector< NetworkNode > &  sources) const

◆ generateIntersections()

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

◆ indexOfEdge() [1/2]

unsigned int VICUS::Network::indexOfEdge ( unsigned  edgeId)

returns the index of the according edge in the m_edges vector

◆ indexOfEdge() [2/2]

unsigned int VICUS::Network::indexOfEdge ( unsigned  nodeId1,
unsigned  nodeId2 
)

returns the index of the according edge in the m_edges vector

◆ indexOfNode()

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).

◆ nextUnconnectedBuilding()

int VICUS::Network::nextUnconnectedBuilding ( ) const

returns the first id in m_nodes, which is an unconnected building

◆ nodeById() [1/2]

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).

◆ nodeById() [2/2]

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).

◆ numberOfBuildings()

size_t VICUS::Network::numberOfBuildings ( ) const

returns the number of nodes with type NT_Building

◆ origin()

IBKMK::Vector3D VICUS::Network::origin ( ) const

◆ removeShortEdges()

void VICUS::Network::removeShortEdges ( const double &  thresholdLength)

iteratively removes edges which have a length below thresholdLength in [m]

◆ setDefaultColors()

void VICUS::Network::setDefaultColors ( ) const

sets default colors

◆ setOrigin()

void VICUS::Network::setOrigin ( const IBKMK::Vector3D &  origin)

set m_origin and normalize all position to this origin

◆ setVisible()

void VICUS::Network::setVisible ( bool  visible)

sets the network object as well as all edges and nodes visible

◆ sizePipeDimensions()

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)

◆ totalLength()

double VICUS::Network::totalLength ( ) const

return sum of length of all edges

◆ typeinfo()

const char * VICUS::Network::typeinfo ( ) const
inlineoverridevirtual

Type-info string.

Implements VICUS::Object.

◆ updateExtends()

void VICUS::Network::updateExtends ( )

Recomputes the min/max coordinates of the network and updates m_extends.

◆ updateNodeEdgeConnectionPointers()

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.

◆ updateVisualizationRadius()

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)

◆ writeBuildingsCSV()

void VICUS::Network::writeBuildingsCSV ( const IBK::Path &  file) const

◆ writeNetworkEdgesCSV()

void VICUS::Network::writeNetworkEdgesCSV ( const IBK::Path &  file) const

◆ writeNetworkNodesCSV()

void VICUS::Network::writeNetworkNodesCSV ( const IBK::Path &  file) const

◆ writePathCSV()

void VICUS::Network::writePathCSV ( const IBK::Path &  file,
const NetworkNode nodeById,
const std::vector< NetworkEdge * > &  path 
) const

Member Data Documentation

◆ m_availablePipes

std::vector<unsigned int> VICUS::Network::m_availablePipes

List of pipes (ids) that may be used in this network.

◆ m_buriedPipeProperties

NetworkBuriedPipeProperties VICUS::Network::m_buriedPipeProperties

Describes all properties for a buried pipe in the ground

◆ m_edges

std::vector<NetworkEdge> VICUS::Network::m_edges

Vector with edges

◆ m_extends

IBK::rectangle<double> VICUS::Network::m_extends

Stores the extends of the network. Use the function updateExtends() to compute these.

m_extends.set(minX, minY, maxX, maxY);
IBK::rectangle< double > m_extends
Definition VICUS_Network.h:292

◆ m_hasHeatExchangeWithGround

bool VICUS::Network::m_hasHeatExchangeWithGround = false

Determines wether the entire network has heat exchange with the ground

◆ m_idFluid

unsigned int VICUS::Network::m_idFluid = INVALID_ID

Fluid id

◆ m_modelType

ModelType VICUS::Network::m_modelType = MT_ThermalHydraulicNetwork

◆ m_nodes

std::vector<NetworkNode> VICUS::Network::m_nodes

Nodes id must not match index in vector. To obtain a node by id use nodeById() function

◆ m_origin

IBKMK::Vector3D VICUS::Network::m_origin = IBKMK::Vector3D(0.0, 0.0, 0.0)

Origin of the network.

◆ m_para

IBK::Parameter VICUS::Network::m_para[NUM_P]

Network parameters (e.g. for pipe sizing algorithm)

◆ m_pipeModel

PipeModel VICUS::Network::m_pipeModel = PM_DynamicPipe

Defines which pipe model will be used for all edges, when transforming them to Nandrad

◆ m_scaleEdges

double VICUS::Network::m_scaleEdges = 30

◆ m_scaleNodes

double VICUS::Network::m_scaleNodes = 30

◆ m_selectedForSimulation

unsigned int VICUS::Network::m_selectedForSimulation = true

Determines if this network is currently selected for simulation

◆ m_type

NetworkType VICUS::Network::m_type = NET_DoublePipe

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