# Structural Monitoring of a Drawbridge in Operation: Signal Analysis
## 3 Signal Processing
### Event Identification  
The first step of the signal processing procedure relates to the identification of the event type. Events are triggered by any of multiple trigger conditions and must be correctly identified for further analysis. As the object under study is a drawbridge, three main event types were defined: opening and closing maneuvers, and inconclusive events. The first two types are self-explanatory, with the third corresponding to any event that does not fit the two categories and must be analyzed individually. For the first two categories, reference signals were acquired experimentally during an opening and a closing of the bridge in good structural health, with the goal of being used as a basis for comparison. Event recognition was performed focusing on the sensors that were seen as the most representative ones for this identification, i.e. hydraulic pressure. The selection of these signals was made considering previous experience with the same structure. Nonetheless, since these are process variables, they should inherently be representative of the bridge operation. The pressure signals for the cylinders' secondary or primary chambers can be used in this procedure, with some adjustments. Additionally, the analysis was performed knowing that a stable sampling rate of 100 Hz was used. Signals under the expected event length were padded with a trailing constant value equal to the last sample. Two copies of the input signal were created, _so_ and _sc_, which will be modified to enable comparison with both event types, open or close, respectively. Any offset is then removed, such that  
\[ \begin{split} so_{i}&=so_{i}-so_{1},\quad i\in\{ 1\dots N\}\\ sc_{i}&=sc_{i}-sc_{N},\quad i\in\{1\dots N-1\}\end{split}  \tag{1}\]  
where \(N\) is the signal length, in samples, and \(so_{i}\) and \(sc_{i}\) correspond to a data point in the _so_ and _sc_ signals, respectively. Then, a rough alignment is performed by determining the time when the acquired signal crosses two reference levels, \(r_{o}\) and \(r_{c}\), defined for the open and close events. Considering a constant sampling rate, these times are represented by the indices, \(o\) and \(c\), such that  
\[ \begin{split} o&=\min_{i}(i\in\{1\dots N\}\quad| \quad so_{i}>r_{o})\\ c&=\max_{i}(i\in\{1\dots N\}\quad|\quad sc_{i}>r_{ c})\end{split}  \tag{2}\]  
The same analysis is performed for the reference signals of that same sensor. This results in indices \(o_{r}\) and \(c_{r}\), defined as  
\[ \begin{split} o_{r}&=\min_{i}(i\in\{1\dots N\}\quad| \quad ro_{i}>r_{o})\\ c_{r}&=\max_{i}(i\in\{1\dots N\}\quad|\quad rc_{i }>r_{c})\end{split}  \tag{3}\]  
where _ro_ and _rc_ are the reference signals for the open and close events, respectively. In the real analyses, \(r_{o}\) was defined as 20 bar and \(r_{c}\) as 50 bar. The _so_ signal is then shifted by \(o_{r}-o\), while the _sc_ signal is then shifted by \(c_{r}-c\), which can be either positive or negative amounts. Then, cross-correlation peaks are calculated for the two as follows:\[R_{o} =\max(\{ro_{1}\dots ro_{N_{o}}\}\star\{so_{1}\dots so_{N_{o}}\}) \tag{4}\] \[R_{c} =\max(\{rc_{N_{c}}\dots rc_{N}\}\star\{sc_{N_{c}}\dots sc_{N}\})\]  
where \(\star\) denotes the normalized cross-correlation and \(N_{o}\) and \(N_{c}\) limit the signal to its more consistent parts. The opposing pressure chamber can be analyzed with the opposite event's procedure. The signal is then classified as follows:  
* If \(R_{c}<R_{min}\) and \(R_{o}<R_{min}\), it is an inconclusive event;
* If \(R_{c}-R_{o}>0\), it is a closing event;
* If \(R_{o}-R_{c}>0\), it is an opening event. If, for some reason, this comparison fails, a simpler approach was used, where the dataset is fitted to a first-degree polynomial \(y=ax+b\) and its slope and \(R^{2}\) were used for the detection. If the \(R^{2}\) is too high (>0.8), this means that it represents the signal too well and that it does not represent either signal type. Otherwise, a negative slope will correspond to an opening event, and a positive slope to a closing one.