Introduction

Carbon steel remains the most commonly used material in infrastructure, transportation, energy and other industries due to its low cost and good mechanical strength1,2,3. The durability of exposed steel structures is mainly impacted by atmospheric corrosion. Thus, the exposed atmospheric corrosion of carbon steel has been a critical topic for decades4,5,6. Field in situ testing and data collection is of great significance7,8,9. Nevertheless, the corrosion performance of steel structure in exposed environment is mostly studied by using corrosion coupons that usually generate data once a year and it is hard to make accurate assessments based on the discontinuous data collected this way. A rapid and accurate evaluation of the corrosion performance of carbon steel in exposed outdoor environments is essential in guiding the material selection and engineering design for better corrosion protection.

Various atmospheric corrosion monitoring (ACM) technologies have been exerted to characterize the corrosion performance of metallic materials. Electrical resistance (ER) technique could be used to monitor corrosion rate, which measures the resistance of the metallic sensor then converts it to the thickness loss10,11. However, the sensitivity of ER to detect nm-scale thickness cannot be guaranteed, and the resistance affected by ambient temperature fluctuates further degrades the accuracy of the monitoring result12. Electrochemical impedance spectroscopy (EIS) monitoring technique measures the impedance of the comb-like electrodes of steel. By employing EIS and comb-like sensors, Thee et al. found that the rust promotes corrosion in the first five wet–dry cycles and inhibits in the next 15 cycles13. Nishikata et al. applied this technology on a bridge and established an exponential relationship between the impedance at 10 mHz and corrosion rate. However, the data used in their study were all over 0.5 year apart, making the conversion calculation during the initial stage of corrosion doubtful14. Quartz crystal microbalance (QCM) technology is in favor for monitoring corrosion behavior on the initial stage of corrosion due to its ability to detect ng-scale mass change15. For example, Kleber et al. found that SO2 has an obvious influence on the growth rate of the corrosion products on weathered silver surface in an ambient environment16. But QCM requires testing metals to be plated on the crystals, which limit the steel sample to be used for long-term monitoring.

Unlike the ACM technologies, Galvanic-cell-based ACM technology directly monitors the galvanic current of galvanic couple of the sensor, which consists of two electrodes with different electrochemical activities17. By monitoring the magnitude and variation tendency of the galvanic current, the corrosion behavior of anode metal or the corrosivity of atmosphere can be observed. Due to its higher sensitivity and better tolerance to temperature variation than ER, longer monitoring period than QCM, less requirements for the external polarization disturbance current than EIS, galvanic-cell-based ACM technology has great applicability in exposed atmospheric environments18,19,20. Mizuno et al. proved that Fe/Cu-type ACM sensor is very sensitive to the change of atmospheric corrosivity19. Shi et al. highlighted the impact of air quality index on the environmental corrosivity based on a Zn/Cu-type ACM sensor20. Our earlier analyses of Fe/Cu-type ACM data found that stronger corrosion occurred at night time or during rainfalls21. Nevertheless, few exposure tests in above studies lasted longer than 3 months. The acceleration effect of the galvanic corrosion and the conversion between the ACM current and natural corrosion rate in exposed atmospheric environments are still unknown, especially for long-period testing. Investigating these unknowns has great significance for better monitoring the characterization of corrosion properties of steel.

ACM technologies collect vast amounts of data that carry rich information about the interactions between the dynamic corrosion process and corrosive factors. The combination of multidimensional data and other environmental data brings challenges to analyze the relationship between single environmental factor and corrosion process22. In this case, machine learning may offer opportunities to better understand and predict atmospheric corrosion influenced by the complex environmental factors due to its powerful automated pattern search capability17,23,24,25. Random forest (RF) model, which has deeper layers than general machine learning models and may possess a better processing capacity for the data with high variability, could be a good candidate for the dynamic atmospheric corrosion processes26,27. After 16 years study by applying a RF model to rank the influences of multiple environmental factors, Zhi et al. found that the pH value of rainwater persisted as the most significant environmental factors28.

