A method for quickly calculating hydrogen-doped natural gas compression factor

CN123012346APending Publication Date: 2026-10-30CHINA JILIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611253892.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-18
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

虽然GERG-2008方程具有极高的计算精度,能够较好地适应复杂的多组分气体体系,但其本质上是一套复杂的隐式方程体系,其求解过程高度依赖于Helmholtz自由能偏导数的繁琐计算,必须在给定的边界条件下通过设定收敛阈值进行多轮高维非线性迭代求解

Benefits of technology

[0017]本发明的有益效果是:本发明通过创新性地构建显式多项式空间曲面回归模型,摆脱了传统GERG-2008标准状态方程求解时对复杂非线性迭代和收敛边界条件的依赖,解决了大型输气管网动态仿真控制及现场流量在线计量对微秒级超高实时性的核心诉求。同时,本申请通过对气体组分进行映射的方式,消除了模型对多组分直接输入造成的维度问题,使得该架构不仅适用于二元、三元等简易混合气,更全面兼容并包了包含多种重烃馏分、惰性气体及酸性杂质气体的实际复杂多组分工业管输流体。并且,本发明提出的快速计量方法,通过多项式模型达成了在宽工况和全掺氢范围内维持工业级预测精度的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012346A_ABST
    Figure CN123012346A_ABST
Patent Text Reader

Abstract

The application discloses a kind of hydrogen-doped natural gas compression factor fast calculation method.The method comprises: obtaining the actual temperature, actual pressure and the mole fraction of each gas component of hydrogen-doped natural gas to be detected;Virtual critical temperature and virtual critical pressure of mixed gas are calculated using a predetermined mixing rule;By ratio operation, normalized contrast temperature and contrast pressure are output;As independent variable, directly input into the preset explicit polynomial space surface regression model for non-iterative calculation, and further directly output to obtain actual compression factor;Compare the calculated value with the standard state equation, and the accuracy and time performance of the model are quantitatively evaluated by statistical deviation index.The application utilizes the principle of physical corresponding state to reduce the dimension of high-dimensional multi-component to two-dimensional control variable space, eliminates the complex iterative process of traditional calculation method, and the time consumption of single-point solution is only microsecond level, with high calculation efficiency and industrial high prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of hydrogen-blended natural gas, and more specifically to a rapid method for calculating the compressibility factor of hydrogen-blended natural gas. Background Technology

[0002] With the transformation of the global energy structure and the advancement of dual-carbon goals, hydrogen energy, as a low-carbon, efficient, and clean energy source, is becoming a core carrier for building a modern energy system. However, the low density and high transportation cost of hydrogen limit its large-scale utilization. Blending hydrogen in existing natural gas pipelines for mixed transportation and utilizing mature long-distance natural gas pipeline networks and urban gas pipeline networks for hydrogen storage and transportation has been widely recognized as the most feasible key path to achieve low-cost, long-distance, and large-scale hydrogen energy transportation.

[0003] In the engineering design, operation simulation, hydraulic dynamic calculation, and trade settlement measurement of hydrogen-blended natural gas pipeline networks, the compressibility factor is an indispensable core physical property parameter. It directly affects the accuracy of pipeline gas transmission energy consumption assessment, instantaneous flow integration, and pipeline pressure fluctuation prediction. Currently, the international and domestic industries generally use the high-precision GERG-2008 equation of state to calculate the compressibility factor of hydrogen-blended natural gas. Although the GERG-2008 equation has extremely high computational accuracy and can adapt well to complex multi-component gas systems, it is essentially a complex implicit equation system. Its solution process relies heavily on the tedious calculation of Helmholtz free energy partial derivatives, and must be solved through multiple rounds of high-dimensional nonlinear iterations under given boundary conditions and by setting convergence thresholds. Due to the numerous solution steps, long processing time, potential for non-convergence under critical conditions, and severe limitations in computational efficiency imposed by hardware computing power, traditional standard state equation calculation methods often prove inadequate for high-concurrency, high-real-time industrial applications such as large-scale node dynamic simulation of complex natural gas pipeline networks, massive streaming data throughput of distributed SCADA systems, and microsecond-level instantaneous flow online integration of embedded smart instruments.

[0004] Therefore, in order to significantly reduce the time required for property calculations and eliminate the risk of iteration non-convergence while ensuring industrial-grade computational accuracy, this application proposes a fast calculation method for the compressibility factor of hydrogen-doped natural gas. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to provide a rapid method for calculating the compressibility factor of hydrogen-blended natural gas, comprising: The basic data acquisition steps involve obtaining the absolute temperature, absolute pressure, and mole fraction of each gas component of the hydrogen-blended natural gas to be tested.

