Background

Studies conducted on the productivity of the construction industries show that the industry could improve efficiency using a standardized workflow across its stakeholders, particularly in the field of electrical construction companies. According to these studies the implementation of building information modeling (BIM) is a solution (Bernstein and Jones 2012; Malleson 2015); its application would reduce conflicts and improve coordination. A survey conducted in 2015 showed that the implementation of BIM has not yet reached the majority of companies (Braun et al. 2015). The study by Hanna et al. (Hanna et al. 2014) points out the deficits of actual implementations of BIM in the electrical construction field. Other sectors of the construction industry have increased their productivity using BIM (Øbro 2015). The globally accepted Industry Foundation Classes (IFC) standard (ISO 2013) includes a complete set of electrical entities. The lack of BIM implementation in the field of building electricity is surprising, as shown by a survey conducted in the United States (Azhar 2009). This study shows a ranking of BIM features used, e.g. clash detections, visualization of electrical design or space utilization. Out of the partaking companies, 21% use BIM and report positive savings in time and cost. The remaining 79% respond that they are not using BIM due to not knowing about BIM, lack of technological experience, software incompatibility, and implementation costs. In addition, 59% of the companies which actually use BIM have only three or less years of experience with this technique. Nevertheless, these studies show that there is an interest in the utilization of BIM for electrical construction. There seems to be a hesitation of participants of the electrical construction sector to engage with BIM. This is at least partially grounded in the fact that BIM data is generally not available for projects that deal with the existing building stock which accounts for the biggest share of the building market, e.g. in the European Union for 75% (Atanasiu et al. 2011). Most of buildings date to a pre-digital area (Rapf et al. 2015). Project planning for such buildings requires extensive and expensive documentation of the as-built state. In Europe, 61% of the overall building stock consists of pre-1980 buildings. The need to upgrade these buildings in terms of energy efficiency (European Parliament 2002) demands investments in a range between 584 and 937 billion euro until 2050.

The lack of information on the existing building stock makes planning and execution of upgrade and renovation tasks challenging and resource demanding. Even if 2D plans, 3D models, or more advanced facility management systems exist, these are rarely up to date and require adjustments to reflect the true state of the built reality. To acquire this state, terrestrial laser scanners (TLS) currently provide a means for quick three-dimensional acquisition and documentation of building stock (Tamke et al. 2016). A way to automatically document the electrical lines in existing buildings in BIM formats is unknown. Such an approach would benefit all stakeholders that deal with the planning of buildings:

  • architects, engineers and interior designers can consider the existing electrical system in their design and reduce collisions of added elements and existing structures;

  • electrical planning companies are provided with a good base for planning of electrical systems,

  • electrical construction companies can reduce risks in their offers for building jobs,

  • building owners have an overview of the existing systems and a tool to control whether planned electrical systems collide with existing elements and systems in the building.

The current situation regarding the documentation of electrical systems in existing building stock is however challenging, as it is, if at all, only present as a 2D drawing that does not provide information about the concrete position of cables in three dimensions. Figure 1 shows a typical example of such a 2D drawing as it is produced in the planning phase, and later used for work on site. It contains the necessary information for workers to perform the work in the building, such as the position of switches and fuse boxes, as well as the principal connections between them. The workers themselves know about the height at which switches are to be mounted in walls, and the way that cables shall be laid. These rules are set up by national authorities, and sometimes harmonized on a bigger scale, e.g. on the European level. Technical standards, such as the DIN 18015 in Germany (see also Fig. 2), or the “Stærkstrømsbekendtgørelsen”, the technical standard in denmark (Vækstministeriet 2006) specify so-called “installation zones”, which should be preferred for cable routing. Workers might adapt the routing to special features on local level, but will generally follow the concept of the norms.

Fig. 1
figure 1

Electrical plans. This image shows a typical electrical plan for a small one family house, such plans are the common interface to communicate the locations of sockets and switches to on-site construction. This image was retrieved from (OAS/USDE)

Fig. 2
figure 2

Technical Specifications. Installation zones for electrical installations based on DIN18015. Zones are defined by a minimum and maximum distance from elements like floors, doors, windows, etc. Image from (Wikimedia Commons 2014)

