An intelligent oil-water detection method

By building an intelligent oil-water detection system and using the least squares method for nonlinear error compensation, the problem of inaccurate measurement of oil-water separation process in crude oil is solved, and higher measurement accuracy and safety are achieved.

CN114894844BActive Publication Date: 2025-05-23HUNAN PETROCHEMICAL VOCATIONAL TECH COLLEGE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110683336.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-18
Publication Date
2025-05-23
Estimated Expiration
2041-06-18

AI Technical Summary

Technical Problem

The prior art is difficult to achieve accurate and real-time measurement of the oil-water separation process in crude oil, resulting in refinery safety accidents and resource waste.

Method used

An intelligent oil-water detection method is used to build an intelligent oil-water detection system, and a nonlinear error compensation model is constructed based on the least squares method, solving each coefficient, and solving the relationship between crude oil moisture content and voltage value at preset temperature.

Benefits of technology

The sensor measurement accuracy is improved, the accuracy of the oil-water separation process is ensured, and safety accidents and resource waste are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114894844B_ABST
    Figure CN114894844B_ABST
Patent Text Reader

Abstract

An intelligent oil-water detection method, the method comprising the steps of: constructing an intelligent oil-water detection system; constructing a nonlinear error compensation model of the intelligent oil-water detection system based on the least squares method; solving the coefficients of the nonlinear error compensation model; solving the relationship between the water content of crude oil and the voltage value at a preset temperature. The present invention uses the least squares method to perform nonlinear error compensation on the electrical signal measured when crude oil is detected to obtain a better effect, improve the measurement accuracy of the sensor, and is sufficient to meet the parameter requirements of the sensor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of crude oil extraction, and in particular relates to an intelligent oil-water detection method. Background Art

[0002] Freshly mined crude oil is not pure due to mixed impurities such as water, so it is necessary to separate oil and water during processing. Due to the different densities of water and oil, under the action of gravity, the water in the crude oil tank will separate from the oil, thus forming an oil-water interface. The separation of oil and water can be achieved by drawing out the water layer and the oil layer separately. In order to better control the entire oil-water separation process, it is necessary to accurately and real-time measure the oil content of the wastewater during the entire process.

[0003] At present, there are some sophisticated equipments abroad that can achieve this purpose better, but they are expensive. On the other hand, the awareness of environmental protection in petrochemical enterprises is increasing, and the oil-water interface sensors currently used can no longer completely solve the problem of variable characteristics of crude oil.

[0004] The intelligent oil-water detection system is mainly used in the automatic dehydrator of the oil tank in the crude oil filling area. It is an important device to ensure that the dehydrator completes the dehydration. Its quality (or accuracy) directly determines the use effect of the automatic dehydrator. The whole process needs to be detected during the dehydration process. Incomplete dehydration is likely to cause a safety accident of "explosion" of the refinery tower due to a sharp increase in pressure, and discharging crude oil as sewage will cause a serious waste of resources and cause serious pollution to the environment. Therefore, in the crude oil filling area, the dehydration of crude oil is very important.

[0005] In recent years, some domestic manufacturers have produced instruments for measuring oil-water interface, but the technology does not meet the requirements. Some manufacturers have adopted other methods to achieve phased results and have achieved certain effects, but the problem of oil leakage still exists. Summary of the invention

[0006] In order to solve the above problems, the present invention provides an intelligent oil-water detection method, which comprises the following steps:

[0007] Build an intelligent oil and water detection system;

[0008] A nonlinear error compensation model of the intelligent oil-water detection system is constructed based on the least squares method;

[0009] Solving the coefficients of the nonlinear error compensation model;

[0010] Solve the relationship between the water content of crude oil and the voltage value at the preset temperature.

[0011] Preferably, the intelligent oil-water detection system includes: a power module, a clock module, a temperature acquisition module, a serial communication module, an excitation signal module, a reset module, a human-machine interface module, a key module, an alarm module, a signal acquisition module, an STM, a transmitting electrode, a receiving electrode and a sampling capacitor, wherein the power module, the clock module, the temperature acquisition module, the serial communication module, the excitation signal module, the reset module, the human-machine interface module, the key module, the alarm module and the signal acquisition module are all connected to the STM, the excitation signal module is connected to the transmitting electrode, and the signal acquisition module is connected to the receiving electrode through the sampling capacitor.

