S. S. Agrawal, Offsite Management Systems, Houston, Texas
Fuel blending is a vital process in the downstream refining industry, as 80%–85% of end-user refinery products are made by blending processes in offsite operations. Refineries lose $25 MM/yr–$40 MM/yr due to inefficient and non-optimized blend recipes’ poor quality control.
Refineries employ planning and real-time control systems to improve the marginality of the blending process. These systems are supposed to keep blend qualities on-spec while minimizing the quality giveaways and utilizing the available components to produce the desired quantity of the product at the lowest cost. Both planning and control systems rely on blend models, which predict the blend’s properties based on the blended components’ properties and their ratios in the blend. Two methods are adopted to model the blend: the first-principle blend model (FPBM) and generalized blending equations.
The FPBM. The first predominant method uses the first principles of mathematical equations to model the blending process. This method requires an initial customization of model parameters and the continuous updating of model biases to correct the quality predictions online or offline by an experienced blend control engineer, and it must use historical data. Invariably, if not exercised diligently, this method results in a loss of tangible benefits for the refinery and diminished blend quality error control.
Generalized blending equations. Blending equations start with simple mixing rules of component ratios (e.g., X1, X2, X3...Xn) and their properties (e.g., Q1, Q2, Q3...Qn) to achieve the final M number of product quality, as shown in the equations in FIG. 1.
where:
i = Component
j = Quality
b = Blend product
m = Number of qualities
n = Number of components, also known as degree of freedom.
The above equation representation has the following concerns:
If n = m, it contains a unique set of component ratios called a deterministic set of equations.
If the n < m, an infeasible set of equations with no solution is created.
If the n > m, then there are an infinite number of solutions for the component ratios, and another constraint—called the objective function—must be imposed to secure an optimum solution for the component ratios.
The mixing rule may not be a simple linear multiplication of component ratios and component properties, as they may have complex interactions with other components’ ratios and their properties due to their nonlinear nature.
Inequalities and nonlinearity of blend models. The generalized FPBM (Eq. 1 in FIG. 1) is modified to convert inequalities to equalities by two slack variables for the giveaway and final target product quality violation, as shown in Eq. 2 in FIG. 1. The sign of variables G and V will depend on the inequality of the product quality—that is, either the minimum or maximum target value.
The qualities of component Qi,j may be a nonlinear function of ratios and properties of other components in the mixture. The nonlinearity of blending can be resolved in two manners: linearizing the component quality by transformation or using a combination of two terms—linear and nonlinear—as shown in Eqs. 3 and 4 in FIG. 1.
As mentioned in Eqs. 3 and 4, examples of qualities are Reid vapor pressure (RVP) and the ethyl equation of octane. More discussion of this aspect is outside the scope of this article.
Customization of blend models by data regression. Blend models for various qualities have complex equations with a generic set of parameters. Each refinery’s model parameters should be customized depending on the process conditions and component qualities. It may be acceptable to start with published generic blend model parameters. Still, these parameters must be customized for any refinery by regressing the historical data to predict the blend qualities more accurately.
FIG. 2 shows an example of regressing parameters for RVP using the blended historical data. The generic parameter for the RVP model is 1.75, but the customized value is regressed to 1.2241. The effect of the regressed parameter is reflected in the RVP giveaway values, as also shown in FIG. 2. The predicted value of the blend RVP is switched from violation to giveaway due to the regressed value of the RVP model exponent.
Estimation of model correction term (bias). Unfortunately, there are many unaccounted errors in the fuel blending process, and they can be neither measured nor estimated—these errors are shown in FIG. 3. Hence, the FPBM combines these unknown sources of errors in a lumped term called bias. These biases can be further divided into four sub-parameters to estimate, as they originate from different sources.
The lumped bias and its contributing terms are shown in FIG. 4, as well as how the four contributing parameters are estimated from analyzers, lab analysis, and errors in predicted qualities at the blend header and the final blend tank.
Since nearly all known and unknown sources of errors inherent in the FPBM have been taken care of, the next step is optimizing the blend recipe.
Optimization of the recipe. As discussed, the blending set of equations is non-deterministic, meaning there are many possible solutions for the problem for the same constraints. The final solution selection can be narrowed by importing another constraint called an “objective function” to optimize the recipe for either minimum quality giveaway or maximum profit. Sometimes, both can be used in the same constraint by assigning different weights. FIG. 5 shows the set of multiple solutions and additional objective function constraints to find the optimum blend recipes.
The objective functions can have many additional terms, as Diagram 1 in FIG. 6 shows. The next step is to solve this nonlinear set of equations. Typically, a linear set of equations can be solved by linear programming for the optimal solution. However, the nonlinear equations can be solved by successive linear programming or a nonlinear optimizer, as shown in Diagram 2 of FIG. 6.
Care must be taken with the optimal solutions obtained from the optimizer, as they can mislead to a local optimum instead of a global one, as shown in Diagram 3 of FIG. 6. However, there are techniques to rule out local optimum solutions.
Despite the author’s efforts to account for and estimate all sources of errors, some errors remain between predicted qualities and measured blend qualities. The backcasting step shown in Diagram 4 of FIG. 6 must estimate these residual errors.
Use of backcasting to update models. Backcasting is used to calculate the blend quality from the optimized recipe, component qualities and all updated blend models with regressed parameters. The difference between the calculated blend quality and the final measured tank quality further corrects the prediction of blend qualities. Diagram 1 in FIG. 7 shows the diminishing value of the bias term as nonlinear blend models are used, and all known and estimable sources of errors are corrected, as previously discussed. Diagram 2 in FIG. 7 summarizes the information flow of the FPBM.
Residual errors in the blend quality prediction. At this point, it could be assumed we have everything possible to predict the final blend qualities by nonlinear models, updated model parameters and bias. Unfortunately, dynamic changes in process conditions, uncertainty in flow and quality measurements, and analyzer dynamics leave a 1%–2% residual error. This small error can reduce the tangible benefits of the blend control and optimization system. For example, a 0.1-octane giveaway would cost a 100,000-bpd refinery $1 MM/yr in tangible benefits.
The role of artificial intelligence (AI)-based machine-learning (ML). The lack of perfection in the FPBM led to the exploration of an AI-based ML model to minimize the 1%–2% residual error for improved precision of blend qualities. AI-based ML is not a replacement for the FPBM, but rather an add-on to squeeze that extra drop out of a barrel to boost profitability by decreasing the quality of giveaways.
Another side benefit of AI/ML combined with the hybrid model is an analyzer-less fuel blending system to predict blend header qualities and final tank qualities. Analyzer-less fuel blending is the next technological marvel due to poorly maintained, modeled or used online analyzers. Online analyzers, even if properly installed, maintained and modeled, are used only for monitoring purposes and not to optimize the recipe, which is the sole purpose of a fuel blending system.
Objective. Typically, in the three-tier architecture of a blend control system, there are three modules:
Offline optimizer and planning
Online control and optimization
Regulatory blend control (RBC) with distinct roles and functionalities.
The refinery planner optimizes the recipes using the same blend model utilized in online blend control. This optimum blend recipe from the offline optimizer is the initial recipe for the online blend control.
The recipe may not be optimized, as the planner may use linear models in an Excel-based tool. Therefore, there are two sources of blend recipe feedings for AI machine learning: optimum and non-optimum recipes.
The role of AI-based ML is to use 3 yr–5 yr of historical blend data to learn how the blend qualities are affected by varying the component ratios and the component properties without knowing the blend models like the FPBM. Conversely, the hybrid model uses the prediction based on the nonlinear models of blending component ratios and their qualities being modified due to interaction and nonlinearity.
Remember that the hybrid model is termed because it combines both linear and nonlinear models, whereas linear AI models use only linear quality models. The following discusses both approaches to demonstrate the benefits of hybrid, rather than linear, AI/ML models.
Input and output to AI models. The input to the AI/ML model comprises:
Optimum or non-optimum component ratios
Component properties measured by lab analysis for the blend
Blend product specifications for each grade
Final measured blend qualities (lab-measured or measured at the blend header and analyzed for the blend/tank)
Linear or nonlinear blend models
Prices of products, components, and relative penalties for quality giveaways and violations.
The output from the AI model comprises:
Back-calculated blend header qualities from the final tank analysis
Optimized component ratios to reach the target blend qualities
Final predicted blend tank qualities
Error bias between AI-predicted and measured values of blend qualities.
The AI model would require initial training using historical data, recommended for at least 3 yr–5 yr to capture all process changes due to crude switching and various product grades of blend batches. Without a well-trained and effectively programmed AI model using historical data, the success of the AI model add-on for the blend control system is less than desirable, as personnel are targeting minor 1%–2% corrections in the prediction of blend qualities.
The output of AI models would be stored in the database until confidence is built to download the recipes directly to the flow controller for live blending execution.
A case study of 750 gasoline blends from a 300,000-bpd U.S.-based refinery to develop an AI model for analyzer-less fuel blending is discussed here. This data set did not provide blend header qualities, as the refinery did not historize the blend header qualities. Therefore, the analysis involved only lab analysis of component qualities, component recipes and the lab’s final blend tank qualities. The case contains data for four gasoline grades from 87–92 octane. The author’s AI models did not differentiate gasoline grades.
Configuration of the analyzer-less blending system. The following are three configurations for the AI/ML hybrid analyzer-less blending systems:
The prediction of final product tank qualities. This configuration is the simplest and predicts the final tank qualities based on the final tank certification by lab analysis, component qualities and component recipe. AI/ML models can be either linear for all qualities or mixed hybrid models for nonlinear qualities. This configuration would require a large dataset of > 5,000 blends with crude switches and process changes to be effective. Real-time updates of bias would improve the AI models. This option is shown in Diagram 1 of FIG. 8.
Backcasted blend header qualities. This configuration back-calculates the aggregated blend header qualities from the final lab quality to train the AI/ML models. The user can back-calculate the aggregated blend header qualities from the tank qualities and from the heel and final tank qualities using Eq. 5: Qhdi = (Vt × Qt – Vh × Qh ) / Vhd (5) where: Qhdi = Integrated blend header quality t = Final product tank h = Product tank heel Q = Quality Vhd = Blend batch volume. The back-calculated header blend qualities represent the aggregate qualities at the end of the blend and can be used to train the hybrid AI model. The linear calculation to back-calculate the header quality is justified due to minimal errors. If installed and functional, it is very close to the accumulated qualities from online analyzers. While a more robust approach can use nonlinear models to back-calculate the header qualities, this may not be necessary due to an insignificant loss of accuracy. This option is shown in Diagram 2 of FIG. 8.
AI/ML hybrid models for the blend header and product tank. This configuration combines methods to train the blend header and product tank qualities using final certified tank qualities, components and recipes. Both models can use mixed linear and nonlinear blend quality models to create a robust AI/ML hybrid model twin set to configure an analyzer-less blending system. Diagram 3 of FIG. 8 shows both options to predict header and product tank qualities.
Training the AI model. The purpose of training the AI model is to predict the back-calculated blend header qualities using linear and nonlinear blend models. The linear AI model does not require the knowledge of any nonlinear blending model to predict the blend header quality without any online blend header analyzers. However, the nonlinearity of the blending process leaves little hope for a linear AI model—although simple in concept and implementation—to accurately predict blend qualities.
Updates of the residual bias term by AI. The AI-based ML scheme to adjust the blend component ratios and calculate the blend bias to match the final measured values of the blend qualities is shown in FIG. 9. The values of the correction term can then be applied to online/offline blend control systems. Eventually, a well-trained AI model will gradually reduce the residual error within acceptable limits of 0.25%–0.5%.
The bias terms for blend header and tank qualities are unstable during the initial training phase, but tend to stabilize asymptotically after many training, prediction and backcasting cycles.
Linear vs. hybrid AI/ML models. The linear blending model is a simple calculation of component ratios and their qualities. About 60% of blend qualities can be handled accurately, depending on the accuracy of component qualities and flow ratios. Therefore, AI models for these are simply linear models. However, qualities like research octane number (RON), motor octane number (MON), RVP, D10, D90 and FBP are nonlinear and are candidates for hybrid models. The parameters for nonlinear models must be customized for specific refinery processes using the regressions method to build hybrid AI/ML models for blending.
These parameters can be interactive DuPont coefficients or exponent constants for RVP and distillation points. In the author’s 14 components and 18 qualities case study, > 90 DuPont coefficients for 750 blends were regressed. The techniques for regressions could be Excel Solver, multi-linear regression or moving deterministic solutions. The author used all to cross-check the accuracy of customized blend parameters. FIG. 10 shows the regressed values of DuPont coefficients, and FIG. 11 shows the interaction effect of DuPont coefficients on bonus or penalty of octane values.
Roadmap to develop AI/ML models for an analyzer-less fuel blending system. In the case study, it was assumed that the blend header has functional online analyzers. The author started with three pieces of information: component flow ratios, component qualities as analyzed intermittently, and final blend tank qualities certified by the lab before sale. The complete roadmap involves the following steps (FIG. 12):
Data collection: It all starts with collecting all required historical blend data for at least 3 yr–5 yr, including the variability of process changes and crude switches.
Data analysis: It is required to analyze the collected data for outliers, completeness, consistency, missing values and applicable ranges. The biggest bottleneck is component qualities, as the refinery lab follows a lean schedule to sample and analyze blend component tanks.
Data consolidation: This requires consolidating all data-like qualities, inventories, recipes and lab analyses in one place and interface. The author’s organization used Excel to bring all the data blends into one workbook sheet. Then, the workbook sheet is used for different purposes like optimization, custom-developed code in Visual Basic for Applications (VBA) and Python language.
Backcasted blend header qualities: The author’s organization worked backwards and calculated aggregated blend header qualities from the final blend tank lab analysis, using heel qualities, heel volume and final tank volume. These values provided the training dataset for the AI/ML models.
Customization of hybrid blend models: The nonlinear blend model parameters are specific refinery processes and must be customized using the final lab analysis of the product tank. Only 40% of blend qualities are nonlinear, and the rest are linear and require no customization.
Training of linear AI models: The author’s organization initially attempted to train the linear AI models, which required component qualities, flow ratios and backcasted blend header qualities. This model is expected to regress well for qualities that are blended linearly. Still, outliers exist because component qualities are in sync with each blend data, showing outliers.
Training of hybrid AI models: Once the parameters of the nonlinear blend models have been customized, they are used to predict nonlinear qualities at the blend header. They showed better prediction than linear models; however, input data of component qualities caused some outliers.
Recipe optimization: It was shown that hybrid AI/ML models can be used to optimize the recipe. The optimizers use hybrid AI/ML during the optimization process. The author’s organization developed Python-based optimizers for this purpose. Two techniques were used to feed the prediction of qualities for each internal optimization iteration: internally dynamic in the code or static external prediction. The latter was used only for training purposes, but dynamic internal prediction would be required for the online execution of the blending process.
Prediction of blend qualities: The output from the optimizer generated qualities prediction collected via interfaces to compare them before and after the optimization.
Analysis of qualities giveaways: This is the ultimate proof of concept, which utilized an AI/ML analyzer-less hybrid model that improved blend profitability and minimized giveaways over traditional systems using FPBMs and online analyzers. The most important limitations are the sizeable historical dataset, data quality and component qualities for every blend in the dataset. Therefore, only this concept proved optimum.
Takeaways. This article discussed FPBM architecture used traditionally by refineries, including its pros and cons. This text also explored the concept and trend of using AI/ML hybrid models for blending for cases where online analyzers may not be installed or may be nonfunctional, sometimes causing quality giveaways and violations. This article differentiated between linear and hybrid AI/ML models based on the linearity or nonlinearity of the blend qualities. Finally, all the steps to develop an AI/ML hybrid analyzer-less fuel blending system were outlined. HP
Suresh S. Agrawal is the founder and CEO of Offsite Management Systems LLC (OMS) in Houston, Texas. OMS specializes in advanced process control systems and has developed, installed and managed many innovative and technologically advanced automation software products and integrated solutions for the automation of offsite operations for the chemical, oil and gas industries internationally, including in India, Mexico, Colombia, the U.S. and Europe. Dr. Agrawal has more than 40 yr of experience in senior technical/management positions with international companies and has managed advanced refinery process control projects in numerous countries. He has published and presented more than 30 papers on advanced process control in international publications and conferences. He was co-editor of the handbook ASTM MNL58—Petroleum Refining and Natural Gas Processing and the sole author of two chapters. Dr. Agrawal earned a BCh degree in chemical engineering from the Indian Institute of Technology in Mumbai, and obtained an MS degree and a PhD in chemical engineering from the Illinois Institute of Technology in Chicago.