[0006] The virtual critical mapping step calculates the virtual critical temperature and virtual critical pressure of the mixed gas based on the mole fraction of each gas component and the corresponding critical physical constants of each gas component, including critical pressure and critical temperature, through a preset mixing rule.

[0007] The comparative state parameter determination step involves calculating the comparative temperature and comparative pressure of the hydrogen-blended natural gas to be tested based on the absolute temperature, absolute pressure, virtual critical temperature, and virtual critical pressure.

[0008] The compressibility factor calculation step involves using a preset explicit polynomial surface regression model to perform non-iterative calculations based on the comparison temperature and comparison pressure to obtain the compressibility factor of the hydrogen-blended natural gas to be tested.

[0009] The model analysis and verification step compares the compression factor with the baseline calculated value of the preset standard state equation under the same working conditions. By calculating the statistical deviation index of multiple groups of samples, the prediction accuracy and computational time performance of the explicit polynomial spatial surface regression model are quantitatively evaluated and verified.

[0010] As a further improvement of the present invention, the virtual critical mapping step includes multiplying the mole fraction of each gas component by the corresponding critical temperature and critical pressure, and summing the product results of each component to obtain the virtual critical temperature and virtual critical pressure of the mixed gas.

[0011] As a further improvement of the present invention, the displayed polynomial spatial surface regression model is a polynomial spatial surface regression model with a maximum degree of five.

[0012] As a further improvement of the present invention, the construction of the explicit polynomial spatial surface regression model includes: randomly sampling within a set component boundary range according to a high-precision state equation to generate a sample gas set containing multiple component mole fraction ratios; for each sample gas set, performing gridded chemical condition discretization within a set temperature and pressure range; calculating the compressibility factor benchmark values ​​of each sample gas under different operating conditions by iteratively solving the high-precision state equation through a convergence threshold; combining these to form a multidimensional physical property benchmark dataset; and using the comparison temperature and comparison pressure in the multidimensional physical property benchmark dataset, combined with the compressibility factor benchmark values, performing multivariate polynomial regression fitting through the least squares method to determine the regression coefficients in the explicit polynomial spatial surface regression model.

[0013] As a further improvement of the present invention, the step of solving the compressibility factor includes, in the fifth-order polynomial space surface regression model, the compressibility factor of the hydrogen-blended natural gas to be detected is obtained by linearly accumulating and combining the constant term, the monomials of each order of the comparison temperature and the comparison pressure, and the cross-product terms of the comparison temperature and the comparison pressure at different orders, after multiplying them by preset regression coefficients respectively.

[0014] As a further improvement of the present invention, the preset regression coefficients are fixed real-value matrices obtained by randomly sampling a hydrogen-blended natural gas benchmark dataset generated by a high-precision state equation within a preset pipeline operating condition and typical hydrogen-blended component range, and by performing multi-dimensional surface fitting using the least squares method.

[0015] As a further improvement of the present invention, the model analysis and verification step includes: the statistical deviation index is the root mean square error calculated by the root mean square deviation formula, the goodness of fit is calculated by the coefficient of determination formula, and the mean absolute percentage error is calculated by the mean absolute percentage deviation formula.

[0016] As a further improvement of the present invention, the model analysis and verification step further includes calculating the dispersion error, overall goodness of fit and average percentage deviation between the compression factor and the benchmark calculated value. When all deviations are less than the preset industrial tolerance threshold, the prediction accuracy of the explicit polynomial spatial surface regression model is determined to meet the standard.

[0017] The beneficial effects of this invention are as follows: By innovatively constructing an explicit polynomial spatial surface regression model, this invention eliminates the dependence on complex nonlinear iterations and convergence boundary conditions in solving the traditional GERG-2008 standard equation of state, thus solving the core requirement of microsecond-level ultra-high real-time performance for dynamic simulation control of large-scale gas pipeline networks and online flow metering. Simultaneously, by mapping gas components, this application eliminates the dimensionality problem caused by direct input of multiple components into the model, making the architecture not only applicable to simple binary and ternary gas mixtures, but also comprehensively compatible with and encompassing complex multi-component industrial pipeline fluids containing various heavy hydrocarbon fractions, inert gases, and acidic impurities. Furthermore, the rapid metering method proposed in this invention achieves industrial-grade prediction accuracy across a wide range of operating conditions and in the full hydrogen-doped range through a polynomial model. Attached Figure Description

