1 Introduction

Reinforced concrete (RC) structures face challenges such as premature deterioration caused by aggressive environments, overloading, and inadequate maintenance [1, 2]. Structural health monitoring (SHM) systems provide a proactive approach to improve the safety, reliability, and sustainability of civil infrastructure by advancing monitoring capabilities and promptly detecting anomalies or deviations from expected behavior that could infer damage or deterioration. Equipped with various sensors and data transfer networks, the SMH systems are capable of monitoring parameters such as deformation, strain, temperature, and humidity simultaneously [3]. Fiber optical sensors (FOS) have emerged as a reliable technology well suited to fulfill this purpose, offering a range of compelling benefits, including compact size, lightweight nature, extended durability, immunity to electromagnetic fields, minimal losses at optical frequencies, broad bandwidth, seamless integration into new and pre-existing structures, and resilience in high temperatures and hazardous environments [4]. Over the last decade, significant research has been dedicated to deploying fiber Bragg grating (FBG) sensors in RC structures, owing to their potential applications in precise sensing and easy multiplexing capability [5, 6]. These optical sensors have demonstrated immense value, offering crucial benefits in various sensing applications, including temperature measurement [7], vibration [8], pressure [9] and strain sensing [10, 11], gas detection [12], pH sensing [13], and humidity monitoring [14]. FBG-based optical sensors stand for their precise wavelength-specific sensing, multiplexing capability, high sensitivity, compact design, and stability [15]. Despite their high sensitivity and multiplexing capabilities, FBG sensors often incur higher costs due to the expensive interrogation units required for accurate measurement. Additionally, installing and maintaining FBG sensors can be challenging and costly, as the delicate optical fibers are prone to breakage and require specialized handling and equipment [16]. Silicon-type materials, which are commonly employed in the fabrication of fiber optics, are known for their high sensitivity to temperature rather than strain [17, 18]. Hence, in FBG-based sensors, temperature fluctuations can significantly affect the readings of other measurements such as strain, vibration, and pressure during the sensing time. Moreover, in FBG sensors, the sensitivity to typical temperature variations is significantly higher than that to typical strain variations. As a result, there is considerable research interest in isolating the temperature effects from other sensing parameters [19, 20].

Over the years, temperature compensation in FBG sensors has garnered significant attention, primarily aimed at enhancing performance and minimizing sensing complexity. Consequently, comprehensive theoretical and experimental studies have focused on discerning variations in temperature and strain when utilizing FBGs as sensing elements [22,23,24,25,26]. Conventionally, to isolate the temperature perturbations, a strain-free FBG sensor \(\left({FBG}_{T}\right)\) is installed with the actual FBG strain sensors\(\left({FBG}_{ST}\right)\), which have different Bragg wavelengths (λBG) and temperature sensitivities. The strain and temperature changes affect the λBG value of \({FBG}_{ST}\), but for\({FBG}_{T}\), only the operating temperature change influences its λBG value. A characterization matrix equation is used for various wavelengths and sensitivity parameters to separate strain and temperature independently [27]. Various combinations of different types of FOSs and optical systems, for example, Raman scattering [28], Brillouin scattering [29], Fabry–Perot fiber optic sensor [30], optical cavity waveguide [31], and OTDR [32] with FBG sensor are employed alongside FBG sensors to mitigate cross-sensitivity. Moreover, FBG sensors are packaged in various ways to minimize cross-sensitivity, including encapsulation in carbon fiber-reinforced polymer (CRPF) [25], assembly in a robust cantilever shell [32], use of a double grating sensor with pre-stretching and fixation [33], utilizing tilted BGs [34], and embedding FBGs in a twisted configuration [35]. While addressing cross-sensitivity, these methods come with limitations such as increased system complexity, challenges in fabrication, and potential cost escalation [36].

Machine learning (ML) is being increasingly employed to enhance the performance of various sensors, including FOSs. ML techniques have proven effective in enhancing selectivity, data processing, and cross-sensitivity issues without adding to costs or hardware complexity. Temperature perturbation is a concern for FBG sensors and remains a significant source of noise in photonics sensing systems. The dynamics and enhancement of the performance of ML to discriminate temperature interference from other measured parameters have been investigated in different photonics systems, including microwave photonic sensors [37, 38], Brillouin optical time domain sensors [39, 40], photonic crystal sensors [41], Fabry–Perot [42], and multimode FOS [43]. Ongoing investigations are aimed at resolving cross-sensitivity challenges in FBG sensors through the application of ML algorithms. Recent advances in temperature measurement, using FBG and ML, provide better accuracy and faster data processing [44]. Separation of temperature and strain in FOS has been investigated using an etched FBG sensor combined with a single-multi-single mode (SMS) and multi-single-multi mode (MSM) filters and ML [45, 46]. However, these approaches may require additional filtering systems, potentially increasing hardware costs. An alternative method involves measuring the sidelobe power of the FBG reflected spectrum and employing an ML model, although this may demand increased computational power [47]. The sensitivity of the FBG sensors was increased using multiple FBGs inside a fiber optic setup, implemented through the single-phase mask technique [48]. Recently, a new inscription technique for creating multiple FBGs inside fiber optics was discussed, along with sensitivity analysis [49].

In this paper, we present a novel approach to compensate for temperature effects in FBG sensors by designing and fabricating multiple FBGs with distinct Bragg wavelengths on a single mode fiber (SMF) and utilizing ML models. Our approach significantly advances the compensation of temperature effects in FBG sensors by extracting extended feature points from multiple FBGs embedded within a single fiber. This eliminates the need for additional hardware, resulting in a cost-effective and highly scalable solution. We achieve high correlation accuracy by training ML models on a robust FBG sensor dataset capturing temperature and strain level measurements. This approach paves the way for wider adoption and enhanced capabilities of ML-assisted FOS technology for SHM.