[0012] Preferably, it further comprises: a sampling resistor, a first end of the sampling resistor is connected to the receiving electrode and a second end of the sampling resistor is grounded.

[0013] Preferably, the signal acquisition module includes: a resistor R7, a resistor R8, a resistor R9, a resistor R10, a resistor R11, a resistor R13, a resistor R14, a resistor R15, a resistor R16, a capacitor C12, a capacitor C13, an operational amplifier U5A and an operational amplifier U5B, wherein a first end of the resistor R7 is connected to an output end of the operational amplifier U5B and a first end of the resistor R15 and a second end is connected to the resistor R9, the capacitor C12 and a first end of the capacitor C13, a first end of the resistor R8 is grounded and a second end is connected to a second end of the capacitor C12, a second end of the resistor R9 is connected to the output end of the operational amplifier U5A, and The first end of the resistor R10 is grounded and the second end is connected to the negative input terminal of the operational amplifier U5A, the first end of the resistor R11 is connected to the negative input terminal of the operational amplifier U5A and the second end is connected to the output terminal of the operational amplifier U5A, the first end of the resistor R13 is connected to the receiving electrode and the second end is connected to the positive input terminal of the operational amplifier U5B, the first end of the resistor R14 is connected to the negative input terminal of the operational amplifier U5B and the second end of the resistor R15 and the second end is grounded, the first end of the resistor R16 is connected to the receiving electrode and the second end is grounded, and the first end of the capacitor C13 is connected to the first end of the capacitor C12 and the second end is grounded.

[0014] Preferably, the temperature acquisition module includes: resistor R17, resistor R18, resistor R19, resistor R20, temperature measuring resistor PT1000, capacitor C1, voltage stabilizing chip U3 and differential amplifier U6, wherein the input end of the voltage stabilizing chip U3 is connected to the power supply end and the output end is respectively connected to the first ends of the resistors R17 and R18, the first end of the capacitor C1 is connected to the power supply end and the second end is grounded, the second end of the resistor R17 is connected to the first end of the temperature measuring resistor PT1000, the second end of the temperature measuring resistor PT1000 is grounded, the second end of the resistor R18 is connected to the negative input end of the differential amplifier U6, the first end of the resistor R19 is connected to the negative input end of the differential amplifier U6 and the second end is grounded, the first end of the resistor R20 is connected to the negative input end of the differential amplifier U6 and the second end is connected to the output end of the differential amplifier U6, the second end of the capacitor C1 is grounded, and the moving end of the resistor R17 is connected to the positive input end of the differential amplifier U6.

[0015] Preferably, the step of solving the coefficients of the nonlinear error compensation model comprises the steps of:

[0016] Obtaining a sample between the moisture content and the voltage measurement value at a first preset temperature;

[0017] Eliminate abnormal data points in the sample;

[0018] Obtaining a calibrated value of moisture content at a second preset temperature;

[0019] Calculating the sum of the mean square error of the calibration value and the sample;

[0020] Solving the coefficients of the nonlinear error compensation model by using a multivariate function extreme value method;

[0021] A relationship between the moisture content, the voltage value and the temperature is obtained.

[0022] Preferably, the relationship between the moisture content, the voltage value and the temperature is:

[0023] ,

[0024] Wherein, y represents the water content of the crude oil, V represents the voltage value, and T represents the temperature.

[0025] Preferably, at 30°C, the relationship between the moisture content and the temperature is:

[0026] ,

[0027] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0028] Preferably, at 35°C, the relationship between the moisture content and the temperature is:

[0029] ,

[0030] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0031] Preferably, at 40°C, the relationship between the moisture content and the temperature is:

[0032] ,

[0033] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0034] The present invention provides an intelligent oil-water detection method, which adopts the least squares method for nonlinear error compensation to ensure the accuracy of system measurement and achieve the expected effect; the least squares method is used to perform nonlinear error compensation on the electrical signal measured when crude oil is detected to obtain better results, improve the measurement accuracy of the sensor, and is sufficient to meet the parameter requirements of the sensor. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0036] Figure 1 It is an overall schematic diagram of an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0037] Figure 2 It is a schematic diagram of an excitation signal module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0038] Figure 3 It is a schematic diagram of a signal acquisition module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0039] Figure 4 It is a schematic diagram of a temperature acquisition module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0040] Figure 5 It is a schematic diagram of an information processing module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0041] Figure 6It is a schematic diagram of a reset module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0042] Figure 7 It is a schematic diagram of a serial communication module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0043] Figure 8 It is a schematic diagram of a power supply module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0044] Fig. 9 It is a schematic diagram of a human-machine interface module in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0045] Fig.10 It is a main program flow chart of an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0046] Fig.11 It is a signal acquisition program flow chart of an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0047] Fig.12 It is a program diagram of a least square method medium interface judgment module of an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention;