[0018] Figure 1 This is a flowchart of a rapid calculation method for the compressibility factor of hydrogen-doped natural gas according to an embodiment of the present invention.

[0019] Figure 2 This is a natural gas composition table according to an embodiment of this application.

[0020] Figure 3This is a sample gas composition table of hydrogen-doped natural gas according to an embodiment of this application.

[0021] Figure 4 These are critical temperature and pressure tables for each component gas in embodiments of this application.

[0022] Figure 5 This is a table of regression coefficients for a cubic polynomial model in an embodiment of this application.

[0023] Figure 6 This is a table of regression coefficients for a fourth-order polynomial model in an embodiment of this application.

[0024] Figure 7 This is a table of regression coefficients for a fifth-order polynomial model in an embodiment of this application.

[0025] Figure 8 This is a scatter plot comparing the predicted and actual values ​​in an embodiment of this application.

[0026] Figure 9 This is a data table of model fitting results from an embodiment of this application.

[0027] Figure 10 This is a diagram showing the relative error distribution of the model in an embodiment of this application.

[0028] Figure 11 This is a comparison chart of the computational efficiency of the models in the embodiments of this application. Detailed Implementation

[0029] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Identical components are denoted by the same reference numerals. It should be noted that the terms "front," "rear," "left," "right," "upper," and "lower" used in the following description refer to directions in the accompanying drawings, and the terms "bottom surface," "top surface," "inner," and "outer" refer to directions toward or away from the geometric center of a specific component, respectively.

[0030] The first embodiment of this invention proposes a rapid calculation method for the compressibility factor of hydrogen-blended natural gas, such as... Figure 1 As shown, it includes: The basic data acquisition steps involve obtaining the absolute temperature, absolute pressure, and mole fraction of each gas component of the hydrogen-blended natural gas to be tested.

[0031] In the specific implementation process, the method for obtaining the aforementioned basic thermodynamic and physical property parameters in this step is not limited to a specific form. Different technical means can be used to expand or replace these methods according to the deployment requirements of actual industrial application scenarios. In dynamic hydraulic simulation scenarios of long-distance natural gas pipelines and urban gas pipelines, the basic data acquisition step is achieved through data communication interfaces with monitoring and data acquisition systems or distributed field instruments. Utilizing temperature sensors, pressure transmitters, and online gas chromatographs deployed at key nodes in the pipeline network, such as pressurization stations, pressure regulating and metering stations, and hydrogen blending station outlets, the actual thermodynamic temperature, operating pressure, and total component mole fraction of the flowing hydrogen-blended natural gas within the pipeline are periodically and dynamically acquired synchronously at a preset sampling frequency, providing a high-frequency, continuous, dynamic input stream for rapid downstream physical property calculations. In industrial field design calculations or offline pipeline planning scenarios, the basic data acquisition step also supports non-fully automatic mixed data entry. For example, through a local human-machine interface or configuration file, the molar fractions of each gas component in the hydrogen-blended natural gas that are relatively stable within a specific time period, obtained through laboratory chromatographic analysis, such as the background values ​​of the basic components of natural gas and the specific hydrogen blending ratio settings, can be statically input; at the same time, through the connected field hardware probes, instantaneous temperature and pressure data that fluctuate with the working environment can be dynamically acquired.

[0032] The virtual critical mapping step calculates the virtual critical temperature and virtual critical pressure of the mixed gas based on the mole fraction of each gas component and the corresponding critical physical constants of each gas component, including critical pressure and critical temperature, through a preset mixing rule.

[0033] Specifically, the virtual critical mapping step includes multiplying the mole fraction of each gas component by its corresponding critical temperature and critical pressure, and summing the product results of each component to obtain the virtual critical temperature and virtual critical pressure of the mixed gas.

[0034] In the specific implementation process, to ensure the high compatibility of this step with the diverse physical properties of natural gas in complex industrial sites, the following technical means are employed: In actual hydrogen-blended natural gas industrial transportation systems, the mixed gas typically consists of as many as a dozen or even more than twenty pure material components. Directly using the mole fraction of each component as the independent variable to calculate the compressibility factor would lead to the curse of dimensionality in the regression model, resulting in excessively high computational dimensionality and an exponential explosion in the number of terms. This step introduces virtual critical physical parameters—virtual critical temperature and virtual critical pressure—based on the principle of corresponding states, as physical parameters connecting the discrete multi-component physical properties with the macroscopic thermodynamic state. Through preset mixing rules, the physical properties of the mixture, originally in a high-dimensional component space, are physically projected and collapsed onto a low-dimensional spatial surface independent variable. This eliminates the direct dependence of the multi-components on the compressibility factor calculation model at the underlying algebraic structure level, laying the foundation for dimensionality reduction in the subsequent one-step explicit solution.

