# Development and Testing of a Railway Bridge Weigh-in-Motion System
## 2 RB-WIM Algorithm
### Train Velocity and Axle Determination  
Commercial B-WIM for road vehicles breaks the continuous strain signal into segments of data known as bridge loading \"events\". The settings for the splitting algorithm are chosen so that the segments contain enough data to ensure that the influence of the vehicles within each event do not extend beyond event boundaries. The weighing algorithm uses these events as basic units of information.  
In addition to the signals from the strain transducers, two additional classes of signal need to be acquired in order to solve the system of equations: signals from which the axles are detected and the vehicle velocity is computed. The requirements for these classes of signals are different. Calculating the vehicle velocity requires at least two sensors mounted at so-called speed measurement points (SMPs), which need to be located at different longitudinal locations along the bridge. The exact shapes of these signals are not crucial, as long as the vehicle can be clearly identified in the signals. While sharper and more symmetrical peaks will give better speed accuracy, relatively smooth signals have been found to be sufficient.  
In contrast to SMPs, sensors located at the axle detection measurement points (ADMPs) need to have pronounced peaks in order to accurately determine the axle positions. It is possible to use advanced filtering and vehicle reconstruction algorithms to partially mitigate this [33], but it is much better to start with good signals. Depending on the details of the installation, a sensor may play more than one role. For example, on a typical road installation, one of the SMPs may be used as an ADMP. In the case of the tested railway bridge in Poland, a separate sensor, dedicated to axle detection, needed to be installed, as explained below.  
The correlation between two signals from SMPs defines the time shift of one signal relative to the other and hence is used to find the speed. An example for a one-carriage passenger train is presented in Figure 1. The solid and dashed traces of Figure 1a represent the signals measured at the first and the second SMP, respectively; Figure 1b shows the correlation. The location of the peak in the correlation is used to determine the time shift, 2.475 s in this case. The calculated time shift and the known distance between the SMPs are used to determine the speed of the vehicle.  
Figure 1: An example of correlation of speed measurement points (SMPs) for a one-carriage passenger train: (**a**) SMP for two signals. (**b**) Cross-correlation of the two signals.  
Once the vehicle speed is known, the axles of a train are detected using the same algorithm used for road bridges [33]. The signal from the sensor is conditioned by applying two moving average filters with different averaging lengths. The moving average with the shorter length is used to smooth out the high-frequency noise; the other is used to determine the general shape of the response. The two filtered signals are subtracted, and the resulting difference is examined to identify all peaks above a specified threshold level. These peaks correspond to the passing of individual axles. Figure 2 shows the axle detection signal and the conditioned signal for a one-carriage passenger train. The conditioned signals can be seen to have clear peaks corresponding to the four passing axles.  
Once the speed of the vehicle and the times of passage of individual axles have been obtained, the intra- and inter-bogie spacings are calculated.