In this paper, the atmospheric corrosion of carbon steels was monitored using Fe/Cu-type ACM technology in the six different exposed atmospheric environments in China. After ~12 months testing, over three million ACM and mass loss data was collected. The galvanic acceleration effect was discussed and the conversion method between the instantaneous ACM current and actual real-time corrosion rate was defined. Finally, based on a multidimensional corrosion dataset (including corrosion rate, mass loss, temperature, relative humidity (RH), rainfall rate, wind speed, the deposition of chloride, particulates smaller than or equal to 2.5 microns (PM2.5) and 10 microns (PM10), SO2, and NO2), a RF model was built to predict the atmospheric corrosion of carbon steel under dynamic atmospheres and was employed to investigate the impacts of the corrosive factors.

Results and discussion

Corrosion monitoring by ACM sensors

Supplementary Fig. 1a–f shows the complete data sets of the instantaneous galvanic current output by the ACM sensors (IACM) after 1-year test. A notable phenomenon is that the values of IACM fluctuated a lot in every day at all six stations, indicating that a typical characteristic of atmospheric corrosion is that it is highly unstable compared to laboratory experiments. The alternative fluctuations from day to night correlate with the process of the formation and evaporation of thin liquid film.

By integrating IACM, ACM current collected in each minute, over the entire testing period according to Eq. (1), the corrosivity differences of the six atmospheres could be obtained by comparing the output power (QACM):21

$$Q_{\rm{ACM}} = {\sum} {I_{\rm{ACM}}} \times 1\,\min$$
(1)

The calculation results of QACM are shown in Fig. 1a. The missing data in the blank areas in Supplementary Fig. 1a–f, which were caused due to the power outage or ACM equipment failure, caused the calculation error of QACM, thus QACM needed to be adjusted by the average method based on Eq. (2):

$$Q_{\rm{{ACM - adjust}}} = Q_{\rm{{ACM}}} \times \frac{{t_{\rm{{test}}}}}{{t_{\rm{{monitor}}}}}$$
(2)

where QACM-adjust represents the electric quantity output of ACM sensors after adjusting; ttest is the total testing time; and tmonitor is the total working time of the ACM sensor. The calculated QACM-adjust is shown in Fig. 1b, from which it can be seen that the corrosivity at six sites are not consistent, especially at Qingdao and Sanya. Since Qingdao and Sanya have marine atmosphere, chloride might bring about the stronger corrosion during the later period. The corrosivity after 1-year exposure is in the order of Qingdao > Sanya > Hangzhou > Wuhan > Beijing > Tulufan.

Fig. 1: Real-time electric quantity output by ACM sensors during ~12-month exposure test at 6 sites.
figure 1

a Collected while ACM technology was working, b adjusted by average method.

The influence of galvanic effect

The mechanism of using ACM sensors to detect atmospheric corrosion is based on the principle of galvanic corrosion, which accelerates the corrosion process of anodes. This acceleration makes it doubtful to use ACM sensors as a replacement for long-term standard steel coupons.

The surface morphologies of the ACM sensors and standard coupons were shown in Supplementary Fig. 2. The color of the rust layers on ACM sensors and steel coupons were consistent at each site, and uniform corrosion morphologies could be observed. The acceleration effect did not alter the corrosion morphology from the macroscopic observation.

To further investigate the acceleration effect, it is necessary to use electrochemical process to determine whether ACM current supports both Fe to Fe2+ and Fe2+ to Fe3+ reactions. Supplementary Fig. 3 shows polarization curves of the galvanized system in deionized water with pH 5.4, which simulates the pollution-free atmosphere29. The results demonstrate that the corrosion potential in galvanized system was −0.30 V initially, and then decreased below −0.49 V as rust layer grew. The study of the conventional potential-pH diagram for Fe-H2O in previous study30 affirmed that the potential for the transformation of Fe2+ to Fe3+ is far above −0.3 V when the temperature is below 60 °C and pH value stays at 5.4, and the presence of chloride would not alter the thermodynamic parameters much. Therefore, it could conclude that in exposed environments, the corrosion potential is not conducive to the conversion of Fe2+ to Fe3+ directly on the ACM sensor, and the ACM current is generated by the Fe to Fe2+ reaction.

The acceleration effect was calculated based on Supplementary Fig. 3. The mass loss of galvanic-induced corrosion, mg(A) (g m−1), after 1-year testing was calculated using Eq. (3):

$$m_{g(A)} = \frac{{Q_{\rm{{ACM - adjust}}} \times A_{\rm{{Fe}}}}}{{2e \times 1N_A \times A}}$$
(3)