[0035] While basic industrial calculations primarily employ a simple linear weighted average of the mole fractions of each gas component and their corresponding critical constants, the method architecture of this invention is also compatible with introducing binary interaction coefficients or nonlinear correction functions on top of the weighted summation, especially under extreme conditions such as high pressure, ultra-high hydrogen doping ratios, or the presence of large-molecule long-chain hydrocarbons or strongly polar non-hydrocarbon impurities. For example, by adding a binary cross term containing the product of the mole fractions of each pair of different gas components to the weighted summation, the virtual critical parameters can be fine-tuned. This modular computational architecture maintains the high simplicity and computational efficiency of linear weighted summation under normal operating conditions while providing the system with the technical flexibility to ensure mapping accuracy through nonlinear extensions under extreme conditions.

[0036] During the virtual criticality mapping step, the system has a built-in emergency property mapping mechanism for non-standard or unknown trace impurity components. When the component data obtained in the basic data acquisition step includes trace unknown components or heavy hydrocarbon fractions that cannot be matched to the preset critical constant database, the mixing rules support automatically classifying the unknown heavy hydrocarbon fraction into a preset virtual single hydrocarbon component, or using the correlation function between its average relative molecular mass and density to estimate its equivalent critical temperature and critical pressure online, and then substituting them into the multiplication and accumulation process of the mole fraction and the corresponding critical constant. This ensures that even if the on-site chromatographic analysis equipment outputs non-standard component data, the method of the present invention can still achieve closed-loop, continuous and uninterrupted virtual critical parameter mapping.

[0037] The comparative state parameter determination step involves calculating the comparative temperature and comparative pressure of the hydrogen-blended natural gas to be tested based on the absolute temperature, absolute pressure, virtual critical temperature, and virtual critical pressure.

[0038] In the specific implementation process, in order to ensure the high compatibility and operational stability of this step with different data sources and different operating environments in actual gas transmission projects, the following technical means are used: In hydrogen-blended natural gas pipeline systems, the actual temperature and pressure fluctuate dramatically across different pipeline sections and at different times, and their absolute values ​​cannot directly reflect the relative thermodynamic activity of the gas. This step introduces comparative temperature and comparative pressure to achieve dimensionless transformation of the physical quantities under operating conditions, i.e., state normalization. Specifically, by performing a ratio calculation, the dynamic actual absolute temperature is mapped and compared with the relatively fixed virtual critical temperature obtained in the previous step, eliminating the temperature dimension and outputting a dimensionless comparative temperature characterizing the relative margin of thermal kinetic energy. Simultaneously, the dynamic actual absolute pressure is mapped and compared with the virtual critical pressure obtained in the previous step, eliminating the pressure dimension and outputting a dimensionless comparative pressure characterizing the relative degree of intermolecular compression. Thus, all complex physical inputs under different operating conditions are uniformly normalized into a two-dimensional standard orthogonal control space constructed by comparative temperature and comparative pressure, ensuring that the subsequent explicit polynomial spatial surface regression model can be solved accurately in one step based on a unified independent variable boundary.

[0039] To accommodate non-standard units of measurement that may be used in different industrial settings or simulation software, this step's technical architecture incorporates a dimensional adaptive conversion module. Before performing the ratio calculation, the system automatically identifies the unit label of the input data. If a non-thermodynamic standard unit is identified, the system uses built-in linear transformation operators, such as the additive constant conversion from Celsius to Kelvin and the multiplicative coefficient conversion from bar to megapascal, to first convert the actual collected temperature and pressure to an absolute temperature that matches the virtual critical parameter before performing the ratio calculation. This avoids inaccurate calculations of the ratio parameters due to inconsistent dimensions of field instruments.

[0040] The compressibility factor calculation step involves using a preset explicit polynomial surface regression model to perform non-iterative calculations based on the comparison temperature and comparison pressure to obtain the compressibility factor of the hydrogen-blended natural gas to be tested.