The general compliance of the electrical installation to the framework built by norms provides a relatively secure ground for professionals to estimate where wires could be routed, but assured data is usually not available. This situation provides the base scenario of this paper and other recent research: In the work of Petkova et al. (Petkova and Rüppel 2014), the location of sockets in 2D floorplans of buildings were used to estimate the amount of copper wire in the walls, a valuable resource and a real asset in the evaluation of a buildings value before demolition. This method integrates the prior knowledge of wiring placement directly into the algorithm, however, the norms differ between countries and been revised over time. In contrast, the method presented in this paper proposes to encode this knowledge using a knowledge management approach.

Knowledge management

The main idea of knowledge management is to represent prior knowledge and expert knowledge in a self-contained, machine-readable manner, independent of the usage scenario. A commonly used approach to represent knowledge is based on machine learning. It “teaches” a machine to solve a problem using a training dataset; i.e. a set of input data with corresponding, labelled output data. Many computer vision problems, such as segmentation, detection, recognition, and matching, can be solved by machine learning techniques (Bishop 2007). Although many problems can be solved by machine learning, its application has some important limitations. Most machine learning techniques require a sufficiently large, labelled training dataset – a crucial precondition, which may be elaborate to meet. From the knowledge management point of view another problem of machine learning algorithms may arise: the “learned” knowledge can seldom be imported or exported in a human-readable way. As a consequence, prior knowledge, which may be available in form of specifications, standards and norms cannot be reused and the question what has been learned remains unanswered. Therefore, we chose a rule-based approach to represent knowledge (Schinko et al. 2010). The main advantage of procedural modeling techniques is the included expert knowledge within an object description; e.g. classification schemes used in architecture and civil engineering can be mapped to procedures. For a specific object only its type and its instantiation parameters have to be identified.

The paradigm of procedural and generative modeling is to describe an object by a sequence of operations analogue to an algorithm. The advantages of the generative approach are (Havemann et al. 2012):

  • complex models become manageable through a few high-level parameters,

  • models are easier to store and to transmit, as only the process itself is described, not the processed data, i.e., the end result,

  • changeability and re-usability of existing solutions to modeling problems can be very much improved, and

  • the smaller parameter space can lead to much better results in model-based indexing and retrieval.

Figure 3 illustrates an architectural use-case (Thaller et al. 2013). The “building block” of a window in neoclassical style has been programmed in a scripting language. Each variation of the high-level parameter set passed to the script results an a variation of the generated geometry. This example shows that all objects with well-organized structures and repetitive forms can easily be described procedurally. The procedurally encoded knowledge represents the complete family of windows; i.e. the neoclassical style of windows.

Fig. 3
figure 3

Generative Building Blocks. Modeling of a family of similar structures can be facilitated using a generative approach, shown by this architectural example (Thaller et al. 2013): representative windows,respectively highlighted by a red and blue border, are modeled using a scripting language. Variations of these window types are generated by only replacing assets and adjusting proportions

Procedurally encoded knowledge can be used to solve inverse problems such as model segmentation, semantic recognition and model completion. The article on “Irregular Lattices for Complex Shape Grammar Façade Parsing” (Riemenschneider et al. 2012) demonstrates a reconstruction pipeline using prior knowledge encoded in a generative representation. The authors use a shape grammar to specify the rules and regularities of façades. In a reconstruction task with incomplete data, the knowledge about possible façades, i.e. about possible outcomes of a reconstruction process respectively, reduces the search space of the reconstruction significantly. An overview of the reconstruction pipeline is illustrated in Fig. 4.

Fig. 4
figure 4

Grammar based building façade reconstruction. A grammar that specifies a simple variant of buildings is specified as a twodimensional shape grammar with the rules S, X, Y and Z (left). Applying the rules yields a façade layout (right). Such a grammar can be facilitated for the inverse problem (Riemenschneider et al. 2012), in which a meta ruleset is given that specifies all feasible façades, and a concrete best matching parse tree from this feasible façade family is determined for a given façade photograph

Such grammar systems were originally developed in formal language theory, and are commonly used in compiler construction. They are also a common tool used by generative modeling techniques (Thaller et al. 2013). For a review on generative modeling techniques we refer to (Krispel et al. 2015). The proposed grammar ruleset can be adapted to reflect changes in norms, or encode different norms, typically by a domain expert. The method is implemented as a pipeline that uses indoor 3D scans of buildings as a starting point. These scans consist of range scans and image information. From this data, a 3D representation of the scanned spaces is generated via a preprocessing step, and is further processed to determine the configuration of installation zones and a possible wiring hypothesis for the acquired data.