[0048] Fig.13 It is an abnormal point analysis diagram of data in an intelligent oil-water detection system in an intelligent oil-water detection method provided by the present invention. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0050] like Figure 1In an embodiment of the present application, the present invention provides an intelligent oil-water detection system, including: a power module, a clock module, a temperature acquisition module, a serial communication module, an excitation signal module, a reset module, a human-machine interface module, a key module, an alarm module, a signal acquisition module, an STM, a transmitting electrode, a receiving electrode and a sampling capacitor, wherein the power module, the clock module, the temperature acquisition module, the serial communication module, the excitation signal module, the reset module, the human-machine interface module, the key module, the alarm module and the signal acquisition module are all connected to the STM, the excitation signal module is connected to the transmitting electrode, and the signal acquisition module is connected to the receiving electrode through the sampling capacitor.

[0051] After the intelligent oil-water detection system provided by the present application is started, it is first initialized, and a sinusoidal AC frequency signal of 10kHz is generated by the STM (STM32F single-chip microcomputer), and the AC frequency signal is output through the excitation signal module. The AC frequency signal is transmitted to the medium through the transmitting electrode, and the voltage signal after passing through the medium (equivalent to an impedance circuit) is received by the signal acquisition module, and after data amplification, it is filtered and denoised through the filter. At the same time, the temperature signal collected by the temperature acquisition module is sent to the STM, and the STM performs error compensation and the result is displayed on the display. The system can communicate with the host computer through the serial communication module and perform signal communication.

[0052] like Figure 1 In an embodiment of the present application, an intelligent oil-water detection system provided by the present invention further includes: a sampling resistor, a first end of the sampling resistor is connected to the receiving electrode and a second end is grounded.

[0053] In the embodiment of the present application, the voltage signal of the sampling resistor after passing through the medium (equivalent to an impedance circuit) is received by the signal acquisition module.

[0054] like Figure 2 In the embodiment of the present application, the excitation signal module adopts a 10kHz sinusoidal AC frequency signal. The intelligent oil-water detection system transmits a 10 kHz sinusoidal AC frequency signal and outputs the signal to the outside through the transmitting electrode in the medium. The system uses STM (information processing module STM32F407) itself to generate a 10kHz sinusoidal AC frequency signal. According to the requirements of the intelligent oil-water detection system itself for a 10kHz sinusoidal AC frequency signal, the amplitude must reach 5V, so an LM358AP operational amplifier is added externally to amplify the signal amplitude to meet the requirements of the designed circuit. The relationship between the input and output of the in-phase amplifier signal is as follows:

[0055]

[0056] The LM358AP operational amplifier is a high input impedance common-phase amplifier with a closed-loop gain of (R5+R6) / R5. Its output signal is in phase with the input signal. The LM358AP operational amplifier uses a 12V power supply and has the advantages of unity gain bandwidth (about 1MHz), internal frequency compensation, low power consumption, high DC voltage gain (about 100dB) and a wide power supply voltage range. It can perform common-phase amplification. The information processing controller STM32F407 generates a sinusoidal AC frequency signal controlled by an internal program, which is converted by the internal digital-to-analog conversion function and output from the DAC port to the operational amplifier LM358AP.

[0057] like Figure 3 In the embodiment of the present application, the signal acquisition module includes: a resistor R7, a resistor R8, a resistor R9, a resistor R10, a resistor R11, a resistor R13, a resistor R14, a resistor R15, a resistor R16, a capacitor C12, a capacitor C13, an operational amplifier U5A and an operational amplifier U5B, wherein a first end of the resistor R7 is connected to an output end of the operational amplifier U5B and a first end of the resistor R15 and a second end is connected to the resistor R9, the capacitor C12 and a first end of the capacitor C13, a first end of the resistor R8 is grounded and a second end is connected to a second end of the capacitor C12, and a second end of the resistor R9 is connected to the output end of the operational amplifier U5A end, the first end of the resistor R10 is grounded and the second end is connected to the negative input terminal of the operational amplifier U5A, the first end of the resistor R11 is connected to the negative input terminal of the operational amplifier U5A and the second end is connected to the output terminal of the operational amplifier U5A, the first end of the resistor R13 is connected to the receiving electrode and the second end is connected to the positive input terminal of the operational amplifier U5B, the first end of the resistor R14 is connected to the negative input terminal of the operational amplifier U5B and the second end of the resistor R15 and the second end is grounded, the first end of the resistor R16 is connected to the receiving electrode and the second end is grounded, and the first end of the capacitor C13 is connected to the first end of the capacitor C12 and the second end is grounded.