[0041] Specifically, the explicit polynomial spatial surface regression model is a polynomial spatial surface regression model with a maximum degree of five. In broader industrial applications, the maximum degree of the model is not rigidly limited to five, but rather constructed as a multi-order elastic architecture that can be dynamically adjusted based on both accuracy and computing power boundaries. Depending on the computing power of the specific deployed hardware terminal, its maximum degree can be selected concurrently or alternatively as cubic, quadrilateral, quintic, or higher. Lower-order polynomials are used to sacrifice minimal accuracy in exchange for simplified algebraic operations and lower coefficient storage overhead on low-end chips; while higher-order polynomials, by adding higher-order cross terms, comprehensively approximate the details of ultra-high-dimensional physical property surfaces, and are used for hydraulic dynamic simulation of long-distance pipeline networks or standard trade metering terminals where computational accuracy requirements are extremely stringent.

[0042] Specifically, the construction of the explicit polynomial spatial surface regression model includes: randomly sampling within a set component boundary range according to a high-precision equation of state to generate a sample gas set containing multiple component mole fraction ratios; for each sample gas set, performing gridded chemical condition calculations within a set temperature and pressure range, calculating the compressibility factor benchmark values ​​of each sample gas under different operating conditions by iteratively solving the high-precision equation of state through a convergence threshold, and combining them to form a multidimensional physical property benchmark dataset; and determining the regression coefficients of each item in the explicit polynomial spatial surface regression model by performing multivariate polynomial regression fitting using the least squares method based on the comparative temperature and comparative pressure in the multidimensional physical property benchmark dataset and the compressibility factor benchmark values.

[0043] In the extended technical means of model construction described above, to ensure that the generated benchmark dataset can comprehensively cover the thermodynamics of actual multi-component gas mixtures, the random sampling employs a multi-dimensional probability distribution joint sampling algorithm, such as Latin hypercube sampling or Monte Carlo random flow. This algorithm uniformly disperses the samples in a high-dimensional space within the set concentration boundaries of each gas component. This ensures that the generated sample gas set not only includes several typical hydrogen-doped ratios but also covers various non-standard and extreme gas component ratios that may arise from the dynamic mixing of flow distribution at various nodes in the pipeline network. Simultaneously, during the gridding and discretization process, a non-uniform grid is used for the spatial step size of temperature and pressure. Local fine-grained discretization is performed in sensitive operating conditions with drastic fluctuations in compressibility factors, near the critical region, or in high-pressure regions. This results in the final multi-dimensional physical property benchmark dataset possessing extremely high global completeness and local detail sensitivity, ensuring that the regression coefficient matrix obtained by the least squares method has globally optimal approximation characteristics.

[0044] Specifically, in the fifth-order polynomial space surface regression model, the compressibility factor of the hydrogen-blended natural gas to be detected is obtained by linearly summing and combining the constant term, the monomials of each order of the comparison temperature and the comparison pressure, and the cross-product terms of the comparison temperature and the comparison pressure at different orders, after multiplying them by preset regression coefficients respectively.

[0045] Extending the description from the perspective of multidimensional spatial geometry and algebraic structure, the introduction of hydrogen molecules drastically alters the interaction potential energy of the original natural gas system, leading to a highly intricate nonlinear distortion in the compressibility factor space surface of multi-component hydrogen-blended natural gas. The linear cumulative combination structure employed in this step, mathematically speaking, maps the complex nonlinear state equation surface into a standard orthogonal polynomial basis space with relative temperature and relative pressure as dual independent variables. The monomials of relative temperature and relative pressure, such as their respective first, second, and higher-order terms, are used to independently delineate and capture the trend of expansion or compression of the compressibility factor caused by changes in a single physical quantity. Meanwhile, the multidimensional cross-product terms at different orders, such as the low-order and high-order cross-product terms of relative temperature and relative pressure, are specifically used, in terms of physical mechanism, to quantitatively characterize and compensate for the nonlinear coupling superposition effect caused by changes in the intermolecular distance of the two core control variables, temperature and pressure. Through the complete expansion of this algebraic structure, the complex material property space that originally required cumbersome superfluid theory and high-dimensional implicit iteration to solve can be perfectly transformed into a pure algebraic one-step summation pipeline with single-point, explicit, and unbounded convergence conditions.

[0046] Specifically, the preset regression coefficients are fixed real-value matrices obtained by randomly sampling a hydrogen-blended natural gas benchmark dataset generated by the high-precision state equation within a preset pipeline operating condition and typical hydrogen-blended component range, and then performing multi-dimensional surface fitting using the least squares method.