where AFe is the atomic weight of iron (55.845); 2e is the charge of 2 electrons (2 × 1.602 × 10−19 C) generated by a Fe atom to a Fe2+ ion; NA is Avogadro’s number (6.02 × 1023); and A is the total exposure area (21 × 1 × 7 mm2) of the carbon steel electrode on the sensor surface.

Meanwhile, in a galvanic corrosion system, the relationship amongst the natural corrosion mass loss of ungalvanized coupon (m), the natural corrosion mass loss of the galvanized steel on ACM sensor (m(A)) and mg(A) follow the rule in Eq. (4):

$$m_{(A)} < m < m_{(A)} + m_{g(A)}$$
(4)

Thus, the ratio of the acceleration effect on ACM sensor (ratiog) can be calculated based on Eq. (5):

$${\rm{ratio}}_g = \frac{{m_{(A)} + m_{g(A)} - m}}{m} < \frac{{m_{g(A)}}}{m}$$
(5)

Supplementary Table 1 shows the values of m measured in the test, mg(A) and ratiog obtained from Eqs. (3) and (5). The values of ratiog revealed that all the acceleration effect was less than 14.4%. Stronger corrosion cause more obvious acceleration effect. It can be concluded from these results that the galvanic effect did not change the corrosion status of carbon steel on ACM sensors greatly during the testing, while the strong galvanic effect of ACM sensor under a highly corrosive environment could cause the result not truly reflect the real corrosion situation in a yearly experiment.

ACM data interpretation

After discussing the influence of galvanic effect, Fig. 2 presents the correlation between m (g m−2) and the corresponding QACM-adjust (C). m was the mass loss of the standard corrosion coupons that were collected from the six sites after 1 month, 6 months and 12 months. The QACM-adjust was calculated based on the IACM, Eqs. (1) and (2). Despite the differences of the site environments and exposure periods, the mass loss correlated well with the electric quantity except for the data point circled in red that has the largest error in Fig. 2. The correlation equation could be fitted using Eq. (6):

$$m = 36.19 \times Q_{\rm{{ACM - adjust}}}^{0.73}$$
(6)
Fig. 2: The relationship between the mass loss of the corrosion coupons and the electric quantity output by the ACM sensors.
figure 2

Error bars are the experimental results of three sets of coupons during the same period.

The R2 value of 0.996 confirms a very good fitting. According to Eq. (6), when an ACM sensor is in a stable environment, the correlation will not be proportional for long-term testing. Based on the data from recent literatures18,19, a lot of efforts had been put in to make the correlation of ACM sensor more meaningful and there was no better replacement for it so far.

Taking the derivative with respect to time based on Eq. (6), the correlation between the instantaneous natural corrosion rate of carbon steel r (g m−2 a−1) and the instantaneous ACM current IACM (nA) can be described as:

$$r = 0.83 \times Q_{\rm{{ACM - adjust}}}^{ - 0.27} \times I_{\rm{{ACM}}}$$
(7)

According to Eq. (7) and assuming r as a constant, the increase of QACM-adjust will lead to the increase of IACM, which is due to the growth of rust layer that increases the electric conductivity of thin liquid film. Before the rust layer stops growing, QACM-adjust increases with the growth of the thickness of the rust layer, and the hygroscopicity will also be enhanced due to the porous structure of the rust layer. Higher hygroscopicity is conducive to the resistance reduction of the thin liquid film and facilitates the transmission of ions electrons produced by galvanic corrosion. Hence, the increased electric quantity of the ACM sensors would enhance the instantaneous ACM current. Thus, Eq. (7) has great significance, which gives the relationship between corrosion rate and instantaneous ACM current. Based on Eqs. (6) and (7), the ACM current data and electric quantity data in Supplementary Fig. 1 and Fig. 1 were analyzed. The instantaneous corrosion rate and mass loss calculated are shown in Fig. 3.

Fig. 3: Full instantaneous (analyzed by ACM) data during ~12-month exposure test at six sites.
figure 3

a Corrosion rate (analyzed by ACM) and b mass loss.

