A hydrocarbon determination instrument data acquisition and analysis method based on a neural network
By using a neural network-based data acquisition method and color sensors and servers to analyze data from hydrocarbon analyzers, the problems of manual operation hazards and large errors in hydrocarbon analyzers are solved. This achieves automated and accurate data acquisition and analysis, protects personnel safety, and improves analysis efficiency and accuracy.
Patent Information
- Application Number
- CN202410621570.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-05-20
AI Technical Summary
Existing hydrocarbon analyzers suffer from several problems during data acquisition and analysis, including the risk of exposure to ultraviolet light during manual operation, significant human eye error, low automation, poor data repeatability, and a lack of image acquisition and data processing functions.
A neural network-based data acquisition method is adopted, which uses color sensors and embedded development boards to record color information and analyzes it through a server. It combines data acquisition from color sensors on position marker rulers and slide rails, and uses recurrent neural networks to identify color information, thereby realizing automated data acquisition and analysis.
It enables unmanned data collection, reduces human error, improves data repeatability, protects personnel safety, enhances analysis efficiency and accuracy, and supports automatic data calculation and storage.
Smart Images

Figure CN118603949B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of liquid petroleum hydrocarbon determination technology, and particularly relates to a data acquisition and analysis method for a hydrocarbon analyzer based on a neural network. Background Technology
[0002] In the testing of refined petroleum products such as gasoline and jet fuel, accurately determining the content of saturated hydrocarbons, olefins, and aromatics in liquid petroleum products such as automotive gasoline, diesel, and aviation kerosene can reflect important quality control indicators such as blending component ratios, octane number content, and product color. This is of great significance for the production, transportation, and use of refined petroleum products. Hydrocarbon analyzers are the main analytical instruments used in the national standard "Determination of Hydrocarbons in Liquid Petroleum Products" (GB / T 11132). They offer rapid and accurate analysis, are easy to operate, and have low equipment costs, making them widely used in the quality monitoring of liquid petroleum products. Several current mandatory national standards, including "Automotive Gasoline" (GB 17930-2016), "No. 3 Jet Fuel" (GB 6537-2018), and "Aero Engine Fuel" (GB 1787-2018), specify the olefin and aromatic content indicators and testing methods. The detection method must comply with the national standard GB / T 11132 "Determination of Hydrocarbons in Liquid Petroleum Products - Fluorescent Indicator Adsorption Method". The hydrocarbon analyzer, as the analytical instrument of the GB / T 11132 standard method, plays an extremely important role in the quality monitoring of fuel oil products, and its application is widespread in large-scale refining and chemical enterprises and research institutes at home and abroad.
[0003] Because the color recognition, data reading, and calculation of hydrocarbon analyzers require a large amount of manual operation, the level of automation is extremely low, which is labor-intensive, and the analytical results are highly susceptible to human factors. Currently, the main problems are as follows:
[0004] (1) During the entire test process, under ultraviolet light, the target color displayed on the silica gel adsorption column needs to be marked, read and calculated manually, which causes the analysts to be directly exposed to ultraviolet light, which is extremely harmful to human eyes and bare skin.
[0005] (2) Due to the differences in color sensitivity and judgment standards among different analysts, there are significant differences in the identification and reading of target colors, resulting in large data errors and poor repeatability.
[0006] (3) The hydrocarbon analyzer lacks image acquisition function during the test. After the analyst manually marks the target color with the slider and records the corresponding set of data, he immediately moves the slider again to mark the next set of data. As a result, only the recorded marked data and the final result of the calculation can be retained. It is impossible to save the image of hydrocarbon separation on the adsorption column during sample separation and the image of the identification situation when the analyst marks the target color. Therefore, it is impossible to trace the source of hydrocarbon component separation in the sample during analysis.
[0007] (4) Commercially available instruments lack workstations and software, relying solely on manual calculation of the read data, which consumes a lot of time and labor costs, resulting in low work efficiency and a lack of data processing and analysis process saving functions. Summary of the Invention
[0008] The purpose of this invention is to address the shortcomings in the current process of reading, identifying and recording results from hydrocarbon analyzers by providing a data acquisition and analysis method for hydrocarbon analyzers based on neural networks. This method uses a color sensor and an embedded development board to record color information and send it to a server for analysis and processing.
[0009] The objective of this invention is achieved through the following technical solution: a method for data acquisition and analysis of hydrocarbon analyzers based on neural networks, wherein the method acquires data from hydrocarbon analyzers through data acquisition equipment and analyzes the acquired data through a server;
[0010] The data acquisition device includes a position marker ruler, and the position marker ruler and the adsorption column are vertically arranged on both sides of the slide rail. The slide rail is equipped with a first color sensor facing the adsorption column and a second color sensor facing the position marker ruler, which can slide synchronously along the slide rail. The position marker ruler is distributed with black and white stripes, and two adjacent stripes form an adjustment step.
[0011] A complete color acquisition of the adsorption column from bottom to top / top to bottom is considered as one scan cycle, and each scan cycle acquires a color information sequence. The acquired color information is sent to the embedded development board. The embedded development board queries the color information of the corresponding change time point acquired by the first color sensor based on the color change time point from black to white / from white to black acquired by the second color sensor in a single scan, and calculates the sampling position according to the adjustment step size to form a data table with position information.
[0012] The data acquisition and analysis method of the hydrocarbon analyzer includes the following steps:
[0013] (1) Constructing a training set: Collect and label the color information sequences during the adsorption process and after adsorption to construct the first training set; collect the color information sequence after adsorption and label the positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring, and the other red ring. Based on the labeled positions, classify the components at different sampling positions of the color information sequence into four categories: saturated hydrocarbons, alkenes, aromatics, and others to construct the second training set.
[0014] (2) Establish and train a recurrent neural network: Use the first training set to train the first recurrent neural network to identify whether the color information sequence of the input adsorption column is a color information sequence that has been adsorbed; use the second training set to train the second recurrent neural network to identify the component categories at different sampling positions of the adsorption column;
[0015] (3) Data acquisition and analysis of the adsorption column to be tested: The color information sequence of the adsorption column to be tested is collected to form a data table with position information and sent to the server; the server inputs the color information sequence in the data table into the first recurrent neural network to determine whether adsorption is completed. If it is determined to be completed, a stop measurement command is sent to the embedded development board. Then, the color information sequence in the data table is input into the second recurrent neural network to output the component category of each sampling position of the adsorption column and calculate the content of each component.
[0016] Further, the width of the white stripe on the position marker ruler is denoted as 'a', and the width of the black stripe is denoted as 'b'. Adjacent black and white stripes form an adjustment step size, with step size l = a + b. The moving speeds of the two color sensors are the same, denoted as 'v', and the sampling frequencies of the two color sensors are the same, denoted as 'F'. The following conditions must be met: and
[0017] Furthermore, the adsorption column is 1.8m long, the position marking ruler is 2m long, a = 0.85mm, b = 0.15mm, l = 1mm, v = 10mm / s, and F = 1kHz.
[0018] Furthermore, the formation of the data table containing location information specifically involves:
[0019] Two color sensors move at a constant speed on a slide rail. The first color sensor and the second color sensor respectively send the collected color information of the adsorption column and the color information of the position marker ruler to the embedded development board. The embedded development board records the color information and the sending time to form data table D1 and data table D2 respectively.
[0020] The embedded development board processes D2, records the time points when the color changes from black to white / from white to black in a single scan to form a change time table T, queries D1 according to the change time points in T to form an ordered data table A, and calculates the sampling position of the color information of the first color sensor according to the sequence number and the adjustment step size to form a data table B with position information.
[0021] Furthermore, during the processing of D2 by the embedded development board, when scanning from bottom to top, the time points of color change from black to white are recorded; when scanning from top to bottom, the time points of color change from white to black are recorded. The resulting ordered data table A is in the form of: serial number - sampling time point - adsorption column color information data pair. For bottom-to-top scanning, the serial numbers are 1, 2, ..., n, where n is the number of all change time points collected in a single scanning cycle. For top-to-top scanning, the serial numbers are n, n-1, ..., 1. The sampling position of the color information of the first color sensor is calculated based on the serial number * the step size l, and A is expanded into a data table B with position information. The data table B is in the form of: serial number - sampling time point - adsorption column color information - adsorption column position data pair.
[0022] Furthermore, the construction of the training set specifically involves:
[0023] Color information during the adsorption process is collected using a data acquisition device and formed into a data table with location information, marked as incomplete; color information after adsorption is completed is collected using the same data acquisition device and formed into a data table with location information, marked as complete; the above collection and marking process is repeated to construct the first training set;
[0024] The color information of the adsorption process is collected by a data acquisition device and formed into a data table with location information. The positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring, and the second red ring are marked. The region from the front of the adsorption column to the position of the first strong yellow fluorescence is saturated hydrocarbons, the region from the position of the first strong yellow fluorescence to the position of the first strong blue fluorescence is alkenes, and the region from the position of the first strong blue fluorescence to the red-brown ring is aromatics. By marking the positions, the components at different sampling positions of the color information sequence are divided into four categories: saturated hydrocarbons, alkenes, aromatics, and others. The above collection and labeling process is repeated to construct a second training set.
[0025] Furthermore, the construction and training of the first recurrent neural network are specifically as follows:
[0026] The input to the first recurrent neural network is a sequence containing RGB color information of several adsorption columns. The network includes a data preprocessing part and a model architecture part. The data preprocessing part normalizes the input RGB color information.
[0027] The input of the first recurrent neural network consists of three neurons, which respectively receive the red, green and blue color components in the color information;
[0028] The hidden layer of the first recurrent neural network consists of four parts: a reset gate, an update gate, a candidate state, and a hidden state.
[0029] In one round, a sequence of n color information is input into the first recurrent neural network at time step t, where t equals 1, 2, ..., n; the input at time step t is x. t , where x t This represents the t-th color information in the sequence;
[0030] Reset Gate: r t =σ(W r ·[h t-1 ,x t ]+b r ), where r t W is the reset gate vector at time step t, σ is the sigmoid activation function, and W is the gate vector at time step t. r It is the weight matrix of the reset gate, b r It is the offset term for resetting the door, [h t-1 ,x t The symbol ] represents the concatenation of the previous hidden state and the current input. For the input at t=1, all values of h0 are initialized to 0.
[0031] Update Gate: z t =σ(W z ·[h t-1 ,x t ]+b z ), where z t W is the update gate vector at time step t. z It is the weight matrix of the updated gate, b z It updates the bias term of the gate;
[0032] Candidate state: in is the candidate state at time step t, tanh is the hyperbolic tangent activation function, W is the weight matrix of the candidate state, b is the bias term of the candidate state, and * indicates element-wise multiplication.
[0033] Hidden state:
[0034] The output layer of the first recurrent neural network is a fully connected layer with 1 neuron, representing the probability of successful adsorption. The function of the output layer is executed only when t = n, and the expression of the output layer is y. out =softmax(W y *h n +by ), where softmax is the softmax activation function of the output layer, W y h is the weight matrix of the output layer. n Let b be the hidden state at t=n. y For the bias term of the output layer, y out This indicates the probability that adsorption is complete.
[0035] The loss function of the first recurrent neural network is Where N is the number of color information sequences input during the training of the first recurrent neural network, i.e., the number of training rounds, y i p is the true label of the i-th color information sequence. i It is the probability that the adsorption is complete when the i-th color information sequence is predicted by the first recurrent neural network.
[0036] Furthermore, the construction and training of the second recurrent neural network are as follows:
[0037] The input to the second recurrent neural network is a sequence containing RGB color information of several adsorption columns. The network includes a data preprocessing part and a model architecture part; the data preprocessing part normalizes the input RGB color information.
[0038] The input of the second recurrent neural network consists of three neurons, which respectively receive the red, green and blue color components in the color information;
[0039] The hidden layer of the second recurrent neural network consists of four parts: reset gate, update gate, candidate state, and hidden state.
[0040] In one round, a sequence of n color information is input into the second recurrent neural network at time step t, where t equals 1, 2, ..., n; the input at time step t is x. t , where x t This represents the t-th color information in the sequence;
[0041] Reset Gate: r t =σ(W r ·[h t-1 ,x t ]+b r ), where r t W is the reset gate vector at time step t, σ is the sigmoid activation function, and W is the gate vector at time step t. r It is the weight matrix of the reset gate, b r It is the offset term for resetting the door, [h t-1 ,x t The symbol ] represents the concatenation of the previous hidden state and the current input. For the input at t=1, all values of h0 are initialized to 0.
[0042] Update Gate: z t =σ(W z ·[h t-1 ,x t ]+b z ), where z t W is the update gate vector at time step t. z It is the weight matrix of the updated gate, b z It updates the bias term of the gate;
[0043] Candidate state: in is the candidate state at time step t, tanh is the hyperbolic tangent activation function, W is the weight matrix of the candidate state, b is the bias term of the candidate state, and * indicates element-wise multiplication.
[0044] Hidden state:
[0045] The output layer of the second recurrent neural network is a fully connected layer with 4 neurons, representing the probabilities of outputting saturated hydrocarbons, alkenes, aromatics, and others at step t. The expression for the output layer is y. t =softmax(W y ·h t +b y ), where t = 1, 2, ..., n, softmax is the softmax activation function of the output layer, and W y h is the weight matrix of the output layer. t The hidden state when t, b y For the bias term of the output layer, y t Let t be a vector representing the probability of saturated hydrocarbons, alkenes, aromatics, and others at step t. The class with the highest output probability is taken as the class at step t, and finally a sequence of length n is obtained to identify the hydrocarbon class.
[0046] The loss function of the second recurrent neural network is Where M is the number of color information sequences input during the training of the second recurrent neural network, n represents the total number of steps in the sequence, c represents the hydrocarbon category, and y mtc p represents the indicator function that the hydrocarbon category is c when the step number is t in the m-th color information sequence. mtc This represents the probability that the hydrocarbon category is class c when the number of steps is t in the m-th color information sequence predicted by the second recurrent neural network.
[0047] Furthermore, the color information acquisition of the adsorption column to be tested is specifically as follows: two color sensors move from bottom to top on a slide rail, and the color information sequence of the adsorption column to be tested is collected by a data acquisition device to form a data table with position information. When the movement reaches the top of the adsorption column, the movement stops for a period of time and the data table is sent to the server. The movement then starts from top to bottom and continues to collect color information sequences. When the movement reaches the bottom of the adsorption column, the movement stops for a period of time and the data table is sent to the server. The above process is repeated continuously.
[0048] Furthermore, when the server receives a data table containing position information of the adsorption column to be tested, it records the receiving time to form a receiving time-data table pair. The color information sequence in the data table is then input into a trained first recurrent neural network to determine whether adsorption is complete. If it is determined to be complete, a stop measurement command is sent to the embedded development board, and the last receiving time-data table pair is saved as the final data of this measurement. The color information sequence in the data table of the final data is then input into a trained second recurrent neural network to output the component categories of each sampling position of the adsorption column. The content of saturated hydrocarbons, olefins, and aromatics is calculated based on the percentage of each category of sampling positions to the total number of sampling positions.
[0049] The beneficial effects of this invention are as follows:
[0050] 1. Enables unmanned data collection, eliminating the need for analysts to be directly exposed to ultraviolet light, thus protecting personnel safety;
[0051] 2. The color information of the adsorption column is collected by a color sensor, eliminating human visual error and ensuring good repeatability;
[0052] 3. Since the color sensor does not require imaging, the distance between it and the adsorption column can be almost zero, which facilitates miniaturization and is unaffected by ambient light;
[0053] 4. Use a position marker ruler to obtain the sampling position with an accuracy of up to 1mm;
[0054] 5. Using a specially designed one-dimensional recurrent neural network, it consumes little memory and can capture long-term dependencies in color information sequences, resulting in highly accurate results;
[0055] 6. The server can automatically calculate and save the content of saturated hydrocarbons, olefins and aromatics in petroleum samples for easy retrieval and archiving. Attached Figure Description
[0056] Figure 1 A structural diagram of a data acquisition device provided in an embodiment of the present invention;
[0057] Figure 2 A structural diagram of a position marker ruler provided in an embodiment of the present invention;
[0058] Figure 3 A flowchart of a data acquisition and analysis method for a hydrocarbon analyzer based on a neural network, provided in an embodiment of the present invention. Detailed Implementation
[0059] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0060] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0061] Hydrocarbon analyzers are widely used to determine the composition of petroleum samples. However, there are many shortcomings in the reading, identification, and recording of hydrocarbon analyzer results. This invention designs a data acquisition device to collect data from hydrocarbon analyzers and analyzes the collected data through a server.
[0062] The specific structure of the data acquisition device designed in this invention is as follows: Figure 1 As shown, the system includes a position marker 1, a first color sensor 2, a second color sensor 3, a slide rail 4, a stepper motor 5, and an embedded development board 6. The adsorption column 7 and the position marker 1 of the hydrocarbon analyzer are vertically and parallelly arranged on both sides of the slide rail 4. The slide rail 4 is equipped with the first color sensor 2 and the second color sensor 3, controlled by the stepper motor 5, which slide synchronously along the slide rail. The first color sensor 2 faces the adsorption column 7 to collect color information from the adsorption column, and the second color sensor 3 faces the position marker 1 to collect color information from the position marker 1. The color information collected by the color sensors is sent to the embedded development board 6 and finally to the server for data analysis.
[0063] The length of the adsorption column of the hydrocarbon analyzer is denoted as L1, and the length of the position marker ruler is denoted as L2, where L2 ≥ L1. The structure of the position marker ruler designed in this invention is as follows: Figure 2 As shown, the position marker ruler has alternating black and white stripes. The distance between adjacent black stripes, which is the width of the white stripe, is denoted as 'a', and the distance between adjacent white stripes, which is the width of the black stripe, is denoted as 'b'. The adjacent black and white stripes form an adjustment step size, with the step size l = a + b. The measurement accuracy can be improved by modifying the width of the black stripe and / or the width of the white stripe.
[0064] The adsorption column length of existing hydrocarbon analyzers is typically 1.2m to 1.8m. In this embodiment, for example... Figure 2As shown, the adsorption column length L1 = 1.8m, the position marker ruler length L2 = 2m, a = 0.85mm, b = 0.15mm, and l = 1mm.
[0065] This invention captures color information using a color sensor and converts the captured color information into RGB or YCrCb values. The OPT4048 high-speed, high-precision three-color XYZ color sensor manufactured by Texas Instruments can be used.
[0066] In this invention, a server refers to a computer cluster that can process received data, has networking capabilities, and can store and remotely access data.
[0067] The data acquisition process for the hydrocarbon analyzer is as follows:
[0068] A stepper motor drives the first and second color sensors to move synchronously at a constant speed along the vertical direction on a slide rail. The first color sensor captures the color information of the adsorption column, and the second color sensor captures the color information of the position marker. The speed at which the stepper motor moves the first and second color sensors in the vertical direction is denoted as v. The sampling frequency of both the first and second color sensors is set to F. To obtain accurate position information, the relationship between them needs to satisfy: and In this embodiment, v = 10 mm / s and F = 1 kHz.
[0069] A complete color acquisition of the adsorption column from bottom to top or from top to bottom is considered as one scan cycle. Each scan cycle acquires a set of color information sequences, containing several color information.
[0070] Initially, the first and second color sensors are positioned directly opposite the bottom of the adsorption column and the position marker ruler, respectively. The stepper motor is activated, and the two color sensors move synchronously from bottom to top on the slide rail at a speed v, collecting color information at a sampling frequency F. The first color sensor acquires the color information of the adsorption column at sampling frequency F and sends it to the embedded development board. The embedded development board records the color information and the corresponding transmission time to form data table D1. The second color sensor acquires the color information of the position marker ruler at sampling frequency F and sends it to the embedded development board. The embedded development board records the color information and the corresponding transmission time to form data table D2.
[0071] The embedded development board processes the color information sent by the second color sensor. When the color sensor scans from bottom to top, it records the time points when the color changes from black to white; when the color sensor scans from top to bottom, it records the time points when the color changes from white to black. Each scan cycle forms a change time table T. The embedded development board queries the data table D1 of the first color sensor according to each change time point in the change time table T, forming an ordered data table A. The ordered data table A has the form: sequence number - sampling time point - adsorption column color information data pair. For bottom-to-top scanning, the sequence number is 1, 2, ..., n, where n is the number of all change time points collected in a single scan cycle. For top-to-top scanning, the sequence number is n, n-1, ..., 1. In this embodiment, n = L2 / l = 2m / 1mm = 2000. Based on the sequence number * the step size l, the sampling position of the color information acquired by the first color sensor is calculated. The ordered data table A is expanded into a data table B with position information. The data table B has the form: sequence number - sampling time point - adsorption column color information - adsorption column position data pair.
[0072] The data acquisition and analysis method for hydrocarbon analyzers based on neural networks provided in this invention embodiment, such as... Figure 3 As shown, it includes the following steps:
[0073] (1) Constructing the training set
[0074] Color information during the adsorption process is collected using a data acquisition device and formed into a data table B, marked as incomplete; color information after adsorption is completed is collected using the same data acquisition device and formed into a data table B, marked as complete; the above collection and marking process is repeated to construct the first training set.
[0075] The color information of the adsorption process was collected using a data acquisition device and formed into a data table B. The positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring, and the second red ring were manually marked and recorded. The region from the front of the adsorption column to the first strong yellow fluorescence position was saturated hydrocarbons, the region from the first strong yellow fluorescence position to the first strong blue fluorescence position was alkenes, and the region from the first strong blue fluorescence position to the red-brown ring position was aromatics. The components at different positions in the color information sequence were divided into four categories based on the marked positions: saturated hydrocarbons, alkenes, aromatics, and others. The above collection and marking process was repeated to construct a second training set.
[0076] (2) Establish and train a recurrent neural network
[0077] The recurrent neural network is trained iteratively multiple times using the first training set through backpropagation to finally generate the first recurrent neural network, which can identify whether the color information sequence of the input adsorption column is a color information sequence that has been adsorbed. Since the input data is one-dimensional, the first recurrent neural network here adopts a one-dimensional recurrent neural network.
[0078] The recurrent neural network was trained iteratively multiple times using the second training set through backpropagation, and finally a second recurrent neural network was generated. This second recurrent neural network can identify the component categories at different sampling positions of the adsorption column, including saturated hydrocarbons, alkenes, aromatics, and others. Since the input data is one-dimensional, a one-dimensional recurrent neural network is used here.
[0079] Specifically, the input to the first recurrent neural network is a sequence containing RGB color information of n adsorption columns. The network consists of two parts: a data preprocessing part and a model architecture part.
[0080] The data preprocessing section normalizes the input RGB color information, converting its value range from 0 to 255 to 0 to 1.
[0081] The input of the first recurrent neural network consists of three neurons, which respectively receive the red, green and blue color components in the color information;
[0082] The hidden layer of the first recurrent neural network consists of four parts: reset gate, update gate, candidate state, and hidden state.
[0083] In one round, a sequence of n RGB color information is input into the first recurrent neural network at time step t, where t equals 1, 2, ..., n;
[0084] The input at time step t is x t , where x t This is the t-th color information in the sequence, which is a vector containing the three colors red, green, and blue;
[0085] Reset Gate: r t =σ(W r ·[h t-1 ,x t ]+b r ), where r t W is the reset gate vector at time step t, σ is the sigmoid activation function, and W is the gate vector at time step t. r It is the weight matrix of the reset gate, b r It is the offset term for resetting the door, [h t-1 ,x t The ] symbol represents the concatenation of the previous hidden state and the current input. For the input at t=1, all values of h0 are initialized to 0, and r t It is a 256-dimensional vector;
[0086] Update Gate: z t =σ(W z ·[h t-1 ,x t ]+b z ), where z t W is the update gate vector at time step t. z It is the weight matrix of the updated gate, b z It is the bias term of the updated gate, z t It is a 256-dimensional vector;
[0087] Candidate state: in Let be the candidate state at time step t, tanh be the hyperbolic tangent activation function, W be the weight matrix of the candidate state, b be the bias term of the candidate state, and * denote element-wise multiplication. It is a 256-dimensional vector;
[0088] Hidden state: Hidden state h t It is updated by gate z t Controlled, combined with the previous hidden state h t-1 and candidate states h t It is a 256-dimensional vector;
[0089] The output layer of the first recurrent neural network is a fully connected layer with 1 neuron, representing the probability of successful adsorption. The output layer function is executed only when t = n, and its expression is y. out =softmax(W y ·h n +b y ), where softmax is the softmax activation function of the output layer, W y h is the weight matrix of the output layer. n Let b be the hidden state at t=n. y For the bias term of the output layer, y out This indicates the probability that adsorption is complete.
[0090] The loss function of the first recurrent neural network is Where N is the number of color information sequences input during the training of the first recurrent neural network, i.e., the number of training rounds, y i p is the true label of the i-th color information sequence, taking the value 0 or 1. 0 indicates incomplete adsorption, and 1 indicates complete adsorption. i is the probability that the adsorption of the i-th color information sequence is complete, as predicted by the first recurrent neural network, and log represents the natural logarithm.
[0091] Specifically, the input to the second recurrent neural network is a sequence containing RGB color information of n adsorption columns. The network consists of two parts: a data preprocessing part and a model architecture part.
[0092] The data preprocessing section normalizes the input RGB color information, converting its value range from 0 to 255 to 0 to 1.
[0093] The input to the second recurrent neural network consists of three neurons, which respectively receive the red, green and blue color components in the color information;
[0094] The hidden layer of the second recurrent neural network consists of four parts: reset gate, update gate, candidate state, and hidden state.
[0095] In one round, a sequence of n RGB color information is input into the second recurrent neural network at time step t, where t equals 1, 2, ..., n;
[0096] The input at time step t is x t , where x t This is the t-th color information in the sequence, which is a vector containing the three colors red, green, and blue;
[0097] Reset Gate: r t =σ(W r ·[h t-1 ,x t ]+b r ), where r t W is the reset gate vector at time step t, σ is the sigmoid activation function, and W is the gate vector at time step t. r It is the weight matrix of the reset gate, b r It is the offset term for resetting the door, [h t-1 ,x t The ] symbol represents the concatenation of the previous hidden state and the current input. For the input at t=1, all values of h0 are initialized to 0, and r t It is a 512-dimensional vector;
[0098] Update Gate: z t =σ(W z ·[h t-1 ,x t ]+b z ), where z t W is the update gate vector at time step t. z It is the weight matrix of the updated gate, b z It is the bias term of the updated gate, z t It is a 512-dimensional vector;
[0099] Candidate state: in Let be the candidate state at time step t, tanh be the hyperbolic tangent activation function, W be the weight matrix of the candidate state, b be the bias term of the candidate state, and * denote element-wise multiplication. It is a 512-dimensional vector;
[0100] Hidden state: Hidden state h t It is updated by gate z t Controlled, combined with the previous hidden state h t-1 and candidate states h t It is a 512-dimensional vector;
[0101] The output layer of the second recurrent neural network is a fully connected layer with 4 neurons. These neurons represent the probabilities of the output being saturated hydrocarbons, alkenes, aromatics, or other hydrocarbons at step t. The expression for the output layer is y. t =softmax(W y ·h t +b y ), where t = 1, 2, ..., n, softmax is the softmax activation function of the output layer, and W y h is the weight matrix of the output layer. t The hidden state when t, b y For the bias term of the output layer, y t Let t be a vector representing the probability of saturated hydrocarbons, alkenes, aromatics, and others at step t. The class with the highest output probability is taken as the class at step t, and finally a sequence of length n is obtained to identify the hydrocarbon class.
[0102] The loss function of the second recurrent neural network is Where M is the number of color information sequences input during the training of the second recurrent neural network, n represents the total number of steps in the sequence, c represents the hydrocarbon category, and y mtc This represents an indicator function indicating that the hydrocarbon category is c at step t in the m-th color information sequence. A value of 1 indicates that the hydrocarbon belongs to class c, and a value of 0 indicates that it does not belong to class c. mtc This represents the probability that the hydrocarbon category is class c when the number of steps is t in the m-th color information sequence predicted by the second recurrent neural network.
[0103] (3) Data acquisition and analysis of the adsorption column to be tested
[0104] As the two color sensors move upwards along the slide rail, they collect the color information sequence of the adsorption column to be tested, forming a data table B. When the two color sensors reach the top of the adsorption column, they stop running for u seconds and send data table B to the server. Then, they start running downwards again, continuing to collect the color information sequence of the adsorption column to be tested. When the two color sensors reach the bottom of the adsorption column, they stop running for u seconds and send data table B to the server, repeating this process continuously. In this embodiment, u = 10.
[0105] When the server receives data table B, it records the reception time, forming a reception time-data table pair. Since different liquid petroleum products take different times to be adsorbed, the color information sequence in data table B is input into the trained first recurrent neural network to determine whether it has been completely adsorbed. If it is determined to be complete, the server sends a stop measurement command to the embedded development board, the embedded development board stops the measurement, and the server saves the last reception time-data table as the final data of this measurement.
[0106] The server obtains the final data from the hydrocarbon measurement, inputs the color information sequence from the final data table into a trained second recurrent neural network, and outputs the component categories at n positions on the adsorption column. It calculates the content of saturated hydrocarbons, alkenes, and aromatics based on the percentage of each category relative to the total number of n. After obtaining this information, the server records the following: the batch of hydrocarbon measurement, the measurement time, the color information of the adsorption tube during the measurement process, the final color information and the positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring, and another red ring, as well as the content of saturated hydrocarbons, alkenes, and aromatics. Simultaneously, the server can restore the saved data table into an image easily recognizable by the human eye, facilitating data retrieval.
[0107] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit the scope of one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments of this specification should be included within the scope of protection of one or more embodiments of this specification.
Claims
1. A neural network-based hydrocarbon measurement instrument data acquisition and analysis method, characterized by, The method comprises the following steps: The data acquisition device comprises a position identification ruler, the position identification ruler and the adsorption column are vertically arranged on both sides of the slide rail, the first color sensor facing the adsorption column and the second color sensor facing the position identification ruler are arranged on the slide rail and can synchronously slide along the slide rail, the position identification ruler is provided with black and white stripes, and two adjacent stripes serve as an adjustment step; The color information sequence collected by the two color sensors is sent to the embedded development board, and the embedded development board records the color information and the sending time to form data table D1 and data table D2 respectively. The data acquisition and analysis method of the hydrocarbon tester comprises the following steps: (1) constructing a training set: collecting color information sequences in the adsorption process and after the adsorption is completed respectively and marking the color information sequences, constructing a first training set, collecting the color information sequences after the adsorption is completed, marking the positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring and another red ring, and dividing the components at different sampling positions of the color information sequences into four categories: saturated hydrocarbons, olefins, aromatic hydrocarbons and others through the marked positions, and constructing a second training set; (2) establishing and training a recurrent neural network: training a first recurrent neural network by using the first training set, the first recurrent neural network being used for identifying whether the input color information sequence of the adsorption column is a color information sequence after the adsorption is completed, and training a second recurrent neural network by using the second training set, the second recurrent neural network being used for identifying the categories of the components at different sampling positions of the adsorption column; (3) data acquisition and analysis of an adsorption column to be detected: collecting the color information sequence of the adsorption column to be detected to form a data table with position information and sending the data table to the server, inputting the color information sequence in the data table into the first recurrent neural network to determine whether the adsorption is completed, if the adsorption is determined to be completed, sending a stop measurement instruction to the embedded development board, then inputting the color information sequence in the data table into the second recurrent neural network, outputting the categories of the components at different sampling positions of the adsorption column, and calculating the contents of the components.
2. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The white stripe width on the position identification ruler is denoted as a, the black stripe width is denoted as b, that is, adjacent black stripe and white stripe are taken as an adjustment step, the step size l=a+b; the moving speed of the two color sensors is the same and is denoted as v, the sampling frequency of the two color sensors is the same and is denoted as F, and the following needs to be met: and 3. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 2, wherein, The length of the adsorption column is 1.8 m, the length of the position identification ruler is 2 m, a=0.85 mm, b=0.15 mm, l=1 mm, v=10 mm / s and F=1 kHz.
4. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The formation of the data table with position information is as follows: The two color sensors move at a constant speed on the slide rail, the first color sensor and the second color sensor send the collected adsorption column color information and position identification ruler color information to the embedded development board, and the embedded development board records the color information and the sending time to form data table D1 and data table D2 respectively. The embedded development board processes D2, records the change time points of color change from black to white / white to black in a single scan to form a change time table T, queries D1 according to the change time points in T to form an ordered data table A, calculates the sampling position of the color information of the first color sensor according to the serial number and the adjustment step size, and forms a data table B with position information.
5. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 4, wherein, In the processing of D2 by the embedded development board, when scanning from bottom to top, the change time points of color change from black to white are recorded, and when scanning from top to bottom, the change time points of color change from white to black are recorded; the ordered data table A is formed in the form of: serial number-sampling time point-adsorption column color information data pair, for scanning from bottom to top, the serial number is 1, 2, …, n, n is the number of all change time points collected in a single scanning round, for scanning from top to bottom, the serial number is n, n-1, …, 1; the sampling position of the color information of the first color sensor is calculated according to the serial number*adjustment step size l, A is expanded into a data table B with position information, and the data table B is in the form of: serial number-sampling time point-adsorption column color information-adsorption column position data pair.
6. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The construction of the training set is specifically: The color information in the adsorption process is collected by a data acquisition device to form a data table with position information, which is marked as incomplete; the color information of the completed adsorption is collected by a data acquisition device to form a data table with position information, which is marked as complete; the above-mentioned collection and marking process is repeated to construct a first training set; The color information of the completed adsorption is collected by a data acquisition device to form a data table with position information, and the positions of the first strong yellow fluorescence, the first strong blue fluorescence, the red-brown ring, and another red ring are marked out. The region from the front position of the adsorption column to the position of the first strong yellow fluorescence is saturated hydrocarbon, the region from the position of the first strong yellow fluorescence to the position of the first strong blue fluorescence is olefin, and the region from the position of the first strong blue fluorescence to the position of the red-brown ring is aromatic hydrocarbon. The components of the color information sequence at different sampling positions are divided into four categories: saturated hydrocarbon, olefin, aromatic hydrocarbon, and others by marking the positions; the above-mentioned collection and marking process is repeated to construct a second training set.
7. The neural network based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The construction and training of the first recurrent neural network are specifically: The input of the first recurrent neural network is a sequence containing several adsorption column RGB color information, and the network includes a data preprocessing part and a model architecture part; the data preprocessing part performs normalization processing on the input RGB color information; The input of the first recurrent neural network is composed of three neurons, which respectively receive the red, green and blue color components in the color information; The hidden layer of the first recurrent neural network is composed of four parts, which are reset gate, update gate, candidate state and hidden state; In one round, a sequence of n color information is input into the first recurrent neural network at time step t, t equals 1, 2,..., n; the input at time step t is x t , wherein x t is the tth color information in the sequence. Reset gate: r t = σ(W r · [h t-1 , x t ] + b r ), where r t is the reset gate vector at time step t, σ is the sigmoid activation function, W r is the weight matrix for the reset gate, b r is the bias term for the reset gate, [h t-1 , x t ] represents the concatenation of the previous hidden state and the current input, and for the input at t = 1, all values of h0 are initialized to 0; update gate: z t = σ(W z · [h t-1 , x t ] + b z ), where z t is the update gate vector for time step t, W z is the weight matrix for the update gate, and b z is the bias term for the update gate; candidate state: where is the candidate state at time step t, tanh is the hyperbolic tangent activation function, W is a weight matrix for the candidate state, b is a bias term for the candidate state, and * denotes element-wise multiplication; Hidden state: The output layer of the first recurrent neural network is a full connection layer, the number of output layer neurons is 1, representing the probability of adsorption completion, and only when t=n, the function of the output layer is executed, and the expression of the output layer is y out =softmax(W y ·h n +b y ), wherein softmax is the softmax activation function of the output layer, W y is the weight matrix of the output layer, h n is the hidden state when t=n, b y is the bias term of the output layer, and y out represents the probability of adsorption completion; The loss function of the first recurrent neural network is where N is the number of color information sequences input when training the first recurrent neural network, i.e. the number of training rounds, y i is the true label of the i-th color information sequence, p i is the probability of the first recurrent neural network predicting that the i-th color information sequence is completed.
8. The neural network-based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The construction and training of the second recurrent neural network are specifically: The input of the second recurrent neural network is a sequence containing several adsorption column RGB color information, and the network includes a data preprocessing part and a model architecture part; the data preprocessing part performs normalization processing on the input RGB color information; The input of the second recurrent neural network is composed of three neurons, which respectively receive red, green and blue color components in color information; The hidden layer of the second recurrent neural network is composed of four parts, which are reset gate, update gate, candidate state and hidden state respectively; In one round, a sequence of n color information is input into the second recurrent neural network at time step t, t is equal to 1, 2,..., n; the input at time step t is x t , wherein x t is the tth color information in the sequence. Reset gate: r t = σ(W r · [h t-1 , x t ] + b r ), where r t is the reset gate vector at time step t, σ is the sigmoid activation function, W r is the weight matrix for the reset gate, b r is the bias term for the reset gate, [h t-1 , x t ] denotes the concatenation of the previous hidden state and the current input, and for the input at t = 1, all values of h0are initialized to 0; update gate: z t = σ(W z · [h t-1 , x t ]+b z ), where z t is the update gate vector for time step t, W z is the weight matrix for the update gate, and b z is the bias term for the update gate; candidate state: where is the candidate state at time step t, tanh is the hyperbolic tangent activation function, W is a weight matrix for the candidate state, b is a bias term for the candidate state, and * denotes element-wise multiplication; Hidden state: The output layer of the second recurrent neural network is a full connection layer, the number of output layer neurons is 4, respectively representing the probability of output results being saturated hydrocarbon, olefin, aromatic hydrocarbon and other at the step t, and the expression of the output layer is y t = softmax(W y ·h t +b y ), wherein t = 1, 2,..., n, softmax is a softmax activation function of the output layer, W y is a weight matrix of the output layer, h t is a hidden state at t, b y is a bias term of the output layer, y t is a vector representing the probability of saturated hydrocarbon, olefin, aromatic hydrocarbon and other at the step t, and the kind with the maximum output probability is taken as the kind at the step t, and finally a sequence with a length of n is obtained, which identifies the hydrocarbon class. The loss function of the second recurrent neural network is where M is the number of color information sequences input when training the second recurrent neural network, n represents the total number of steps in the sequence, c represents the hydrocarbon class to which the sequence belongs, y mtc represents the indication function of the hydrocarbon class c at step t in the mth color information sequence, p mtc is the probability of the second recurrent neural network predicting that the hydrocarbon class is c at step t in the mth color information sequence.
9. The neural network-based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The color information collection of the to-be-detected adsorption column is specifically as follows: two color sensors move from bottom to top on a slide rail, a color information sequence of the to-be-detected adsorption column is collected by a data collection device to form a data table with position information, when running to the top end of the adsorption column, the running is stopped for a period of time and the formed data table is sent to the server, then the running is started from top to bottom, the color information sequence is continuously collected, when running to the bottom end of the adsorption column, the running is stopped for a period of time and the formed data table is sent to the server, and the above process is repeatedly performed.
10. The neural network-based hydrocarbon measurement instrument data acquisition and analysis method of claim 1, wherein, The server records the receiving time when receiving the data table with position information of the to-be-detected adsorption column, forms a receiving time-data table pair, inputs the color information sequence in the data table into the trained first recurrent neural network to judge whether the adsorption is completed, if the judgment is completed, sends a stop measurement instruction to the embedded development board, saves the last receiving time-data table pair as the final data of this measurement, inputs the color information sequence in the data table of the final data into the trained second recurrent neural network, and outputs the classification of each sampling position of the adsorption column, and calculates the content of saturated hydrocarbon, olefin and aromatic hydrocarbon according to the percentage of the number of each category of sampling position in the total number of sampling positions.
Citation Information
Patent Citations
Inferring petrophysical properties of hydrocarbon reservoirs using a neural network
CN111316294A
Novel hydrocarbon tester adding device
CN209167101U