[0047] In the extended implementation approach, the fixed real-value matrix possesses both operating condition adaptability and dynamic updateability. During the initial deployment of the industrial system, the matrix is ​​pre-fixed as a multi-dimensional constant coefficient array in the non-volatile memory of the computing device, allowing the explicit solution module to perform direct static addressing calls within microsecond-level machine cycles, achieving ultra-fast one-step non-iterative computation. Furthermore, to accommodate future gas transmission projects due to special operating conditions, this technical architecture also supports online remote upgrades or offline dynamic overlay of the matrix: that is, the backend server triggers the least-squares fitting process of the aforementioned high-precision state equations again based on new boundary conditions, calculates a new fixed real-value matrix after smooth correction, and streams it into the memory of the field device through a network interface, completing a seamless upgrade of the computational model. This allows the system to have unlimited operating condition extension capabilities while maintaining the underlying explicit algebraic solution architecture completely unchanged.

[0048] The model analysis and verification step compares the compression factor with the baseline calculated value of the preset standard state equation under the same working conditions. By calculating the statistical deviation index of multiple groups of samples, the prediction accuracy and computational time performance of the explicit polynomial spatial surface regression model are quantitatively evaluated and verified.

[0049] Specifically, the model analysis and verification steps include: the statistical deviation index is the root mean square error calculated using the root mean square deviation formula; the goodness of fit is calculated using the coefficient of determination formula; and the mean absolute percentage error is calculated using the mean absolute percentage deviation formula.

[0050] Extending from the underlying mechanisms of multidimensional mathematical statistics and system identification, the evaluation of prediction accuracy is not limited to errors in a single dimension. Instead, a three-dimensional collaborative verification technology matrix covering local dispersion, global fitting trend, and average deviation level is constructed. Specifically, the root mean square error obtained through algebraic operations acts as a sensitive amplifier of local abnormal fluctuations in the system, specifically used to accurately capture severe local prediction distortions that may occur in the model under critical or extreme high-pressure conditions. The coefficient of determination obtained through algebraic operations is used to quantitatively characterize the geometric overlap and consistency between the explicit polynomial space surface and the high-dimensional real thermodynamic surface in terms of global trends at the geometric projection level. The mean absolute percentage error obtained through algebraic operations is used to evaluate the expected prediction accuracy of the model in the entire process of wide gas transmission conditions from a statistical average dimension. Through the algebraic cascade and collaborative constraints of the above three indicators, the statistical blind spots that may be caused by a single evaluation indicator are avoided, providing a comprehensive and refined measurement method for the reliability verification of explicit solution schemes in industrial fields.

[0051] Specifically, the model analysis and verification steps also include calculating the dispersion error, overall goodness of fit, and average percentage deviation between the compression factor and the benchmark calculated value. When all deviations are less than the preset industrial tolerance threshold, the prediction accuracy of the explicit polynomial spatial surface regression model is determined to meet the standard.

[0052] In the closed-loop operation of actual industrial dynamic simulation or on-site online metering systems, the model analysis and verification steps, based on static mathematical calculations, further extend to dynamic performance evaluation and hardware / software linkage control methods. For the quantitative evaluation of computational time performance, the system incorporates a high-precision hardware clock interrupt monitor or code-level timestamp counter. During compression factor calculation, the system automatically triggers time monitoring to accurately capture the absolute machine cycles and execution time consumed by the algebraic expansion calculation of a single compression factor within the microprocessor, and simultaneously calculates the data processing throughput per unit time. By dynamically comparing the monitored actual execution time with a preset industrial microsecond-level real-time threshold—for example, determining whether the single-point time remains stably within the microsecond range—the system assesses whether the model's full-concurrency control performance meets the timeliness standard.

[0053] The second embodiment of the present invention proposes a specific method for calculating the compression factor, based on, as follows: Figure 2The composition range of pipeline natural gas is shown. Considering the current status of hydrogen blending in natural gas, and assuming a maximum hydrogen mole fraction of 35%, 1000 sets of hydrogen-blended natural gas samples were randomly generated. Some data are shown below. Figure 3 As shown.

[0054] This embodiment uses the international standard GERG-2008 equation of state as a high-precision benchmark. To ensure the reliability of the benchmark dataset, the accuracy of the equation of state solver was verified in advance using standard test data. The verification results show that the program's calculation error is within the industrial allowable range. Then, the program is used to generate a benchmark dataset containing 44,100 data points.

