Buildings’ Biaxial Tilt Assessment Using Inertial Wireless Sensors and a Parallel Training Model

Applications of MEMS-based sensing technology are beneficial and versatile. If these electronic sensors integrate efficient processing methods, and if supervisory control and data acquisition (SCADA) software is also required, then mass networked real-time monitoring will be limited by cost, revealing a research gap related to the specific processing of signals. Static and dynamic accelerations are very noisy, and small variations of correctly processed static accelerations can be used as measurements and patterns of the biaxial inclination of many structures. This paper presents a biaxial tilt assessment for buildings based on a parallel training model and real-time measurements using inertial sensors, Wi-Fi Xbee, and Internet connectivity. The specific structural inclinations of the four exterior walls and their severity of rectangular buildings in urban areas with differential soil settlements can be supervised simultaneously in a control center. Two algorithms, combined with a new procedure using successive numeric repetitions designed especially for this work, process the gravitational acceleration signals, improving the final result remarkably. Subsequently, the inclination patterns based on biaxial angles are generated computationally, considering differential settlements and seismic events. The two neural models recognize 18 inclination patterns and their severity using an approach in cascade with a parallel training model for the severity classification. Lastly, the algorithms are integrated into monitoring software with 0.1° resolution, and their performance is verified on a small-scale physical model for laboratory tests. The classifiers had a precision, recall, F1-score, and accuracy greater than 95%.


Introduction
Cities in lacustrine and seismic zones face a significant challenge; their buildings are subject to predisposing agents and triggers of various damages. Underground water extraction changes ground subsidence and its dynamic properties; these effects are relevant during an earthquake, such as those found in the Mexico City Valley [1]. Ground subsidence can cause building biaxial tilts, which can become critical with serious safety risks. Permanent monitoring and structural health monitoring (SHM) [2][3][4][5][6] allow the acquisition of time series with historical data, including their behavior before and after seismic events. Differential settlements, together with the structural characteristics of the building, can cause uneven slopes in its walls [7][8][9]. These tilt patterns can be diverse, and the value of their angles allows for establishing their severity levels. Measurements in real time show the importance of damage detection and building assessment by placing sensors and assum-

Orientation Filter for Inertial Sensors
A useful accelerometer feature is the static acceleration measurement due to the Earth's gravity, which is used to obtain the biaxial tilt of buildings. However, extensive tests showed that the dynamic acceleration signals existing in the sensors (caused by transient vibrations, fundamentally) are among the causes of interference with the calculated lean angles. It is necessary to obtain only the static acceleration. For this purpose, the orientation filter utilizes a quaternion representation. Accelerometer and magnetometer data are employed in an optimized gradient-descent algorithm to calculate the direction of the gyroscope measurement error as a quaternion derivative [40,41].
The quaternions are an extension of the complex numbers of four dimensions and can represent space rotations. They characterize the rigid body orientations or reference frames in three-dimensional space. For example, an orientation of the reference frame B relative to the reference frame A can be realized through a rotation of the angle θ around an axis ̂ defined in frame A [41]. This is presented graphically in Figure 2, where the mutually orthogonal unit vectors ̂ , ̂ , ̂ and ̂ , ̂ , ̂ define the main reference frame axes A and B, respectively [41].

Methods Combination for the Preliminary Treatment of Measurements 2.2.1. Orientation Filter for Inertial Sensors
A useful accelerometer feature is the static acceleration measurement due to the Earth's gravity, which is used to obtain the biaxial tilt of buildings. However, extensive tests showed that the dynamic acceleration signals existing in the sensors (caused by transient vibrations, fundamentally) are among the causes of interference with the calculated lean angles. It is necessary to obtain only the static acceleration. For this purpose, the orientation filter utilizes a quaternion representation. Accelerometer and magnetometer data are employed in an optimized gradient-descent algorithm to calculate the direction of the gyroscope measurement error as a quaternion derivative [40,41].
The quaternions are an extension of the complex numbers of four dimensions and can represent space rotations. They characterize the rigid body orientations or reference frames in three-dimensional space. For example, an orientation of the reference frame B relative to the reference frame A can be realized through a rotation of the angle θ around an axis Ar defined in frame A [41]. This is presented graphically in Figure 2, where the mutually orthogonal unit vectorŝ X A ,Ŷ A ,Ẑ A andX B ,Ŷ B ,Ẑ B define the main reference frame axes A and B, respectively [41]. The quaternions that describe an orientation must be normalized and of unit length for an orientation ̂ defined in Equation (1).
In this sense, the orientation filter is applied to the inertial sensor measurements. The sensor orientation is determined using Madwick's algorithm in [41], and a representation is obtained using quaternion calculations, as shown in Equation (1).
Subsequently, the unitary vector of the Earth's acceleration [ , , ] = [0, 0, 1] is rotated to the sensor position or IMU, obtaining its static acceleration at each sampling instant. Figure 3 illustrates the quaternion rotation method to get gravity acceleration to calculate biaxial tilt angles. This calculation using the orientation filter eliminates any component of dynamic acceleration resulting from temporary vibrations in the building, less than 25 Hz. Any disturbance still existing in the signal will be treated in the time series using the successive repetitions algorithm proposed in Section 2.2.3, as illustrated by the block diagram in Figure 4.  The quaternions that describe an orientation must be normalized and of unit length for an orientation A Bq defined in Equation (1).
In this sense, the orientation filter is applied to the inertial sensor measurements. The sensor orientation is determined using Madwick's algorithm in [41], and a representation is obtained using quaternion calculations, as shown in Equation (1).
Subsequently, the unitary vector of the Earth's acceleration [x, y, z] = [0, 0, 1] is rotated to the sensor position or IMU, obtaining its static acceleration at each sampling instant. Figure 3 illustrates the quaternion rotation method to get gravity acceleration to calculate biaxial tilt angles. This calculation using the orientation filter eliminates any component of dynamic acceleration resulting from temporary vibrations in the building, less than 25 Hz. Any disturbance still existing in the signal will be treated in the time series using the successive repetitions algorithm proposed in Section 2.2.3, as illustrated by the block diagram in Figure 4. The quaternions that describe an orientation must be normalized and of unit length for an orientation ̂ defined in Equation (1).
In this sense, the orientation filter is applied to the inertial sensor measurements. The sensor orientation is determined using Madwick's algorithm in [41], and a representation is obtained using quaternion calculations, as shown in Equation (1).
Subsequently, the unitary vector of the Earth's acceleration [ , , ] = [0, 0, 1] is rotated to the sensor position or IMU, obtaining its static acceleration at each sampling instant. Figure 3 illustrates the quaternion rotation method to get gravity acceleration to calculate biaxial tilt angles. This calculation using the orientation filter eliminates any component of dynamic acceleration resulting from temporary vibrations in the building, less than 25 Hz. Any disturbance still existing in the signal will be treated in the time series using the successive repetitions algorithm proposed in Section 2.2.3, as illustrated by the block diagram in Figure 4.