Methods

The proposed approach is divided into four main concepts: data acquisition, data preprocessing, the detection of visible endpoints of electrical installations (sockets and switches), and eventually the hypothesis of installation zones and a possible wiring inside the walls.

Figure 5 shows a visual overview over the whole pipeline. The first part, data acquisition, is concerned with the acquisition of measurements in the form of range scans and image information, i.e. photographs. In the preprocessing stage, a coarse room layout and geometric model is reconstructed from the point cloud. Furthermore, orthographic projections of the image information of each wall are generated. In these orthophotos, visible points of electrical lines, e.g. sockets or switches, are detected using a classification algorithm that has been pre-trained on a set of exemplar images of sockets and switches. From these detections and additional information that were extracted from the reconstructed model, i.e. the adjacency of walls and the location of openings (windows and doors), the location of preferred installation zones for electrical wirings are generated in consideration of norms and requirements. By means of the extracted wall adjacency, the installation zones inside all walls are connected to one graph that represents all possible routes along preferred zones. From this graph, a final hypothesis of wall wirings is extracted under the assumption that all detected points should be connected using the least amount of resources, i.e. cable length.

Fig. 5
figure 5

Pipeline Overview. The proposed approach for electrical wiring hypothesis is presented as a pipeline approach: The acquired data, consisting of point clouds and panoramic images, is preprocessed which yields augmented floor plans and ortho photos of walls. On these ortho photos, visible endpoints of electrical lines, i.e. sockets or switches, are detected. Finally, installation zones are generated for each wall and a hypothesis of electrical lines beneath the walls is synthesized

Although the final result of the pipeline is non-visual (i.e. a semantically enriched BIM model), all steps produce a visual output which is used for debugging the pipeline, for the verification of the results and for publication purposes. The point clouds have been rendered using CloudCompare1; the room geometry is exported as X3D2 and rendered with Blender3; the endpoint detection returns JPEG for visual inspection; the hypothesis modules generates SVG files for visualization.

The following sub-chapters describe each part of the pipeline in greater detail.

Data acquisition

The input for the pipeline consists of range scan information (point clouds) in E57 format (Huber 2011), accompanied with spherical panoramas, i.e. equirectangular projections of the sphere around the scanner. Bigger datasets, e.g. a whole building floor require several scans and registration. The E57 file stores metadata for each scan; additionally, one panorama per scan has to be supplied. Our test datasets were acquired using a FARO Focus 3D scanner. In some cases the scanner-mounted camera yields too low resolutions for the details that should be detected in photographs, and some lighting conditions were challenging. In these cases, a high-resolution panoramic image was used that was taken with a Canon 500D DSLR and a Nodal Ninja 3 panoramic head. These panoramas were acquired at the scanning position, immediately after the scan.

Preprocessing

If multiple scans have been acquired, they need to be registered into one coordinate system before further processing. Registration is usually done using the scanner software and is outside the scope of this paper. After registration, all point clouds and meta data (e.g. position or orientation of each scan) are stored in E57 format. We utilize the approach presented by Ochmann et al. to obtain the room layout and a coarse geometric representation (see Fig. 6): “In contrast to pure surface reconstructions, their approach allows more comprehensive use: first, it enables efficient high-level editing operations in terms of e.g. wall removal or room reshaping which always result in a topologically consistent representation. Second, it enables easy taking of measurements like e.g. determining wall thickness or room areas. These properties render the reconstruction method especially beneficial to architects or engineers for planning renovation or retrofitting. The reconstruction task is cast as a labelling problem which is solved by an energy minimization. This global optimization approach allows for the reconstruction of wall elements shared between rooms while simultaneously maintaining plausible connectivity between all wall elements. The reconstructed model is further enriched by detected doors and windows” (Ochmann et al. 2016).

Fig. 6
figure 6

Geometric Preprocessing. The geometric preprocessing of range scans (a) was carried out using the method of Ochmann et al. (Ochmann et al. 2016). The method estimates a room layout (b), and the configuration of walls (c) and openings, e.g. windows and doors (d)