Until now, no work has been reported on multi-arrayed FBGs in a single fiber optics, along with ML techniques for simultaneous measurement of strain and temperature. Unlike traditional FOS-based systems that primarily focus on strain or temperature individually, our approach integrates these parameters into a single system using newly designed FBGs and ML models. We validated our approach through mechanical loading tests under various temperature conditions and real-world applications on a post-tensioned concrete bridge. This research contributes to developing robust, cost-effective, and less complex FOS, based explicitly on FBG strain and temperature sensors, with a potentially significant impact on SHM by addressing the challenge of unpredictable and uncontrollable temperature variations during the monitoring process. Additionally, the proposed ML technique eliminates the need for extra strain-free FBG sensors for temperature compensation purposes.

2 Materials and methodology

This section describes the materials utilized and the steps undertaken to develop the multi-arrayed FGB sensor tailored for our experiment. This section also discusses the data acquisition system, which aims to continuously collect real-time sensor readings and effectively capture responses to temperature and mechanical load variations. Moreover, we discussed sophisticated signal processing techniques to extract discriminative features from the spectral data.

2.1 Fabrication and characterization of multi-arrayed FBG sensor

We designed and fabricated an array of FBG sensors with a spectrum comprising four distinct peak wavelengths, which differs from conventional FBG sensors. This innovation increases the number of features for the ML model. As a result, the anticipated application of ML with a higher number of feature points is expected to enhance the accuracy of temperature and strain measurements simultaneously. The fabrication process of multiple FBGs on a SMF is detailed in [50]. Four FBGs were inscribed into a segment of standard SMF-28 fiber using a Sagnac loop interferometric writing system equipped with acousto-optic modulators in the arms [50]. This setup facilitated easy adjustment of both the amplitude and phase of the induced refractive index change, allowing precise control to attain the desired spatial and spectral characteristics. The system employs a phase mask to split the laser light into two beams in a Sagnac loop. Within the loop, two acousto-optic modulators independently modulate the phase of each beam allowing precise control of both the period and magnitude of the resulting refractive index modulation within the fiber core. Consequently, it allows for precise control of the spectral properties, including the generation of multiple reflection peaks with exact peak wavelengths [51].

The SMF-28 fiber employed for inscribing the four FBGs featured a 15 mm separation between each, with each FBG having a length of 10 mm. The total length of the arrayed FBGs amounted to 85 mm, including the separation between them. The schematic representation of the multi-arrayed FBGs is shown in Fig. 1a, highlighting the grating region. Figure 1b shows the actual FBG sensor we have fabricated. For validation purposes, the fabricated arrayed FBG sensor was tested under various mechanical loading and temperature conditions. The input end of the sensor is connected to a ST/PC connector using a splicer. Further insights into the sensor’s behavior are provided in Fig. 1c, d, Fig. 1c presents the theoretical reflection power spectrum of the designed FBGs under no-load conditions, while Fig. 1d illustrates the corresponding experimental reflection power spectrum measured at room temperature \(\left(25.2^\circ{\rm C} \right)\).

Fig. 1
figure 1

Spectral response as a function of wavelength for an array of four uniform FBGs. a Schematic and b actual representation of the designed multi-arrayed FBG sensor; Spectra of the FBGs array under zero-load conditions and room temperature (T = 25.2 ℃). c Theoretical transmission (Tx) and reflection (Rx) spectra are shown in red and blue, respectively; d Experimental reflection spectra (colour figure online)

In the case of a conventional FBG sensor with a single grating, there are limited feature points, either in terms of the change of wavelengths or reflectivity power corresponding to a single Bragg wavelength (λBG). Achieving higher prediction accuracy proves challenging when training an ML model with limited feature points, as the model struggles to comprehend the behavior of strain and temperature effects within a restricted set of variable parameters. By incorporating multiple gratings, each with a unique Bragg wavelength (λBG1–λBG4), the sensor generates additional feature points for training the ML model. When both strain and temperature are applied to the sensor, all the gratings respond simultaneously, offering distinct features to train the ML model. This approach provides a unique advantage over conventional FBG sensors, enhancing the model’s ability to differentiate and accurately interpret temperature and strain variations. Both temperature and strain fluctuations can lead to shifts in the wavelength shift (∆λBG), as illustrated in the following expression [52].

$${\Delta \lambda }_{{BG}_{i}}={\Delta \lambda }_{{BG}_{i}}\left[\left(1-{\rho }_{0}\right)\Delta \varepsilon +\left({\alpha }_{\varepsilon }+{\alpha }_{0}\right)\Delta T\right],$$
(1)

where ρo, αe, and αo denote the photo-elastic, thermal expansion, and thermo-optic coefficients, respectively. The subscript i represents the individual Bragg wavelength from 1 to 4. Consequently, any variations in strain and temperature within the sensor yield four distinct sets of wavelength changes. Likewise, the reflectivity power and full-width half maximum (FWHM) changes are employed to observe the effects of temperature and strain. The reflection spectrum of the sensor was initially measured at zero load and room temperature, determining the Bragg wavelength, reflectivity power, and FWHM of the FBGs. The results are summarized in Table 1.

Table 1 Experimental Parameters of FBGs at T = 25.2 ℃

The effect of strain and temperature on the spectrum of the FBG sensor is depicted in Figs. 2a and 2b, respectively. Figure 2a illustrates the wavelength shifts of single gratings \(({\Delta \lambda }_{BG3})\) due to the change in applied load (from 0 to 50 gm) at room temperature \((25.2^\circ C)\), providing insights into the sensor’s response under varying loading conditions. In Fig. 2b, the sensor’s spectral response to temperature changes (from 25.2 to 40.1 ℃) is presented at no-load condition. The inset in each case shows the wavelength shift of \({\text{BG}}_{3}\) in response to the applied change.

Fig. 2
figure 2

Experimental results for change in the spectral response of the multi-arrayed FBG sensor to changes of a applied load with room temperature (25.2 ℃) and b temperature with no load condition

2.2 FBG spectrum analysis for data acquisition