Average Filter in Real Time
This filter averages many input signal points to produce each output signal point. Equation (2) presents this definition.
where n is the number of samples to average, X(i) is the filter input at sampling time i, and k is the current sampling time. Equation (3) shows the programmed recursive expression.
where Y(k) represents filter output at sampling time k, Y(k − 1) is the filter output at sampling time k − 1, X(k) is the input to the filter at sampling time k, X(k − n) represents the average filter input at sampling time k − n, and n is the number of samples to average. The filter only requires input information at the current sampling time X(k) and at the last n previous sampling times. The filter must be initialized, saving Y(k), Y(k − 1), and the previous n inputs. The filter is efficiently programmed because the last n inputs are shifted, eliminating the oldest.

Successive Repetitions Algorithm
Wind or heavy traffic can produce temporary building vibrations, affecting the realtime inclination angle measurements. Figure 4 presents an algorithm of successive repetitions based on a numerical value array, which processes the time series of biaxial tilt angles. This algorithm establishes that the inclination angle must maintain its value for several successive repetitions to accept that there has been a change in it; each repetition is considered at the corresponding sampling instant.
This algorithm of successive repetitions is useful for diverse applications, and the successive repetition number can be adjusted to ensure stability and convergence. In this work, on the basis of numerous experimental tests, the successive repetition number is set to 200, and the results are reliable in their accuracy. The convergence time is always 4 s since the sampling rate is 50 S/s. RA1 indicated in (a) is calculated after the IMU inertial signal processing by the filters of Section 2.2.1 (orientation filter) and Section 2.2.2 (average filter for real time). In (b), the system checks if RA1 differs from the building tilt angle TA recorded in the system. If there are no differences, the system considers the building tilt angle (TA) unchanged, and only the current relative angle RA1 is assigned to the previous relative angle RA2 for processing in the next sampling instant. If in (b) the answer is yes, the processing is indicated in the block diagram. (c) If RA1 is equal to RA2, then SRC increases by one; otherwise, SRC = 1. (d) If SRC is equal to SRN, the number of successive repetitions of the RA1 angle value has occurred, and the system considers that the calculation of the current relative angle measured at the present sampling instant is stable, making TA = RA1.
This processing is applied for each of the eight biaxial tilt angles in each sampling instant.

Tilt Patterns
Eighteen basic patterns were proposed, representing the shapes of frequent inclinations in buildings, mainly considering the differential settlements [7][8][9]. Several buildings are leaning (off-kilter), from Big Ben at just 0.26° to the Sturluson church tower in Germany at 5.19° [42]. In general, construction regulations establish the maximum limits of the average inclination of the building through formulas based on its height, specified in percentages [43]. For example, the maximum slope allowed for a building 18 m high is 0.65% or 0.37°; for 36 m height, it is 0.48% or 0.28°. However, quite a few buildings have slopes greater than 1° and are still inhabited, although they are under supervision, as shown in Figure A1 (Appendix A) for the Mexico City Press Clinic and Figure A2 for the Palace of Fine Arts.