[0058] The signal acquisition module is mainly responsible for collecting the output signal passing through the measured medium, and sending it to the STM (information processing controller) after analog-to-digital conversion. The sinusoidal AC 10kHz frequency signal generated by the excitation signal module outputs the excitation signal through the transmitting electrode, and a suitable receiving electrode is designed to complete the signal reception. The received signal is converted into a sampling voltage signal through a 1 kilo-ohm sampling resistor. To ensure the accuracy of the measurement, the OP284 operational amplifier is used for in-phase amplification. The OP284 chip is a rail-to-rail input and output operational amplifier with single power supply, wide bandwidth (4 MHz), low offset voltage (65 µV), unity gain stability, high slew rate (4.0 V / µs) and low noise, making the performance of the entire circuit more superior.

[0059] The signal obtained by the signal acquisition module is easily affected by the external environment and is often accompanied by many interference signals. It is necessary to accurately extract the signal and eliminate the noise. A filter needs to be designed for signal extraction and noise elimination. In the circuit, the OP284 operational amplifier and the corresponding resistors and capacitors are selected to form a bandpass filter. Among them, the OP284 chip has an operational amplifier function. The millivolt signal is amplified by the front-stage OP284 operational amplifier and then amplified by the OP284 secondary stage again. In this way, the measurement signal is easier to be recognized and received by the information processing module STM32F407, which effectively improves the circuit's ability to resist external environmental interference. The signal processed by the bandpass filter is sent to the ADC port of the information processing module STM32F407 to complete the analog-to-digital conversion, and its signal is more stable and accurate.

[0060] like Figure 4 In the embodiment of the present application, the temperature acquisition module includes: a resistor R17, a resistor R18, a resistor R19, a resistor R20, a temperature measuring resistor PT1000, a capacitor C1, a voltage stabilizing chip U3 and a differential amplifier U6, wherein the input end of the voltage stabilizing chip U3 is connected to the power supply end and the output end is respectively connected to the first ends of the resistors R17 and R18, the first end of the capacitor C1 is connected to the power supply end and the second end is grounded, the second end of the resistor R17 is connected to the first end of the temperature measuring resistor PT1000, the second end of the temperature measuring resistor PT1000 is grounded, the second end of the resistor R18 is connected to the negative input end of the differential amplifier U6, the first end of the resistor R19 is connected to the negative input end of the differential amplifier U6 and the second end is grounded, the first end of the resistor R20 is connected to the negative input end of the differential amplifier U6 and the second end is connected to the output end of the differential amplifier U6, the second end of the capacitor C1 is grounded, and the moving end of the resistor R17 is connected to the positive input end of the differential amplifier U6.

[0061] The temperature acquisition module is mainly responsible for measuring the ambient temperature of the medium. The temperature information is converted into a standard electrical signal and sent to the information processing module STM32F407. After processing, the temperature is displayed. The temperature measuring element used in the circuit of the temperature acquisition module is a platinum resistor (Pt1000), which has a measurement range of -50-200℃ and has the characteristics of high measurement accuracy, good linearity, and convenient long-distance, multi-point, centralized measurement and automatic control.

[0062] The measuring bridge is provided with a standard +3V DC regulated power supply by the voltage regulator chip U3 (REF3030 chip) to ensure the stable operation of the measuring bridge. The platinum resistor is placed in the measuring bridge. When the temperature changes, it can quickly convert the temperature into a change in resistance, so that the bridge loses balance. The bridge outputs an electrical signal corresponding to the temperature change, which is sent to the AD623 chip. The AD623 chip is a differential amplifier, which can accurately amplify the voltage difference of the measuring bridge by 11 times with a 10K amplification feedback resistor. According to the circuit design requirements, the maximum output voltage of the AD623 chip is 3.3V, which means that the maximum voltage difference electrical signal output by the measuring bridge can only be 300mV (3300 / 11=300mV), which also limits the entire temperature measurement range. According to the principle of the bridge arm voltage division of the measuring bridge, the temperature measurement range can measure up to 131℃, so the temperature measurement range of the temperature measurement circuit is 0-131℃ (the actual working temperature is 30-40℃), which can fully meet the working requirements of the intelligent oil and water detection system.

