Oil-water well production curve drawing method based on OLE automation

Through OLE automation-based methods, oil and water well data in Excel format and dynamically draw production curves in Excel, the problem of slow data sorting and chart drawing speed in the existing technology is solved, and the rapid automatic drawing and secondary editing of oil and water well production curves are realized.

CN120107398APending Publication Date: 2025-06-06PETROCHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311646195.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-04
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

When drawing oil and water well production curves, data sorting and chart drawing speeds are slow, and rely on complex software and data format requirements, resulting in cumbersome and error-prone.

Method used

Using an OLE automation-based method, the Excel format oil and water well data provided by users through the Delphi development platform is read and standardized, and the data required to draw the curve is saved using the csv file, and the production curve of a single well or block is dynamically drawn in Excel.

Benefits of technology

It realizes the rapid automatic drawing of oil and water well production curves. The drawn curves are vector graphics, and support secondary editing and use, avoiding the time-consuming and labor-intensive and error-prone problems of manual data sorting, and fully expanding the functions of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107398A_ABST
    Figure CN120107398A_ABST
Patent Text Reader

Abstract

An oil-water well production curve drawing method based on OLE automation belongs to the technical field of petroleum and natural gas exploration and development, and comprises the following steps: reading and standardizing Excel format oil-water well data provided by a user by using a Delphi OLE automation method according to user requirements, storing data required by curve drawing by using a csv file, drawing a curve according to a well number range selected by the user, and drawing the oil-water well production curve according to the well number range selected by the user. And an Excel application program is opened in an OLE Automation mode, and a production curve of a single well or a block is dynamically drawn in Excel. According to the method, the OLE Automation technology is applied, a Delphi application program can directly control the Excel through codes, functions provided by the Excel are called to complete oil-water well monthly report data reading, standardization and chart curve drawing, and the functions of software are fully expanded. By using the method, convenient, fast and accurate drawing can be realized, the problems of time and labor consumption and high error rate in manual data arrangement are avoided, the method does not depend on Windows and Office system versions, and the drawn curve can be randomly scaled and can be used for secondary editing and use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of automatic production curve drawing, and in particular relates to an oil and water well production curve drawing method based on OLE automation. Background Art

[0002] The application range of production curves is very wide, from real-time observation of oil well production status, to block development effect evaluation, to macro-control, etc. Therefore, it is very meaningful to develop a software that can quickly and accurately make production curves to improve work efficiency. There are two conventional methods for drawing production curves: one is to use the built-in functions of office software to make drawings. This method replaces the traditional manual drawing and is an important change. However, with the popularization of computers and the continuous improvement of people's work efficiency, office software is very troublesome in sorting data and the drawing speed is also very slow; the second is to rely on purchased professional software. This purchased software package includes a lot of content, and the production curve is only one aspect. In addition, since production data is dynamic data, it is also troublesome to continuously sort and add according to the software's requirements for data format. Summary of the invention

[0003] In order to solve the above-mentioned problems, the present invention proposes: a method for drawing oil and water well production curves based on OLE automation. According to user needs, the OLE automation method of Delphi is used to read and standardize the oil and water well data in Excel format provided by the user, and the csv file is used to save the data required for drawing the curve. The curve is drawn according to the well number range selected by the user, and the Excel application is opened by OLEAutomation to dynamically draw the production curve of a single well or block in Excel.

[0004] Furthermore, the Delphi application directly controls Excel with code and calls the functions provided by Excel to complete the reading, standardization and chart curve drawing of oil and water well monthly report data.

[0005] Furthermore, OLE automation was used to open the Excel application for drawing charts, and the Delphi development platform was used to write a program to automatically draw the production curves, achieving the rapid drawing of seven curves in two categories.

[0006] Furthermore, the two major categories are oil well production curve and water well injection curve, which specifically include seven production curves: single well production curve, block oil production curve, block oil production curve, block decline curve, single well water injection curve, block water injection curve, and block water injection curve.

[0007] Furthermore, the drawing process of the first type of curve: single well oil production curve is as follows: including the following steps:

[0008] S1. Configure ADO database connection;

[0009] S2, collect and organize well numbers;

[0010] S3. Draw the single well oil production curve.

[0011] Furthermore, in step S1, the ADO database connection is configured: using the ADO component of Delphi and the OLEDB data interface provided by the Windows system, the Excel data table provided by the user is accessed as a database, wherein the monthly report file of oil and water wells in Excel format is used as the database body, including three "oil wells", "time horizons" and "water wells".

[0012] Furthermore, in step S2, the well numbers are collected and sorted: after connecting to the data source, the TADOQuery component accesses the monthly report form of oil and water wells in Excel format through TADOConnection, and uses the TListBox component to display all well numbers, and single or multiple selections are made for them, corresponding to the drawing of single-well and multi-well curves respectively.