To analyze the FBG spectrum for data acquisition, the FBG sensor was subjected to varying environmental conditions or mechanical loads to induce changes in temperature and strain. As these changes occur, the reflected spectrum of the FBG sensor undergoes alterations, primarily manifested in wavelength shifts, FWHM shifts, and changes in reflectivity. When a broadband light wave passes through the grating inscribed fiber, with a narrow spectrum of light centered on a specific wavelength, known as the Bragg wavelength (λBG), is reflected, while the rest of the light continues through the fiber. The Bragg wavelength can be determined from the grating structure using the following equation:

$${\lambda }_{BG}=2{n}_{ef}\Lambda ,$$
(2)

where Λ is the grating period and nef represents the effective index of light guided in the fiber core. Therefore, any change in the grating structure leads to a change in the Bragg condition. The FBG system generates two types of light waves known as forward and backward propagating waves. The reflectivity \((R(\lambda ,L))\) is the fraction of power reflected by the FBG and is typically determined by applying coupled mode theory, which involves solving equations for both forward and backward propagating waves [52].

$$R\left(\lambda ,L\right)=\frac{{\kappa }^{2} {sinh}^{2}\left(L\sqrt{{\kappa }^{2}-{\Delta \beta }^{2}}\right)}{\left({\kappa }^{2}-{\Delta \beta }^{2}\right) {cosh}^{2}\left(L\sqrt{{\kappa }^{2}-{\Delta \beta }^{2}}\right)+{\Delta \beta }^{2}{sinh}^{2}\left(L\sqrt{{\kappa }^{2}-{\Delta \beta }^{2}}\right) },$$
(3)

where κ and ∆β are the grating coupling coefficient and frequency detuning, and L is the length of the gratings. From this, the maximum reflectivity and FWHM of the FBG reflected spectrum in terms of the grating parameters can be defined by the following equations, respectively:

$${R}_{max}={tanh}^{2}\left(\kappa L\right),$$
(4)
$$FWHM=\frac{{\lambda }_{BG}}{{n}_{ef}L}\sqrt{1+\frac{{\kappa }^{2} {L}^{2}}{{\pi }^{2}}}.$$
(5)

The equations above indicate that any alteration in the FBG structure due to external factors such as strain, temperature, and pressure can affect the FBG parameters such as \(L, \kappa ,\) and \({n}_{\text{ef}}\), and thus the spectrum parameters (λBG, Rmax, and FWHM). Fig 3 depicts how reflectivity and FWHM are influenced by the grating strength coefficient (κL = 2 and nef = 1.457) for a uniform FBG. This essentially means that any change in the grating parameters due to external influences affects both the grating reflectivity and the bandwidth of the reflected spectrum. When the product of the grating length (L) and the grating strength (κ) is large (κL > 3.5), the reflectivity approaches unity (nearly perfect reflection). Conversely, changes in the FWHM decreases as \(\kappa L\) increases. When subject to external changes such as strain (∆ε) and temperature (∆T), the FBG exhibits a shift in its Bragg wavelength from λBG to (λBG + ∆λBG) as follows:

Fig. 3
figure 3

Spectral response as a function of wavelength for a uniform Bragg grating. a Reflection and transmission spectra as a function of wavelength; b Variation in reflectivity for the length of the grating; c Variation in FWHM for the length of the grating

$$\Delta {\lambda }_{BG}=\Delta \varepsilon {K}_{0}+\Delta T {K}_{T}.$$
(6)

In Eq. (6), \({K}_{0}\) and \({K}_{\text{T}}\) stand for the strain-optic and thermo-optic sensitivities, respectively. In the C-Band wavelength region, typical commercial values are approximately 1 pm/µε for \({K}_{0}\) and 10 pm/°C for \({K}_{\text{T}}\) [53]. The sensitivity coefficients for newly designed and fabricated FBG sensors are obtained through calibration. The principle of FBG sensors highlights the inherent challenge of distinguishing between strain and temperature. In the conventional method of temperature compensation during strain measurement, an additional FBG temperature sensor is embedded inside a capillary tube within the same system to eliminate strain effects. The Bragg wavelengths and sensitivity coefficients of the two sensors differ from each other. Consequently, under the same strain and temperature conditions, the wavelength shifts of both sensors exhibit distinct behaviors. The following well-known characterization matrix allows for the independent calculation of strain and temperature [54].

$$\left(\begin{array}{c}{\Delta \lambda }_{BG1}\\ {\Delta \lambda }_{BG2}\end{array}\right)=\left(\begin{array}{cc}{K}_{\varepsilon 1}& {K}_{T1}\\ {K}_{\varepsilon 2}& {K}_{T2}\end{array}\right) \left(\begin{array}{c}\varepsilon \\\Delta T\end{array}\right).$$
(7)

In Eq. (7), \({K}_{\upvarepsilon }\) and \({K}_{\text{T}}\) represent the strain-optic and thermo-optic sensitivities, respectively, with subscripts 1 and 2 indicating the two different sensors, FBG1 and FBG2. FBG1 is connected to another strain-free sensor, FBG2. Therefore, the two FBGs exhibit different sensitivities to the same amount of strain and temperature. Given these varying sensitivities, the strain (ε) and temperature (ΔT) near each sensor can be determined by solving Eq. (7).

Conventional temperature compensation in FBG sensors relies on fixed rules or equations, while ML adapts to complex relationships using data-driven approaches for more flexible and adaptive compensation. ML works better when it has lots of useful information (feature points) and a big dataset to learn from, ultimately leading to improved predictive capabilities. The experimental setup for data acquisition at different strain and temperature conditions is shown in Fig. 4. A commercially available tunable laser-based data acquisition unit (optical interrogator- Scaime MDX8000) for the FBG sensor was utilized. The MDX8000 optical interrogator has a laser source that emits light from 1528 to 1565 nm with resolution <1pm, repeatability of 1pm, and reproducibility of 3pm. An experimental system was built to investigate the spectral changes in the FBG sensor with environmental changes.

Fig. 4
figure 4