Tilt Patterns
Eighteen basic patterns were proposed, representing the shapes of frequent inclinations in buildings, mainly considering the differential settlements [7][8][9]. Several buildings are leaning (off-kilter), from Big Ben at just 0.26 • to the Sturluson church tower in Germany at 5.19 • [42]. In general, construction regulations establish the maximum limits of the average inclination of the building through formulas based on its height, specified in percentages [43]. For example, the maximum slope allowed for a building 18 m high is 0.65% or 0.37 • ; for 36 m height, it is 0.48% or 0.28 • . However, quite a few buildings have slopes greater than 1 • and are still inhabited, although they are under supervision, as shown in Figure A1 (Appendix A) for the Mexico City Press Clinic and Figure A2 for the Palace of Fine Arts.
This work uses sexagesimal degrees; the tilt resolution is 0.1 • , and the severity or range is from −1.5 • to 1.5 • . The tilt patterns and neural models developed can be applied to smaller resolutions, i.e., hundredths of a degree. Likewise, a conversion can be made to a percentage concerning the height of the building. The base patterns can be illustrated graphically by considering the inclinations' general shapes. The tilt resolution of this project was 0.1 • . Figure 5a presents the sensors' initial reference system (when installed on the walls). Two axes are used to measure the building's tilt. The Y-Z plane represents the biaxial tilt, allowing the IMUs to be easily powered regardless of their location on the building walls. A generic building illustration is presented regarding the walls' inclination. Figure 5b illustrates pattern 0, where all four walls tilt to the right. Figure 5c shows the rotation of the axes Y and Z, regardless of their location on the building walls. This work uses sexagesimal degrees; the tilt resolution is 0.1°, and the severity or range is from −1.5° to 1.5°. The tilt patterns and neural models developed can be applied to smaller resolutions, i.e., hundredths of a degree. Likewise, a conversion can be made to a percentage concerning the height of the building. The base patterns can be illustrated graphically by considering the inclinations' general shapes. The tilt resolution of this project was 0.1°. Figure 5a presents the sensors' initial reference system (when installed on the walls). Two axes are used to measure the building's tilt. The Y-Z plane represents the biaxial tilt, allowing the IMUs to be easily powered regardless of their location on the building walls. A generic building illustration is presented regarding the walls' inclination. Figure 5b illustrates pattern 0, where all four walls tilt to the right. Figure 5c shows the rotation of the axes Y and Z, regardless of their location on the building walls.  Figure 6 illustrates an example of the wall's possible tilts from its front view. The positive Y-axis is to the right, and the positive Z-axis goes into the page (to the sensor). In Figure 6a, the wall is perpendicular to its base, and there are no tilts. In Figure 6b, the wall has tilted over time; the Y-axis is tilted clockwise and is represented by a positive sign. Figure 7 shows a simplified scheme of the 18 base patterns proposed in this work. Considering the expert knowledge of structure and architecture specialists, the 18 base patterns can cover the building tilt forms in practice and even more. These patterns contemplate each wall as a single entity; however, each wall tilt has a close relationship throughout the structure. Furthermore, if the classifier does not recognize a predominant pattern, the biaxial inclination of each wall is recorded independently by the real-time monitoring system. Likewise, the possible future redesign of the system may include new tilt types with classifier retraining and some changes to the model or includes more sensors per wall.  Figure 6 illustrates an example of the wall's possible tilts from its front view. The positive Y-axis is to the right, and the positive Z-axis goes into the page (to the sensor). In Figure 6a, the wall is perpendicular to its base, and there are no tilts. In Figure 6b, the wall has tilted over time; the Y-axis is tilted clockwise and is represented by a positive sign. Figure 7 shows a simplified scheme of the 18 base patterns proposed in this work. Considering the expert knowledge of structure and architecture specialists, the 18 base patterns can cover the building tilt forms in practice and even more. These patterns contemplate each wall as a single entity; however, each wall tilt has a close relationship throughout the structure. Furthermore, if the classifier does not recognize a predominant pattern, the biaxial inclination of each wall is recorded independently by the real-time monitoring system. Likewise, the possible future redesign of the system may include new tilt types with classifier retraining and some changes to the model or includes more sensors per wall. Sensors 2023, 23, x FOR PEER REVIEW 9 of 28     The biaxial tilt measured by the sensors is determined as shown in Equation (4), e.g., when the Z-axis has not changed.
where i w represents the biaxial inclination of the wall w of the building. The ordered pair (g w Y , g w Z ) represents the relative angles in the Y-and Z-axes, respectively, for the wall w | w = 0 . . . 3. For example, for pattern 0, considering the resolution of 0.1 • , Equation (5) is obtained for a wall 0.
Equation (6) represents the building's biaxial tilt patterns mathematically for its four walls.
where p x is the set of base tilt patterns, x is the base pattern, i 0 , i 1 , i 2 , and i 3 are the tilt angles of walls 0, 1, 2, and 3, respectively, and g w Y , g w Z represent the relative angles in the Yand Z-axes, respectively, for the wall w | w = 0 . . . 3.
The 18 base patterns were created using Equations (4) and (5). Equations (7)- (10) show examples for patterns 6 and 14 from Figure 7. Pattern 6 has inclinations in walls 2 and 3, as shown in Equation (7), with the rotation directions of Figure 5c.
The values are substituted into Equation (7) considering the system resolution of 0.1 • , resulting in Equation (8).
Pattern 14 presents tilt in wall 0, as shown in Equation (9). The values are substituted in Equation (10). Table 1 shows examples of patterns 0-3 of the four walls based on Equations (4)-(6). Table 1. Examples of tilt angles of patterns 0-3.