[0063] like Figure 5 In the embodiment of the present application, the intelligent oil-water detection system uses the microprocessor controller STM32F407 as the information processing module, which is responsible for all data processing of the entire system. The STM32F407 has a 32-bit ARM Cortex-M4 core, a low power supply voltage, and a wide operating temperature range.

[0064] like Figure 6 In the embodiment of the present application, the information processing module STM32F407 has a built-in reset function, which can complete the power-on reset function, that is, automatically initialize each time the power is turned on. When the program runs into an infinite loop, the reset module can implement the external reset function. The reset module needs to provide an external working power supply of +3.3V when working. Press the reset button, and the information processing module STM32F407 RESET connection pin will reset at a low level, completing the program initialization of the information processing controller. The reset module circuit diagram is shown in Figure 6 shown.

[0065] like Figure 7In the embodiment of the present application, the serial communication module is mainly used to realize the data communication function between the intelligent oil-water detection system and the host computer. The intelligent oil-water detection system adopts RS-232 serial communication mode. RS-232 serial communication has few transmission lines, low long-distance transmission cost, convenient wiring and easy implementation. Generally, the host computer has its own RS-232 serial communication interface, so the intelligent oil-water detection system can be connected to the host computer very conveniently and quickly to transmit data. The sensor system hardware circuit adopts a 9-wire interface, and the transmission baud rate is set to 120kbit / s.

[0066] Since TTL integrated circuits are used in the information processing module STM32F407 system, its logic level 0-0.8V represents logic zero, and greater than 2.4V represents logic 1, while the logic level of the RS-232 serial communication interface -15V--3V represents logic 1, and +3V-+15V represents logic zero. The logic levels of the two are inconsistent, so the conversion between the TTL logic level and the RS-232 logic level is required to realize the communication between the information processing module STM32F407 system and the host computer. The SP3232 chip is used in this module to realize the conversion between the TTL logic level and the RS-232 logic level. The SP3232 chip can meet the requirements as long as it provides a +3.3V DC voltage, and has the advantages of strong adaptability, moderate price, and simple hardware interface.

[0067] like Figure 8 In the embodiment of the present application, the power module is responsible for providing a DC regulated power supply when the system is working. The power supply required in this system mainly includes the information processing module STM32F407 working voltage +3.3V, the excitation source power supply +12V and the signal receiving module working voltage +12V.

[0068] The +3.3V working voltage required by the information processing module STM32F407 and other peripheral devices is first obtained by stabilizing the +12V DC voltage through the LM2940-5V chip to obtain a +5V DC regulated power supply. After the +5V voltage comes out, it is stabilized by the AMS1117-3.3V chip to obtain a DC regulated power supply +3.3V, which can be used for power supply.

[0069] like Fig. 9In the embodiment of the present application, the human-machine interface module mainly realizes the display function of information such as measurement and alarm. The display module uses a seven-pin 0.96-inch OLED display, also known as an organic electro-laser display, which has the advantages of self-luminescence (no backlight source required), fast response speed, high resolution (128*64), thin thickness, low power consumption (only 0.08 watts when the full screen is lit), wide voltage (supports 3-5V voltage), high contrast, wide operating temperature range (-40-70℃), small IO port occupation (only 4 IO ports are required to drive at most), and wide viewing angle. The OLED display is driven by the SSD1306 chip. After the power is turned on, the display will display normally when the correct driver is run.

[0070] The intelligent oil-water detection system uses C language to write software code, which mainly completes system initialization, transmission of sinusoidal AC frequency signals, reception of voltage signals, signal processing and storage, etc. According to the functional modules, the intelligent oil-water detection system divides the software into the main program module, temperature detection module, least squares method medium interface judgment module, etc.