Experimental setup for temperature and strain measurement with the arrayed FBG Sensors. a Photograph of the experimental test rig and analyser setup; b Schematic representation of the test setup

Figure 4a shows the photograph of the experimental setup station. This setup has the capability to adjust both strain and temperature independently, while also recording the corresponding optical spectrum data. In this setup, the strain along the FBG sensor can be adjusted by applying weight (mass) to the end of the fiber, while the other end is rigidly mounted. The applied load ranged from no load to 100gm in increments of 5 gm. The position of the FBG sensor was passed through the temperature controller. The temperature controller system includes a mechanism for controlling the FBG sensor temperature using water. The liquid-based temperature control mechanism involves circulating water through a container, which can be heated or cooled as needed to achieve the desired temperature. This system enables us to adjust and maintain the temperature at which our experiments or tests are conducted. A crucial element of the setup involved immersing a segment of the optical fiber, approximately 100mm in length, into the water. This immersion was facilitated through a stainless-steel capillary tube, which serves to protect the fiber and maintain its integrity during exposure to the liquid. The thermally controlled water then directly contacts this capillary stainless-steel tube surrounding and close to the FBG sensor, effectively transferring the water temperature to the sensor. Fig 4b illustrates a schematic of the uniform heat transfer from the stainless-steel tube to the FBG sensor.

To assess temperature variation and establish the ML-assisted sensing model, we conducted strain sensing based on a single FBG interrogation at seven different temperatures (20–50 ℃). The reference temperature is set at \(25.2^\circ{\rm C}\), with other temperatures being treated as deviations. A K - type thermocouple was utilized to measure the temperature of the liquid surrounding the FBG sensor. It provides a resolution of \(0.1^\circ{\rm C}\) and an accuracy of ± 2.0% of the reading. The loading test was conducted for each temperature. The acquisition system employed a conventional optical interrogation method to gather the necessary measurements under varying temperature and strain conditions. The fiber optic sensing system is based on the FBGs principle; therefore, any change of strain and temperature is reflected by the spectrum analysis through the spectrum’s peak wavelength, FWHM, and reflectivity power change.

Figure 5 illustrates the analyzed data from the FBG reflection spectrum obtained under varying temperature conditions ranging from \(20.2\)to \(50.5^\circ{\rm C}\), depicting the changes of key features of the spectral response of the FBG sensor under different mechanical loading conditions. Figure 5a shows the variation of peak wavelength with mechanical load for different temperatures. Additionally, Fig. 5b presents the variation of peak wavelength with varying temperatures for different loads. Together these reveal the interplay between temperature and mechanical stress on the FBG sensor’s performance. Furthermore, Fig. 5c illustrates the FWHM variation with load for different temperatures, and Fig. 5d shows the FWHM variation with temperature for different loads. The reflectivity power (not shown) decreased with the applied loads and temperature. Together, these reveal the impact of temperature and load variations on the spectral response of the FBG sensor. This comprehensive analysis offers valuable insights into the sensor’s behavior under various environmental and loading conditions, essential for structural health monitoring applications.

Fig. 5
figure 5

FBG reflection spectral changes captured under different temperatures and mechanical loading conditions, illustrating: a Peak wavelength change versus load at different temperatures; b Peak wavelength change versus temperature at different loading conditions; c FWHM versus load for different temperatures; d FWHM versus temperature for different loads. (Note that in b and d, for clarity only 3 of the 21 measured loads are shown.)

Adding weight (mass) to the optical fiber inscribed with the gratings creates a small stretch or squeeze (stress) in the fiber optic cable. The resultant change in peak reflected wavelength is proportional to the strain experienced by the optical fiber, which in turn is related to the applied mass. We assumed that the fiber optics cable behaves linearly elastic within the range of loads applied. This means that the strain induced in the material is directly proportional to the applied stress. In normal operating conditions, the free space FBG exhibits a strain sensitivity of 14.02 pm/gm and a thermal sensitivity of 9.2 \(\text{pm}/^\circ{\rm C}\).

Utilizing MATLAB R2019b, we explored various regression models to address strain and temperature estimation, and the best-performing approach was subsequently employed. Support vector machine (SVM) and regression-based algorithms were employed to explore data behavior, select features, train models, and assess results. The ML system featured an Intel(R) Corei7−9750H CPU, operating at a base speed of 2.60 GHz, accompanied by 16 GB of RAM, running Windows 11 Home. For the ML we used a dataset containing spectral data collected under various temperature and tensile strain (mass) conditions, which we separated into two parts. To train the ML models, we used 70% of the dataset. This data was independent of the primary dataset (30%), which was not involved in the training process. The primary dataset was reserved solely for validating the model’s prediction results [41].

3 Machine learning approach for temperature compensation

This research considered the variation of key spectral features, including peak wavelength, FWHM and reflectivity, due to temperature change as noise or perturbation. The study employed various ML-supervised algorithms, including linear regression (LR) models, different types of SVM models, Gaussian process regression (GPR), and tree ensembles (TE).

3.1 Data description

The experimental procedure involved the collection of spectra, followed by a subsequent post-analysis to extract the feature points. We tested an arrayed FBG sensor at different temperatures to improve accuracy. By studying how temperature affected the FBG spectrum, we trained the model to predict strain based on wavelength, reflectivity power, and FWHM changes. Key changes in the experimentally obtained FBG spectrum were identified, and the peak wavelengths (∆λBG), reflectivity or power (∆P), and FWHM were employed as feature values for input into the ML model as the training data.

During the experimental procedure, FBG spectra were collected for 21 different applied loads, systematically varied from 0 to 100 gm, incrementing by 5 grams for each successive measurement. For each of these loads, FBG spectra were collected for 8 distinct temperature settings. Consequently, the combination of load and temperature variations yielded a comprehensive dataset comprising a total of 168 FBG spectra. As expected from the design, each spectrum from the FBG sensor consisted of four distinct peaks corresponding to the four FBGs incorporated in the sensor. These spectra were analyzed to identify variations in λBG, P, and FWHM, serving as responses to applied mechanical loads and temperature variations during the experiment. Hence, we can gather four distinct sets of grating information from each spectrum, making a dataset containing 672 sets of information on peak wavelength change. We extracted a similar amount of data for both FWHM and reflectivity power change. It is worth noting that at every temperature and load condition, the data exhibits a distinct change in the features, providing clear and consistent trends across the experimental conditions. The data obtained from the experimental system were utilized to train, test, and validate the ML models discussed in Section 2.

