Online Bayesian Changepoint Detection

. This paper presents a method for online vibration analysis and a simple test bench analogue for the solder pumping system in an industrial wave-soldering machine at a Siemens factory. A common machine fault is caused by solder build-up within the pipes of the machine. This leads to a pressure drop in the system, which is replicated in the test bench by restricting the ﬂow of water using a gate valve. The pump’s vibrational response is recorded using an accelerometer. The captured data is passed through an online Bayesian Changepoint Detection algorithm, adapted from existing literature, to detect the point at which the change inﬂowrateaffectsthepump,andthusthePCBassemblycapabilityofthemachine. Thisinformationcanbeusedtotriggermachinemaintenanceoperations,orto isolatethevibrationalresponseindicativeofthemachinefault.


Introduction
This paper is a follow up to an offline fault detection algorithm applied to the presented machine use case [1]. It describes an online, non-disruptive technique to detect a machine fault in a wave-soldering machine in Printed Circuit Board (PCB) manufacturing. This machine works by maintaining a constant flow of solder in the form of a set wave height, over which PCBs are passed in order to connect large numbers of through-hole components efficiently. The fault in question is solder build-up in the machine pipes, which was considered the most common recurring machine fault in the wave-soldering process by Siemens Congleton. As time passes there is a buildup of solder dross in the pipes, which leads to a pressure drop and reduced solder flow rate. Due to the resultant reduced solder wave height, PCBs passing over the wave are left unsoldered, needing repairs and touch ups. The response to these is manual adjustment of the wave height by increasing the pump power. This can be performed a set number of times before full machine maintenance is performed. This process is reactive and repeated on a weekly to monthly basis depending on the solder quality and machine uptime. The project brief set by Siemens requires a non-disruptive and low-cost solution to monitor the machine. The goal is to improve the fault detection rate and reduce the number of unsoldered products.
Awareness of a machine's state at any given time is valuable for making predictive maintenance decisions. Costly maintenance and machine downtime can be minimized effectively by implementing early and accurate fault detection [2]. This is particularly valuable during the current push towards Industry 4.0 (I4.0) [3] and is enabled by the increased prevalence of Industrial Internet of Things (IIoTs) allowing for a greater ability of factories to gather and process machine data [4]. However, the financial and time costs of directly replacing and upgrading machines can dissuade a lot of companies from investing in these technologies. As such, a "wrap and re-use" approach is generally taken instead [5]. This concept of minimal disruption to existing machine setups and production lines, alongside the extraction of new data, without machine downtime is a key motivator for this paper and the proposed methodology.
Due to its age and the hostile internal environment, the wave-soldering machine use case presented in this paper is significantly limited in the usable data that can be collected from it. As such, pump vibrations are used for the vibration analysis in this paper as access to other components is effectively impossible. Pump vibration monitoring is not unique, and many examples can be found in literature [6,7]. Techniques include comparing recorded pump vibrations against a model of the expected vibrations [8] and using pump vibrations to predict cavitation by training an Artificial Neural Network (ANN) [9]. Similarly, time-frequency analysis of vibrations have been used to diagnose wear in pump valve plates [10]. These analyses can notifying operators when pump maintenance needs to take place.in a timely manner, and are particularly effective at detecting issues such as cavitation, resonance and misaligned or warped components.
However, pump vibration analysis is not (to the author's knowledge) used to monitor general system health and predict faults that occur outside of the pump itself. This is largely assessed using pipe vibrations [11,12], which can provide insights into general system performance, or be used to locate discrete blockages downstream of pumps [13]. In the motivating scenario, access to the pipes is unavailable, and solder build-up does not form a localized blockage. Any solution needs to have low complexity so that it can be implemented on a low-cost microcontroller. Additionally, there is no pre-existing vibration data with which to establish baseline readings. This paper uses online sequential Bayesian Changepoint Detection (BCD) based on an existing algorithm [14] and assesses its suitability on a test bench. The use case fault can be presented as an unsupervised segmentation problem as the machine transitions from a functional to a non-functional state. BCD is particularly suitable for this type of problem [15]. It provides a measurement of the probability that, based on the collected information, a change in behaviour has occurred at a certain point [16,17]. This can then directly notify machine operators of the change in machine state, or be used to isolate the vibrational response of the pump at the point where the solder build-up is affecting the flow rate. In rare cases where the deterioration of the pipe state is instantaneous rather than gradual (such as in the case of seal failure), the change in vibrational response will still be able to inform machine operators of the need for maintenance. Successful applications in literature include the assessment of climate records to locate changepoints in climate regimes [17], detecting faults and failures in valves in an Unmanned Aerial Vehicle (UAV) fuel system [18], and detecting changes in the behaviour of a user of a textmessaging service [16]. Online applications of BCD are used to process live data [19] and predict the likelihood of newly recorded data being part of a "current run" between two changepoints. BCD has also been used for online signal segmentation of epileptic brain activity [20] as well as activity recognition in a home [21]. The variety of applications demonstrates the flexibility of BCD. Alongside the number of changepoints, BCD can also provide an indication of the size of the changes [17], which can highlight significant events. The computational cost of this approach increases as the number of time steps increase, although this can be managed by implementing a maximum length of time for assessment, and storing and reusing previous calculations [14]. Another drawback of this approach is a sensitivity to the prior distribution assigned to the changepoints present in the system.

Methodology
The research methodology as illustrated in Fig. 1 aims to use data analytics for improved process control in wave soldering. The data analytics approach is based on non-disruptive data extraction and processing using online sequential Bayesian Changepoint Detection. A test bench setup has been developed to replicate the wave-soldering machine behavior as the industrial machine and environment is not suitable for development. To keep it manageable in a laboratory environment, water is used instead of solder. The difference between the vibrational characteristics of water and solder should not affect the results of the BCD so long as the deterioration of the pipe leads to a change in measured vibrations that the BCD can detect. The experimental set-up and data collection are discussed in Sects. 2.1 and 2.2. As this is virtually identical setup to the setup presented in [1], these sections will largely remain as presented in that earlier work. The BCD formulation is discussed in Sect. 2.3.

Test Bench Setup
The test bench presented in this paper considers the behaviour of a pump moving water through a closed system. The flow rate is controlled by a gate valve, which is closed in discrete increments and goes from completely open to completely closed. It mimics the effects of solder dross build up in a wave soldering machine, which takes place over several weeks. As such, the steady state behaviour of the pump is the most relevant to this investigation. The schematic for this can be seen in Fig. 2, with a photo of the realised test bench in Fig. 3.  As the valve is closed, the change in the fluid's flow rate is monitored using the flow rate sensor YF-S201, connected to an Arduino. The vibration of the pump is recorded, using an accelerometer (LSM9DS1), at each increment to build up its response profile. This data is then processed at a Raspberry Pi 3B, and the results can be displayed in real time or uploaded to online networks, including any available IIoTs.

Data Collection from the Test Bench
The change in flowrate as the valve is closed is shown in Fig. 4. There is a small drop in the flow rate until the valve is approximately 70% before a transition period, and an almost linear drop to no flow from approximately 80% closed onwards. The minimal initial change is a result of the low flow rates used in this experiment. Pump vibrations are recorded with a sampling rate of 350 Hz. Each collected sample is 10,000 data points in size. The accelerometer has a range of ±2 g, a sensitivity of 0.061 mg/LSB, and collects samples in the X, Y and Z axis. This is then converted into the absolute acceleration. A fast Fourier transform (FFT) algorithm is used to extract the frequency and amplitude data from the vibrations [6]. Figures 5 and 6 show the results of the FFT on the vibration data recorded from an open and shut valve respectively. The difference between the two is clearly visible, as the peak frequency shifts to the left. Additionally, it is clear that a lot of noise is present in the system -as would be present in an industrial setting. The solder in the use case might result in different vibrational characteristics. Despite this, the solder blockage should still result in a change in the recorded vibrations over time, which can be detected by the BCD algorithm. This is a significant benefit of the proposed methodology: as long as the input changes in a way that can be detected, the BCD algorithm will be able to assess the probability that a changepoint has occurred at a given point in time. This reduces the need for calibration procedures, which can be expensive and time consuming.   Figure 7 presents some of the pump data gathered by the accelerometer. Analysis of the time-domain vibration data has shown that it is not suitable for the analysis -it does not vary significantly enough across the different valve states to be a useful feature for predicting the current state. The mean of the amplitude of the time-domain data is shown to remain roughly constant throughout. However, the plotted features extracted from the FFT (peak frequency and maximum amplitude) can be seen to respond to the change in valve state. As such, these are the features used in the BCD algorithm presented.

Online Bayesian Changepoint Detection
The algorithm is based on a simplified version of the sequential BCD algorithm described in [14], modified to detect a single changepoint in the datasets used. The simplified equations are presented below, and [14] should be referenced for additional detail and an extended version of this algorithm. As the algorithm processes the peak frequencies and maximum amplitudes in the same way, the following example will be presented for only the amplitude. An initial assumption is made about the data model: in this case, a linear regression model is used to predict the distribution of the data. Notably, other models can be used, depending on experience with the data.
Equation (1) presents the linear regression model used to represent the data gathered, where A is the amplitude of the pump vibrations and V l is the level of valve closure. β l is the lth regression coefficient and ε is the random error term. The assumptions made about β and ε are the same as in [14], with the same conjugate priors assigned here for both.
Assuming that this regression model applies to the data between the start of the dataset up until the changepoint, and from the changepoint to the end of the dataset, for each possible subset of the data i:j, the probability of the data given the regression model is calculated using Eq. (2) and stored.
In Eq. (3), the probability density of the first j data points containing the changepoint is calculated and stored. Starting at the beginning of the time series, two non-overlapping subsets of data (assumed to be independent as per [22]) are pieced together. By multiplying together the probabilities of the two subsets (calculated in (2)) and summing over all of the placements of the changepoint, the probability density of the data can be calculated.
The final quantity that needs to be specified is the prior distribution of the location of the changepoint. By using an uninformative prior distribution which assumes that the location of the changepoint is equally likely at any datapoint, bias in the algorithm can be avoided. From here, sampling from within the distributions defined above can be performed to ascertain the location of the changepoint and the regression parameters for the subsets of data either side of it. This is extended in [14] to search for additional changepoints up to a defined maximum number of changepoints k max . This is outside of the scope of this paper, but is achieved by extending Eq. (3) such that the term f(A 1:v ) contains k-1 changepoints when calculating the probability of the location of the kth changepoint. The prior distribution for the number of changepoints is specified, and sampling for changepoints between 0 and k max takes places before sampling for the locations of the change ponts. Additional tuning can be done based on the values of the linear regression model used, as described in [14,17]. A minimum distance between changepoints can also be specified.
The described algorithm will locate a changepoint in a single set of data of a set length. To expand it efficiently to process incoming data points, the matrices storing the results of Eqs. (2) and (3) are expanded. New rows and columns are added to hold the new probabilities calculated for each newly generated subset of data (by Eq. (2)). A new column is added for the new probability density P 1 (A 1:N ) where N is the most recently added datapoint. The full implementation details can be found in [14]. Figure 4 shows that the flow rate reduction as a result of the valve closure is minimal until the valve is approximately 70% shut. A short transition period can then be seen until the valve is about 80% shut. The flow rate reduction from that point on is nearly linear until it reaches 0 l/s. During the experiment, a total of 260 pump vibration samples were collected as the valve went from completely open to completely closed. Figure 8 plots the extracted amplitudes at against the resultant posterior probability of the changepoint's location as calculated by the algorithm. It suggests that a changepoint has taken place as the valve is 70% closed and shows a high certainty over a small area. This corresponds with the start of the transitional flow rate period in Fig. 4. A plot of the linear model inferred by the algorithm can also be seen in green in Fig. 8. It follows the collected data quite closely up until the last few readings. Had there been additional samples collected afterwards, the algorithm would have adjusted the inferred model to better match the data.

Results and Discussion
Performing the same analysis on the peak frequencies gives the results plotted in Fig. 9. In this case, the changepoint is detected later, when the valve is approximated 80% closed, and the posterior probability is lower and spread over a larger area. It corresponds more closely with the end of the transitional period of flow rate noted in Fig. 4. The inferred model follows the extracted frequencies very closely.
Plotting the posterior probabilities of the changepoint as calculated from the amplitude and frequencies extracted from the pump vibrations against the flow rate produced by the pump as the valve is closed produces Fig. 10. By applying this algorithm to the two different sources of data extracted from the pump vibrations, it has been demonstrated that the state of this system can be assessed by the vibrational response of the pump. Using the amplitude leads to an earlier detection of a changepoint, which is valuable in processes sensitive to changes in the monitored parameters. The frequency leads to a later detection of the changepoint, more valuable in processes that do not require immediate maintenance or are less sensitive to changes. The wave soldering machine use case presented in this paper falls into the former category and benefits from early detection of a change in flow rate so that maintenance can be performed before faulty products are released.

Conclusions
Presented in this paper is an online BCD algorithm adapted from existing literature and applied to an industrial use case. A test bench analogue is used to simulate pipe blockage due to solder build-up in a wave-soldering machine. The pipe state is indirectly monitored using a cheap, non-disruptive device that collects vibration data from the pump feeding the system. The collected data has two features extracted from it, the maximum pump vibrational amplitude and peak frequency as the valve is closed. The BCD algorithm then generates the likelihood of a changepoint having occurred in the flow rate as a result of the pipe blockage. This information is processed online and can be used to identify the current machine state (differentiating between a faulty and non-faulty state) and informs machine operators of the need for maintenance. This work will be expanded upon in the future with data collected directly from the wave-soldering machine, to assess the suitability of the algorithm and non-disruptive methodology in an industrial environment, as well as the accuracy of the test bench analogue. Additional tests with an accelerometer capable of a faster sampling rate could also be valuable, to ensure that information isn't being lost at higher frequencies the current hardware cannot detect. Integration with local IIoT and cloud platforms is also key to ensuring the data is accessible and useful. The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.