[0071] The main program of the intelligent oil-water detection system completes the power-on initialization of the hardware circuit of the intelligent oil-water detection system, and automatically realizes the functional objectives of the system according to the program flow. After the sensor system is powered on, the CPU is first initialized (including internal interrupt module, clock module, I / O module, timer module, 10kHz sinusoidal AC excitation signal module, communication module, A / D module, D / A module, output control module and alarm module, etc.), and the temperature detection module program and the least squares method medium interface judgment automatic calculation module program are called to complete the judgment of the oil-water medium interface, and combined with the OLED display program (the organic laser display screen must pass a valid program to display information.), the temperature, interface status, clock, date and alarm information and other information are displayed on the display interface. Design the algorithm and specific code for each module to form a software design plan. The main program flow chart is as follows Fig.10 shown.

[0072] When the intelligent oil and water detection system starts working, the temperature detection module is also powered on and enters the working state. The temperature information obtained by the thermal resistor is converted into an electrical signal using a measuring bridge, amplified by a differential amplifier, and then processed to complete signal standardization. The temperature signal is sent to the information processing module STM32F407, and the internal A / D conversion module completes the conversion of analog signals and digital signals, and then sent to the system CPU to complete data storage. The signal acquisition program mainly includes initialization, information sampling, A / D conversion module, information storage, etc. The signal acquisition program flow chart is as follows Fig.11 shown.

[0073] After the intelligent oil-water detection system is powered on, the excitation signal module starts working immediately and outputs a sinusoidal AC frequency signal. The signal receiving module amplifies, filters and de-noises the received signal and sends it to the information processing module STM32F407 through the ADC port. The analog signal and digital signal are converted by the internal A / D conversion module of the information processing module STM32F407 and sent to the system CPU. At this time, the temperature information provided by the temperature detection module is collected here and waits for commands. The least squares medium interface judgment module linearly fits the voltage-temperature signal according to the calculation formula for the new voltage and temperature information received in the same period, obtains a more accurate voltage-temperature data curve, and processes the data accordingly. The program starts to judge the medium located at the sensor position interface according to the given information, and sends the judgment result to the display interface. At the same time, the PID subroutine is called for calculation control, and a 4-20mA current signal is output externally according to the judgment result to control the opening of the regulating valve. The least squares medium interface judgment module program mainly includes the module initialization, information sampling, A / D conversion module, least squares voltage-temperature signal linear fitting, PID control module, D / A conversion module, interface judgment, information storage and other functions, which are completed in three functional steps. The least squares medium interface judgment module program diagram is as follows Fig.12 shown.

[0074] In an embodiment of the present application, the present invention provides an intelligent oil-water detection method, the method comprising the steps of:

[0075] S1: Build an intelligent oil-water detection system;

[0076] S2: constructing a nonlinear error compensation model of the intelligent oil-water detection system based on the least squares method;

[0077] S3: solving each coefficient of the nonlinear error compensation model;

[0078] S4: Solve the relationship between the water content of crude oil and the voltage value at a preset temperature.

[0079] In the embodiment of the present application, the intelligent oil-water detection system in step S1 is the above Figure 1-Figure 9 The intelligent oil-water detection system described in will not be described here.

[0080] In the embodiment of the present application, a large number of experiments have found that the water content and temperature have the greatest impact on the above-mentioned intelligent oil-water detection system during operation, that is, different water contents and different temperatures have different AC impedances, and the AC voltage signals obtained by the detection system are also different, and there are large errors. The water content P of crude oil is a binary nonlinear function of the AC voltage measurement value U and the temperature T, that is,

[0081] ,

[0082] The model shown in formula (1-2) is constructed according to the regression analysis method. Considering the fitting accuracy and calculation complexity, the regression equation adopts a quadratic polynomial, that is,

[0083] ,

[0084] In the formula, P represents the water content, U represents the voltage value of the intelligent oil-water detection system, and T represents the temperature value of the intelligent oil-water detection system. Represents polynomial coefficients.

[0085] Therefore, the expression of the nonlinear error compensation model in step S2 is equation (1-3).

[0086] In the embodiment of the present application, solving the coefficients of the nonlinear error compensation model in step S3 includes the steps of:

[0087] Obtaining a sample between the moisture content and the voltage measurement value at a first preset temperature;

[0088] Eliminate abnormal data points in the sample;

[0089] Obtaining a calibrated value of moisture content at a second preset temperature;

[0090] Calculating the sum of the mean square error of the calibration value and the sample;

[0091] Solving the coefficients of the nonlinear error compensation model by using a multivariate function extreme value method;

[0092] A relationship between the moisture content, the voltage value and the temperature is obtained.