3.2 Proposed machine learning model

Supervised regression techniques are employed to analyze temperature and strain predictions. We aim to find patterns and relationships in the input data that can help accurately predict the continuous values of temperature and strain. The most common regression-based SVM algorithm utilizes a kernel function (K (x)) to separate the samples. The radial basis function (RBF) kernel is particularly useful when data points do not have a clear linear separation in the original feature space, and it can be defined as [55]:

$$K\left({x}_{i,f}, {y}_{j,f}\right)=exp\left(-\gamma {\Vert {x}_{i,f}-{y}_{j,f}\Vert }^{2}\right),$$
(8)

where the parameter γ =  − 0.5σ−2 can be obtained from Gaussian noise (σ). The feature vectors for corresponding temperature and strain variation are denoted by xi and yj, respectively, and can be acquired from the training set within the input space. The subscript defines different feature parameters obtained from the FBG spectrum (f = [∆λ,P,FWHM]). In SVM, the process entails selecting a hyperplane that maximizes the distance from each point, achieving optimal separation of the data. Our approach to predicting strain and temperature, starting from the collection of spectral data to the final prediction, is depicted as an ML pipeline in Fig. 6. The process involves hardware setup, sensing data analysis, and the ML process. An arrayed FBG sensor captures spectral data, and relevant features like ∆λ, ∆P, and ∆FWHM are selected. The performance of the predicted result from different models is analyzed through different statistical approaches, including root mean squared error (RMSE), mean absolute error (MAE), and coefficient of determination \(\left({R}^{2}\right)\). The following mathematical expressions are utilized to elucidate these performance metrics:

$$RMSE=\sqrt{\frac{1}{N}\sum_{i=1}^{N}{\left(\overline{{\varepsilon }_{i}}-{\varepsilon }_{i}\right)}^{2}},$$
(9)
$$MAE=\frac{1}{N}\sum_{i=1}^{N}\left|\frac{{\varepsilon }_{i}-\overline{{\varepsilon }_{i}}}{{\varepsilon }_{i}}\right|,$$
(10)
$${R}^{2}=1-\frac{\sum_{i=1}^{N}{\left(\overline{{\varepsilon }_{i}}-{\varepsilon }_{i}\right)}^{2}}{\sum_{i=1}^{N}{\left(\overline{{\varepsilon }_{i}}-{\varepsilon }_{m}\right)}^{2}},$$
(11)

where N is the number of observations, \(\overline{{\varepsilon }_{i}}\) is the actual value, εi is the predicted value, and εm is the mean of the actual values. These statistical metrics, including RMSE, MAE, and R2, are significant for quantifying and comparing the accuracy, percentage error, and goodness of fit of predictive models, respectively, providing valuable insights into their performance.

Fig. 6
figure 6

Machine learning and data acquisition approach used for predictive analysis of strain and temperature

4 Experimental outcome

The performance of the proposed ML-augmented FBG sensing method for SHM is demonstrated and analyzed in this section. In both controlled laboratory settings and real-time scenarios, the method demonstrates the concurrent measurement of strain and temperature. The discussion will involve the evaluation of the performance of different ML methods for compensating the temperature effect in strain measurement. This includes the examination of linear regression models, regression trees, support vector machines (linear, quadratic, cubic, Gaussian kernel), Gaussian process regression models, and ensembles of trees. We tested all the regression learner-based algorithms for training and validating the models, and finally selected the four best-performing models. The overall analysis of the experimental investigation is presented in three distinct categories. First, the focus was on the data acquisition analysis, which involved a comprehensive examination of data collected from the fabricated arrayed FBG sensor within the laboratory-controlled setup. Second, the analysis involved the collection and examination of FBG data from a post-tensioned footbridge structure to assess the behavior and responses of the FBG sensor in real-world applications. Finally, the performance analysis of ML models is presented to interpret and utilize the acquired FBG data, thereby assessing their predictive capabilities and contribution to the overall experimental outcomes.

4.1 Arrayed FBG sensor within the laboratory-controlled setup

The accuracy of the developed ML models to compensate for temperature perturbations by utilizing the data collected from the novel multi-arrayed FBG sensor within the laboratory-controlled setup is discussed here. The outcomes for temperature and strain derived from employing various predictive models are visually depicted in Figs. 7 and 8 for different feature points. In these figures, the x-axis represents the actual applied loads, while the y-axis represents the residuals (loads) generated by the ML models. In each graph, the solid black line represents instances where the predicted values perfectly match the actual values. Essentially, the proximity of a data point to this line indicates higher prediction accuracy.

Fig. 7
figure 7

Exploring load prediction for arrayed FBG sensor: A comparative study of predictive accuracy using ML models with single feature analysis (λBG) collected from FBG1

Fig. 8
figure 8

Exploring load prediction for arrayed FBG sensor: A comparative study of predictive accuracy using ML models with three features analysis (λBG, R, FWHM) collected from all the Bragg gratings (BG1 − BG4)

As shown in Fig. 7, when we employed a single feature, mirroring traditional sensing methods, specifically the wavelength change, the resulting RMSE values were: 7.2 for LR, 10.2 for SVM, 11.8 for GPR, and 17.6 for TE models under room temperature conditions. These RMSE values indicate that the accuracy achieved with only one feature is insufficient for practical applications. Next, rather than using a single feature, we used three different features (λBG, R, FWHM) obtained from the single FBG, and found that the prediction accuracy increases significantly (results not presented here). Taking this further, we found that a much higher level of accuracy in prediction was achieved by incorporating three distinct features (λBG, R, FWHM) extracted from the four individual BGs, resulting in a total of 12 features \(\left({\lambda }_{BG1}-{\lambda }_{BG4}; {R}_{BG1}-{R}_{BG4} ; {FWHM}_{BG1}-{FWHM}_{\text{BG}4}\right)\) as illustrated in Fig. 8.