IMU 0 (Wall 0) IMU 1 (Wall 1) IMU 2 (Wall 1) IMU 3 (Wall 3)
So far, the example patterns have been for the minimum inclination of 0.1 • . For the computer model's training, variations of the patterns were made. For example, the pattern 0 for wall 0 illustrated with Equation (5), based on increments of 0.1 • , can go up to i 0 = (1.5, 0); the same applies for walls 1, 2, and 3. However, there may be differences in the inclination between the walls, which would result in a distorted pattern 0, but the computer system indicates the angles in each wall so that an expert has additional information on the base pattern recognized. Similar behavior can be presented for other patterns.

General Diagram of the Classification Model
The model uses artificial neural networks for base tilt pattern recognition and its severity classification. Figure 8 illustrates the general diagram of the classification model. Figure 8a,b shows the four sensors and the four biaxial tilts, respectively. Figure 8c is the classifier of base patterns. Figure 8d is the computer model for the pattern severity classification, which includes the neural network NN 2 and an algorithm, which is detailed in Section 2.6.1.
So far, the example patterns have been for the minimum inclination of 0.1°. For the computer model's training, variations of the patterns were made. For example, the pattern 0 for wall 0 illustrated with Equation (5), based on increments of 0.1°, can go up to 0 = (1.5, 0); the same applies for walls 1, 2, and 3. However, there may be differences in the inclination between the walls, which would result in a distorted pattern 0, but the computer system indicates the angles in each wall so that an expert has additional information on the base pattern recognized. Similar behavior can be presented for other patterns.

General Diagram of the Classification Model
The model uses artificial neural networks for base tilt pattern recognition and its severity classification. Figure 8 illustrates the general diagram of the classification model. Figure 8a,b show the four sensors and the four biaxial tilts, respectively. Figure 8c is the classifier of base patterns. Figure 8d is the computer model for the pattern severity classification, which includes the neural network and an algorithm, which is detailed in Section 2.6.1.

Classifier of Base Biaxial Tilt Patterns (NN 1 ) of Figure 8c
A multilayer perceptron neural network was used to classify the base tilt patterns. Parameters that are not directly learned within the neural network training were adjusted on the basis of exhaustive search-generated candidates from a grid of parameters (gridsearch) [44,45]. This grid consisted of different values for each parameter, such as epochs, learning rate, and loss function. For fitting the model to the data, the possible combinations of the grid were evaluated, and the best combination was chosen according to a specific metric (in this case, accuracy).
After applying the grid-search method, the chosen hyperparameters during the training phase were the mean squared error (MSE) as the loss function, learning rate α = 0.0001, and training for 2000 epochs. The hidden layer and the output layer used a hyperbolic tangent activation function.
A stratified cross-validation of the 18 features (base patterns) was implemented to obtain the training and a test subset (with a ratio of 70:27, respectively). The validation uses 3% of the dataset. Afterward, the neural network training was conducted using only the training subset, leaving the test subset out of the training phase.
To have more certainty that the neural network NN 1 architecture had learned adequately, the test subset was used as input for the neural network NN 1 in the test or evaluation phase of the classifier. The metric MSE was used to compare the trained neural network NN 1 performance. The coefficient of determination R 2 did not add different information. Through many tests, the topology shown in Figure 9 was selected.