[0093] In the embodiment of the present application, the coefficients in equation (1-3) are solved by the least square method. . Assume that the system collects The AC voltage data of different water contents at different temperatures are used as samples is the target value of moisture content at normal temperature (i.e., calibration value), is the sum of the mean square error of the calibration value and the sample, that is:

[0094] (1-4),

[0095] Where: .

[0096] when When it is the minimum, the coefficient can be obtained by finding the extreme value of the multivariate function ,Right now

[0097] (1-5),

[0098] Right now

[0099] (1-6),

[0100] In the formula (1-7)

[0101] therefore,

[0102] ,

[0103] (1-9).

[0104] In the embodiment of the present application, some data were obtained through experiments, mainly the corresponding voltage values ​​when the temperature was 30-40°C and the water content was 0-100%, as shown in Table 1:

[0105] Table 1 Voltage values ​​corresponding to moisture content (30-40℃)

[0106]

[0107] Due to system errors, some data may not conform to basic rules, so it is necessary to first remove abnormal points. Through analysis, it is found that the training data basically conforms to certain rules and there are no abnormal points. Fig.13 shown.

[0108] For these random variables, we can find the covariance between the three parameters of voltage, temperature and moisture content according to the definition of covariance, that is:

[0109]

[0110] Therefore, the covariance matrix is

[0111] (1-11)

[0112] Among them, the elements on the diagonal are the variances of each random variable, and the elements on the off-diagonal are the covariances between the two random variables, that is,

[0113] (1-12)

[0114] In order to study the influence of temperature and output voltage on moisture content, correlation analysis is used, and the covariance method is used to analyze and study, and the correlation values ​​between the three factors can be obtained: the first factor is moisture content, the second factor is voltage value, and the third factor is temperature. It can be seen from formula (1-12) that moisture content is mainly related to output voltage, while temperature has little effect on it. Therefore, the main factor affecting moisture content is output voltage.

[0115] Using Matlab software, according to the least square method shown in formulas (1-5)-(1-9), the relationship between water content, voltage value and temperature is solved as follows:

[0116] (1-13).

[0117] In the embodiment of the present application, the specific operation of solving the relationship between the water content of crude oil and the voltage value at the preset temperature in step S4 is: the output voltage is affected by the temperature and the water content. The water content at different temperatures can be obtained by using the least squares method and experimental data. and voltage value The expressions with temperature are shown in equations (1-14), (1-15), and (1-16).

[0118] (1-14),

[0119] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0120] (1-15),

[0121] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0122] (1-16),

[0123] Wherein, y represents the water content of the crude oil, and V represents the voltage value.

[0124] From the above formula, it can be seen that the value of the output voltage is mainly affected by the moisture content and is less affected by the temperature, but it will increase slightly with the increase of temperature.

[0125] The present invention provides an intelligent oil-water detection method, which adopts the least squares method for nonlinear error compensation to ensure the accuracy of system measurement and achieve the expected effect; the least squares method is used to perform nonlinear error compensation on the electrical signal measured when crude oil is detected to obtain better results, improve the measurement accuracy of the sensor, and is sufficient to meet the parameter requirements of the sensor.

[0126] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or the equivalent forms of such scope and boundaries.

Claims

1. An intelligent oil-water detection method, It is characterized in that The method comprises the steps of: Build an intelligent oil and water detection system; A nonlinear error compensation model of the intelligent oil-water detection system is constructed based on the least squares method; Solving the coefficients of the nonlinear error compensation model; Solve the relationship between the water content of crude oil and the voltage value at the preset temperature; Wherein, solving the coefficients of the nonlinear error compensation model comprises the steps of: Obtaining a sample between the moisture content and the voltage measurement value at a first preset temperature; Eliminating abnormal data points in the sample; Obtaining a calibrated value of moisture content at a second preset temperature; Calculating the sum of the mean square error of the calibration value and the sample; Solving the coefficients of the nonlinear error compensation model by using a multivariate function extreme value method; Obtaining a relationship between the moisture content, the voltage value and the temperature; The relationship between the moisture content, the voltage value and the temperature is: , Wherein, y represents the water content of the crude oil, V represents the voltage value, and T represents the temperature.

2. The intelligent oil-water detection method according to claim 1, It is characterized in that The intelligent oil-water detection system includes: a power module, a clock module, a temperature acquisition module, a serial communication module, an excitation signal module, a reset module, a human-machine interface module, a key module, an alarm module, a signal acquisition module, an STM, a transmitting electrode, a receiving electrode and a sampling capacitor, wherein the power module, the clock module, the temperature acquisition module, the serial communication module, the excitation signal module, the reset module, the human-machine interface module, the key module, the alarm module and the signal acquisition module are all connected to the STM, the excitation signal module is connected to the transmitting electrode, and the signal acquisition module is connected to the receiving electrode through the sampling capacitor.