The resulting RMSE values were: 0.22 for LR, 2.8 for SVM, 0.23 for GPR, and 13.5 for TE models under room temperature conditions. This outcome showed that the utilization of ML models in conjunction with this multi-feature analysis presents a practical and effective approach for achieving precise temperature compensation and strain measurement in real-world applications, offering promising prospects for enhanced performance and reliability in various fields such as SHM and industrial process control. Figure 9 illustrates a comparison between predicted temperatures and actual temperature readings from the thermocouple under mid-load conditions (50 gm), generated by different ML models. Figure 9 displays the actual temperatures measured by a thermocouple on the x-axis, and the temperatures predicted by ML models on the y-axis. This setup allows for a direct comparison between observed and model-predicted values, illustrating the accuracy of the ML models in predicting temperature changes. Similar behavior has been observed for other load conditions. The RMSE for temperature measurements were as follows: LR for 2.0 °C, SVM for 5.9 °C, GPR for 4.8 °C, and TE 11.3 °C. Notably, among the ML models evaluated, the LR model emerges as the most accurate in forecasting temperature fluctuations in the range of 20–50 ℃.

Fig. 9
figure 9

Exploring temperature prediction for arrayed FBG sensor: A comparative study of predictive accuracy using ML models with three features analysis (λBG, R, FWHM) collected from all the Bragg gratings (BG1 − BG4)

Figure 10 illustrates the RMSE, MAE, and R2 values for the strain measurements as the features used varied between only one feature \(\left({\Delta \lambda }_{\text{BG}}\right),\) all three features from four FBGs, all three features from a single FBG, and just two features \(\left({\Delta \lambda }_{\text{BG}}\ and \ \Delta FWHM\right)\) from a single FBG. These results demonstrate that both the linear regression model and the GPR model can notably enhance the accuracy of strain measurement by effectively compensating for temperature variations using a sensor with multiple FBGs (Set 2).

Fig. 10
figure 10

Analysing the efficacy of ML models in load prediction for different numbers of dataset features. (Set 1: Only one feature \(\left({\Delta \lambda }_{BG}\right)\); Set 2: Three features from four BGs; Set 3. Three features from single BG; Set 4: Two features \(\left({\Delta \lambda }_{BG}\ and \ \Delta FWHM\right)\) from single BG). a RMSE, b MAE, c R2

The superior performance of the LR and GPR models compared to the SVM and TE models can be attributed to several factors. LR, a classic statistical method, and GPR, a probabilistic model, are well suited for capturing linear relationships and complex patterns in the data, respectively. LR inherently assumes a linear relationship between input and output variables, which may align well with the characteristics of the data generated by the FBG sensors. On the other hand, SVM and TE models might struggle to capture the nuanced dependencies between these variables due to their inherent limitations. SVM relies on finding the optimal hyperplane to separate different classes, which may not be well suited for the continuous and interconnected nature of temperature and strain measurements. Similarly, TE models, while powerful for handling large datasets and capturing complex interactions, might not adequately capture the subtle variations in temperature–strain relationships. Therefore, the adaptability and inherent characteristics of LR and GPR make them more effective in compensating for temperature effects and improving the accuracy of strain measurements compared to SVM and TE models. The statistical performance of different ML models across various numbers of utilized features is depicted in Table 2. From these results, it appears that an LR or GPR model using all three spectral features from all four FBGs can precisely discriminate between strain and temperature in a single sensor.

Table 2 Assessment of strain prediction performance by multi-arrayed FBG sensors using various features and ML models

4.2 Concrete bridge test with FBG sensors

In this section, the accuracy of the proposed approach to compensate for temperature perturbations is investigated through the application of FBG sensors for monitoring a post-tensioned reinforced concrete footbridge. FBG sensors were integrated into a footbridge with two spans, measuring a total length of 17.9 m. A total of 16 arrays of FBG sensors, each comprising four individual strain sensors, were embedded into the footbridge at 1-m intervals. These FBG strain sensors, organized into sets A and B, have a spatial resolution of 6.2mm and a strain resolution of 2µε. Attachment points for these sensors were the longitudinal rebar, positioned both at the bottom and top of the concrete slab. The footbridge also included temperature sensors (array C) spaced every 5 m along the top and bottom rebar to track temperature changes. Figure 11 illustrates the installation of the FBG strain and temperature sensors in the footbridge, covering layout planning, embedment, and the implementation of an advanced data collection system. For more information about the bridge and the sensing and interrogation system, readers are referred to [56]. The Micron Optics si255 interrogator was used for data acquisition and initial processing, while on-site analysis of sensor-collected data was performed using the ENLIGHT software on a local computer connected to the unit.

Fig. 11
figure 11

FBG strain and temperature sensors installation process in the footbridge. a Layout planning for FBG sensor installation; b FBG embedding inside the footbridge structure; c Data collection and interrogation system implementation

The si255 is an industrial-grade optical interrogator, providing reliable and precise measurements for nearly 1000 sensors distributed across 16 parallel channels. The interrogator unit operates independently with an integrated PC and software, ensuring accurate dynamic and absolute measurements of FBG sensors through optical spectrum analysis. It features a range of (1500−1600) nm with wavelength repeatability of 0.3 pm at 1 Hz. To monitor the loading effects on the overall structure, a total of 72 FBG sensors, comprising 64 strain sensors and 8 temperature sensors, were installed into the footbridge.