[0013] Furthermore, in step S3, a single well oil production curve is drawn: according to the well number selected by the user, a SQL statement is used to filter out matching records from the oil well data table and the time layer table, including the well number, time, production days, daily liquid production, daily oil production, daily water production, and production time layer data, and save them in the ADOQuery data set;

[0014] Create an Excel OLE automation object through the CreateOleObject statement, and store the relevant data used to draw the single well oil production curve in the Excel application, including time, daily liquid production, daily oil production, water content percentage, production days, production time layer, cumulative oil production, and cumulative water production. These data are read from the ADOQuery data set;

[0015] After completing the data filling, select the area for drawing the curve chart according to the number of rows and fields in the data table, use Excel macro statements in Delphi to add a chart object, and give a drawing coordinate of appropriate size.

[0016] The beneficial effects of the present invention are as follows: the present invention realizes the fast and automatic drawing of seven curves of two categories based on single wells and blocks according to the existing monthly report data of oil and water wells and user needs, and the drawn curves are vector graphics, which support secondary editing and use; using OLE Automation technology, the Delphi application can directly control Excel with code, call the functions provided by Excel to complete the reading, specification and chart curve drawing of monthly report data of oil and water wells, and fully expand the functions of the software. The present invention can realize convenient, fast and accurate drawing, avoid the time-consuming and labor-intensive manual data sorting and the problem of easy errors, and is not dependent on the Windows and Office system versions. The drawn curves can be arbitrarily scaled and can be used for secondary editing and use. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flowchart for the program design of the present invention;

[0018] Figure 2 It is a single well oil production curve diagram of the present invention;

[0019] Figure 3 Draw a main interface diagram for four oil production curves of the present invention;

[0020] Figure 4 The main interface diagram is drawn for the three water injection curves of the present invention. DETAILED DESCRIPTION

[0021] In order to make the technical means and objectives adopted by the present invention easy to understand, the present invention is further described below in conjunction with a specific implementation method. A method for drawing oil and water well production curves based on OLE automation can be considered to use Delphi's OLE automation method to read the oil and water well data in Excel format provided by the user according to user needs, and draw curves according to the well number range selected by the user. The specific method is to use OLE Automation to open the Excel application, dynamically draw the production curve of a single well or a block in Excel, and use OLE Automation technology. The Delphi application can directly control Excel with code, call the functions provided by Excel to complete the reading, specification and chart curve drawing of oil and water well monthly report data, and fully expand the functions of the software, thereby achieving convenient, fast and accurate drawing. The drawn curve can be arbitrarily scaled and can be used for secondary editing and use.

[0022] Read and standardize the oil and water well data in Excel format provided by the user, use csv files to save the data required for drawing curves, and draw curves according to the well number selected by the user. The specific method is to use OLE Automation to open the Excel application and dynamically draw the production curve of a single well or block in Excel. The key method is to use the OLE automation used in the present invention to open the Excel application and draw charts, and use the Delphi development platform to write a program to realize the automatic drawing of production curves, and realize the rapid drawing of two major categories of curves. The two major categories are oil well production curves and water well injection curves, specifically including seven production curves: single well production curve, block production curve (horizontal), block production curve (capacity), block decline curve (first month alignment), single well water injection curve, block water injection curve (horizontal), block water injection curve (capacity), wherein the "curve drawing" process uses the key method used in the present invention.

[0023] The principles of drawing oil production curves and water injection curves are basically the same. Therefore, taking the single well oil production curve and block oil production curve (capacity) as examples, the implementation principles and processes are explained.

[0024] The following is an explanation of the first type of curve - the process of drawing a single well production curve. The program design flow chart is as follows: Figure 1 shown.

[0025] The first step is to configure the ADO database connection. Using the ADO component of Delphi and the OLEDB data interface provided by the Windows system, the Excel data table provided by the user is used as a database access, where the monthly report file of oil and water wells in Excel format is the main body of the database, including "Oil Wells", "Time Layers" and "Water Wells".

[0026] The next step is to collect and organize the well numbers. After connecting to the data source, the TADOQuery component accesses the monthly report table of oil and water wells in Excel format through TADOConnection. In the SQL property, add a similar statement text:

[0027] 'select distinct well number from [oil well $]'

[0028] To facilitate user selection, the TListBox component is used to display all well numbers, which can be selected single or multiple, corresponding to the needs of single-well and multi-well curve drawing respectively.

[0029] Then the single well production curve is drawn. According to the well number selected by the user, SQL statements are used to filter out matching records from the oil well data table and time layer table, including well number, time, production days, daily liquid production, daily oil production, daily water production, production time layer and other data, and save them in the ADOQuery data set.