[0055] To establish a universal and rapid calculation model for the compressibility factor of hydrogen-blended natural gas, this application is based on the corresponding state principle, which states that the thermodynamic properties of different fluids exhibit similar behavior under corresponding states. Therefore, by mapping the compressibility factor of multi-component gas mixtures to the corresponding state space using the corresponding temperature Tr and the corresponding pressure Pr, this approach effectively reduces the dimensionality of the input parameters and avoids the problems of high model complexity and large data requirements caused by directly using the mole fraction of each component as input. (Corresponding temperature T) r And the comparative pressure P r The definition is as follows: ; ; Where T is absolute temperature in Kelvin (K), and P is absolute pressure in MPa (MPa). and These are the virtual critical temperature and virtual critical pressure of the gas mixture, respectively. For the gas mixture, the virtual critical parameters are calculated using a mixing rule with a mole fraction weighted average, including: ; ; Where, x i T is the mole fraction of component i. c,i and P c,i These are the critical temperature and critical pressure of component i, respectively. The critical temperature and pressure of each component are as follows: Figure 4 As shown.

[0056] The 1000 hydrogen-blended natural gas samples were randomly divided into a fitting set and a validation set at a ratio of 7:3. Within the pipeline transportation conditions of 250K~350K and 0.1MPa~12.1MPa, the comparison temperature T was first calculated for the corresponding temperature, pressure, and gas composition. r And the comparative pressure P r Then, the corresponding compression factor is calculated using the GERG-2008 equation as the baseline value.

[0057] Based on a preliminary analysis of the spatial variation of the compressibility factor, this application selects a multinomial regression model for fitting, wherein the compressibility factor varies with T. r and P r The changes exhibit nonlinear characteristics. This paper constructs cubic, quartic, and quintic polynomial fitting models respectively, and solves them using the least squares method. The results are as follows: General form of cubic polynomial: ; Where β0~β9 are the regression coefficients to be fitted, and the solution results are as follows: Figure 5 As shown.

[0058] General form of a quartic polynomial: ; Among them, the regression coefficients β0~β 14 The solution results are as follows Figure 6 As shown.

[0059] General form of a fifth-degree polynomial: ; Among them, the regression coefficients β0~β 20 The solution results are as follows Figure 7 As shown.

[0060] To quantitatively evaluate the predictive performance of different models, the root mean square error (RMSE) and coefficient of determination (R²) were used. 2 The model is evaluated using three parameters: mean absolute percentage error (MAPE). The parameters are defined as follows: Root mean square error: ; Among them, Z G,i Z m,i These are the calculated values ​​from the GERG-2008 equation and the model, respectively.

[0061] Coefficient of determination: ; in, The average value calculated for the GERG-2008 equation.

[0062] Mean absolute percentage error: ; Figure 8 The figures show scatter plots comparing predicted and actual values ​​for cubic, quartic, and quintic polynomial fitting models on the fitting and validation sets, respectively. The results show that as the polynomial order increases, the density of the scatter plots exhibits a clear optimization trend, and the closer the overall distribution conforms to the diagonal, the higher the model's prediction accuracy. Specific data can be found in [the relevant section]. Figure 9 , Figure 9 The root mean square error (RMSE), coefficient of determination (R²), and mean absolute percentage error (MAPE) of cubic, quartic, and quintic polynomial models on the fitting and validation sets are listed. Data shows that as the model order increases, all evaluation metrics exhibit a clear optimization trend: the RMSE of the cubic polynomial model on the fitting and validation sets are 0.005647 and 0.005376, respectively; the R² is 0.993894 and 0.994305, respectively; and the MAPE is 0.4250% and 0.4141%, respectively. Combined with the scatter plot, it can be seen that the model has high overall accuracy, but underfitting in some regions; the RMSE of the quartic polynomial model on the validation set decreases to 0.003663, and the R² is... 2 The accuracy was improved significantly, with the MAPE dropping to 0.2866% after the MAPE was increased to 0.997356. The 5th-order polynomial model achieved an RMSE of 0.003340 and an R² of 0.997801 on the validation set, while keeping the MAPE below 0.2521%, which is a slight improvement over the 4th-order model.

[0063] Figure 10 The figures show the relative error distributions for the three models. The results indicate that for the cubic polynomial model, 92.05% of the samples had a relative error within 1%, while 0.12% had an error exceeding 5%, demonstrating insufficient fitting accuracy. For the quadratic polynomial model, 95.93% of the samples had a relative error within 1%, an increase of 3.88% compared to the cubic model, and the percentage of samples with errors exceeding 5% decreased to 0.01%, indicating a significant improvement in accuracy. The quintic polynomial model consistently showed relative errors within 5%, with 96.30% of the samples having a relative error within 1%, demonstrating high computational accuracy.

