A gas well casing fluid level simultaneous measurement method based on sound velocity inversion
By using casing acoustic velocity inversion technology, combined with gas component parameter inversion and tubing fluid level depth calculation, the accuracy and cost issues of gas well casing fluid level measurement have been solved, achieving efficient and accurate simultaneous measurement of both casing and oil levels.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUIZHOU HANGTIAN KAISHAN PETROLEUM INSTR CO LTD
- Filing Date
- 2026-04-22
- Publication Date
- 2026-07-21
AI Technical Summary
Existing methods for measuring fluid levels in gas well casings suffer from low accuracy, susceptibility to interference, and high costs, making it difficult to achieve simultaneous and accurate measurement of fluid levels in both the tubing and casing.
A sound velocity-based inversion method is adopted, which involves casing fluid level testing, wellbore gas composition parameter inversion, and tubing fluid level depth calculation. The gas composition parameters inside the tubing are inverted using the casing sound velocity, and the tubing fluid level depth is calculated by combining the tubing fluid level reflection wave time. This simplifies the field process and reduces test interference.
It enables precise, low-cost, and portable simultaneous measurement of both liquid levels in the oil jacket, improving measurement accuracy, simplifying the measurement process, and reducing hardware costs.
Smart Images

Figure CN122428897A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for simultaneously measuring the fluid level in the oil well casing of a gas well based on sound velocity inversion, belonging to the field of sonic logging technology for oil and gas wells. Background Technology
[0002] In gas well production dynamic monitoring and wellbore management, the accurate acquisition of the depth of fluid accumulation in the tubing has a clear and critical engineering application requirement. The results are directly used to determine the degree of fluid accumulation in the gas well, assess the wellbore lifting capacity, optimize fluid drainage and gas production systems such as foam drainage, plunger gas lift, and continuous gas lift. At the same time, it provides basic data for diagnosing bottom hole flowing pressure, analyzing gas and water production patterns, predicting wellbore blockage risks, and formulating well workover and production recovery measures. It is also an important support for ensuring stable gas well production, improving recovery rate, and reducing wellbore operation risks.
[0003] In gas well casing fluid level testing, the gas velocity inside the wellbore is typically calculated using the reflected signal from the tubing joint collar, and then the casing fluid level depth is accurately calculated by combining this with the reflected wave from the casing fluid level. In actual production, if simultaneous measurement of the tubing and casing fluid levels can be achieved, it will provide a more comprehensive reflection of the gas distribution in the annulus and production tubing. Currently commonly used measurement methods include: dual-interface acoustic echo testing, single-test combined with mathematical modeling, and pressure gradient joint inversion. Among them, the dual-interface acoustic echo testing method emits acoustic signals at the casing test port and simultaneously identifies the reflected wave signals from the tubing fluid surface and the casing fluid surface. The sound velocity is calibrated using the joint clamp method to calculate the depth of the dual fluid surfaces. It has the advantages of simple operation, fast testing speed, no need to shut in the well, and low cost. However, it is prone to waveform confusion when there is strong interference. The single test combined with mathematical model method arranges an acoustic testing device and pressure sensor in the casing and a pressure sensor in the tubing at the wellhead. The tubing fluid surface depth is derived based on the casing fluid surface depth, pressure, tubing pressure, and a specific data model. This method is an indirect measurement. Its advantage is that it requires less hardware investment and is particularly suitable for automated monitoring scenarios. Its disadvantage is that its accuracy is greatly affected by well conditions, the accuracy of pressure data, and the overall gas density. The pressure gradient joint inversion method indirectly inverts the dual fluid surfaces based on the wellhead oil pressure and casing pressure, combined with the fluid column density. It can achieve continuous monitoring, but it depends on the accuracy of fluid parameters and is greatly affected by gas composition and temperature, resulting in lower accuracy than direct measurement.
[0004] Therefore, it is necessary to study a more efficient and accurate method for simultaneous measurement of oil and casing fluid levels in gas wells, so as to provide more reliable data support for gas well fluid accumulation diagnosis, dynamic analysis, and gas production process optimization. Summary of the Invention
[0005] The purpose of this invention is to provide a method for simultaneous measurement of fluid levels in gas wells and casing based on sound velocity inversion. This method eliminates the need for separate sound velocity calibration inside the tubing, effectively reducing testing interference, simplifying the field process, and effectively overcoming the problem of difficulty in direct and accurate measurement due to the lack of a joint in the tubing as a sound velocity reference. It provides a highly promising technical approach for accurate, low-cost, and portable simultaneous measurement of fluid levels in both the tubing and casing.
[0006] The technical solution of this invention is a method for simultaneous measurement of fluid levels in gas wells and casing based on sound velocity inversion. This method includes three steps: casing fluid level testing and data collection, wellbore gas component parameter inversion, and tubing fluid level depth calculation. First, multiple sets of valid test data are obtained by performing fluid level tests under different pressure conditions on the casing. Second, wellbore gas component parameters are obtained through inversion using a sound velocity theoretical calculation model and wellhead casing temperature and pressure. A tubing sound velocity calculation model is then established using the inverted wellbore gas component parameters and tubing pressure and temperature to obtain the sound velocity at different depths throughout the well. Finally, the final tubing fluid level depth is obtained using the corresponding time of the tubing fluid level position and the overall well sound velocity.
[0007] In the aforementioned method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion, the method includes the following steps:
[0008] Step S1: Install a portable acoustic liquid level measuring device on the gas well casing. The measuring device includes an acoustic generator, a microphone, a hardware filtering sampling circuit unit, a temperature and pressure test acquisition unit, a data wireless communication unit, and a pressure relief module.
[0009] Step S2: Perform fluid level testing through the casing. The acoustic generator produces sound waves that propagate downhole along the tubing annulus. The microphone receives the reflected sound waves from the casing collar and converts them into electrical signals. The hardware filtering and sampling circuit unit then acquires the time-domain signal of the casing collar wave. Time-domain signal of liquid surface wave in casing It receives the acoustic waves reflected from the liquid surface inside the casing and converts them into electrical signals; the wellhead casing temperature is acquired by the temperature and pressure testing and acquisition unit. Obtain wellhead casing pressure ;
[0010] Step S3: Determine whether the current casing liquid level test data is valid. If the test data is valid, save the current test data, upload the test data through the data wireless communication unit, and execute step S4. If the test data is invalid, return to step S2 and retest. When the number of tests exceeds the set maximum value, output an alarm and stop the test.
[0011] Step S4: The remote control pressure relief module depressurizes the casing. It automatically depressurizes the casing pressure according to the set pressure drop value. After the pressure reaches the set value, it performs a liquid level test through the casing and determines whether the current test data is valid. If valid, the data is saved and uploaded, and step S5 is executed. If the data is invalid, step S2 is executed.
[0012] Step S5: Determine whether the number of test data for the casing fluid level has reached the design value. If the data is less than the design value, proceed to step S4; if it has reached the design value, proceed to step S6.
[0013] Step S6: Obtain the wellhead casing pressure through multiple data acquisitions. Casing temperature The sound velocity of the wellhead casing was obtained by calculating the measured joint band signal. and theoretical speed of sound model Inversion calculations yielded the actual gas composition parameters in oil and gas wells. The test will determine whether the wellbore gas composition parameters are valid. If the wellbore gas composition parameters are valid, step S7 will be executed. If they are invalid, a test failure alarm will be output and the test will end.
[0014] Step S7: Install the portable acoustic fluid level measuring device onto the wellhead tubing and perform a well shut-in operation. Conduct a fluid level test through the tubing to obtain the tubing joint clamp wave time-domain signal. Oil pipe fluid surface wave time domain signal The wellhead casing temperature was obtained through a temperature and pressure testing and acquisition unit. Obtain wellhead casing pressure It then determines whether the tubing test data is valid. If invalid, it continues testing. When the number of tests exceeds the set maximum value, it prompts that the current tubing fluid level test has failed and outputs the casing fluid level test result. If valid, it records the current tubing fluid level test data and executes step S8.
[0015] Step S8: Use sensors to collect the wellhead tubing pressure ,temperature and the gas composition parameters in oil and gas wells obtained by inversion Substitute the established whole-well theoretical sound velocity model The sound velocity of the entire well is calculated, and the depth of the tubing fluid level is obtained by calculating the time corresponding to the position of the fluid level in the tubing.
[0016] In the aforementioned method for simultaneous measurement of fluid levels in gas wells and oil casings based on sound velocity inversion, the method for determining the validity of the fluid level test data in step S3 is as follows: FFT is used to analyze the time-domain signal of the banding wave. Analysis allows for the clear determination of the dominant frequency of the coupling and the accurate calculation of the sound velocity of the wellhead casing. The local extremum method was used to analyze the time-domain signal of the liquid surface wave in the casing. By analyzing the data, we can determine the liquid surface reflection time. .
[0017] In the aforementioned method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion, the automatic casing pressure relief control logic in step S4 is as follows: a fixed pressure change value is set, and pressure is relieved through the pressure relief module. When the real-time casing pressure drop value reaches the set value, the pressure relief module is turned off, and the current pressure value is recorded. The target value for the next pressure relief is the recorded current pressure value minus the set fixed pressure change value.
[0018] In the aforementioned method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion, the theoretical sound velocity model in step S6... It is based on gas pressure ,temperature and gas component parameters Establish, where g represents the total number of types of gas components, with a maximum of 21;
[0019] The theoretical speed of sound model is as follows:
[0020] ,
[0021] Where Z represents the compression factor. Indicates isobaric heat capacity. R represents isobaric heat capacity, R represents the ideal gas constant, and T represents temperature. Indicates gas density, The compressibility Z represents the coefficient of thermal expansion with respect to temperature. The first-order partial differential.
[0022] In the aforementioned method for simultaneous measurement of gas well casing fluid level based on sound velocity inversion, the method for inverting wellbore gas component parameters in step S6 is as follows: based on an improved particle swarm optimization algorithm, using the wellhead casing sound velocity and theoretical sound velocity model. Achieve gas component parameter inversion;
[0023] The standard velocity update and particle position algorithms are improved as follows:
[0024] ,
[0025] ,
[0026] In the formula, It is a constant, a weight used to adjust the particle's approach to the best global position, and its value ranges from 0 to 1; The random numbers are mutually independent and uniformly distributed between [0, 1]. Let be the velocity of the particle in the i-th generation. Let be the position of the particle in the i-th generation; The globally optimal position is found for all particles, where the particle position and velocity are constrained within a certain range, i.e. , .
[0027] In the aforementioned method for simultaneous measurement of gas well casing fluid levels based on sound velocity inversion, the gas component parameters obtained in each inversion in step S6 are not unique and have multiple values. Therefore, it is necessary to calculate the average value and correct the parameters based on multiple inversion results using casing temperature and pressure test data.
[0028] ,
[0029] In the formula, W represents the number of times the liquid level in the casing is tested.
[0030] In the aforementioned method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion, the sound velocity model for the entire well in step S8, oil and casing, is as follows:
[0031] ,
[0032] in, A calculation model representing downhole temperature and well depth. Indicates the well depth. Indicates the wellhead tubing temperature. Represents the formation temperature gradient. The calculation model representing downhole pressure and well depth is used. Polynomial linear fitting is performed on the total well sound velocity data to obtain the relationship between the total well sound velocity and the well depth H. ;
[0033] The method for calculating the liquid level depth in the casing is as follows: the time corresponding to the reflected liquid level position is calculated by using the reflected wave from the liquid surface. The time is approximated by the following piecewise integration. This method allows for the calculation of the actual liquid level depth. ;
[0034] ,
[0035] In the formula, Indicates the segment depth step size. The deviation threshold representing the time integral. This indicates the total number of segments calculated. This indicates the calculated actual liquid level depth.
[0036] The beneficial effects of this invention are as follows: Compared with the prior art, this invention adopts a technical route based on casing sound velocity inversion of gas composition parameters. First, it accurately calculates the annular gas sound velocity using the stable tubing collar reflection signal within the casing annulus. Then, it inverts key parameters such as the relative density and component ratio of the wellbore gas based on the pressure-temperature profile and gas composition within the casing. Based on the principle of gas medium consistency in the same well section, the gas sound velocity within the tubing is calculated. Finally, the tubing fluid level depth is calculated by combining the identified tubing fluid surface reflection wave propagation time with the estimated total well sound velocity of the tubing. This method eliminates the need for separate sound velocity calibration within the tubing, effectively reducing testing interference, simplifying the on-site process, and effectively overcoming the difficulty of directly and accurately measuring the tubing fluid level due to the lack of a collar as a sound velocity reference. It provides a technical path for accurate, low-cost, and portable simultaneous measurement of both tubing and fluid levels. The advantage of this invention lies in its "simultaneous measurement of tubing and fluid levels," utilizing the casing to supplement tubing information, achieving high-precision dual-fluid level measurement without increasing hardware costs. Attached Figure Description
[0037] Figure 1 A flowchart of the oil casing and casing simultaneous measurement process based on casing sound velocity inversion;
[0038] Figure 2 A schematic diagram of the casing acoustic logging installation and testing structure;
[0039] Figure 3 A schematic diagram of the installation and testing structure for tubing acoustic logging;
[0040] Figure 4 The time-domain signal diagram of the liquid level in the casing and the clamp;
[0041] Figure 5 This is a time-domain signal diagram of the oil level in the tubing and the coupling.
[0042] Reference numerals: 1-Portable acoustic liquid level measuring device, 2-Oil pipe, 3-Clamping joint, 4-Casing liquid level, 5-Pressure relief valve, 6-Pressure and temperature transmitter, 7-Oil pipe liquid level. Detailed Implementation
[0043] The present invention will be further described below with reference to the accompanying drawings and embodiments, but this should not be construed as limiting the present invention.
[0044] An embodiment of the present invention provides a method for simultaneous measurement of fluid levels in gas wells based on sound velocity inversion. This method comprises three steps: casing fluid level testing and data collection, wellbore gas component parameter inversion, and tubing fluid level depth calculation. First, multiple sets of valid test data are obtained by conducting fluid level tests under different pressure conditions on the casing. Second, wellbore gas component parameters are obtained through inversion using a sound velocity theoretical calculation model and wellhead casing temperature and pressure. A tubing sound velocity calculation model is then established using the inverted wellbore gas component parameters and tubing pressure and temperature to obtain the sound velocity at different depths throughout the well. Finally, the final tubing fluid level depth is obtained using the corresponding time of the tubing fluid level position and the overall well sound velocity.
[0045] Specifically, the following steps are included:
[0046] Step S1: Install a portable acoustic liquid level measuring device on the gas well casing. The measuring device includes an acoustic generator, a microphone, a hardware filtering sampling circuit unit, a temperature and pressure test acquisition unit, a data wireless communication unit, and a pressure relief module.
[0047] A schematic diagram of the portable dual-channel liquid level testing device with sleeve testing is shown below. Figure 2 As shown, a portable acoustic fluid level measuring device 1 is installed at the wellhead casing interface. A pressure relief valve 5 automatically releases pressure from the wellhead casing. A pressure and temperature transmitter 6 collects the wellhead casing pressure and temperature values, which are used as one of the input parameters for the acoustic velocity inversion component parameters. A set of casing test data is obtained through this device, as shown below. Figure 4 As shown, this includes the time-domain signal of the liquid surface wave. and the time-domain signal of the hoop wave The original signal, with a hardware sampling frequency of 500Hz, is the time-domain signal of the liquid surface wave in a single test. and the time-domain signal of the hoop wave The liquid level testing device continuously collects data for 20 seconds. After obtaining the test data, the validity of the data is judged, and if the data is valid, it is automatically saved and uploaded. The data shows that the hoop wave time domain signal in the casing test data has obvious hoop characteristics.
[0048] A schematic diagram of the portable dual-channel liquid level testing device for oil pipe testing is shown below. Figure 3 As shown, a portable acoustic fluid level measuring device 1 is installed at the wellhead tubing interface. This device collects a set of casing test data, as shown below. Figure 5 As shown in the data, the hoop wave time-domain signal does not exhibit obvious hoop signal characteristics.
[0049] according to Figure 1 The complete process shown demonstrates how simultaneous measurement of the oil level in the jacket and oil sleeve can be achieved by completing the testing and data processing. The specific steps are as follows:
[0050] Step S2: Perform fluid level testing through the casing. The acoustic generator produces sound waves that propagate downhole along the tubing annulus. The microphone receives the reflected sound waves from the casing collar and converts them into electrical signals. The time-domain signal of the casing collar wave is then acquired through a hardware filtering circuit. The system receives the sound waves reflected from the liquid surface inside the casing and converts them into electrical signals. The time-domain signal of the liquid surface wave in the casing is then acquired through a hardware filtering circuit. The wellhead casing temperature was obtained through a temperature and pressure testing and acquisition unit. (°C), to obtain the wellhead casing pressure (MPa);
[0051] Step S3: Determine whether the current casing liquid level test data is valid. If the test data is valid, save the current test data, upload the test data through the data wireless communication unit, and execute step S4. If the test data is invalid, return to step S2 and retest. When the number of tests exceeds the set maximum value, output an alarm and stop the test.
[0052] Step S4: The pressure relief module of the portable acoustic liquid level measuring device is remotely controlled to depressurize the casing. The pressure of the casing is automatically depressurized according to the set pressure drop value. After the pressure reaches the set value, the liquid level is tested through the casing, and it is determined whether the current test data is valid. If it is valid, the data is saved and uploaded, and step S5 is executed. If the data is invalid, step S2 is executed.
[0053] Step S5: Determine whether the number of test data for the casing fluid level has reached the design value. If the data is less than the design value, proceed to step S4; if it has reached the design value, proceed to step S6.
[0054] Step S6: Obtain the wellhead casing pressure through multiple data acquisitions. Casing temperature The sound velocity of the wellhead casing was obtained by calculating the measured joint band signal. and theoretical speed of sound model Inversion calculations yielded the actual gas composition parameters in oil and gas wells. The test will determine whether the wellbore gas composition parameters are valid. If the wellbore gas composition parameters are valid, step S7 will be executed. If they are invalid, a test failure alarm will be output and the test will end.
[0055] Step S7: Install the portable acoustic fluid level measuring device onto the wellhead tubing and perform a well shut-in operation. Conduct a fluid level test through the tubing to obtain the tubing joint clamp wave time-domain signal. Oil pipe fluid surface wave time domain signal The wellhead casing temperature was obtained through a temperature and pressure testing and acquisition unit. (°C), to obtain the wellhead casing pressure (MPa); and determine whether the tubing test data is valid. If invalid, continue testing. When the number of tests exceeds the set maximum value, indicate that the current tubing fluid level test has failed; output the casing fluid level test result; if valid, record the current tubing fluid level test data and execute step S8;
[0056] Step S8: Use sensors to collect the wellhead tubing pressure ,temperature and the gas composition parameters in oil and gas wells obtained by inversion Substitute the established whole-well theoretical sound velocity model The sound velocity of the entire well is calculated, and the depth of the tubing fluid level is obtained by calculating the time corresponding to the position of the fluid level in the tubing.
[0057] The method for determining the validity of the liquid level test data in step S3 is as follows: FFT is used to evaluate the time-domain signal of the clamping wave. Analysis allows for the clear determination of the dominant frequency of the coupling and the accurate calculation of the sound velocity of the wellhead casing. The local extremum method was used to analyze the time-domain signal of the liquid surface wave in the casing. By analyzing the data, we can determine the liquid surface reflection time. .
[0058] The automatic pressure relief control logic for the bushing in step S4 is as follows: A fixed pressure change value is set, and pressure is relieved through the pressure relief module. When the real-time bushing pressure drop reaches the set value, the pressure relief module is shut down. Simultaneously, the current pressure value is recorded, and the target value for the next pressure relief is the recorded current pressure value minus the set fixed pressure change value.
[0059] The theoretical speed of sound model in step S6 It is based on gas pressure ,temperature and gas component parameters Establishment, where g represents the total number of types of gas components, with a maximum of 21.
[0060] The theoretical speed of sound model is as follows:
[0061] ,
[0062] Where Z represents the compression factor. Indicates isobaric heat capacity. R represents isobaric heat capacity, R represents the ideal gas constant, and T represents temperature. Indicates gas density, The compressibility Z represents the coefficient of thermal expansion with respect to temperature. The first-order partial differential.
[0063] Step S6, the method for inverting wellbore gas component parameters, is as follows: based on an improved particle swarm optimization algorithm, using a wellhead casing sound velocity and theoretical sound velocity model. To achieve the inversion of gas component parameters.
[0064] The standard velocity update and particle position algorithms are improved as follows:
[0065] ,
[0066] ,
[0067] In the formula, It is a constant. To adjust the weights that allow particles to move closer to the globally optimal position, It typically takes values between 0 and 1, and its value range is 0-1; The random numbers are mutually independent and uniformly distributed between [0, 1]. Let be the velocity of the particle in the i-th generation. The position of the particle in the i-th generation (specific value of the component parameter); The globally optimal position is found for all particles, where the particle position and velocity are constrained within a certain range, i.e. , .
[0068] In step S6, the gas component parameters obtained from each inversion are not unique and have multiple values. Therefore, it is necessary to calculate the average value and correct the parameters based on multiple inversion results using test data from different temperatures and pressures of the casing.
[0069] ,
[0070] In the formula, W represents the number of times the liquid level in the casing is tested.
[0071] The full-well acoustic velocity model for the casing and tubing in step S8 is as follows:
[0072] ,
[0073] in, A calculation model representing downhole temperature and well depth. Indicates the well depth (m); Indicates the wellhead tubing temperature. This represents the formation temperature gradient. This represents a calculation model for downhole pressure and well depth. Polynomial linear fitting is performed on the total well sound velocity data to obtain the relationship between the total well sound velocity and the well depth H. .
[0074] The method for calculating the liquid level depth in the casing is as follows: the time corresponding to the reflected liquid level position is calculated by using the reflected wave from the liquid surface. The unit is seconds, and the time is approximated by the following piecewise integration. This method allows for the calculation of the actual liquid level depth. ;
[0075] ,
[0076] In the formula, This represents the segmented depth step size. A shorter step size results in higher accuracy in depth calculation, but also longer calculation time. The segmented step size needs to be set appropriately based on the required accuracy of the depth calculation. This represents the deviation threshold for time integration; the smaller the threshold, the higher the accuracy of depth calculation. This indicates the total number of segments calculated. This indicates the calculated actual liquid level depth.
[0077] It should be understood that the specific embodiments described herein are merely ordinary embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion, characterized in that: The process includes three steps: casing fluid level testing and data collection, wellbore gas composition parameter inversion, and tubing fluid level depth calculation. First, multiple sets of valid test data are obtained by conducting fluid level tests under different pressure conditions through the casing. Second, wellbore gas composition parameters are obtained by inverting the casing temperature and pressure based on the sound velocity theoretical calculation model. Using the inverted wellbore gas composition parameters and tubing pressure and temperature, a tubing sound velocity calculation model is established to obtain the sound velocity at different depths throughout the well. Finally, the final tubing fluid level depth is obtained by using the corresponding time of the tubing fluid level position and the sound velocity throughout the well.
2. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 1, characterized in that: The method includes the following steps: Step S1: Install a portable acoustic liquid level measuring device on the gas well casing. The measuring device includes an acoustic generator, a microphone, a hardware filtering sampling circuit unit, a temperature and pressure test acquisition unit, a data wireless communication unit, and a pressure relief module. Step S2: Perform fluid level testing through the casing. The acoustic generator produces sound waves that propagate downhole along the tubing annulus. The microphone receives the reflected sound waves from the casing collar and converts them into electrical signals. The hardware filtering and sampling circuit unit then acquires the time-domain signal of the casing collar wave. Time-domain signal of liquid surface wave in casing It receives the acoustic waves reflected from the liquid surface inside the casing and converts them into electrical signals; the wellhead casing temperature is acquired by the temperature and pressure testing and acquisition unit. Obtain wellhead casing pressure ; Step S3: Determine whether the current casing liquid level test data is valid. If the test data is valid, save the current test data, upload the test data through the data wireless communication unit, and execute step S4. If the test data is invalid, return to step S2 and retest. When the number of tests exceeds the set maximum value, output an alarm and stop the test. Step S4: The remote control pressure relief module depressurizes the casing. It automatically depressurizes the casing pressure according to the set pressure drop value. After the pressure reaches the set value, it performs a liquid level test through the casing and determines whether the current test data is valid. If valid, the data is saved and uploaded, and step S5 is executed. If the data is invalid, step S2 is executed. Step S5: Determine whether the number of test data for the casing fluid level has reached the design value. If the data is less than the design value, proceed to step S4; if it has reached the design value, proceed to step S6. Step S6: Obtain the wellhead casing pressure through multiple data acquisitions. Casing temperature The sound velocity of the wellhead casing was obtained by calculating the measured joint band signal. and theoretical speed of sound model Inversion calculations yielded the actual gas composition parameters in oil and gas wells. The test will determine whether the wellbore gas composition parameters are valid. If the wellbore gas composition parameters are valid, step S7 will be executed. If they are invalid, a test failure alarm will be output and the test will end. Step S7: Install the portable acoustic fluid level measuring device onto the wellhead tubing and perform a well shut-in operation. Conduct a fluid level test through the tubing to obtain the tubing joint clamp wave time-domain signal. Oil pipe fluid surface wave time domain signal The wellhead casing temperature was obtained through a temperature and pressure testing and acquisition unit. Obtain wellhead casing pressure It then determines whether the tubing test data is valid. If invalid, it continues testing. When the number of tests exceeds the set maximum value, it prompts that the current tubing fluid level test has failed and outputs the casing fluid level test result. If valid, it records the current tubing fluid level test data and executes step S8. Step S8: Use sensors to collect the wellhead tubing pressure ,temperature and the gas composition parameters in oil and gas wells obtained by inversion Substitute the established whole-well theoretical sound velocity model The sound velocity of the entire well is calculated, and the depth of the tubing fluid level is obtained by calculating the time corresponding to the position of the fluid level in the tubing.
3. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: The method for determining the validity of the liquid level test data in step S3 is as follows: FFT is used to evaluate the time-domain signal of the banding wave. Analysis allows for the clear determination of the dominant frequency of the coupling and the accurate calculation of the sound velocity of the wellhead casing. The local extremum method was used to analyze the time-domain signal of the liquid surface wave in the casing. By analyzing the data, we can determine the liquid surface reflection time. .
4. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: The automatic pressure relief control logic of step S4 is as follows: a fixed pressure change value is set, and pressure is relieved through the pressure relief module. When the real-time pressure drop value of the casing reaches the set value, the pressure relief module is turned off, and the current pressure value is recorded. The target value for the next pressure relief is the recorded current pressure value minus the set fixed pressure change value.
5. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: The theoretical speed of sound model in step S6 It is based on gas pressure ,temperature and gas component parameters Establish, where g represents the total number of types of gas components, with a maximum of 21; The theoretical speed of sound model is as follows: , Where Z represents the compression factor. Indicates isobaric heat capacity. R represents isobaric heat capacity, R represents the ideal gas constant, and T represents temperature. Indicates gas density, The compressibility Z represents the coefficient of thermal expansion with respect to temperature. The first-order partial differential.
6. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: The method for inverting wellbore gas component parameters in step S6 is as follows: based on an improved particle swarm optimization algorithm, using a wellhead casing sound velocity and theoretical sound velocity model. Achieve gas component parameter inversion; The standard velocity update and particle position algorithms are improved as follows: , , In the formula, It is a constant, a weight used to adjust the particle's approach to the best global position, and its value ranges from 0 to 1; The random numbers are mutually independent and uniformly distributed between [0, 1]. Let be the velocity of the particle in the i-th generation. Let be the position of the particle in the i-th generation; The globally optimal position is found for all particles, where the particle position and velocity are constrained within a certain range, i.e. , .
7. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: In step S6, the gas component parameters obtained from each inversion are not unique and have multiple values. Therefore, it is necessary to calculate the average value and correct the parameters based on multiple inversion results using test data of different temperatures and pressures of the casing. , In the formula, W represents the number of times the liquid level in the casing is tested.
8. The method for simultaneous measurement of oil and casing fluid levels in gas wells based on sound velocity inversion according to claim 2, characterized in that: The full-well acoustic velocity model for the oil casing in step S8 is as follows: , in, A calculation model representing downhole temperature and well depth. Indicates the well depth. Indicates the wellhead tubing temperature. Represents the formation temperature gradient. The calculation model representing downhole pressure and well depth is used. Polynomial linear fitting is performed on the total well sound velocity data to obtain the relationship between the total well sound velocity and the well depth H. ; The method for calculating the liquid level depth in the casing is as follows: the time corresponding to the reflected liquid level position is calculated by using the reflected wave from the liquid surface. The time is approximated by the following piecewise integration. This method allows for the calculation of the actual liquid level depth. ; , In the formula, Indicates the segment depth step size. The deviation threshold representing the time integral. This indicates the total number of segments calculated. This indicates the calculated actual liquid level depth.