Classifier of Base Biaxial Tilt Patterns ( ) of Figure 8c
A multilayer perceptron neural network was used to classify the base tilt patter Parameters that are not directly learned within the neural network training were adjus on the basis of exhaustive search-generated candidates from a grid of parameters (g search) [44,45]. This grid consisted of different values for each parameter, such as epoc learning rate, and loss function. For fitting the model to the data, the possible combi tions of the grid were evaluated, and the best combination was chosen according to a s cific metric (in this case, accuracy).
After applying the grid-search method, the chosen hyperparameters during the tra ing phase were the mean squared error (MSE) as the loss function, learning rate 0.0001, and training for 2000 epochs. The hidden layer and the output layer used a hyp bolic tangent activation function.
A stratified cross-validation of the 18 features (base patterns) was implemented obtain the training and a test subset (with a ratio of 70:27, respectively). The validat uses 3% of the dataset. Afterward, the neural network training was conducted using o the training subset, leaving the test subset out of the training phase.
To have more certainty that the neural network 1 architecture had learned a quately, the test subset was used as input for the neural network 1 in the test or ev uation phase of the classifier. The metric MSE was used to compare the trained neu network 1 performance. The coefficient of determination 2 did not add different formation. Through many tests, the topology shown in Figure 9 was selected. 1 had eight input neurons, where ( 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 ) represent four ordered pairs of inclinations in the Y-and Z-axes for the four building walls. It h two hidden layers (96 and 58 neurons, respectively) and a layer of 18 output neurons classify the 18 base patterns. According to a set of tests and the range of inclinations to monitored for this work (−1.5° to 1.5°), the hyperbolic tangent activation function ( ) w used to process each of the outputs ( ) with m = 0, …, 17.
For the neural network supervised training, a target output vector was related to e input vector, as shown in Equation (11).
represent the four ordered pairs of inclinations in the Y-and Z-axes for the four building walls. It had two hidden layers (96 and 58 neurons, respectively) and a layer of 18 output neurons to classify the 18 base patterns. According to a set of tests and the range of inclinations to be monitored for this work (−1.5 • to 1.5 • ), the hyperbolic tangent activation function (γ m ) was used to process each of the outputs (O m ) with m = 0, . . . , 17.
For the neural network supervised training, a target output vector was related to each input vector, as shown in Equation (11).
where v x is the training dataset consisting of the base tilt pattern p x and their respective target vectors s x . For the simulation, a computational algorithm generated v x , varying the inclinations ±0.1 • up to ±1.5 • , according to the corresponding base pattern (0 . . . 17). A total of 12,900 patterns were used (approximately 715 patterns for each base pattern): 70% for training the network, 3% for validation, and 27% for testing, with which the best results were obtained using the library of Python neural networks. Only one of the 18 output neurons is triggered when pattern recognition is excellent. In other cases, more than one is activated, but a predominant value indicates the pattern with the most remarkable similarity. This behavior, regarding the most notable similarity, is essential for future work improvements. In that sense, if a building presents a different tilt pattern than the 18 proposed in this work or one that is the combination of two or more base patterns or their distortions, then specialists can analyze the inclination angles returned by the measurement system for each wall. We propose a buildings' biaxial tilt classification assessment with a computer expert system that can be progressively enriched with new scientific and technological contributions and the experience derived from its application in real buildings in each geographical area. For example, Mexico City has land with very particular characteristics. Figure 10 presents the confusion matrix generated by the base pattern classification of NN 1 .
where is the training dataset consisting of the base tilt pattern and their respective target vectors . For the simulation, a computational algorithm generated , varying the inclinations ±0.1° up to ±1.5°, according to the corresponding base pattern (0…17). A total of 12,900 patterns were used (approximately 715 patterns for each base pattern): 70% for training the network, 3% for validation, and 27% for testing, with which the best results were obtained using the library of Python neural networks.
Only one of the 18 output neurons is triggered when pattern recognition is excellent. In other cases, more than one is activated, but a predominant value indicates the pattern with the most remarkable similarity. This behavior, regarding the most notable similarity, is essential for future work improvements. In that sense, if a building presents a different tilt pattern than the 18 proposed in this work or one that is the combination of two or more base patterns or their distortions, then specialists can analyze the inclination angles returned by the measurement system for each wall. We propose a buildings' biaxial tilt classification assessment with a computer expert system that can be progressively enriched with new scientific and technological contributions and the experience derived from its application in real buildings in each geographical area. For example, Mexico City has land with very particular characteristics. Figure 10 presents the confusion matrix generated by the base pattern classification of . Figure 10. Confusion matrix to evaluate NN1. The Y-axis represents the accurate classification assigned to the patterns (true label), while the X-axis indicates the classification given by the network (predicted label). The diagonal values show the correctly labeled patterns; the neural network classified them as the same pattern to which they belong. Table 2 shows the performance metrics of the multiclass classifier using macro-average, with values truncated to two decimal places. Figure 10. Confusion matrix to evaluate NN 1. The Y-axis represents the accurate classification assigned to the patterns (true label), while the X-axis indicates the classification given by the network (predicted label). The diagonal values show the correctly labeled patterns; the neural network classified them as the same pattern to which they belong. Table 2 shows the performance metrics of the multiclass classifier using macro-average, with values truncated to two decimal places. The precision [46] is the ratio shown in Equation (12).
where tp is the number of true positives, and f p is the number of false positives. The precision is intuitively the ability of the classifier not to label as positive a sample that is negative. The worst value is zero, and the best is one. The recall [46] is defined in Equation (13).
where tp is the number of true positives, and f n is the number of false negatives. Recall is intuitively the ability of the classifier to find all the positive patterns. The F 1 score is interpreted as a weighted average of precision and recall, where an F1 score reaches its best value at one and worst score at zero. The relative contribution of precision and recall to the F 1 score is equal. The formula for the F 1 score is shown in Equation (14).
In the multiclass and multilabel case, this was the average of the F 1 score of each class with weighting depending on the average parameter.
Considering that some of the 18 base biaxial tilt patterns proposed can be infrequent in buildings, the classifier of base biaxial tilt patterns (NN 1 ) is very recommendable since the performance scores were higher than 94%. Section 3 presents examples of tilt pattern classification on a small-scale physical model for laboratory tests.