According to the classification in ISO 922331, the environmental corrosivity of six monitored sites was shown in Supplementary Fig. 4 based on the natural corrosion rate data from Fig. 2. By the visual observation in Supplementary Fig. 4, accurately evaluate the damage of carbon steel was difficult through simply classifying the environmental corrosivity. The corrosion rate in Hangzhou was 10 times larger than Tulufan, whereas they all belonged to C2 level.

In order to precisely characterize the environmental corrosivity, the minutely time distributions of corrosivity classification at six sites were counted based on the data in Fig. 3a, and the statistical results were shown in Fig. 4. Compare Supplementary Fig. 4 with Fig. 4, the macroscopic classification level of the environmental corrosivity in all sites was higher than the level with the longest distribution in microscopic time except Hangzhou (e.g., the macroscopic classification level in Sanya was C3 in Supplementary Fig. 4, meanwhile the level with the longest distribution in microscopic time was C2 in Fig. 4). In addition, each monitored environment covered C1 to CX level in the microscopic time during the monitoring period. Even Tulufan own 0.1% ratio of monitoring time in CX level. This phenomenon led to a new understanding of atmospheric corrosivity in exposed outdoor environments.

Fig. 4: The results of minutely time distributions of corrosivity classification at six sites.
figure 4

a Tulufan, b Beijing, c Wuhan, d Hangzhou, e Sanya, and f Qingdao.

For exploring the method which could precisely characterize the damage degree of carbon steel in atmospheric environments, the relationship between the natural corrosion rate and the time ratio of different corrosivity level was counted based on the data in Figs. 2 and 4. The results were shown in Supplementary Fig. 5. From Supplementary Fig. 5ad, the data performed irregular. However, a positive correlation trend was observed in Supplementary Fig. 5e, and this law was more obvious in Supplementary Fig. 5f. Therefore, the time proportion of CX level was able to effectively represent the macroscopic corrosivity, and it should be more accurate than the traditional corrosion classification method. This method of characterizing environmental corrosivity by counting the time ratio in CX level provides the possibility in shortening the evaluation period of environmental corrosivity.

Prediction of atmospheric corrosion by RF

Traditional methods to predict the corrosion rate of carbon steel generally follow ISO 9223-2012, which is based on annual corrosion data and is incapable to reflect the details of corrosion in dynamic atmospheres32,33. Machine learning models have powerful automated patterns searching capability, may accurately predict the atmospheric corrosion in dynamic environments.

In order to predict the atmospheric corrosion of carbon steels, multiple environmental factors were collected. Due to its typical atmosphere environment, Qingdao was selected for this purpose. The deposition of chloride ions was measured monthly using the dry plate method at Qingdao site and the results are shown in Fig. 5. In Supplementary Fig. 6, the complete environmental data that were involved in this study refers to corrosive factors, including the meteorological data (i.e., daily average temperature, RH, rainfall rate and wind speed) and the environmental pollutants data (i.e., SO2, NO2, PM2.5, PM10 and the cumulative deposition of chloride). In the modeling, the growth of rust layers were also considered as a corrosive factor, which were indirectly characterized by the mass loss in Fig. 3b. It is difficult to directly visualize the influences of all these corrosive factors on the atmospheric corrosion behavior of carbon steels by comparing the r variations in Fig. 3a.

Fig. 5: Monthly chloride deposition rate in Qingdao site during the exposure test.
figure 5

The cumulated deposition of chloride ions was integrated from the deposition rate.

In this study, a RF model was built to predict the instantaneous corrosion rate of carbon steels based on the corrosive factors mentioned above. To validate the performance of the models, the corrosion data samples were divided into the training part and testing part. In total, 90% of the entire dataset was randomly selected as the training part, and the rest 10% was used as the testing part to evaluate the predicting performance.

Figure 6 presents the fittings of both training and prediction results. The abscissa of each figure is the actual r value analyzed by ACM technology, while the ordinate represents the r value predicted based on the RF model. The red diagonal line represents the true-prediction line on which the predicted values equal to the corresponding actual values. The closer a point is to the red diagonal line, the smaller prediction error it has. Root mean square error (RMSE) and R2 were adopted to evaluate the performance of the established model28. Comparing the fitting results of training and prediction, there is not much difference between the values of RMSE. Both have high R2 values (å 0.9), and all the points are basically located close to the red line. So far, no fittings reported overperform this at any range for RF. Therefore, the new RF model established in the study can successfully predict the atmospheric corrosion of carbon steels in dynamic atmosphere with ten corrosive factors.