The resulting data is stored in an intermediate JSON format that encodes the position of each wall, the adjacencies of walls, and the position of windows and doors inside walls. After the extraction of rooms and walls, a projection of the spherical panorama onto each wall is generated to obtain orthophotos for each wall using our orthogen command line application which is described in more detail in (Krispel et al. 2015). Figure 7 shows an example on a simple room. If several scans are available, each pixel of an orthophoto is generated using the nearest scan, i.e. the scan with shortest distance from scanning position to the pixel.

Fig. 7
figure 7

Orthophoto generation. From the panoramic views and coarse wall geometry (left), orthophotos for each wall are generated (right)

Endpoint detection

The detection of visible endpoints, e.g. sockets or switches in walls, were carried out using a machine learning approach: the system was trained using a database of images of fixed size, in our case 130 x 130 pixel; the scale of detection was fixed at 1mm per pixel. The learning is carried out using a reduced representation of a training image, the so-called descriptor. For our use case, the descriptor is a combination of a slightly modified Histogram of oriented gradients (Dalal and Triggs 2005) and Haar-like features (Viola and Jones 2001). All these descriptors are combined by concatenating their entries to one feature vector. According to its values, the pre-trained random forest classifier (Breiman 2001) retrieves the probability of each class. In order to train the classifier, we created a large training set of labelled image patches representing three object classes: power socket, light switch and background. After classification, a subsequently applied non-maxima suppression on the class probability maps yield the final detection results (Krispel et al. 2015). The results of the detection are bounding boxes around each detected endpoint, associated to a specific orthophoto, or wall, as shown in Fig. 8.

Fig. 8
figure 8

Endpoint detection. The detection system has been trained with various examples of switches (a) and sockets (b). Detections on an orthophoto are shown as violet rectangles on the right (c). rectangles

Electrical line hypothesis

The hypothesis is carried out by two main steps: the installation zone generation and the final hypothesis extraction.

Installation zone generating is carried out by an approach that is inspired by formal grammars (Hopcroft et al. 2006): The generating ruleset encodes domain knowledge from technical standards. Different technical standards are represented by different ruleset files. In the course of the DURAARK project several standards were implemented. All examples in this article use the implementation of the DIN 18015. The information obtained from prior pipeline steps are encoded as starting symbols, e.g. walls or openings, and attributes, e.g. the location of a symbol inside a wall. The evaluation of the generating ruleset will yield horizontal and vertical installation zones per wall. An illustrative simple example is shown in Fig. 9.

Fig. 9
figure 9

Hypothesis generation. The Hypothesis generation starts from the starting symbol that specifies walls, openings (yellow), detections (green and blue), and roots (purple) as seen in (a). Applying the generative rule set, installation zones are created (b). From these zones, a graph is created that connects all given end points (c), and a final hypothesis is extracted that connects all endpoints to a root and minimizes the total wire length (d)

After grammar evaluation, a graph is built that encodes all possible routings. A graph consists of a set of elements (vertices or nodes) together with a binary relation that is defined on the set; a relation between two vertices is called edge (Wilson 1996). Crossing installation zones yield vertices, and detections, as shown by the blue and green rectangles in Fig. 9, are either placed as vertex on an existing edge, or connected by the shortest orthogonal path to nearby edge. Using the adjacency information of the floorplan, adjacent zones of adjacent walls are identified and connected. Furthermore, a power root node, see the orange rectangle in Fig. 9, has to be supplied; in many cases the location of the main fuse box of a floor is known and can be added to the data description, if no root is known one of the endpoints is chosen as root.

Finally, a subgraph (specifically a forest) is extracted from this graph using a discrete optimization approach. This subgraph connects all endpoints (detections) to a power root, under the assumption that the overall length of power lines, which corresponds to material costs, is minimized. Note that this is not a minimum spanning tree problem (Graham and Hell 1985), as not all vertices of the main graph might be included in the optimal solution.

Installation zone grammar

Installation zones are placed with respect to wall boundaries or “forbidden” zones, e.g. openings such as doors or windows, these objects are utilized as start symbols in the grammar.

We define the installation zone grammar as an attribute grammar G IZ =(N,T,P,S) that consists of the set of nonterminal symbols N, the set of terminal symbols T, the set of production rules P and the start symbol S. Nonterminal symbols NT∈N are written in uppercase letters, e.g. WINDOW and terminals t∈T are written in lowercase, e.g. hzone. A production rule is written

