## 3 An Approach to Generate the MEP Logic Chain from BIMs
### Logic Chain Completion of MEP Models
#### 3.3.1 Graph Structure of the MEP Topology  
When modeling MEP systems by Revit or other BIM software, the component usually contains extended properties including system type, system classification, and system name. Taking an ordinary duct as an example, these properties can be specified as \"air duct system\", \"supply air\", and \"supply air 8\". Accordingly, this approach firstly parses the model (which can be exported in IFC format) to obtain the hierarchy relationships between MEP systems. The first-level node refers to the system type such as duct or pipe systems pre-defined in Revit. The second-level node refers to the system classification, such as supply air, return air and exhaust air in the duct system. The third-level node refers to the system name that can be defined by users. Some other attributes extracted from MEP model are shown in Table 4.  
The list of attributes is assigned to each node. This list acts as the semantic feature of the system topology. It makes the element do have a \"meaning\" inside the system.  
In a subsystem, the proposed approach determines the upstream terminal components by analyzing the identification rules. Considering that there may be some circles within MEP systems, this study selects the graph structure and uses the adjacency list as the data structure. Comparing with the search in the tree structure, graph search has an advantage that whenever the algorithm explores a new node, it marks it as visited. In this study, the node can be marked as an upstream component or downstream component when being visiting.  
Taking an HVAC loop subsystem as an example, the graph in Figure 8(b) shows a simplified supply air system with 13 components, where E1 is the air handing unit, E8, E10, and E13 are VAVs, and the remainders are ducts. After performing the spatial topology analysis discussed in step 1, the connection table is shown in Figure 8(a). Each component pair indicates that the two components are spatially connected, where <E1, E2> indicates that air handing units E1 and duct E2 are connected. If entity E1 is selected manually or determined automatically to be the upstream terminal component by identification rules, the algorithm can generate a directed graph as shown in Figure 8(b), and E1 will be selected as the start node for the generation of the logical relationships. The completed inverse adjacent list is shown in Figure 8(c). Each list describes the set of input nodes of a vertex in the graph.  
\begin{table}
\begin{tabular}{l l l} \hline \hline
**Attributes** & **Types** & **Brief Description** \\ \hline Element Id & Number & Unique Id in BIM model for every element. \\ Element Location & Coordinate Point & The element location point. \\ Space Located & String & The spaces of this element located. \\ System classification & String & The system classification includes supply air, return air, etc. \\ System name & String & The name of system which elements belong to, such as supply air, return air, etc. \\ Flow & Number & Flow in and out of a diffuser or duct. \\ Start Point & Coordinate Point & Start point of a duct. For duct only. \\ End Point & Coordinate Point & End point of a duct. For duct only. \\ \hline \hline \end{tabular}
\end{table}
Table 4: Example of the attributes list.  
Figure 9: Data structure of MEP subsystem’s components. (**a**) Connection table for illustrating topological relationships. (**b**) Graph structure of the MEP subsystem. (**c**) Inverse adjacent list of MEP components.