As detailed in Sect. 2.1, optimizing the ML model requires the integration of additional features, such as change of reflectivity and FWHM, including spectrum wavelength changes. Moreover, achieving accurate predictions requires a substantial dataset encompassing a wide spectrum of temperature and strain variations. A total of eight sensors were strategically selected to capture spectral information under varying temperature and strain conditions, yielding a comprehensive dataset. The data collection spanned from August 2020 (the time of FBG embedment in the bridge) to the present, emphasizing the need for a diverse range of temperature variations to effectively compensate for temperature perturbations through the ML model. We began by collecting diverse sets of spectrum data captured by the FBG sensors embedded within the footbridge. These sensors continuously record data reflecting various environmental conditions (temperature and strain) experienced by the structure. To facilitate a comprehensive analysis, we divided these datasets into two groups for comparative purposes. The first group comprised smaller datasets, each containing around 6000 data points. These datasets were characterized by relatively minor fluctuations in temperature across the footbridge. By selecting datasets with smaller temperature variations, we aimed to create a subset that could serve as a baseline for comparison, allowing us to discern subtle changes or patterns in the sensor data. As shown in Fig. 12, the current temperature variations are confined within the range of \(2-9^\circ{\rm C}\), attributed to the concrete bridge’s location inside a temperature-controlled building, with all sensors embedded within the concrete structure.

Fig. 12
figure 12

Temperature variation data collected from four FBG temperature sensors at different positions on the concrete bridge. Following sensors data are collected (see. Figure 10 a): a FBG-2B; b FBG-7B; c FBG-12B; d FBG-17B

In this study, the data obtained from the concrete bridge consist of only one feature, (λBG), which we derived from the optical spectrum analysis. This limited feature set posed a challenge for ML models aiming to predict strain while compensating for temperature perturbations, as discussed in Sect. 2.1. This limitation restricted the information available for the ML models to effectively distinguish between variations in temperature and strain within the sensor data. As a result, the predictive capabilities of the models may be hindered, potentially impacting the accuracy of strain predictions, particularly in scenarios with significant temperature fluctuations. To address this limitation, the second group consisted of larger datasets, encompassing approximately 86,000 data points each, and we utilized data acquired during the bridge’s postconstruction period, where a broader temperature range of up to \(23^\circ{\rm C}\) (ranging from \(20\) to \(43.5^\circ{\rm C}\)) was observed. This division into smaller and larger datasets with varying temperature variations enabled us to conduct a more detailed analysis of the FBG sensor data. Figure 13 provides a visual representation of the temperature dataset obtained from four distinct temperature sensors strategically positioned at different locations across the footbridge, illustrating the temperature variations experienced throughout the structure. The positions of these selected temperature sensors, along with the strain sensors, are clearly delineated in Fig. 11 for reference.

Fig. 13
figure 13

Measured temperature and corresponding wavelength shift of FBG-based temperature (TFBG) sensors embedded in two different positions on the concrete bridge a Comparative analysis of temperature variations recorded by multiple sensors along the footbridge, illustrating the maximum distance between the sensors. Measured temperature and corresponding wavelength shift of FBG-based temperature (TFBG) sensors embedded at b 2 m (TFBG − 2B) and c 17 m (TFBG − 17B) position on the footbridge. (See Fig. 11a for details)

Furthermore, Fig 13b and c exhibits the spectrum response and corresponding wavelength shift resulting from temperature changes detected by sensors positioned at the 2m and 17m locations along the footbridge, respectively. It is noteworthy that the temperature sensors embedded within the footbridge are designed to be strain free, offering a linear response to temperature fluctuations. However, a minor nonlinearity is noticeable, particularly in the higher temperature range of each sensor’s response, which can be attributed to noise perturbations caused by systematic hysteresis inherent to the sensor mechanism. The linear fit is used to demonstrate the true linear response of the FBG spectrum to temperature changes. It also suggests that the larger dataset with a higher temperature range shows the actual behavior of the FBG spectrum’s response.

Similarly, Fig. 14a and b illustrates the spectrum response and corresponding wavelength shift resulting from varying applied strain detected by sensors located at the 2 m and 17 m positions along the footbridge, respectively. These strain sensors are influenced by temperature effects, as evidenced by the nonlinear nature of the wavelength change (depicted in red). Even with attempted linear fitting (illustrated in blue), achieving a completely linear response proves challenging. Since the FBG sensors were placed at different positions, they experienced varying temperature effects. It is clearly shown in the figures that for FBG-2B, the residuals of the wavelength shift were negative for \(600\mu \varepsilon -700 \mu \varepsilon\) and positive beyond \(700 \mu \varepsilon\), indicating the effects of temperature rise and reduction at that time, respectively. Similar patterns were observed for the FBG-17B sensor and its spectrum response. Furthermore, analyzing the residuals of wavelength change under applied strain confirms temperature effects, as the wavelength change is not linear. This observation highlights the complexity of isolating strain-related data from the influence of temperature variations on the sensors’ measurements.

Fig. 14
figure 14

Measured spectrum response and corresponding wavelength shift of two FBG sensors placed at different positions. a FBG-2B is embedded at the 2 m position and b FBG-17B is embedded at the 17 m position of the bridge structure

Figure 15 a and b represents the outcome of strain prediction using the proposed LR model, considering both smaller and larger temperature variations. This exploration utilizes LR-ML models, focusing on single-feature analysis. The dataset employed in this analysis is relatively smaller and exhibits limited temperature variations. Despite these constraints, the observed RMSE is reported to be 30.2µε, indicating the model’s performance under these specific conditions. However, a significant enhancement in predictive accuracy is observed when a larger dataset spanning a more extended period is utilized. This expanded dataset incorporates a wider range of temperature variations, providing the model with richer and more diverse data to learn from. As depicted in Fig. 15, the RMSE improves notably to 12.2µε under these conditions. This improvement underscores the importance of leveraging extensive datasets with diverse temperature profiles for training ML models, as it enables them to capture a more comprehensive understanding of the system dynamics and enhance their predictive capabilities significantly.

Fig. 15
figure 15

Exploring strain prediction by utilising the FBG sensors data from the footbridge with a single feature analysis. a Small temperature variation (6000 data points), and b large temperature variation (86,000 data points)