$$ \texttt{NT} \left\{ \text{constraints} \right\} \rightarrow \langle \texttt{t} | \texttt{NT} \rangle \left\{ \text{attribute definitions} \right\} $$
(1)

The left side of a production rule contains exactly one nonterminal, and an optional constraint that evaluates to a boolean value, the rule will be matched only if the constraint evaluates to true. The right side can consist of any number of nonterminal and terminal symbols, together with attribute definitions in curly brackets. An attribute corresponds to a key-value pair. When a rule is evaluated, all symbols on the right hand side inherit all attributes from the left hand side, attribute definitions on the right hand side are carried out afterwards.

The starting production rule, which is generated from the scanned data, produces nonterminal symbols according to the elements that influence installation zone placement (walls, doors, windows, detections). All positional information is stored in attributes, with respect to a wall coordinate system (see also Fig. 10). In our implementation the wall origin is defined on top left when looking at the wall from inside a room, which corresponds to image coordinates. The terminal symbols of this grammar correspond to horizontal and vertical installation zones, as well as forbidden zones, e.g. doors or windows.

Fig. 10
figure 10

Wall Coordinate System. All positional information in the grammar is encoded by attributes relating to a local 2D coordinate frame per wall segment, with origin in top left as seen from inside the room. Symbols (e.g. a door) are represented by rectangular areas

Given such a starting rule, the production rules are evaluated until only terminal symbols are left, and all nonterminal symbols are consumed. The terminals with a special meaning for the hypothesis extraction are hzone, vzone and root, other terminals are treated as an endpoint if it contains the attribute endpoint that is set to true. Using this mechanism, users can manually add points that should be contained in the routing hypothesis, e.g. if there are known positions of wirings that could not be detected by the automatic endpoint detection.

This grammar is context free, i.e. there is only exactly one nonterminal on the left hand side of a rule, but it turned out that this approach was not sufficient in cases where there is strong evidence for an installation area that is not given solely by the rules of the technical standard, but when the detected endpoints contain large horizontal or vertical structures, e.g. an array of sockets. Therefore, the grammar description has been extended to also contain rules of the form

$${} \texttt{NT1:NT2} \left\{ \text{constraints} \right\} \rightarrow \langle \texttt{t} | \texttt{NT} \rangle \left\{ \text{attribute definitions} \right\} $$
(2)

where the left hand side consists of pairs of nonterminals, written “ NT1:NT2”, with an optional constraint statement. Upon evaluation, the production evaluation system creates for these pair rules all possible pairings of concrete instances of nonterminals. These rules match if their condition statement evaluates to true. Pair rules are always prioritized until no pair of nonterminals matches, afterwards context free rules are processed. This allows us to formulate rules that group horizontal and vertical arrangements of endpoints together; groups that exceed a specific size will generate an additional installation zone.

Wire routing hypothesis

A wire routing in the proposed method corresponds to a set of connected straight wire segments beneath a wall surface, and is represented by a graph G W =(V,E), that contains vertices vV and edges eE. A vertex is associated to a position in wall coordinates, and an edge connects two vertices v 0 and v 1. Vertices can also be associated to an endpoint, such as sockets and switches, or a power root, expressed by attributes.

The graph of all possible wire routings is created from the list of terminal symbols after grammar evaluation. A line arrangement that is formed by the horizontal and vertical installation zones is built. Any edges that intersect forbidden zones, e.g. openings, are removed. Terminals that are marked as endpoints are connected to the graph, distinguished by three different cases: terminals near vertices are directly associated to this vertex, terminals near edges will split the edge and introduce an additional endpoint vertex on the edge, remaining terminals will create a new vertex and connected with either a horizontal or vertical edge to the nearest edge or vertex of the graph. Finally, graphs that correspond to adjacent walls are connected at neighbouring nodes using zero length edges.

The final hypothesis is extracted from this graph under the assumption that the wiring was carried out minimizing material costs. The problem of finding a hypothesis subgraph G H G W , where G H =(V H ,E H ) is a forest subject to

$$ \forall \upsilon \in V : \upsilon \in V_{H}\; \text{if v is endpoint} $$
(3)

with the cost function