Tilt Severity Classification
Each pattern (vector of eight angles) was labeled with an algorithm assigning the tilt severity according to Equation (15).
where S is the tilt severity, g represents a relative angle in any Y-or Z-axis for a wall (see Equation (6)), and p x is the set of base biaxial tilt patterns.
The eight tilt angles can frequently have similar magnitudes because each wall has a close relationship throughout the structure; this is considered in the training patterns. In this way, when the severity labeling algorithm detects an angle within p x | x = 0 . . . 17 exceeding some limit of the four intervals presented in Equation (15), the severity pattern is labeled with the upper level.
Experimental work began with various topologies of a multilayer perceptron neural network to evaluate its performance as a classifier of the tilt severity or to consider other options. Figure 11 shows the selected topology with eight inputs (g 0 two hidden layers (100 and 98 neurons, respectively) and an output layer for the severity classification. A hyperbolic tangent function was used as the activation function (γ m ), to process the outputs (O m ). Table 3 shows how the neurons will be activated.
( 0 , 0 , 1 , 1 , 2 , 2 , 3 , 3 ); two hidden layers (100 and 98 neurons, respectively) and an output layer for the severity classification. A hyperbolic tangent function was used as the activation function ( ), to process the outputs ( ). Table 3 shows how the neurons will be activated. Figure 11. Multilayer perceptron neural network (NN2) topology to classify biaxial tilt severity.  The first option for training the model to classify tilt severity used a single dataset from the 18 base biaxial tilt patterns; however, the differences in the complexities between the base patterns produced significant distortions. A model named parallel was implemented.

Parallel Recognition Model to Classify the Tilt Severity
This model was specialized for recognizing each base pattern severity. Figure 12 presents the schema of the parallel recognition model training. It was trained with 18 datasets, each one formed by the severity patterns of a single base pattern.
The network was trained with 18 datasets, as shown in Equation (16).
where ∆ is a set with the number j of severity variations based on the pattern x. Depending on its complexity, the number j must be different for each base pattern; more complex base patterns (different tilt angles on each wall) will have greater variations. The parallel recognition model training of Figure 12 allows such differences in the number of variations in tilt severity between base patterns without implications on possible training data imbalances. Figure 12a illustrates that severity samples for patterns 0-17 can generally be different. Depending on the complexity of the base pattern, 569-3884 samples were used for each training set (18 sets): 70% for training, 3% for validation, and 27% for testing. Figure 11. Multilayer perceptron neural network (NN 2 ) topology to classify biaxial tilt severity. Table 3. Relationship between the neural network outputs and the severity level. The first option for training the model to classify tilt severity used a single dataset from the 18 base biaxial tilt patterns; however, the differences in the complexities between the base patterns produced significant distortions. A model named parallel was implemented.

Parallel Recognition Model to Classify the Tilt Severity
This model was specialized for recognizing each base pattern severity. Figure 12 presents the schema of the parallel recognition model training. It was trained with 18 datasets, each one formed by the severity patterns of a single base pattern.
The network was trained with 18 datasets, as shown in Equation (16).
where ∆p x is a set with the number j of severity variations based on the pattern x.
Depending on its complexity, the number j must be different for each base pattern; more complex base patterns (different tilt angles on each wall) will have greater variations. The parallel recognition model training of Figure 12 allows such differences in the number of variations in tilt severity between base patterns without implications on possible training data imbalances. Figure 12a illustrates that severity samples for patterns 0-17 can generally be different. Depending on the complexity of the base pattern, 569-3884 samples were used for each training set (18 sets): 70% for training, 3% for validation, and 27% for testing.   Figure 13a is the input of the four biaxial tilts, illustrated initially in Figure 8b. Figure 13b is the classifier of base biaxial tilt patterns of Figure 8c, which outputs a base pattern | = 0, 1, … or 17. This output allows the selection (Figure 13c) of the set | = 0, 1, … or 17 with the weights and biases of the trained NN2 indicated in Figure 12c. Lastly, Figure 13d is the classifier of the tilt severity (see Figure 11), which has an output | = 0, 1, 2, or 4, corresponding to reduced risk, high risk, serious risk, or critical risk, respectively.  Figure 12c). (d) The classifier of the tilt severity (see Figure 11).   Figure 13a is the input of the four biaxial tilts, illustrated initially in Figure 8b. Figure 13b is the classifier of base biaxial tilt patterns of Figure 8c, which outputs a base pattern p x |x = 0, 1, . . . or 17 . This output allows the selection (Figure 13c) of the set T x |x = 0, 1, . . . or 17 with the weights and biases of the trained NN 2 indicated in Figure 12c. Lastly, Figure 13d is the classifier of the tilt severity (see Figure 11), which has an output S i |i = 0, 1, 2, or 4 , corresponding to reduced risk, high risk, serious risk, or critical risk, respectively.  Figure 13 presents the base biaxial tilt pattern classifier and parallel recognition model implementation to classify the tilt severity. Figure 13a is the input of the four biaxial tilts, illustrated initially in Figure 8b. Figure 13b is the classifier of base biaxial tilt patterns of Figure 8c, which outputs a base pattern | = 0, 1, … or 17. This output allows the selection (Figure 13c) of the set | = 0, 1, … or 17 with the weights and biases of the trained NN2 indicated in Figure 12c. Lastly, Figure 13d is the classifier of the tilt severity (see Figure 11), which has an output | = 0, 1, 2, or 4, corresponding to reduced risk, high risk, serious risk, or critical risk, respectively.   Figure 12c). (d) The classifier of the tilt severity (see Figure 11). Figure 14 presents the most representative confusion matrix generated by the parallel recognition model to classify the tilt severity. Table 4 shows its metrics. The tests were performed with the severity samples of each of the 18 base tilt patterns. The classifier metrics were between 0.94 and 0.98, depending on the complexity of the base tilt pattern. The specialization based on the training of each neural network is illustrated in Figure 12, and the implementation is shown in Figure 13. The performance was high, eliminating possible ambiguities between different patterns. The neural network was specialized to recognize the specific severity of each base pattern. Figure 14 presents the most representative confusion matrix generated by the parallel recognition model to classify the tilt severity. Table 4 shows its metrics. The tests were performed with the severity samples of each of the 18 base tilt patterns. The classifier metrics were between 0.94 and 0.98, depending on the complexity of the base tilt pattern. The specialization based on the training of each neural network is illustrated in Figure 12, and the implementation is shown in Figure 13. The performance was high, eliminating possible ambiguities between different patterns. The neural network was specialized to recognize the specific severity of each base pattern.   Figure 15 presents a small-scale physical model for laboratory tests. It was built to verify the distributed measurement system and the tilt pattern recognition in rectangular buildings. It comprised four separate pieces that simulated each of the walls. Figure 16a shows the installation scheme of the IMUs. The sensors were located in the center, 1 m from the base, for the tests. Each wall had a mechanism based on screws at the corners of their respective bases, as shown in Figure 16b, to generate the base patterns and their corresponding severities. The digital inclinometer shown in Figure 16c permitted verifying that the distributed measurement system based on the IMUs correctly detected the angles generated in the prototype from an initial setting (initial reference). We emphasize that the model used angles based on relative variables (deviation variables) concerning an initial inclination that could exist when the measurements and monitoring   Figure 15 presents a small-scale physical model for laboratory tests. It was built to verify the distributed measurement system and the tilt pattern recognition in rectangular buildings. It comprised four separate pieces that simulated each of the walls. Figure 16a shows the installation scheme of the IMUs. The sensors were located in the center, 1 m from the base, for the tests. Each wall had a mechanism based on screws at the corners of their respective bases, as shown in Figure 16b, to generate the base patterns and their corresponding severities. The digital inclinometer shown in Figure 16c permitted verifying that the distributed measurement system based on the IMUs correctly detected the angles generated in the prototype from an initial setting (initial reference). We emphasize that the model used angles based on relative variables (deviation variables) concerning an initial inclination that could exist when the measurements and monitoring began; there could be zero or nonzero initial tilt in each of the four walls. This initial tilt information can be obtained by expert inspection before the real-time monitoring system begins to operate. began; there could be zero or nonzero initial tilt in each of the four walls. This initial tilt information can be obtained by expert inspection before the real-time monitoring system begins to operate.  Numerous laboratory tests in the small-scale physical model for rectangular buildings of Figure 15 were conducted to verify the base pattern classification and severity. Table 5 shows 96 examples of the base pattern classification and their variations. Inclination patterns in the prototype were calibrated using a digital inclinometer with two decimal places. The accuracy was 100% because the real patterns in the physical model had little distortions compared with the definitions of Figure 7. If there were failures to recog- began; there could be zero or nonzero initial tilt in each of the four walls. This initial tilt information can be obtained by expert inspection before the real-time monitoring system begins to operate.  Numerous laboratory tests in the small-scale physical model for rectangular buildings of Figure 15 were conducted to verify the base pattern classification and severity. Table 5 shows 96 examples of the base pattern classification and their variations. Inclination patterns in the prototype were calibrated using a digital inclinometer with two decimal places. The accuracy was 100% because the real patterns in the physical model had little distortions compared with the definitions of Figure 7. If there were failures to recog- Numerous laboratory tests in the small-scale physical model for rectangular buildings of Figure 15 were conducted to verify the base pattern classification and severity. Table 5 shows 96 examples of the base pattern classification and their variations. Inclination patterns in the prototype were calibrated using a digital inclinometer with two decimal places. The accuracy was 100% because the real patterns in the physical model had little distortions compared with the definitions of Figure 7. If there were failures to recognize some patterns highly distorted concerning the proposed base patterns, the measurement system returned the inclination angles in each of the eight axes. The patterns were produced in the physical model, considering the building as a single entity; the tilts in each wall had a close relationship throughout the structure. Distorted patterns are marked with asterisks, indicating the distortion for each axis. Table 5. Examples of base tilt pattern classification on the small-scale physical model of Figure 15 (base pattern and its variations). Distorted patterns are marked with asterisks indicating the distortion for each axis. Accuracy = 100%.      Likewise, many tests were performed to classify the inclination severity level on the basis of the relationship presented in Equation (15) and Table 3. The NN 2 model activated a neuron with a higher numerical value. Table 6 shows 30 examples of the most relevant results. Table A1 of Appendix B presents additional examples. Severities were configured in the physical model (prototype) with calibrated angles using the digital inclinometer with two decimal places. Of the 30 tests performed, one was misclassified as reduced (number 12) since its severity was close to high according to Equation (15). The small-scale physical model in rectangular buildings allowed experimenting with very different tilts between the walls; that is, while one wall had a more significant inclination, another had an angle close to 0 • , which can be infrequent in real buildings. In the future, this behavior could improve the definition of severities by evaluating the non-inclusion of some mathematically subtle differences.

