Open Access Article
Josef Tausendschön
*a,
Michael Poelzl
ab,
Nikola Petrovic
a,
Jason D. Williams
a and
Elisabeth Fink
a
aResearch Center Pharmaceutical Engineering GmbH, Inffeldgasse 13, Graz, 8010, Austria. E-mail: josef.tausendschoen@rcpe.at
bGraz Center for Machine Learning, Graz University of Technology, 8010, Graz, Austria
First published on 4th February 2026
A real-time monitoring and predictive modeling framework was developed to address electrode corrosion and process deviations in the single-step electrochemical synthesis of cortisone to adrenosterone. The approach combined inline Fourier-transform infrared (FT-IR) spectroscopy with partial least squares (PLS) modeling for rapid quantification of chemical species, alongside optical coherence tomography (OCT) for electrode surface monitoring. A novel OCT image analysis was introduced enabling efficient dynamic pixel-based quantification of electrode corrosion in real time. To complement this, machine learning-based time-series forecasting models, including convolutional neural networks (CNNs) and long short-term memory (LSTM) architectures, were optimized for long-term concentration forecast from real-time sensor data. The incorporation of domain-inspired additional features like the applied current value and the relative corrosion measure resulted in enhanced accuracy. To ensure chemical plausibility a concentration conservation constraint was employed. Despite challenges arising from fluctuations in FT-IR/PLS-derived concentration data and experimental variability, the combined monitoring–forecasting framework demonstrated robustness and predictive value. This work highlights the potential of integrating advanced sensing with machine learning-based predictive modeling for future predictive process control in electrochemical reactors.
However, applying electrochemical methods is not inherently sustainable, as environmentally harmful solvents or waste through sacrificial electrodes are problematic.6 Furthermore, scaling up the electrochemical processes developed at the lab scale to industrial settings is not straightforward,7 with much of the challenge stemming from reactor design, which must be informed by suitable reaction data to facilitate transfer between different scales. This work focuses on developing process data collection and predictive monitoring strategies at the laboratory scale, with specific emphasis on integrating corrosion data to address these challenges. This includes systems capable of monitoring reaction progress and identifying potential issues such as electrode corrosion, connectivity faults, or deviations from the expected process trajectory. Establishing such reliable monitoring systems, is a critical step toward enabling scalable and robust electrochemical synthesis.8
In the realm of pharmaceuticals, steroids and their derivatives play a crucial role as drug for anti-inflammatory, contraceptive, antibiotic or antihistamine treatments.9–16 Sommer et al.10 pioneered the electro-organic synthesis of C19 android steroids. The investigated reaction proceeds in a single step, is safe to perform, and is relatively inexpensive—making it a strong candidate for a model process for development and provides an opportunity to explore how corrosion-informed forecasting could improve process control.
In order to perform electrochemical process control, in-line or operando monitoring was established.17–22 Chemical species concentrations must be recorded rapidly to ensure fast detection and response to disturbances, therefore spectroscopic methods are preferred over chromatographic ones.23 For reactions involving complex molecules with multiple functional groups, such as adrenosterone and cortisone, spectroscopic monitoring is generally not straightforward, due to a large number of overlapping peaks. To facilitate rapid quantification, chemometric methods, such as partial least squares (PLS) modeling can be used to link spectroscopic data and chemical concentration. By calibrating a PLS model, the entire “fingerprint” of a molecule is considered, rather than signals arising from individual functional groups. Fourier transform infrared (FT-IR) spectroscopy is especially suitable for such an approach, due to the characteristic fingerprint for a particular molecule, albeit often with many overlapping signals.24
Degradation of the electrodes due to fouling and corrosion can hinder process efficiency. The study of fouling and corrosion processes is crucial for understanding their causes and dynamics, which can aid in mitigating these issues. This work hypothesizes that real-time incorporation of corrosion data into predictive models will improve their ability to capture process dynamics. Real-time monitoring of the electrode surface during electrolysis provides valuable insights by simultaneously acquiring electrolysis data and quantitative information about surface changes, allowing for the establishment of cause-and-effect relationships. Recently, optical coherence tomography (OCT) has emerged as an in situ monitoring technique for electrochemical processes.25 This technique enables the detection and quantification of critical challenges such as corrosion and fouling, which significantly impact the efficiency and commercial viability of electrochemical processes. These findings underscore the potential of OCT as a valuable tool for real-time analysis, offering insights into the conditions that lead to electrode degradation and enabling improved management of electrode performance in electrochemical applications.
In electrochemistry, thermodynamics and kinetics have a quantitative relationship,26 allowing mathematical models to predict the effects of change in a system, e.g., concentration or rate constant. By integrating mass transfer with the thermodynamics and kinetics of the reaction, it is possible to describe electrochemical systems in a rigorous manner. However, this generally leads to coupled systems of partial differential equations (PDEs), whose formulation, parametrization, and solution in a reactor context can be complex and computationally demanding, particularly when time-varying operating conditions are considered.26–29
For real-time applications, mathematically simpler alternatives such as ordinary differential equation (ODE) models or reduced-order models (ROMs) are often employed in electrochemical environments.30–32 Traditional ODE-based models are usually not applied in multivariate time-series forecasting across extended horizons when the system is subject to non-linear parameter drift (e.g., electrode corrosion) as this behavior is difficult to capture with fixed coefficients. ROMs, while computationally efficient, are commonly derived for specific system configurations and require significant effort to construct and re-validate when system inputs or operating regimes change. This limitation highlights the potential of flexible, data-driven approaches that can explicitly account for corrosion dynamics.
In this context, data-driven time-series models based on neural networks offer a flexible alternative. Such models can naturally incorporate multiple dynamic inputs, including applied current and corrosion-related variables, and can capture nonlinear, time-dependent behavior, aligning with the goal of real-time data processing and forecasting.
We propose that models incorporating corrosion data will better capture the time-dependent degradation of electrode performance. Time-series forecasting is a critical and rapidly evolving research area with significant implications for both academia and industry. Chandra et al.33 thoroughly analyzed univariate time-series for multi-step-ahead prediction using simple recurrent neural networks (RNNs), long short-term memory (LSTM) networks, bidirectional LSTM networks, encoder-decoder LSTM networks, and convolutional neural networks (CNNs). Similarly, Lim et al.34 reviewed attention-based35 models for univariate time-series. These findings for univariate time-series can in general be extended to multivariate time-series.36,37 However, optimal architecture varies depending on the specific time-series data. It is important to note that time-series data, such as weather patterns or consumer prices, which often underpin these studies, typically exhibit underlying seasonality and trends. In contrast, electrochemical reaction data, particularly when corrosion is a factor, requires models capable of handling non-stationary, nonlinear drift.
The application of neural networks to electrochemical reaction data began several decades ago,38 laying the foundation for more recent developments in time-series forecasting within this domain. Luo et al.8 developed an online predictive control system for an electrochemical reactor using an LSTM network to forecast the production rates of CO, C2H4, and H2 one step ahead. Similarly, Zhang et al.39 created a battery forecasting system employing Gaussian process machine learning models based on electrochemical impedance spectroscopy data. Davies et al.40 leveraged machine learning to predict future product formation from time-series data collected in situ from twelve sensors, employing models such as random forest, gradient boosting regression, and LSTM neural networks. Ji et al.41 treated steel corrosion, a process inherently involving electrochemical reactions, as a time-series prediction problem and proposed RNN models for time-variant corrosion rate forecasting. Furthermore, Chen et al.42 introduced a hybrid prediction model and benchmarked its performance against classical machine learning models for forecasting iron and silicon content from time-series data.
Although models for time-series forecasting in some specific systems have been developed, they cannot be directly applied to the present system. Transfer learning is also not suitable, as no large body of pre-existing data from similar electrochemical processes exists to support such an approach. In addition, flexible and adaptive process modeling require forecasts with variable input and output lengths, which exceeds the capabilities of some models. Therefore, this study aims to develop a process model for an electrochemical reactor. Specifically, we design a machine learning-based time-series forecasting model in which the applied current, the main process parameter, and corrosion measurements are directly incorporated.
The experiments utilize two different solvent ratios of acetonitrile to water, specifically 40
:
1 and 80
:
1 (MeCN
:
H2O). The mixture is then electrolyzed using a graphite anode and a stainless-steel cathode with defined current density at room temperature. To ensure that the process runs optimally, three different data sources are monitored (see Fig. 1a): (1) the power supply defining the voltage and current settings, (2) the online FT-IR measurement providing information about the chemical composition of the solution and (3) the OCT measurement, providing images of the electrode's surface.
However, optimal control of such processes typically results in a tradeoff between productivity, product yield and electrode condition: high applied current generally provides a fast reaction rate (high productivity) but can detrimentally affect reaction selectivity (lower product yield). Fouling or corrosion of the electrode can occur with high current,44 which reduces the process performance and can even cause irreversible damage, forcing a process-ending replacement. Furthermore, unnecessary waste is produced, and the production of new electrodes is energy intensive.
Real-time FT-IR analytics has been utilized by Sagmeister et al.24 for multistep synthesis among other applications. In this study we want to add the OCT measurements25 and aim to develop a neural network-based time-series forecasting model for the concentration of the reactant and the products. During the process, the model forecasts the reactant and product concentrations (and thus the product yield), based on real-time sensor data from an online FT-IR spectroscopy measurement (and a subsequent PSL regression model), the power supply and the corrosion measurement.
The reaction by-product, glycolic acid, is then proposed to decompose to CO2 and formaldehyde, which are lost from the system and not observed. Water is present in the system in excess, so can be ignored in rate equations. Furthermore, the cathodic reduction (2H+ → H2) is considered to occur freely, due to the availability of H+ in the reaction. The reactor is filled with 10 mL of the mixture, which contains 50 mM cortisone. Side products are formed by reaction of either cortisone or adrenosterone, thereby the mole balance is conserved. This means that one can assume that the sum of concentration of cortisone, adrenosterone and the side products remains at around 50 mM.
![]() | ||
| Fig. 2 (a) Representative FT-IR spectra over the process time in the desired range and (b) the second derivative of these spectra. | ||
![]() | ||
| Fig. 3 The chemical structure of the reactant and the product as well as the reaction conditions (adjusted from ref. 10). | ||
Offline measurements of the chemical composition are determined using high-performance liquid chromatography (HPLC). This method identifies the amounts of cortisone, adrenosterone, and any side products. These HPLC-derived concentrations are then tagged to the recorded FT-IR spectrum at that time point. A PLS model is then calibrated to correlate these HPLC measurements with the FT-IR spectra. The range considered in the FT-IR spectra was reduced to 850–2500 cm−1 (see Fig. 2), no baseline correction was applied and a second derivative (see Fig. 2b) was taken (to enhance the influence of small differences in the spectra and help distinguish shoulders of overlapping peaks). A rank of 9, 9 and 8 was taken for cortisone, adrenosterone and side products, respectively.
These model parameters are chosen for the ability of the resulting model to handle multicollinearity and to predict the concentrations of substances from new spectra accurately. As measures of accuracy and overfitting, the root mean squared error (RMSE) of calibration (RMSEC) and cross validation (RMSECV) were used. For the chosen model, RMSEC = 2.73 mM, 1.55 mM, 1.94 mM for cortisone, adrenosterone and side products, respectively. To demonstrate that the model was not overfitted, RMSECV = 4.11 mM, 3.13 mM, 3.05 mM for cortisone, adrenosterone and side products, respectively.
In this study a commercial 1D OCT system (OSeeT, Phyllon GmbH, Graz, Austria) was adapted to a 3D system. The 1D system employs a low-coherence light of wavelength of a range of 742–900 nm. The emitted light beam is further split into a reference and a sample measurement arm and the reflected light of the two compared to obtain a spectrum from which an image is reconstructed. The 1D system is a spectral-domain OCT system where the sample is moved in front of the sensor. By utilizing two galvo mirrors, the 1D OCT light beam can scan a stationary surface. Each horizontal movement of the mirrors results in a 2D scan across the surface of the electrode. Depending on the desired resolution the 2D images are then combined into a 3D depiction of the surface. The system can process one 3D scan of 2 GB, which resembles 512 2D scans, with each allocating 4 MB, per minute.
000 and 24
000 and that the signal to noise ratio was above 5000.
Two types of experiments were performed, constant current experiments and designed current path experiments. The selected values for the constant current experiments were 12.5, 25, 50, 75, 100 and 125 mA. For the designed paths see Part A in the SI. In the constant currents experiments HPLC samples were taken after each equivalent of electrons passed through the mixture, while in designed path experiments a HPLC sample taken after each change in the applied current.
The experiments were performed under constant mixing. The solutions were prepared by dissolving 180 mg of cortisone and 217 mg of supporting electrolyte in 10 mL of the solvent mixture in a 10 mL volumetric flask and then transferred into the electrolysis cell. For each performed experiment a new set of electrodes were used to avoid cross-contamination issues in the dataset produced. In total 40 experiments have been performed, for a comprehensive list and overview please see Part A of the SI.
In the next step, an adaptive thresholding operation is applied to account for variations in background illumination. The threshold value T is calculated for each individual image based on the mean pixel intensity (µ) of that image, defined as T = µ − 5. Pixels below this calculated value are set to 1 (white), and those above are set to 0 (black). The constant offset of 5 was selected based on pilot data to maximize the contrast between the electrode and the smoothed background noise.
Following this step, a parabola is fitted to the highlighted region using a least-squares approach, minimizing the sum of squared deviations between the measured OCT signal and the fitted curve. This fitted parabola serves as the reference for generating a dynamic mask that restricts subsequent processing to the region of interest. Specifically, the mask is defined by vertically offsetting the fitted parabola by ±20 pixels along the y-axis, thereby establishing upper and lower bounds around the estimated electrode surface. Pixels within this band are retained for further analysis, while pixels outside the mask are excluded.
The choice of the ±20-pixel vertical extent is based on a statistical analysis of parabola height variability across experiments and is summarized in the SI (see Table S5). For the initial, minimally corroded stages of each experiment, the observed parabola heights and their standard deviations remain well within this range, ensuring that the mask reliably captures all relevant structural information without truncation. Restricting the analysis to this region substantially reduces the computational load while preserving the features of interest.
A new mask is generated for each scan to compensate for potential lateral or axial shifts caused by sensor movement or changes in the observation angle, which could otherwise result in partial loss of the electrode region when using a static mask. Representative examples of the dynamically generated masks are shown in Fig. 5c and d. Recomputing the mask for every scan enhances robustness and stability of feature detection across the dataset.
After these pre-processing steps, only the surface of the electrode remains clearly identifiable in the images. As corrosion progresses, the captured surface of the electrode begins to become less pronounced in the images – possibly due to increased light scattering caused by changes in surface roughness in the corroded areas. This leads to a reduction in the intensity of light transmitted back to the OCT sensor, resulting in fewer pixels surpassing the empirically determined threshold mentioned previously. To quantify the level of corrosion, the number of pixels of high intensity per image is calculated. This value serves as a feature for assessing the degree of corrosion.
Over the course of the experiment, the image of the electrode captured by the OCT device gradually degrades or appears to vanish, as shown previously. Consequently, the number of remaining pixels per image after the pre-processing steps may serve as an indicator of corrosion. This information can be incorporated as an additional feature to improve the prediction of concentration values during training.
To enhance accuracy and incorporate chemical reasoning, we employ domain-inspired neural networks.49 A prevalent approach involves integrating a constraint into the cost function, derived from a domain-specific quantity. Hence, we add the relative conservation of concentration to the loss function. This constraint should ensure that the relative sum of the concentration remains at unity across all time steps (for details of the chemical reasoning see Section 2.1.1).
The optimal number of input and output steps in a sequence are searched within the hyperparameter optimization. Preprocessing the model input data involves normalization of the concentration of the reactant and the products based on the initial cortisone concentration in the solution. The concentration of cortisone at the beginning is equal to 50 mM in the solution. The applied current is also normalized by the maximum setting applied during any experiment (which is 125 mA).
The corrosion value extracted from each image, as presented in chapter 3, enhances the dataset by serving as a promising feature for improving concentration forecasting. To ensure comparability across experiments, the number of corrosion-related pixels per image is normalized using min–max normalization. The min value is set to 0, while the max value is searched in the training data. Fig. 6 illustrates the change in pixel count over six full scans of an experiment conducted at 100 mA. A decreasing trend in the number of pixels is observed across the scans, suggesting progressive corrosion or surface degradation.
![]() | ||
| Fig. 7 Schematic structure of the neural network types investigated. (a) shows the principle of CNN-type models, while (b) displays the principle of RNN-type models. | ||
In summary the model inputs are:
• [C]/[Sol]tot, [A]/[Sol]tot and [S]/[Sol]tot being the relative cortisone, adrenosterone and side product concentrations with input sequence length n.
• A/Amax the normalized applied current value, with input sequence length n for CNNs and at time t for RNNs.
• Srel the relative corrosion value, with input sequence length n for CNNs and at time t for RNNs.
The model output is always:
• [C]/[Sol]tot, [A]/[Sol]tot and [S]/[Sol]tot with output sequence length m.
Details about the architecture of each model type can be found in Part B of the SI.
During the process, the model is used to forecast the concentrations until the cortisone conversion is finished. The models operate in an autoregressive feedback loop, enabling them to predict concentrations until the end of the process at any given time. In contrast to CNNs, RNNs can be explicitly designed as autoregressive models.
This means that the model decomposes its predictions into individual time steps. Then, the model's output can be fed back to itself at each step and predictions can be made conditioned on the previous one. With this structure, models can be set up to produce output with a varying length.
To explore this capability, two different variants of the LSTM (RNN) network were examined: one for use in a feedback loop and another built in an autoregressive manner (AR-LSTM). The searched model and training parameters are summarized in Table 1. CNN-type models require some additional restrictions in terms of valid parameter combinations, e.g. the kernel size (i.e. the size of the window that slides over the time-series data to extract features) must be smaller than the number of input steps, which were integrated into the search.
| Model parameter | CNN | LSTM | AR-LSTM |
|---|---|---|---|
| Number of filters | 1–100 | — | — |
| Kernel size | 1–15 | — | — |
| Number of hidden nodes/units | 10–100 | 10–100 | 10–100 |
| Input sequence length | 5–15 | 5–15 | 5–15 |
| Output sequence length | 5–15 | 5–15 | 5–15 |
| Output activation function | “Linear”, “Sigmoid”, “ReLU” | “Linear”, “Sigmoid”, “ReLU” | “Linear”, “Sigmoid”, “ReLU” |
| Training parameter | Options |
|---|---|
| Batch size | 10–40 |
| Epochs | 5–40 |
| Learning rate | 1 × 10−5–1 × 10−1 |
To ensure effective optimization the optuna framework52 (version 3.5.0) was employed. Each model option was subjected to 1000 trials, and less promising parameter combinations were terminated early using the basic pruner class. Optuna's multi-objective optimization capability was utilized to minimize both sequence loss and long-term forecast error on the training and validation datasets. In addition to model parameters, training parameters were also optimized. Model implementation was carried out in TensorFlow (version 2.10.0). To prevent overfitting, early stopping with a patience value of one was applied in all training runs. The Adam53 optimizer (with default settings except for the learning rate) was used as the standard optimization algorithm.
As basis of the cost function for model training, the mean squared error (MSE) was selected. In addition to the data loss, a domain-inspired constraint was added to ensure that the sum of concentrations remains constant (for details see Chapter 2.1.1). An example of the input, target and predicted sequence can be seen in Fig. 8.
![]() | ||
| Fig. 8 Example of a sequence for one concentration. The top panel shows the linear trend baseline, while the bottom displays the pattern-based baseline. | ||
The data loss is then shown in eqn (1):
![]() | (1) |
![]() | (2) |
The combined loss is then simply the sum (see eqn (3)):
| MSEcomb = λdata MSEdata + λconc MSEconc | (3) |
![]() | (4) |
The predicted concentrations in Fig. 9 also show prediction boundaries. These boundaries reflect the model's average error dependent on the number of forecasted time steps. These boundaries are calculated on the test dataset, in the following way: a long-term forecast is made as shown in Fig. 9, then the RMSE over all test sequences for each forecast step is calculated. The boundaries are then plotted by adding and subtracting the RMSE per forecast step to the actual forecast.
Next to the mean squared error of the sequence and of the long-term forecast we introduce the rolling window analysis to quantify the reliability of the models. If a model is used to regularly update the forecast in an ongoing process, multiple predictions at the same time can occur. The change of the input sequence will lead to a different output sequence, even for prediction at the same time in the output sequence. Predictions of a reliable and robust model will be within a small range, while predictions of an unreliable model will deviate significantly.
To quantify the reliability, the mean value of each rolling window standard deviation is calculated. The rolling window standard deviation is calculated for each experiment in the test dataset (for details see Part B of the SI).
The development of the model, as well as the accuracy it can achieve, is significantly dependent on the amount and quality of the data available. The chemical concentrations derived from the PLS model exhibit natural fluctuations inherent in FT-IR measurements, which are challenging to capture accurately with a time-series model, if capturing them is even wanted. These fluctuations are also evident in the chemical balance (see Fig. 10), presenting additional complexity. Such random fluctuations pose a substantial challenge to modeling efforts, inherently limiting the achievable accuracy. However, this represents only a snapshot of the evaluation. The long-term forecast error also resembles the most challenging scenario in the application: predicting the entire experiment from the first sequence alone. In real-world applications, forecasts are updated with every new measurement and further refined with each change in the applied current, providing more data to the model. This iterative updating process significantly enhances the model's predictive capability over time.
In the evaluation of model performance, two distinct setups were analyzed: one excluding the corrosion feature (Table 2) and one incorporating it (Table 3). In the absence of the corrosion feature, the AR-LSTM model outperformed the baseline, the CNN and the LSTM on the sequence. Specifically, the AR-LSTM model exhibited the lowest MSE and MAE for sequential data. For the long-term forecast the CNN achieved the lowest errors, with the LSTM and the AR-LSTM being close. Furthermore, it can be observed that the baseline models, which were assessed using 15 input and 9 output steps, corresponding to the mean values identified for other models, achieved sufficient results on the sequence. However, they exhibit significant limitations in forecasting accuracy and reliability. This outcome supports the hypothesis that a more sophisticated model is necessary for improved predictive performance. For all found model and training parameters see Part C of the SI.
| Metric | CNN | LSTM | AR-LSTM | Linear baseline | Pattern baseline |
|---|---|---|---|---|---|
| Sequence MSE | 1.323 × 10−3 | 9.645 × 10−4 | 7.763 × 10−4 | 1.538 × 10−3 | 3.416 × 10−3 |
| Sequence MAE | 2.724 × 10−2 | 2.218 × 10−2 | 2.009 × 10−2 | 2.804 × 10−2 | 4.376 × 10−2 |
| Forecast MSE | 3.405 × 10−3 | 4.462 × 10−3 | 4.409 × 10−3 | 2.633 × 10−1 | 2.408 × 10−2 |
| Forecast MAE | 4.759 × 10−2 | 5.300 × 10−2 | 5.324 × 10−2 | 3.842 × 10−1 | 1.251 × 10−1 |
| Reliability STD | 1.282 × 10−2 | 9.536 × 10−3 | 4.528 × 10−3 | 2.682 × 10−2 | 1.700 × 10−2 |
| Metric | CNN | LSTM | AR-LSTM |
|---|---|---|---|
| Sequence MSE | 1.179 × 10−3 | 9.591 × 10−4 | 8.095 × 10−4 |
| Sequence MAE | 2.510 × 10−2 | 2.259 × 10−2 | 2.002 × 10−2 |
| Forecast MSE | 3.463 × 10−3 | 5.161 × 10−3 | 3.736 × 10−3 |
| Forecast MAE | 4.762 × 10−2 | 5.692 × 10−2 | 4.879 × 10−2 |
| Reliability STD | 1.332 × 10−2 | 9.902 × 10−3 | 3.535 × 10−3 |
Regarding reliability, the AR-LSTM performs significantly better than all others. However, one must consider that the reliability value is significantly influenced by the output sequence length. Specifically, the significantly smaller reliability STDs of 4.528 × 10−3 (Table 2) and 3.535 × 10−3 (Table 3), without and with the corrosion feature, respectively, confirm that the AR-LSTM architecture is advantageous in terms of reliability over the other architectures.
Upon the inclusion of the corrosion feature, a notable improvement was observed in the sequence metrics for the CNN model, while the forecast metrics and the reliability remained at the same level. For the basic LSTM no significant change can be observed on the sequence task, the forecasting error and the reliability deviation increased. For the AR-LSTM the sequence errors slightly increased, while the forecast errors and the reliability deviation decreased, which is still a positive effect for the usage in the process.
Overall, both the CNN and AR-LSTM models exhibit the lowest sequence and forecasting errors, demonstrating nearly equivalent accuracy. However, the AR-LSTM model shows significantly lower deviation in its predictions over time. The inclusion of the corrosion feature enhances the performance of the AR-LSTM, whereas it does not necessarily benefit the CNN. In summary, the AR-LSTM emerges as the superior model for the process application, with the corrosion feature further improving its accuracy. Despite the challenges, the developed model can be described as accurate and valuable to the overall process monitoring approach. Its ability to adapt and improve with continuous data input underscores its potential utility in dynamic and complex experimental settings.
The first step of the process monitoring strategy involves the processing of OCT images to quantify electrode corrosion. A preprocessing pipeline was introduced that can automatically and dynamically mask the area of interest on images of the electrode surface. This mask is recalculated for each scan and allows for the correlation of the number of visible pixels with the corrosion of the electrode surface. This novel method of dynamic mask generation and pixel quantification offers a robust and computationally efficient approach to monitoring electrode corrosion in real-time, representing a significant advancement.
In the second step, the paper introduces a machine learning-based time-series forecasting model that incorporates real-time sensor data, including applied current and (optionally) corrosion measurements, to predict reactant and product concentrations. Various neural network architectures, such CNNs and LSTMs, were optimized and evaluated for their forecasting capabilities. In addition to the corrosion detection itself, it was assessed whether an incorporation of the relative corrosion value into the forecasting model is beneficial. The models were evaluated on the sequence as well as on long-term forecasts. To enhance accuracy and integrate chemical reasoning, domain-inspired neural networks were employed. These networks incorporate a concentration conservation constraint into the loss function, ensuring the relative sum of concentrations remains constant over time.
The accuracy and development of the model are significantly influenced by the quantity and quality of the data. Inherent fluctuations in FT-IR measurements and deviations introduced by PLS modeling when converting spectra to actual concentration values, present challenges that limit the precision and achievable accuracy of the time-series model. Despite these challenges, the identified models prove to be accurate and valuable for the overall process monitoring and prediction strategy. The consideration of the corrosion feature was found to be beneficial for long-term forecasts.
Overall, the paper underscores the potential of integrating real-time monitoring with machine learning to develop robust and scalable electrochemical processes. This integration paves the way for more sustainable and efficient pharmaceutical production. In future applications, the developed model and corrosion detection system can be utilized as a framework for predictive process control. This optimization involves balancing productivity and electrode condition by automatically adjusting the applied current.
| This journal is © The Royal Society of Chemistry 2026 |