$$ \sum_{\upsilon_{0},\upsilon_{1}\; \text{of}\; e \in E_{H}} d(\upsilon_{0},\upsilon_{1}) $$
(4)

with the penalty d being the euclidean distance.

This problem is also called the minimum Steiner tree problem in graphs, which is of practical importance in several areas, e.g. chip design or shortest-length connection of households to a power grid. This problem is also known to be NP-complete, as shown by Hwang and Richards (Hwang and Richards 1992), even within an approximation factor of ≈1.129 which was shown by Kaklamanis et al. (Kaklamanis et al. 2008). For small graphs, e.g. single or few-room datasets, this can be evaluated exhaustively to find the global optimum, for larger datasets a faster, approximative algorithm may be needed. Our current solution implements a local search algorithm that is similar to “A fast algorithm for steiner trees” from Kou et al. (Kou et al. 1981); this algorithm subsequently grows the final graph by sorting endpoints by 3D euclidean distance and connecting each endpoint to the graph.

Results and discussion

The approach was evaluated on several datasets. Figure 11 shows an example of a single room dataset. The evaluation was carried out on a Core i7-4930K with 3.40 GHz and 6 cores. The orthophoto generation took 2.4s, the endpoint detection 575.2s and the wire hypothesis (inclusive grammar evaluation) 0.44s. The comparatively long runtime of the endpoint detection stems from the exhaustive sliding window evaluation of each wall. This could be further improved by using a interest point detector that reduces the search space of endpoint candidates. The detection results are further improved by the pipeline in a step that removes false positives, i.e. an endpoint is wrongly detected, inside forbidden regions, compare also Fig. 11 b and Fig. 11 c. The grammar that was used places vertical installation zones near doors and windows, and creates zones from vertical or horizontal groupings, as seen in Fig. 11 b.

Fig. 11
figure 11

Single room dataset evaluation. The first row shows the manually acquired ground truth labeling of sockets and switches (a), as well as electrical lines, according to a domain expert. The second row (b) shows the detected endpoints and the resulting installation zones after grammar evaluation, their center lines are depicted by dashed red lines. Note that zones are also generated from context sensitive information from vertically grouped endpoints, e.g. as shown by the ellipse in the middle of wall2 in (b). The final hypothesis is shown in (c)

This work presents an approach that synthesizes a hypothesis of electrical lines from range scans and photographs. It uses a new method that utilizes a formal grammar to represent the guidelines that govern the placement of electrical lines.

The main contribution of our new approach is the formalization of norms, standards and prior knowledge in a machine-readable manner. The presented application in the context of building information management shows the potential of the generative paradigm. Unfortunately, the machine-readable representation in form of a grammar system differs significantly from human-readable, descriptive norms. Future research will focus on a representation that closes the gap between machine-readable and human-readable knowledge representations.

Besides scientific contributions the new approach has several benefits: it enables the adaption of rules to different norms, up to specifics that concern only one building. The labeling of detected sockets with confidence values from the detection stage proved to be a viable approach in this project. Concerning future developments practitioners which evaluated our solution remarked that it would be necessary to show users that the generated data is an estimate and not the sole truth, to counter the blind believe, which stakeholders often demonstrate in the face of external data. The representation of an installation zone probability as a heat map would be a way to present this information. Practitioners also stated that this feature would be helpful in the design of new buildings. In later BIM based planning stages, the number and locations of sockets and switches per room are known, but no automated means to estimate the cable length and the attached costs are available.

For a productive usage the following issues have to be addressed. Just like any acquisition and reconstruction method, our approach also relies on the input data quality and completeness (a wall which has not been photographed cannot be analysed); the preprocessing step assumes a single floor with straight walls only; the endpoint detection can only detect what has been learned (in our examples we did not train high voltage sockets); the hypothesis cannot reproduce cases where the actual wiring does not follow the rules – a scenario often found in old buildings. Nevertheless, this proof of concept already shows the applicability of our approach.

Source code for the proposed pipeline for the modules orthophoto generation, electric endpoint detection and installation zone generation as well as wiring hypothesis is freely available at the GitHub repository 4 in Modules orthogen, elecdetect and wiregen.

Endnotes

1 http://www.cloudcompare.org/

2 http://x3dgraphics.com/

3 http://www.blender.org/

4 https://github.com/DURAARK/