Results and Discussion
There are more closely related studies for building monitoring. Acceleration response functions were presented in [6], which is one of the most popular options in the structural health monitoring field. However, tilt patterns and their severity were not recognized. A design and validation of a scalable and reconfigurable interesting structural health monitoring system [5] was based on triaxial accelerometers in microelectromechanical systems. It computes the frequency response functions for the subsequent modal analysis based on efficient hardware and graphical programming environment, albeit not inexpensively.
Likewise, that work did not consider biaxial tilt patterns, their severity, and their evolution in real time. Table 6. Tilt severity classification on a small-scale physical model for laboratory tests in rectangular buildings of Figure 15. Accuracy = 96%. * misclassified.

Test
Detected Another extensive and detailed study introduced a convolutional neural network that exploits a form of measured compressed response data through transfer learning-based techniques [32]. Although damage patterns were presented, tilt patterns and their severity were not established, which is requested in urban areas with differential soil settlements. In [47,48], MEMS technology accelerometers were used to monitor inclination, the data were transmitted wirelessly, and the tilts of two axes were analyzed; however, in both works, patterns were not classified, and tilt severity was not determined.
In [25], tilts were monitored with MEMS accelerometers in real time, and a user interface was created; six sensors were installed on the structure body to monitor three axes, but tilt patterns were not recognized, and their severity was not calculated. In some projects, real-time monitoring was carried out [18,25]; however, alarms were only included in [3]. In [49], a system with accelerometers and inclinometers for structural health monitoring was presented but not based on permanent supervision.
In this work, permanent monitoring allowed information processing for tilt angle visualization in real time. A user interface is presented in Figure A3a as an example. In addition, the software allows observing the sensor status, the timestamp of the recorded phenomena, and the tilt severity levels. When the system detects an inclination pattern, the machine learning models define the activation of emerging alarms; for example, Figure A3b provides the most relevant information on the detected pattern and its severity.