Fig. 6: The fitting results of atmospheric corrosion by the RF models in Qingdao.
figure 6

a Training part, b prediction part.

From the analysis in algorithm principle, the prediction process for RF model is based on the principles of statistics and averaging. The cover degree of data and the data size directly determine the accuracy of the RF model. Thus the RF model is incapable to extrapolate and predict in untrained data ranges, whereas the prediction results show high accuracy within the range of the trained data ranges. As for the atmospheric monitoring corrosion data, the minutely monitoring technique solves the problem of week cover degree of data and small data size. Therefore, the model performed well in this study.

The impacts of corrosive factors

The importance indexes of the corrosive factors were calculated by the RF model, and the results are shown in Fig. 7. The weight factors that affect r (corrosion rate) more than 5% are wind speed, mass loss, chloride, rainfall rate and RH. Unexpectedly, wind speed has significant influence on the corrosion rate in dynamic atmosphere. Kleber et al. reported that in static atmospheres, the thicknesses of thin liquid film on metallic surfaces were 3.7 and 4 nm when the RH reaches at 80% and 90%, respectively16. The maximum atmospheric corrosion of carbon steel requires a thin liquid film of 17-um thickness13. It can be inferred that thin liquid films in exposed atmospheres were influenced greatly by the variation of wind speed, thus wind speed has a significant effect on corrosion. As mentioned above, the RH of the atmospheres measured by the humidity sensors actually was the RH on the sensor surface. The variation tendency of wind speed and surface RH on the humidity sensor was shown in Fig. 8. This phenomenon confirmed that high wind speed accelerated the evaporation of the thin liquid film that was generated by the high RH and rainfall in exposed environment, thus slowed down the corrosion process. The rust layer also had an important impact. As the atmospheric corrosion progressed, the rust layer enhanced the roughness of metallic surface, and increased the hygroscopicity and decreased the critical RH of atmospheric corrosion34. An interesting phenomenon is that the effect of rainfall was almost the same as RH in the 1-year exposure test. Unlike dew or the nm-scale thin liquid film formed in high RH16, rainwater can provide required dynamic electrolyte environment for corrosion electrochemical reactions. Therefore, rainfall has a significant influence on corrosion. We have observed that rainfall had more influence on atmospheric corrosion than RH at the initial stage before21, and Zelinka et al. reported that rainfall was the climatic parameter that had the most significant impact on fasteners embedded in wood35. As the rust layer grows, the effect of rainfall is gradually diminished. The importance of the chloride is expected. That effect of chloride for promoting corrosion is well-known: hygroscopicity, penetrability, electroconductibility, and the formation of porous corrosion products with nearly no shielding effectiveness of corrosive factors36,37,38,39,40. Other parameters, i.e., daily average temperature, SO2, NO2, PM2.5, and PM10 were not very important. In exposed environment, the effect of temperature was always considered to be less important than RH40,41,42, because electrolytes are the necessary condition for corrosion. The pollutants are far less important than chloride, which may be explained by the low concentrations of pollutants at the Qingdao test site. The yearly average concentrations of SO2, NO2, PM2.5 and PM10 were only 6.8 µg m−3, 33.5 µg m−3, 42.7 µg m−3, and 76.8 µg m−3, respectively.

Fig. 7: Importance index of corrosive factors to atmospheric corrosion of carbon steel after 1-year exposure.
figure 7

Including mass loss, wind speed, rainfall rate, RH, chloride deposition, temperature, the concentrations of SO2, NO2, PM2.5 and PM10.

Fig. 8: The variation tendency of wind speed and surface relative humidity on the humidity sensor.
figure 8

High RH data obviously clustered in the area with low wind speed.