[0030] OLE automation enables access to Excel application objects from Delphi applications, which allows Delphi applications to automatically perform Excel application operations. To draw a single well oil production curve chart, create an Excel OLE automation object through the CreateOleObject statement, and store the relevant data used to draw the single well oil production curve in the Excel application. Including time, daily liquid production, daily oil production, water content percentage, production days, production time layer, cumulative oil production, cumulative water production, these data can be read from the ADOQuery data set.

[0031] After completing the data filling, select the area for drawing the curve chart according to the number of rows and fields in the data table, use Excel macro statements in Delphi to add a chart object, and give a drawing coordinate of appropriate size.

[0032] In order to utilize space and meet aesthetic requirements, the curve line type is set. The left vertical axis displays two numerical series of daily oil production and daily liquid production in tons; the right axis displays two series of water content percentage and production days. For clear display, the density of the constant axis scale is determined according to the number of date values. The user-selected well sign is used as the title of the chart using a macro statement. The left axis title is set to "Production (t / d)", the right axis is set to "Water Content (%) | Production Days", and the horizontal axis title is set to "Date".

[0033] Assign the area containing valid data to the chart object, and set the starting point of the curve to start from the coordinate axis. Different colors and shapes are used to distinguish the line type and connection point shape to facilitate user comparison and viewing.

[0034] So far, the process of drawing the single well production curve has been explained. Figure 2 The figure shows an example of a single well production curve.

[0035] The second type of oil production curve in the first category: block oil production curve. The following is an explanation of its drawing process: The block oil production curve is a curve chart drawn for multiple wells. The SQL statement query function of the TADOQuery component is used to filter out the data records of the relevant well numbers and sort them by time. After creating an Excel OLE application, the month, daily liquid production, daily oil production, water content, number of wells opened, cumulative oil production, and cumulative water production data are written in the cells in a loop.

[0036] The cumulative oil production, cumulative water production, and production days of the same well are accumulated and summed up respectively. The monthly liquid production and monthly oil production are summed up and divided by the sum of production days to get the monthly liquid production and monthly oil production values. The water content percentage is obtained by dividing the difference between the monthly liquid production and the monthly oil production by the previous month's liquid production. In terms of chart drawing, the left vertical axis is still the production series, the right vertical axis is the water content and the number of wells opened, and the horizontal axis is the month.

[0037] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A method for drawing oil and water well production curves based on OLE automation, It is characterized in that According to user needs, use Delphi's OLE automation method to read and standardize the oil and water well data in Excel format provided by the user, use csv files to save the data required for drawing curves, draw curves according to the well number range selected by the user, use OLE Automation to open the Excel application, and dynamically draw the production curve of a single well or block in Excel.

2. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 1, It is characterized in that The Delphi application directly controls Excel with code and calls the functions provided by Excel to complete the reading, standardization and chart curve drawing of oil and water well monthly report data.

3. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 2, It is characterized in that OLE automation is used to open Excel applications to draw charts, and the Delphi development platform is used to write programs to automatically draw production curves, thereby achieving rapid drawing of seven types of curves in two categories.

4. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 3, It is characterized in that The two major categories are oil well production curves and water well injection curves, which specifically include seven types of production curves: single well oil production curve, block oil production curve, block oil production curve, block decline curve, single well water injection curve, block water injection curve, and block water injection curve.

5. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 4, It is characterized in that The first type of curve: The process of drawing a single well production curve is as follows: It includes the following steps: S1. Configure ADO database connection; S2, collect and organize well numbers; S3. Draw the single well oil production curve.

6. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 5, It is characterized in that In step S1, the ADO database connection is configured: the ADO component of Delphi and the OLEDB data interface provided by the Windows system are used to access the Excel data table provided by the user as the database, wherein the monthly report file of oil and water wells in Excel format is used as the database body, including three "oil wells", "time horizons" and "water wells".

7. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 6, It is characterized in that In the step S2, the well numbers are collected and sorted: after connecting to the data source, the TADOQuery component accesses the monthly report form of oil and water wells in Excel format through TADOConnection, and uses the TListBox component to display all well numbers, and single or multiple selections are made for them, corresponding to the drawing of single-well and multi-well curves respectively.

8. The method for drawing oil and water well production curves based on OLE automation as claimed in claim 7, It is characterized in that In step S3, a single well oil production curve is drawn: according to the well number selected by the user, a SQL statement is used to filter out matching records from the oil well data table and the time layer table, including the well number, time, production days, daily liquid production, daily oil production, daily water production, and production time layer data, and save them in the ADOQuery data set; Create an Excel OLE automation object through the CreateOleObject statement, and store the relevant data used to draw the single well oil production curve in the Excel application, including time, daily liquid production, daily oil production, water content percentage, production days, production time layer, cumulative oil production, and cumulative water production. These data are read from the ADOQuery data set; After completing the data filling, select the area for drawing the curve chart according to the number of rows and fields in the data table, use Excel macro statements in Delphi to add a chart object, and give a drawing coordinate of appropriate size.