3. The intelligent oil-water detection method according to claim 2, It is characterized in that Also includes: A sampling resistor, wherein a first end of the sampling resistor is connected to the receiving electrode and a second end of the sampling resistor is grounded.

4. The intelligent oil-water detection method according to claim 2, It is characterized in that The signal acquisition module includes: resistor R7, resistor R8, resistor R9, resistor R10, resistor R11, resistor R13, resistor R14, resistor R15, resistor R16, capacitor C12, capacitor C13, operational amplifier U5A and operational amplifier U5B, wherein the first end of the resistor R7 is connected to the output end of the operational amplifier U5B and the first end of the resistor R15 and the second end is connected to the resistor R9, the capacitor C12 and the first end of the capacitor C13, the first end of the resistor R8 is grounded and the second end is connected to the second end of the capacitor C12, the second end of the resistor R9 is connected to the output end of the operational amplifier U5A, and ... first end of the resistor R9, the capacitor C12 and the first end of the capacitor C13, the first end of the resistor R8 is grounded and the second end is connected to the second end of the capacitor C12, the second end of the resistor R9 is connected to the output end of the operational amplifier U5A, and the resistor R7 is connected to the output end of the operational amplifier U5B and the first end of the resistor R15 and the first end of the resistor R7 is connected to the output end of the operational amplifier U5B and the first end of the resistor R7 is connected to the output end of the operational amplifier U5B and the first end of the resistor R7 is connected to the output end of the operational amplifier U5B and the first end of the resistor R7 is connected to the output end of the operational amplifier U5 The first end of the resistor R10 is grounded and the second end is connected to the negative input terminal of the operational amplifier U5A, the first end of the resistor R11 is connected to the negative input terminal of the operational amplifier U5A and the second end is connected to the output terminal of the operational amplifier U5A, the first end of the resistor R13 is connected to the receiving electrode and the second end is connected to the positive input terminal of the operational amplifier U5B, the first end of the resistor R14 is connected to the negative input terminal of the operational amplifier U5B and the second end of the resistor R15 and the second end is grounded, the first end of the resistor R16 is connected to the receiving electrode and the second end is grounded, and the first end of the capacitor C13 is connected to the first end of the capacitor C12 and the second end is grounded.

5. The intelligent oil-water detection method according to claim 2, It is characterized in that The temperature acquisition module includes: resistor R17, resistor R18, resistor R19, resistor R20, temperature measuring resistor PT1000, capacitor C1, voltage stabilizing chip U3 and differential amplifier U6, wherein the input end of the voltage stabilizing chip U3 is connected to the power supply end and the output end is respectively connected to the first ends of the resistors R17 and R18, the first end of the capacitor C1 is connected to the power supply end and the second end is grounded, the second end of the resistor R17 is connected to the first end of the temperature measuring resistor PT1000, the second end of the temperature measuring resistor PT1000 is grounded, the second end of the resistor R18 is connected to the negative input end of the differential amplifier U6, the first end of the resistor R19 is connected to the negative input end of the differential amplifier U6 and the second end is grounded, the first end of the resistor R20 is connected to the negative input end of the differential amplifier U6 and the second end is connected to the output end of the differential amplifier U6, the second end of the capacitor C1 is grounded, and the moving end of the resistor R17 is connected to the positive input end of the differential amplifier U6.

6. The intelligent oil-water detection method according to claim 1, It is characterized in that At 30°C, the relationship between the moisture content and the temperature is: , Wherein, y represents the water content of the crude oil, and V represents the voltage value.

7. The intelligent oil-water detection method according to claim 1, It is characterized in that At 35°C, the relationship between the moisture content and the temperature is: , Wherein, y represents the water content of the crude oil, and V represents the voltage value.

8. The intelligent oil-water detection method according to claim 1, It is characterized in that At 40°C, the relationship between the moisture content and the temperature is: , Wherein, y represents the water content of the crude oil, and V represents the voltage value.

Citation Information

Patent Citations

  • Temperature acquisition module and intelligent oil-water detection system

    CN216847580U

  • Intelligent oil-water detection system

    CN216847581U