The directed representative graph generation incorporates two parts, the representative edge extraction and the direction identification. They are explained in detail in the ensuing sub-sections.
4.1. Representative Edge Extraction
This section aims to extract representative edges using boundary points. Usually, triangulations can be rendered directly in most browsers, and thereby all MEP elements are first transformed into triangular meshes [
5]. Subsequently, boundary points are extracted to obtain representative points. Finally, representative points are connected to generate the representative edge (or edges). As the MEP element with unchanged cross-section normal vectors is a special case of the one whose normal vectors of the cross-section change in the process of representative edge extraction, this study takes the latter as an example for discussion, as illustrated in
Figure 6.
Among these triangulation techniques, the Delaunay algorithm is suitable to generate triangular meshes because Delaunay triangulations have good regularity and are easy to generalize in three-dimensional (3D) problems. The point-by-point insertion algorithm, Bowyer–Watson, is used to generate Delaunay triangulation.
Figure 7 shows the process of the Delaunay algorithm. Firstly, a triangle with discrete points is formed. Secondly, points are given to generate an initial grid and new points are added to this grid. Thirdly, all triangles whose circumcircle contains newly added points are found, and these triangles are removed to form cavities. Further, newly added points are connected to obtain vertices of the cavity to form new Delaunay triangular meshes. Finally, this process is iterated until all vertices are added to generate triangle meshes.
Additionally, initial triangles with discrete points are first generated on an MEP element, then Bowyer–Watson algorithm is used to integrate all the points into Delaunay meshes. The process of triangulation is illustrated in
Figure 8.
In fact, triangular points of an MEP element are divided into two types. One type is the boundary point, and another is the interior point. Boundary points are located on the contour curve where MEP ports are located, and internal points are located on the contour curve of an MEP element other than MEP ports. To facilitate description, an MEP element is divided into
k cross-sections in order. The contour curve of a cross-section is represented by
Ci (1 ≤
I ≤
k). The cross-section curve of an MEP element is depicted in
Figure 9. Though triangular meshes on the MEP element are randomly generated, these cross-sectional curves do not actually exist. Consequently, the polygon with finite (
n) triangle points can be represented as the cross-section, and the set of
n triangle points is termed as the representative set
Qi. That is,
pim is a triangle point, where
i represents the
i-th representative set,
m is the
m-th point on the representative set, and
k is the number of the representative set.
Because center points of representative sets represent the spatial position of an MEP element, this study utilizes the center point as the representative point. Without loss of generality, the MEP element with unchanged cross-section normal vectors utilizes representative points (the center points) of two outer cross-section curves to build the representative edge. The element with mutative cross-section normal vectors requires extracting representative points of each cross-section curve to obtain representative edge (edges). In fact, representative points of outer cross-section curves can be obtained by extracting boundary points of triangular meshes.
To facilitate the description of boundary extraction, it is imperative to define the adjacent triangle mesh and the adjacent points [
35]. Take any point
p of an MEP element, the triangle where
p is located is the adjacent triangle of
p. If a line between any two triangle points is the edge of a triangle, these triangle points are defined as adjacent points; that is,
ge = {
t|
p ∈
t, where
t is the triangular mesh and
p is the triangle point}. Moreover, the set of adjacent points is denoted as
W,
W = {
q|
t,
p∈
t &&
q∈
t, where
q is the point different from
p on the triangle}. The set
W is used to determine whether the triangle point
p is the boundary point. If all adjacent points of
p can be connected by edges of triangles to form a closed curve, then
p is an interior triangle point; otherwise,
p is a boundary point.
Figure 10 presents ten triangles. Take
p6 as an example;
Wp6 = {
p1,
p2,
p3,
p7} and
p1p2,
p2p3,
p3p7,
p1p7 constitute a closed curve. Therefore,
p6 is not the boundary point. Similarly,
p7, p8, and
p9 are not the boundary point.
Take the elbow as an example. All triangle points can be identified using boundary points because points are distributed randomly on the MEP element surface and the boundary point has a clear characteristic. Moreover, according to the spatial distribution, these points are located in
C1 and
Ck regularly; thus, sets where these points are located are represented by
Q1 and
Qk. Consequently, points are obtained using Equation (3), termed as the representative points
O1 and
O2, where
Oi = (
xi,
yi,
zi). If
O1 and
Ok are connected, then the representative edge of an MEP element with unchanged cross-section normal vectors is obtained. However, this method is not suitable for MEP elements with mutative cross-section normal vectors. The process of the representative edge extraction of an MEP element with unchanged cross-section normal vectors is illustrated in
Figure 11. Take the representative set
Q1 as the start, and then delete
Q1; new boundary points will appear, and the new representative set is denoted as
Q2. Likewise, the representative point
O2 is obtained from
Q2. Iterating these steps, all representative sets are extracted in turn, namely {
Q1,
Q2, ⋯,
Qk}. Correspondingly, representative points are acquired using Equation (3), namely {
O1,
O2,
⋯,
Ok}. Representative edges are generated by connecting these points.
Algorithm 1 summarizes the whole process of representative edge extraction from the MEP system. Line 3 acquires triangular meshes based on the Delaunay algorithm. Lines 17–26 extract boundary points on a triangulated MEP element. Lines 4–14 extract all representative points using representative sets. Line 10 obtains each representative point using Equation (3). Iterating lines 2–16, all representative points are extracted. Line 17 generates representative edges by connecting these representative points.
Algorithm 1: RepEdg—Representative edge extraction |
Input: Geometric representation of an MEP system model Mg = {ge1, ge2, ⋯, geg}, gei = {p1, p2, ⋯, pg} |
Output: Representative edges |
1. function RepEdg (Mg) |
2. Q = [ ], V = [ ] |
3. Mg = Delaunay (Mg) |
4. for each p in Mg: |
5. for i ←1 to k |
6. Q = BoudIde (Mg) |
7. Distribute Q into two parts according to spatial positions of boundary points |
8. Q = (Qi, Q(i+1)) |
9. Take Qi as the start |
10. Obtain Oi using Equation (3) |
11. V = Oi ++ |
12. Delete Qi |
13. end for |
14. end for |
15. Connect V to obtain representative edges |
16. return |
17. function BoudIde (Mg) |
18. temp = [ ], boudp = [ ] |
19. for each p in Mg: |
20. Find all adjacent triangle points Wp of p |
21. if p ∈ temp: Delete p from temp [ ] |
22. else: Add p to temp [ ] |
23. if temp = 0: break |
24. else: Add p to boudp |
25. end for |
26. return boudp |
4.2. Direction Identification
This section aims to automatically generate the direction of MEP elements. The IFC file includes the semantic information on MEP elements and topological connection relationships between adjacent MEP elements [
35].
Figure 12 presents the framework of the direction identification. Firstly, the semantic and relationship data are extracted from an IFC file. Secondly, the internal relation of an MEP element and relations between adjacent elements are extracted. Finally, representative points are connected using representative arrows to generate the graph direction.
4.2.1. Semantic Information Extraction
BIM data contain the geometric and semantic information of a building. It is a digital expression of the physical and functional characteristics of a building. BIM establishes a unified data format for the whole process by constructing the IFC standard and realizes the unified format storage and sharing of the whole-process BIM data. In IFC specifications, each element corresponds to an instance of the IFC class, namely the object. Likewise, each IFC instance describes an MEP element and forms a computer object that corresponds to the knowledge in the BIM definition.
MEP systems based on IFC are analyzed into six types of entities, namely the IfcDistributionControlElement, the IfcFlowController, the IfcFlowSegment, the IfcFlowFitting, the IfcFlowTerminal, and the IfcBuildingElementPoxy (including the IfcEnergyConversionDevice, the IfcFlowMovingDevice, the IfcFlowStorageDevice, and the IfcFlowTreatmentDevice). The IfcDistributionControlElement defines the occurrence elements of a building automation control system that are used to impart control over elements of an MEP system. The IfcFlowController defines the occurrence of elements of an MEP system that are used to regulate flow through an MEP system. The IfcFlowSegment refers to the occurrence of a segment of a flow MEP system. The IfcFlowFitting refers to the occurrence of a junction or transition in a flow MEP system such as an elbow or a tee. Both the IfcFlowSegment and the IfcFlowFitting are the occurrence of an MEP system, and they provide a similar function; therefore, these two types of entities are considered one type entity. The IfcFlowTerminal is the occurrence of a permanently attached element that acts as a terminus or the beginning of an MEP system (such as an air outlet, drain, water closet, or sink). The IfcBuildingElementPoxy refers to the occurrence of a device used to provide a service or function in an MEP system, for example, the conveyance of fluids, temporary storage, energy conversion, or heat transfer, and removing unwanted matter.
Table 2 presents six types of entities in the MEP system.
IfcRelationship is the abstract generalization of all objectified relationships of an MEP system. It is typically used to extract the topological connection relationship by adjacent elements. Moreover, the IfcRelationship has five subtypes, namely IfcRelAssigns, IfcRelAssociates, IfcRelConnects, IfcRelDecomposes, and IfcRelDefines. The IfcRelConnects is usually used to determine the flow direction in the subclasses of IFC, which includes IfcRelConnectsPorts, IfcRelConnectsElements, and IfcRelFlowControlElements. Generally, the IfcPort is used to identify the flow direction of the interior of an MEP element. In the IFC specification, an IfcPort is associated with an IfcElement, and it belongs to through the objectified relationship IfcRelNests if the port is fixed, or IfcRelConnectsPortToElement if the port is dynamically attached. The internal direction of an MEP element is from sc to sk. Exactly two ports, belonging to two different elements, are connected through the objectified relationship IfcRelConnectsPorts.
4.2.2. Topological Connection Relationship Extraction
The IFC specification defines the topologies of an MEP system using the IfcRelConnects. The topological connection relationship is divided into two types: the control relationship and the upstream and downstream relationships. The control relationship corresponds to the topological connection relationship of the IfcRelFlowControlElements, which can be extracted directly. The upstream and downstream relationships of an MEP system are determined by the IfcDistributionPort, the IfcDistributionElement, and the relationship between them. In addition, the upstream and downstream relationships between MEP elements are presented by the IfcDistributionPort attached to the MEP element and the relationship between them. According to the topology between the MEP port and the MEP element
e, the IfcDistributionPort is connected to the MEP element
e using two types of relationships, the IfcRelConnectsPortToElement and the IfcRelNests. The IfcDistributionPort defines the upstream and downstream relationship using the IfcRelConnectsPorts, and the direction of the upstream and downstream relationship using the ConnectedFrom and ConnectedTo.
Figure 13 illustrates the topological connection relationships of MEP elements.
Figure 14 presents an instance of the upstream and downstream relationship. Without loss in generality, an IFC instance is a concrete instance of an IFC entity. #175782 is an instance of class IfcRelConnectsPorts, and 175782 is the instance number. This instance defines the relationship that is made between two ports located in #175763 and #175777. #175763 and #175777 are both instances of class IfcDistributionPort. The text “#175763 = IFCDISTRIBUTIONPORT (‘2WIZguDaDFAwt6jkbnC7eQ’, #41, ‘InPort_694055’, ‘Flow’,
$, #175761,
$, SINK.)” shows the identification in the first attribute (guid), and the eighth attribute is the flow direction SINK. Likewise, the text “#175777 = IFCDISTRIBUTIONPORT (‘29_xxOVWr7Fg1Acq5Pm3sr’, #41, ‘OutPort_694210′, ‘Flow’,
$, #175775,
$, SOURCE.)” shows the flow attribute is SOURCE. Apparently, the direction of IfcRelConnectsPorts object is from #175763 to #175777.
The direction identification starts from an MEP element (such as a flow segment). Steps of direction identification act as follows.
- (1)
If the topological connection relationship of the IfcRelFlowControlElements is recognized from MEP elements, it is the controlling relationship. If the entity is the IfcDistributionControlElement or IfcFlowController, the connected entity is an IfcFlowSegment or an IfcFlowFitting, and then the direction is IfcBuildingElementPoxy to IfcFlowSegment or IfcFlowFitting.
- (2)
If the topological connection relationship of the IfcRelFlowControlElements is not recognized and the IfcDistributionPorts is recognized, it is the upstream and downstream relationship. The two attributes of IfcDistributionPorts (SOURCE or SINK) indicate the direction of the upstream and downstream relationship, that is: IfcBuildingElementPoxy to IfcFlowController…to IfcFlowTerminal.
Figure 15 presents an example of the direction identification. The representative points of a partial MEP system are represented as V
1, V
1= {
p1,
p2,
p3,
p4,
p5,
p6,
p7,
p8,
p9,
p10,
p11,
p12,
p13,
p14,
p15,
p16,
p17,
p18,
p19,
p20,
p21,
p22,
p23,
p24,
p25,
p26,
p27,
p28,
p29,
p30,
p31,
p32,
p33,
p34,
p35,
p36,
p37,
p38,
p39,
p40,
p41,
p42,
p43,
p44,
p45,
p46,
p47,
p48,
p49,
p50,
p51,
p52,
p53,
p54,
p55,
p56,
p57,
p58,
p59,
p60}. There are two types of relations in representative edges. The two relations are determined by the attribute information IfcPort of two MEP ports on an MEP element and the direction attribute information IfcRelconnectsPorts of adjacent MEP elements. Thus,
E1 = ((
p1,
p2), (
p2,
p3), (
p3,
p4), (
p4,
p5), (
p5,
p6), (
p6,
p7), (
p7,
p8), ⋯, (
p44,
p45), (
p59,
p60)). Directions of representative edges are shown in
Figure 14, and red edges represent directions of two MEP ports on an MEP element, and blue edges indicate directions of adjacent MEP elements. In addition, blue circles refer to IfcFlowSegments or IfcFlowFittings, red circles are IfcFlowControllers, and green circles represent IfcFlowTerminals.
Algorithm 2 summarizes the main process of the direction identification. Line 2 extracts topological connection relationships among IFC instances, lines 3–7 extract directions based on the control relationship, and lines 9–12 identify directions based on the upstream and downstream relationships.
Algorithm 2: DirIde—Direction identification |
Input: Semantic representation of an MEP system, Ma = {ae1, ae2, ⋯, aen,} |
Output: the direction relations E |
1. function DirIde (M) |
2. Analyze the semantic information of the |
3. Search for the relationships of the IFC instance |
4. If IfcRelFlowControlElements |
5. Obtain the control relationship |
6. Search for IfcRelFlowControlElements |
7. Extract the relationship between the adjacency MEP elements |
8. Else: |
9. Extract the attribute information (InPort or OutPort) of IfcPort |
10. return the direction relations E |