5 Discussion

Based on the detailed statistical analysis summarized in Table 2, it is evident that when predicting load by compensating the temperature perturbations for varying numbers of dataset features, the LR and GPR models consistently outperformed other models across all measured evaluation metrics. Significantly, both the LR and GPR exhibited the lowest MAE, and RMSE, underscoring the ML’s ability to generate baseline strain datasets with greater precision and consistency compared to the alternative methods explored in the study. It is important to mention that the effect of selecting different features also has a significant effect on the compensation of temperature perturbations. For example, when we utilized only one BG and only one feature which was the change of wavelength similar to the conventional FBG sensing system, all measured statistical metrics showed higher values. This indicates that the applied ML techniques were unable to compensate for the temperature perturbations from the load measurements. Similarly, if we increased the features for a single FBG system, the performance metrics showed poor performance for the applied ML models. However, notably improved accuracy was obtained for the LR and GPR model when we used all the features from four different FBGs that were inscribed into our designed FBG system. Conceptually, this is due to the fact that the number of features from different BGs, which have distinct Bragg wavelengths, can create a better map to understand the behavior of temperature and loading effect more effectively. Also, we have observed that the loading effect on the change in the spectrum’s bandwidth is more prominent than the temperature effects. On the other hand, the tree ensemble model performed the worst according to all the statistical measures we considered. This suggests that the algorithm used in the tree ensemble model had difficulty to generalize the behavior between strain and temperature on different features. Notably, the performance metrics of both LR and GPR models exhibited remarkable similarity. The LR model constructs a linear relationship between the input data and the predicted outcome, whereas the GPR model treats the outcome variable as a smooth, continuous function of the input data. The proposed multi-arrayed FBG sensing system likely provides both models with more spectrum information (features) and data inputs, establishing a well-defined linear relationship between the load and temperature variations with the features. Furthermore, the LR algorithm typically offers a more straightforward model and is easier to interpret compared to GPR. Therefore, if interpretability holds significant value, LR might be the preferred choice. Installing the novel multi-arrayed FBG sensor inside the concrete bridge was beyond our scope, as the bridge has already been constructed. To compare the performance of the novel multi-arrayed FBG sensor with the installed sensors in the bridge, we used two datasets: a smaller dataset of 6000 samples with one feature (wavelength) and a larger dataset of 86,000 samples with one feature (wavelength). The smaller dataset mimics a multi-arrayed FBG sensor with three features (wavelength, FWHM, and reflectivity). The results, presented in Figs. 15 (a) and (b), demonstrate that the best-performing ML model (i.e., LR) achieves similar performance when trained on the smaller dataset with three features (novel multi-arrayed FBG sensor) compared to the larger dataset with one feature (existing bridge FBG sensors).

To ensure the effectiveness of our proposed ML model, rigorous verification was crucial. Initially, a relatively smaller dataset is employed, which exhibits limited temperature variations. This constraint implies that the dataset encompasses a restricted range of temperature values, as shown in Fig. 12. Our developed ML model underwent training using various temperature fluctuations ranging from 22.2 to 50.5 ℃. Consequently, it becomes evident that the model’s accuracy would naturally be compromised when applied to a narrower temperature range for training the model with a sensing system, such as the dataset collected from the footbridge with variations between 20.3 and 27.4 ℃. However, a significant improvement in predictive accuracy is observed when transitioning to a larger dataset spanning an extended period and incorporating a wider range of temperature variations. This expanded dataset provides the model with richer and more diverse data to learn from, enabling it to capture a more comprehensive understanding of the system dynamics.

6 Conclusions

In summary, we have introduced and showcased the application of a solitary FBG sensor for SHM by utilizing ML to compensate for temperature influences, alongside developing and producing a multi-arrayed FBG sensor. The preliminary research phase focused on the systematic design and fabrication of an FBG sensor, featuring four series of gratings with unique Bragg wavelengths. This design facilitated effective surveillance of concrete structures within controlled laboratory settings. Subsequently, in the ensuing research phase, ML algorithms were employed to discern and separate the effects of temperature from strain variations. This dual-phase approach aimed to enhance the understanding and functionality of the FBG sensor for SHM applications in real-world scenarios. We collected the data from a post-tensioned bridge equipped with temperature and strain FBG sensors for real-world scenarios. Our ML model, trained on datasets encompassing a wide range of temperature variations, demonstrated varying degrees of accuracy depending on the dataset size and temperature range. We used the collected spectrum data for lower and higher temperature variation ranges to observe the developed ML model’s performance. The performance of the predicted result from different models was analyzed through different statistical approaches, including RMSE, MAE, and coefficient of determination \(\left({R}^{2}\right)\) values for temperature and strain measurements. The results indicate that the method's effectiveness could be further enhanced by incorporating multiple features extracted from the FBG spectral response. We have trained and validated various ML models, such as LR, SVM, GPR, and TE, to determine optimal performance, evaluating their effectiveness through different statistical approaches. Feature points extracted from the FBG reflection spectrum of the FBG sensor, including the displacement of Bragg wavelengths, FWHM, and reflectivity power, were employed for ML analysis. This research outcome demonstrates the feasibility of achieving temperature-independent sensing using a single FBG sensor, streamlining the interrogation system’s design and reducing hardware costs.

In our study on the effectiveness of the ML model for SHM, several limitations emerged despite the promising results. The generalizability of our model beyond the specific conditions and parameters of our study may be limited. Factors such as sensor types (e.g., one BG or multiple BGs) and structural characteristics could significantly influence the model’s performance in different settings. In addition to the limitations, it is important to highlight the importance of utilizing a high-resolution interrogator system for extracting information from FBG spectra, particularly focusing on the change of FWHM. It should be reinforced that the benefits of using structural health monitoring in new and existing infrastructure are that it will enable structures to be much better utilized and efficiently maintained. This will potentially reduce the embodied carbon of infrastructure by extending the life of existing infrastructure, optimizing new infrastructure and addressing global efforts to achieve Net-Zero.