In order to study the role of the influential corrosive factors in corrosion process, the daily variation of weight indices of the corrosive factors with value greater than 5% (i.e., wind speed, mass loss, Cl-, rainfall rate and RH) was determined by the RF model and shown in Fig. 9. Notably, the initial importance of wind speed was much higher than others, and then diminished with the increase of exposure time. Contrariety to wind speed, the importance of mass loss was enhanced. As corrosion progresses, the substrate of carbon steel was slowly covered by rust layer, which decreased the direct impact of wind speed on electrochemical corrosion interface. Thus, the importance of rust layer and wind speed is almost negatively correlated as shown in Fig. 9. The effects of RH and rainfall on atmospheric corrosion are not consistent in different corrosion stages. At the initial stage of corrosion, rainfall had a greater influence, because the rust layer didn’t have the shielding effect on rainfall and the rust layer didn’t have strong hygroscopicity to moisture21. However, it can be seen from Fig. 3b that the atmospheric corrosion increased sharply after June 2019 due to the arrival of summer. Compared with Fig. 9, the influence of RH increased and that of rainfall decreased during this period. The accumulated effect of the rainfall and HR in rust layers on the corrosion process is similar during one year of exposure. As the corrosion progressed, the importance of RH was enhanced further. The importance of chloride had a similar trend as mass loss, which increased as the time extended. The rust layer is the carrier of chloride. Chloride accumulated in the rust layers and promoted corrosion, which played an more important role especially in long-term exposure43,44,45,46.

Fig. 9: Daily variation of the importance index to atmospheric corrosion of carbon steel.
figure 9

Including RH, mass loss, chloride deposition, the wind speed and rainfall rate.

The atmospheric corrosion of carbon steel was monitored over 12 months at six different locations, each with different atmospheres, via Fe/Cu-type galvanic ACM technology. The ACM current was collected continuously in every minute. The data analysis yields the following conclusion.

  1. (1)

    Due to the effect of the seasonal climate and other environmental factors, the ranks of the corrosivity in six exposed atmospheric environments were different in the 1st month, 6th month, and 12th month. When evaluating the exposed environmental corrosivity, it is necessary to take a whole year as the evaluating period.

  2. (2)

    The galvanic acceleration effect on ACM sensors was less than 14.4% in the most corrosive atmosphere during the test. The stronger the corrosion was, more obvious acceleration effect would be observed. The electric quantity output by ACM sensors correlated well with the corrosion mass loss obtained via standard steel coupons. The relationship amongst the corrosion rate (r, g m−2 a−1), ACM current (IACM, nA) and electric quantity (Q, C) can be described as:

    $$r = 0.83 \times Q^{ - 0.27} \times I_{\rm{ACM}}$$
    (8)
  3. (3)

    The exposed atmospheric environmental corrosivity was highly dynamic, and each monitored environment covered the C1 to CX level, in finite time periods, within the overall monitoring duration. The macroscopic classification level of the environmental corrosivity in most monitoring sites was higher than the level with the longest distribution in microscopic time. Meanwhile, the time proportion of CX level was able to effectively represent the macroscopic corrosivity, and it should be more accurate than the traditional corrosion classification method.

  4. (4)

    A RF model was built to predict the atmospheric corrosion of carbon steel in a dynamic atmosphere under the influence of multiple meteorological factors, environmental pollutants and rust layer. Based on the analysis of algorithm principle, RF should be suitable for mining and modeling continuous corrosion monitoring data. As a result, the model performed well.

  5. (5)

    The corrosive factors of principal importance were rust layer, wind speed, rainfall rate, RH and chloride concentration. The effect of temperature was weak, and the effect of pollutants such as SO2, NO2, PM2.5 and PM10 were not the principal factors to the atmospheric corrosion because of their low concentrations at the Qingdao test site. The influence of wind speed on corrosion decreased and the effect of rust layer and chloride became more and more obvious as the exposure time extended. The effect of rainfall was similar to RH, and rainfall is an essential factor in predicting dynamic atmospheric corrosion.

Methods

ACM technology

As shown in Supplementary Fig. 7a, a typical Fe/Cu ACM sensor was assembled by seven pairs of galvanic couples. Each couple consists an anode made of carbon steels (0.47 wt% C, 0.18 wt% Si, 0.59 wt% Mn, 0.01 wt% S, 0.01 wt% P, 0.01 wt% Ni, 0.02 wt% Cr, 0.01 wt% Cu) and a cathode made of copper (>99.5% pure). Glass fiber-reinforced epoxy (FR4) boards with the thickness of 0.1 mm were inserted between every metal sheet to ensure no contact between the cathodes and anodes. The exposed area of the anodes is the same as that of cathodes (21 × 1 mm2). Then the assembly was filled with epoxy, and the surface was abraded using 1200# sandpaper. When a thin liquid film formed across the FR4 to connect the anodes and cathodes, a galvanic current would be provoked by the galvanic effect. The physical display of the ACM sensor was shown in Supplementary Fig. 7b. The galvanic current of the ACM sensor was detected by a micro-galvanometer with the model of Qianlang CM-200. The data collection frequency is once per minute. The resolution of the micro-galvanometer is 0.1 nA and the current value is in the range of 0.1 nA to 50 mA.