Conclusions
A wireless real-time computational system was developed using a distributed architecture and a TCP/IP server client, with inertial sensors to measure and analyze biaxial tilt signals in rectangular buildings. This work effectively combined a set of tools for treating inertial measurements, and a new algorithm of successive numeric repetitions was developed with successful results. It can be used in various applications to improve the quality of digital signals acquired and avoid false alarms due to the presence of unwanted oscillations.
The neural models allowed recognition of the biaxial tilt patterns and their severity in four walls. The classifiers were verified with a small-scale physical model for laboratory tests in rectangular buildings; their good performances were documented in the paper. Recognition metrics were above 95%. The system could be applied successfully since the recognition errors occurred for very infrequent patterns in real buildings. A parallel tilt severity training and recognition model was developed on the basis of specialization for each base pattern, depending on its complexity.
As the building tilt progress can occur over months or years or when an earthquake happens, the method's feasibility must be verified first on a small-scale physical model for laboratory tests. An immediate goal for this work will be its application to real vulnerable buildings and an improvement the system based on fieldwork. Furthermore, using a more significant number of sensors for each wall, fully supported by the hardware and software, would allow for classifying other forms of inclination and deformation. This is an open research and development field where multidisciplinary researchers and engineers can contribute and enrich the scientific and technological state of the art. Machine learning tools can be integrated with low-cost wireless technology and frequently used software.
For the necessary continuous improvements of building biaxial tilt assessment models, multiclass receiver operating characteristic (ROC curves) and their respective area under the curve (AUC) may be presented over a range of thresholds, differentiating the performance from random guessing, i.e., one-vs.-rest multiclass ROC. This could help to optimize the detection algorithm to achieve the highest level of accuracy in detecting damage while minimizing false positives.      Figure A3a presents an example of the interface for permanent monitoring. It allows information processing to visualize the angles in real time, the time at which the event occurred, the detected tilt pattern, and its severity. When the system detects a pattern, the machine learning models define the activation of emerging alarms; for example, Figure A3b provides the most relevant information. Figure A3a presents an example of the interface for permanent monitoring. It allows information processing to visualize the angles in real time, the time at which the event occurred, the detected tilt pattern, and its severity. When the system detects a pattern, the machine learning models define the activation of emerging alarms; for example, Figure  A3b provides the most relevant information.  Table A1 presents additional examples of tilt severity classification. Two of the 50 tests were misclassified (numbers 22 and 41). These are excellent results considering the mathematically subtle differences, which can be infrequent in real buildings. Table A1. Additional examples of tilt severity classification tests on the physical model at laboratory scale of Figure 15. Accuracy = 96%. * misclassified.  Table A1 presents additional examples of tilt severity classification. Two of the 50 tests were misclassified (numbers 22 and 41). These are excellent results considering the mathematically subtle differences, which can be infrequent in real buildings. Table A1. Additional examples of tilt severity classification tests on the physical model at laboratory scale of Figure 15. Accuracy = 96%. * misclassified.