[0064] To compare the computational efficiency of the regression model and the GERG-2008 state equation, under the same hardware environment and computing platform, the efficiency of several models in calculating the compression factor was calculated using 44,100 data points in the validation set. To obtain stable time consumption statistics, the data was repeated 10 times, and extreme values ​​were removed to obtain the average time. The average computation time, time per point, and data throughput per unit time were statistically analyzed. The results are as follows: Figure 11 As shown.

[0065] The results show that the single-point computation time of the cubic regression model is 4.06 μs, which is about 0.7% of that of GERG-2008 (553.31 μs); the throughput is more than 136 times that of the GERG-2008 model, demonstrating a greater advantage in computational efficiency. As the number of regression iterations increases, the total computation time and the time per iteration increase slightly, while the throughput decreases slightly, showing a slight decreasing trend in efficiency.

[0066] The foregoing has illustrated and described the basic features, principles, and advantages of the present invention. It should be noted that the present invention is not limited to the above embodiments, but only to some embodiments. Any improvements and additions made without departing from the spirit and scope of the present invention are considered to be within the scope of protection of the present invention.

Claims

1. A rapid calculation method for the compressibility factor of hydrogen-blended natural gas, characterized in that, include: The basic data acquisition steps are to obtain the absolute temperature, absolute pressure, and mole fraction of each gas component of the hydrogen-blended natural gas to be tested. The virtual critical mapping step calculates the virtual critical temperature and virtual critical pressure of the mixed gas based on the mole fraction of each gas component and the corresponding critical physical constants of each gas component, including critical pressure and critical temperature, through a preset mixing rule. The comparison state parameter determination step involves calculating the comparison temperature and comparison pressure of the hydrogen-blended natural gas to be tested based on the absolute temperature, absolute pressure, virtual critical temperature, and virtual critical pressure. The compressibility factor calculation step involves using a preset explicit polynomial surface regression model to perform non-iterative calculations based on the comparison temperature and comparison pressure to obtain the compressibility factor of the hydrogen-blended natural gas to be tested. The model analysis and verification step compares the compression factor with the baseline calculated value of the preset standard state equation under the same working conditions. By calculating the statistical deviation index of multiple groups of samples, the prediction accuracy and computational time performance of the explicit polynomial spatial surface regression model are quantitatively evaluated and verified.

2. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The virtual critical mapping step includes multiplying the mole fraction of each gas component by its corresponding critical temperature and critical pressure according to the mixing rule, and summing the product results of each component to obtain the virtual critical temperature and virtual critical pressure of the mixed gas.

3. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The displayed polynomial spatial surface regression model is a polynomial spatial surface regression model with a maximum degree of five.

4. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The construction of the explicit polynomial spatial surface regression model includes: randomly sampling within a set component boundary range according to a high-precision equation of state to generate a sample gas set containing multiple component mole fraction ratios; for each sample gas set, performing gridded chemical condition discretization within a set temperature and pressure range; calculating the compressibility factor benchmark values ​​of each sample gas under different operating conditions by iteratively solving the high-precision equation of state through a convergence threshold; combining these to form a multidimensional physical property benchmark dataset; and using the comparison temperature and comparison pressure in the multidimensional physical property benchmark dataset, combined with the compressibility factor benchmark values, performing multivariate polynomial regression fitting through the least squares method to determine the regression coefficients in the explicit polynomial spatial surface regression model.

5. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The steps for solving the compressibility factor include the following: in the fifth-order polynomial space surface regression model, the compressibility factor of the hydrogen-blended natural gas to be detected is obtained by linearly summing and combining the constant term, the monomials of each order of the comparison temperature and the comparison pressure, and the cross-product terms of the comparison temperature and the comparison pressure at different orders, after multiplying them by preset regression coefficients respectively.

6. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 5, characterized in that, The preset regression coefficients are fixed real-value matrices obtained by randomly sampling a hydrogen-blended natural gas benchmark dataset generated by a high-precision equation of state under preset pipeline operating conditions and typical hydrogen-blended component ranges, and by performing multi-dimensional surface fitting using the least squares method.

7. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The model analysis and verification steps include: the statistical deviation index is the root mean square error calculated using the root mean square deviation formula; the goodness of fit is calculated using the coefficient of determination formula; and the mean absolute percentage error is calculated using the mean absolute percentage deviation formula.

8. The method for rapidly calculating the compressibility factor of hydrogen-blended natural gas according to claim 1, characterized in that, The model analysis and verification step also includes calculating the dispersion error, overall goodness of fit, and average percentage deviation between the compression factor and the benchmark calculated value. When all deviations are less than the preset industrial tolerance threshold, the prediction accuracy of the explicit polynomial spatial surface regression model is determined to meet the standard.