Field exposure test

The atmospheric corrosion tests were carried out at six standard exposure test sites of National Environmental Corrosion Platform, China (Supplementary Table 2)47. The ACM sensors together with the humidity and temperature sensors and five parallel standard corrosion coupons (100 × 50 × 5 mm3) of the same carbon steels were installed at each site. All the samples were at least 1 m above the ground and 45° to the south. It should be mentioned that the working principle of humidity sensors on the market is to directly measure the surface resistance of the humidity sensor, and then calibrate the relationship between the resistance and the actual atmospheric RH in the static environment of the manufacturing site, so that the measured resistance can reflect the atmospheric RH. Thus, the RH measured by the humidity sensors actually was the surface RH of the sensors.

The exposure tests started in August 2018 and ended in September 2019, lasting for ~12 months. The parallel standard coupons were collected after 1, 6, and 12 months, respectively. The average mass loss was calculated by the difference in the weight of the coupons after removing the corrosion products by scrubbing with a wire brush in 18 wt% hydrochloric acid solution, as specified in ISO 8407C.3.548.

In order to further investigate the impact of multiple environmental factors on atmospheric corrosion, chloride depositions were measured monthly using the dry plate method at Qingdao site according to ISO 922549. Meanwhile, the hourly rainfall rate, wind speed, the concentrations of SO2, NO2, PM2.5 and PM10 at the Qingdao and Wuhan sites were obtained from China Meteorological Administration.

Electrochemical testing

Potentiodynamic polarization tests were carried out in a traditional three-electrode system, where a platinum plate was used as auxiliary, a saturated calomel electrode (SCE) as the reference and the ACM sensor as the working electrode. All the electrochemical experiments were conducted in deionized water (pH 5.4), which is a simulation of pollution-free atmosphere31. After the open circuit potential was stabilized, the potentiodynamic polarization tests were performed on a CS350 electrochemical workstation from −1.0 to 0.1 V SCE with a scanning rate of 0.5 mV s−1.

Random forest model

The RF model used in this study was implemented with the machine learning library, Scikit-learn50. A suitable model was build using RF as an integrated learning method that combines several classification and regression tree (CART) models. Each CART is like a black box. It could auto split the input space to individual subspaces. The subspaces are adjacent but not intersecting. An example of a trained CART model is shown in Fig. 10a. Take a three-dimensional dataset as an example, temperature and RH are the inputs, and the galvanic current of the ACM sensor is as the output. The input space of the training samples is divided into several subspaces which are represented by different colors according to the CART learning. The average ACM current value of Area I is 1.78 nA. For a test sample with RH of 75% and temperature of 20 °C (red dot in Fig. 10a), the position is located in Area I and the ACM current value would be assigned to 1.78 nA. The training processes of different CART models adopted the same principle. The principle has been described in other literatures in detail28,51, it will not be provided here. The minimum number of samples in each leaf node for each CART was set as 2. Figure 10b illustrates the prediction process of the RF method which contains 100 CART trees. Daily average temperature, RH, rainfall rate, wind speed, the deposition of chloride, SO2, NO2, PM2.5 and PM10 and mass loss were taken as independent variables to make the prediction of instantaneous corrosion rate of ith CART model, ri (i = 1, 2, …, 100). The final prediction result of r is the integration of all the prediction values ri.

Fig. 10: An example of different model prediction process.
figure 10

a CART model, b RF model.

After finalizing the RF model, the out-of-bag (OOB) samples that were not used for training in each CART model can be used to rank the importance of all input variables28. For the ith CART model, the importance is mainly calculated by adding a disturbance to each independent variable of the OOB data and then calculating its variation amplitude from the predicted results. Then the importance of all CART models were averaged to quantify the importance of different independent variables in one RF model.