Identification method of gas meter based on three-Hall countercurrent identification

Through the three-Hall countercurrent identification of gas meter and deep neural network model, the problem of the inability to trace historical countercurrent states in the existing technology is solved, and the accurate countercurrent state judgment of current and historical data is achieved, and the accuracy of countercurrent detection is improved.

CN118706208BActive Publication Date: 2025-02-11ANHUI HONGLING SMART INSTRUMENT TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410723996.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2025-02-11
Estimated Expiration
2044-06-05

Smart Images

  • Figure CN118706208B_ABST
    Figure CN118706208B_ABST
Patent Text Reader

Abstract

The present invention discloses a three-Hall type reverse flow identification gas meter and an identification method. The three-Hall type reverse flow identification gas meter includes a character wheel arranged on the outside and a magnetic steel fixed on the character wheel. Three Hall sensors are arranged on the outside of the magnetic steel. The Hall sensors can output signals in response to the magnetic field changes of the magnetic steel. The three-Hall type reverse flow identification gas meter of the present application continuously collects the output signals of the three Hall sensors, locates the output signal C at any time, and then searches for the states of the two adjacent output signals before the output signal C. It can not only judge the current reverse flow state, but also judge the reverse flow state of historical data, thereby meeting the purpose of retrospective reverse flow detection of historical states.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of gas meters, and in particular relates to a gas meter and an identification method based on three-Hall reverse flow identification. Background Art

[0002] Counting meters are mostly used for gas or water metering. A gas meter is an instrument that uses modern microelectronics and modern sensor technology to measure gas usage and settle water usage data transactions. The prior art also records backflow detection while counting based on Hall sensors.

[0003] For example, a Chinese patent application with application number 201922270475.3 records an anti-interference gas meter counting detection device, in which a Hall switch is arranged on a signal-taking circuit board, and a magnetic body is set on any output gear meshing rotating part of the gas meter's mechanical counter. The magnetic body is arranged within the inductive excitation distance of the Hall switch and rotates with the rotation of the transmission part. A combination switch mode of N / S poles is adopted. By setting the switch excitation sequence, the function of determining the rotation direction of the mechanical counting is realized, and hardware support is provided for the realization of determination and early warning of gas backflow.

[0004] A Chinese patent application with application number 202321542800.7 records a smart water meter, which uses a bidirectional metering and collection circuit, including a first Hall switch H1 and a second Hall switch H2. When the double water flow passes through the water meter, it drives the magnetic needle to rotate clockwise, and the first Hall switch H1 and the second Hall switch H2 experience the following 6 states: the first Hall switch H1 is disconnected, the first Hall switch H1 is closed, and the first Hall switch H1 is disconnected; the second Hall switch H2 is disconnected, the second Hall switch H2 is closed, and the second Hall switch H2 is disconnected; such a complete metering state is considered a metering pulse, which achieves the purpose of backflow detection.

[0005] Similarly, in the Chinese patent application with application number 201220749916.3, two TMR magnetoresistive switch sensors are set. One direction of the TMR magnetic switch will output a high level when sensing the N-pole magnetic field, and will output a low level when sensing the S-pole magnetic field. When the magnet rotates one circle, four levels will be generated. When the two levels are sensed to change in the order of high-low (10) → high-high (11) → low-high (01) → low-low (00), it is forward rotation. When the levels are changed in the order of low-high (01) → high-high (11) → high-low (10) → low-low (00), it is reverse rotation, thereby achieving the purpose of reverse flow detection.

[0006] The dual Hall sensors used in the prior art for backflow detection determine the backflow state by collecting a specific form of pulse signal composed of changes in the output signals of the two dual Hall sensors, but cannot achieve the purpose of retrospective backflow detection of historical states. Summary of the invention

[0007] In view of the above technical problems, this application proposes a gas meter and identification method based on three-Hall reverse flow identification. The specific technical solution is as follows:

[0008] On the one hand, the present application provides a three-Hall type reverse flow identification gas meter, including a character wheel arranged on the outside and a magnet fixed on the character wheel, three Hall sensors are arranged on the outside of the magnet, and the Hall sensors can output signals in response to changes in the magnetic field of the magnet.

[0009] On the other hand, the present application also provides a method for identifying a gas meter based on three-Hall reverse flow identification, the identification method being:

[0010] The positive rotation direction of the calibration character wheel and the output signals of each Hall sensor when the magnetic steel passes through the Hall sensor in sequence in the positive rotation direction are A, B, and C;

[0011] Locate the closest output signal C at any time, and find the two adjacent output signals before the output signal C;

[0012] Determine whether the two adjacent output signals are AB. If so, it is judged to be forward rotation, otherwise it is judged to be reverse flow.

[0013] On the other hand, the present application also provides another identification method based on three-Hall reverse flow identification gas meter, the identification method is:

[0014] Get the current data collected based on the Hall sensor;

[0015] The current Hall sensor-based collected data is input into the backflow detection model to determine whether the current gas meter has backflow. The backflow detection model is obtained by training the neural network model with sample data. The sample data includes the state of the Hall sensor, sequence data of time difference, and label data indicating the rotation state of the gas meter.

[0016] Furthermore, in the sample data, for each time difference data Δt i , the following formula is used for preprocessing:

[0017]

[0018] In the above formula, i represents the i-th time difference measurement value, Δt i is the original time difference data, NΔt iis the preprocessed time difference data, max(Δt) and min(Δt) are the maximum and minimum values ​​in the time difference data, respectively.

[0019] Furthermore, the sample data is constructed as follows:

[0020] Set a sampling time T and record the activation status of the three Hall sensors, 0 or 1;

[0021] Construct a sliding window to generate the input sequence, set the window size to W, and the input feature vector of each time step contains the state information of three Hall sensors (A t ,B t ,C t ) and the time difference information compared to the previous time step (Δt A ,Δt B ,Δt C );

[0022] After determining that the dimension of the sample data is 6W, the preprocessed data is saved as a new input feature vector.

[0023] Furthermore, the neural network of the backflow detection model includes:

[0024] Input layer: The initial part of the model accepts input data of the shape of (Batch Size, Window Size W, Features = 6), where Window Size W represents the sliding window size, which contains the information of W consecutive time steps in the magnetic steel rotation sequence, and Features = 6 means that each time step has six features, including the state information of three sensors and three corresponding time differences;

[0025] Bidirectional LSTM layer 1: First, apply a bidirectional LSTM layer with 128 LSTM units on each side, set the dropout ratio of the output layer to 0.2, and set the dropout ratio of the transfer between LSTM internal states to 0.2;

[0026] Bidirectional LSTM layer 2: followed by the second bidirectional LSTM layer, with the number of units increased to 256 units, and the Dropout strategy is also used to enhance the generalization performance;

[0027] Time-series distributed fully connected layer: A fully connected layer wrapped with TimeDistributed, with 64 neurons and ReLU activation function, transforms each time step feature output by the LSTM layer;

[0028] Global average pooling layer: A GlobalAveragePooling1D layer is used to compress time series data and extract the average feature representation of the entire sequence;

[0029] Fully connected layer 1: has 128 neurons and uses ReLU activation function to increase nonlinearity;

[0030] Dropout layer: A Dropout layer is inserted into the model to randomly drop some neurons with a probability of 0.5;

[0031] Fully connected layer 2: has 64 neurons and ReLU activation function;

[0032] Output layer: It is a single neuron that uses the Sigmoid activation function and outputs a value between 0 and 1, indicating the probability of the magnet rotating counterclockwise or clockwise. A value close to 1 indicates positive rotation.

[0033] Furthermore, the preprocessed data is saved as a new feature matrix and randomly divided into a training set and a validation set, which are then input into the neural network for training;

[0034] The loss function is defined as:

[0035]

[0036] In the above formula, N is the total number of samples, i is the sample index, and y is i is the actual label, y i ∈{0, 1}, p i is the probability of the model output for each sample;

[0037] Using Adam as the optimizer, at the tth iteration, the update of the model parameter θ is:

[0038]

[0039] In the above formula, η is the learning rate, which is 0.001; ε = 1e-8, which is a small constant used for numerical stability; m t is the first-order moment estimate, initially 0; v t is the second-order moment estimate, initially 0; is the bias-corrected first-order moment, β1 is the momentum decay rate, the default value is 0.9; is the bias-corrected second moment, β2 is the variance decay rate, and the default value is 0.999.

[0040] Furthermore, the original learning rate η decreases with the number of training rounds t according to the following formula:

[0041] η t =η0·γ t / T ;

[0042] η0 is the initial learning rate, which is set to 0.001 according to the above record; γ is the decay factor, such as 0.96, which means that every T rounds, the learning rate is reduced to γ ​​times the original; T is the decay period.

[0043] Furthermore, a threshold K is set, K=0.5, to determine whether the output result of the reverse flow detection model is greater than K. If so, it is determined to be forward rotation, otherwise it is determined to be a reverse flow state.

[0044] Furthermore, let V(t) be the performance index value of the model on the validation set at the tth iteration, set a threshold P, such as P = 10, and a minimum change δ for performance improvement. If P consecutive iterations satisfy:

[0045] If V(t)-V(tP)<δ, the model performance is considered to be no longer significantly improved. At this time, the training is stopped and the model parameters with the best performance so far are rolled back.

[0046] The beneficial effects of the present invention are:

[0047] (1) The three-Hall type reverse flow identification gas meter of the present application continuously collects the output signals of three Hall sensors, locates the output signal C at any time, and then searches for the states of the two adjacent output signals before the output signal C. It can not only determine the current reverse flow state, but also determine the reverse flow state of historical data, thereby meeting the purpose of retrospective reverse flow detection of historical states.

[0048] (2) Based on the data collection of three Hall-type reverse flow identification gas meters, the present application provides another method for detecting the rotation working state of the gas meter based on a deep neural network model. This method no longer relies on the continuous collection of the output signals of the three Hall sensors in response to the magnetic steel, but is based on the state representation of the Hall sensors under different rotation states of the gas meter and the time difference information. Feature extraction and sequence analysis are performed to train a reverse flow detection model, and the result of judging the rotation working state of the gas meter is output based on the input sample data based on the reverse flow detection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 The prior art shows that a dual Hall sensor instrument is used to detect the level signal of the forward rotation;

[0050] Figure 2 The prior art shows that a dual Hall sensor instrument is used to detect the level signal of the reverse flow;

[0051] Figure 3 What is shown is the continuous level signal detected by the prior art using a dual Hall sensor instrument;

[0052] Figure 4 Shown is a schematic diagram of a three-Hall type countercurrent identification gas meter in the present application. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments.

[0054] Taking a smart water meter recorded in the Chinese patent application number 202321542800.7 as an example, the basic principle of the dual Hall sensor used to achieve backflow detection is as follows: Figure 1 As shown in the figure, when the magnetic needle rotates clockwise, a level signal of a specific combination state is formed, such as Figure 2 As shown, when the magnetic needle rotates counterclockwise, another level signal of a specific combination state is formed, and there are differences between the two level signal states, mainly due to the timing differences in the level signal changes of the first Hall switch H1 and the second Hall switch H2 caused by the rotation state of the magnetic needle, which can be distinguished to determine whether reverse current occurs.

[0055] Figure 3 The figure shows the change of the level signal during the sampling time at one end. The complete change process of the level from low to high and then to low when the magnetic needle rotates through each Hall switch is indicated by dots. Figure 3 It can be seen that the instrument was in the forward rotation state before T1, and the reverse flow occurred at T1, so the magnetic needle reversed, and then the output level signal changed. The reverse flow judgment can be realized by identifying this change. However, at any T2 moment after T1, it is impossible to accurately judge whether the system is in the reverse flow state. Especially in the process of historical retrospective judgment, what the system sampling can record is still the continuous alternating level changes of the first Hall switch H1 and the second Hall switch H2. Therefore, it is difficult to judge whether the instrument is in the reverse flow state at a certain moment in the historical state.

[0056] Example 1

[0057] Figure 4 What is shown is a schematic diagram of a three-Hall type countercurrent identification gas meter in the present application, especially the structure inside the meter core, wherein the meter core has a plurality of combined character wheels 200, wherein a magnetic steel 201 is fixed on one of the character wheels 200, a PCB board 100 is arranged on the outer side of the character wheel 200, and three Hall sensors are arranged on the PCB board 100, which are respectively marked as Hall sensor one 101, Hall sensor two 102 and Hall sensor three 103, and the character wheel 200 can rotate around the axis in the X or Y direction. In this embodiment, the X direction is calibrated as forward rotation, and the Y direction is reverse rotation (i.e., countercurrent), and the three Hall sensors are all arranged on the rotation path of the magnetic steel 201, and when the magnetic steel 201 passes through the three Hall sensors respectively, the Hall sensors can respond to the magnetic field changes of the magnetic steel 201 and output signals.

[0058] In some specific implementations, the magnet 201 can be fixed on the character wheel 200 by bonding or interlocking. Usually, the character wheel 200 to which the magnet 201 is fixed is the character wheel 200 with the highest rotation speed in the working state of the existing instrument.

[0059] Combined with the above records, when the Hall sensor 101, the Hall sensor 2 102 and the Hall sensor 3 103 approach the magnet 201, the output level will be in the following states: low level - high level - low level, that is, when the magnet 201 approaches each Hall sensor, it will output a high level or a level jump signal.

[0060] Based on this, the Hall sensor 101 is marked as outputting signal A when a high level or level jump signal occurs, the Hall sensor 102 is marked as outputting signal B when a high level or level jump signal occurs, and the Hall sensor 103 is marked as outputting signal C when a high level or level jump signal occurs. Then, when the gas meter always rotates forward, the signal collected is ABCABCABCABCABCABCABCABCABC..., and when the gas meter always rotates reversely, the signal collected is ACBACBACBACBACBACBACBACB...

[0061] When the present application uses three Hall sensors, after locating the output signal C at any time, the two adjacent output signals before the output signal C are searched. If they are AB, it can be determined that the instrument is rotating forward at this moment; if they are BA, it can be determined that reverse flow has occurred at this moment.

[0062] Example 2

[0063] This embodiment further provides a method for identifying the rotation state of a gas meter based on the three-Hall type reverse flow identification gas meter, and the rotation state described is still forward rotation and reverse rotation.

[0064] The method comprises the following steps:

[0065] Step 100: Acquire the current collected data based on the Hall sensor;

[0066] Step 200: inputting the current collected data based on the Hall sensor into the backflow detection model to determine whether the current gas meter has backflow;

[0067] The reverse flow detection model is determined according to the neural network model and sample data; the sample data includes input data and label data; the input data includes sequence data of sensor state and time difference, and the label data is the rotation state of the gas meter, where forward rotation is 1 and reverse flow is 0;

[0068] The sample data required in this embodiment is obtained based on the detection of the rotation state of the gas meter by the Hall sensor.

[0069] More specifically, before inputting the collected data based on the Hall sensor into the backflow detection model, the collected data needs to be standardized, and then the processed data is input into the backflow detection model to determine the rotation state of the gas meter.

[0070] In this embodiment, the construction process of the backflow detection model is as follows:

[0071] (1) Constructing a neural network for the backflow detection model

[0072] The neural network structure of the countercurrent detection model is a deep learning model for judging the rotation direction of the magnetic steel. Its design aims to improve the recognition accuracy of the magnetic steel rotation sequence through multi-level feature extraction and sequence analysis. The neural network structure is as follows:

[0073] Input layer: The initial part of the model accepts input data of the shape of (Batch Size, Window Size W, Features = 6), where Window Size W represents the sliding window size, which contains the information of W consecutive time steps in the magnetic steel rotation sequence, and Features = 6 means that each time step has six features, including the state information of three sensors and three corresponding time differences;

[0074] Bidirectional LSTM layer 1: First, a bidirectional LSTM layer is applied, with 128 LSTM units on each side. This layer not only considers the information of the current time step, but also combines the previous and next contextual information in the sequence, improving the ability to capture complex patterns in the time series. In order to reduce overfitting, the dropout ratio of the output layer is set to 0.2, and the dropout when transferring between LSTM internal states is set to 0.2;

[0075] Bidirectional LSTM layer 2: This is followed by the second bidirectional LSTM layer, which increases the number of units to 256 to further enhance the expressiveness of the model. The Dropout strategy is also used to enhance the generalization performance.

[0076] Time-series distributed fully connected layer: In order to apply feature transformations individually at each time step without destroying the sequence structure, a fully connected layer wrapped with TimeDistributed is used, which has 64 neurons and ReLU activation function to transform the features of each time step output by the LSTM layer;

[0077] Global average pooling layer: After this, a GlobalAveragePooling1D layer is used to compress the time series data and extract the average feature representation of the entire sequence, which helps to reduce model parameters and improve the generalization ability of the model;

[0078] Fully connected layer 1: Next is a standard fully connected layer with 128 neurons, which continues to extract and reduce features and uses the ReLU activation function to increase nonlinearity;

[0079] Dropout layer: To further reduce overfitting, a Dropout layer is inserted into the model to randomly drop some neurons with a probability of 0.5;

[0080] Fully connected layer 2: It passes through another fully connected layer with 64 neurons and ReLU activation function to further refine the features;

[0081] Output layer: The end of the model is a single-neuron fully connected layer that uses the Sigmoid activation function and outputs a value between 0 and 1, indicating the probability of the magnet rotating counterclockwise or clockwise. A value close to 1 indicates that the magnet rotates clockwise.

[0082] The more specific model compilation content is as follows:

[0083] Input Layer

[0084] -------------------

[0085] Shape: (Batch Size,Window Size W,Features=6)

[0086] Note: Receives sequence data containing sensor status and time difference

[0087] Bidirectional LSTM Layer 1

[0088] -------------------------------------

[0089] Type:tf.keras.layers.Bidirectional(tf.keras.layers.LSTM)

[0090] parameter:

[0091] -hidden_units=128 (number of LSTM units)

[0092] -return_sequences=True (keep sequence output)

[0093] -dropout=0.2 (Dropout ratio of LSTM output layer)

[0094] -recurrent_dropout=0.2 (LSTM internal state dropout ratio)

[0095] -merge_mode = 'concat' (forward and reverse output concatenation)

[0096] Bidirectional LSTM Layer 2

[0097] -------------------------------------

[0098] Type:tf.keras.layers.Bidirectional(tf.keras.layers.LSTM)

[0099] The parameters are similar to layer 1, but you can consider adjusting hidden_units to adapt to the model complexity, such as `hidden_units=256`.

[0100] TimeDistributed Dense Layer

[0101] ------------------------------------------

[0102] Type:tf.keras.layers.TimeDistributed(tf.keras.layers.Dense)

[0103] parameter:

[0104] -units=64 (feature transformation at each time step, maintaining sequence structure)

[0105] -activation='relu'

[0106] GlobalAverage Pooling Layer

[0107] ------------------------------------------

[0108] Type: tf.keras.layers.GlobalAveragePooling1D

[0109] Note: Compress the time series data into a vector of fixed length and extract the overall features Dense Layer 1 (fully connected layer 1)

[0110] ------------------------

[0111] Type: tf.keras.layers.Dense

[0112] parameter:

[0113] -units=128 (for further feature extraction and dimensionality reduction)

[0114] -activation='relu'

[0115] Dropout Layer

[0116] -----------------------

[0117] Type: tf.keras.layers.Dropout

[0118] parameter:

[0119] -rate=0.5 (to prevent overfitting)

[0120] Dense Layer 2 (fully connected layer 2)

[0121] ------------------------

[0122] Type: tf.keras.layers.Dense

[0123] parameter:

[0124] -units=64 (further simplifying features)

[0125] -activation='relu'

[0126] Output Layer

[0127] ---------------------

[0128] Type: tf.keras.layers.Dense

[0129] parameter:

[0130] -units=1 (single output, corresponding to the prediction of the rotation direction)

[0131] -activation = 'sigmoid' (Sigmoid activation function)

[0132] (2) Constructing sample data and preprocessing the sample data

[0133] Set a sampling time T and record the activation status of the three Hall sensors. When the magnet passes by, the sensor status changes from "inactive" to "active", which can be simply encoded as a number from 0 to 1 (for example, if the magnet just passes by sensor A, the status of A is 1, while the status of B and C are 0);

[0134] Construct a sliding window method to generate the input sequence, set a window size W, and each sliding step is equal to the sampling time T. Taking W = 3 as an example, an example input may be Since there are 6 features, for the case of window size W = 3, the dimension of the input vector will be 6*3=18; Δt X Represents the time difference between the last activation of the X sensor and the current activation;

[0135] For each time difference data Δt i , i represents the i-th time difference measurement value, and the following formula is used for preprocessing:

[0136]

[0137] In the above formula, Δt i is the original time difference data, NΔt i is the preprocessed time difference data, max(Δt) and min(Δt) are the maximum and minimum values ​​in the time difference data respectively;

[0138] (3) Save the preprocessed data as a new feature matrix and input it into the neural network for training to obtain the backflow detection model

[0139] The preprocessed data is saved as a new feature matrix and randomly divided into a training set and a validation set, which are then input into the neural network for training;

[0140] The loss function is defined as:

[0141]

[0142] In the above formula, N is the total number of samples, i is the sample index, and y is i is the actual label, y i ∈{0, 1}, p i is the probability of the model output for each sample;

[0143] Using Adam as the optimizer, at the tth iteration, the update of the model parameter θ is:

[0144]

[0145] In the above formula, η is the learning rate, which is 0.001; ε = 1e-8, which is a small constant used for numerical stability; m t is the first-order moment estimate (momentum), initially 0; v t is the second-order moment estimate (variance), initially 0; is the bias-corrected first-order moment, β1 is the momentum decay rate, the default value is 0.9; is the bias-corrected second moment, β2 is the variance decay rate, and the default value is 0.999.

[0146] In addition, the original learning rate η decreases with the number of training rounds t according to the following formula:

[0147] η t =η0·γ t / T ;

[0148] η0 is the initial learning rate, which is set to 0.001 according to the above records; γ is the decay factor, such as 0.96, which means that every T rounds (cycles), the learning rate is reduced to γ ​​times the original; T is the decay period, which determines how often the decay is performed.

[0149] According to the backflow detection model of this embodiment, the output is a probability value, and a value close to 0 indicates that it is judged as backflow. Therefore, in order to directly output a judgment result, a threshold K needs to be set. In this embodiment, it is set to 0.5. When the output result of the backflow detection model is greater than K, it is judged as forward rotation. When the output result of the backflow detection model is less than K, it is judged that a backflow state occurs.

[0150] During the training of the backflow detection model, early stopping and model checkpointing are used to optimize the training process, prevent overfitting, ensure model performance, and save the best state during training.

[0151] Let V(t) be the performance index value of the model on the validation set at the tth iteration, set a threshold P, such as P = 10, and a minimum change δ for performance improvement. If P consecutive iterations satisfy:

[0152] If V(t)-V(tP)<δ, it is considered that the model performance is no longer significantly improved. At this time, the training is stopped and the model parameter state with the best performance so far is rolled back. By terminating the training in time, early stopping can save computing resources, prevent the model from overfitting, and maintain the model's generalization ability on unknown data.

[0153] During the training process, after a certain number of iterations or epochs, the system will check the performance indicators (such as accuracy) on the validation set. If the performance of the current model is better than all previously saved models, the current model parameters will be saved.

[0154] Model checkpoints ensure that the best state during training is not lost, making it convenient to directly load the best model for evaluation or deployment after training is completed. It also simplifies the process of hyperparameter adjustment and experimental comparison.

[0155] The above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them.

Claims

1. A method for identifying a gas meter based on three-Hall countercurrent identification, characterized in that: The gas meter includes a character wheel arranged on the outside and a magnet fixed on the character wheel, and three Hall sensors are arranged on the outside of the magnet, and the Hall sensors can output signals in response to changes in the magnetic field of the magnet; The identification method is: Get the current data collected based on the Hall sensor; Inputting the current collected data based on the Hall sensor into the backflow detection model to determine whether the current gas meter has backflow, the backflow detection model is obtained by training the neural network model with sample data, the sample data includes the state of the Hall sensor, the sequence data of the time difference, and the label data indicating the rotation state of the gas meter; In the sample data, for each time difference data Δt i , the following formula is used for preprocessing: In the above formula, i represents the i-th time difference measurement value, Δt i is the original time difference data, NΔt i is the preprocessed time difference data, max(Δt) and min(Δt) are the maximum and minimum values ​​in the time difference data respectively; The sample data is constructed as follows: Set a sampling time T and record the activation status of the three Hall sensors, 0 or 1; Construct a sliding window to generate the input sequence, set the window size to W, and the input feature vector of each time step contains the state information of three Hall sensors (A t ,B t ,C t ) and the time difference information compared to the previous time step (Δt A ,Δt B ,Δt C ); After determining that the dimension of the sample data is 6W, the preprocessed data is saved as a new input feature vector; The neural network of the backflow detection model includes: Input layer: The initial part of the model accepts input data of the shape of (Batch Size, Window Size W, Features = 6), where Window Size W represents the sliding window size, which contains the information of W consecutive time steps in the magnetic steel rotation sequence, and Features = 6 means that each time step has six features, including the state information of three sensors and three corresponding time differences; Bidirectional LSTM layer 1: First, apply a bidirectional LSTM layer with 128 LSTM units on each side, set the dropout ratio of the output layer to 0.2, and set the dropout ratio of the transfer between LSTM internal states to 0.2; Bidirectional LSTM layer 2: followed by the second bidirectional LSTM layer, with the number of units increased to 256 units, and the Dropout strategy is also used to enhance the generalization performance; Time-series distributed fully connected layer: A fully connected layer wrapped with TimeDistributed, with 64 neurons and ReLU activation function, transforms each time step feature output by the LSTM layer; Global average pooling layer: A GlobalAveragePooling1D layer is used to compress time series data and extract the average feature representation of the entire sequence; Fully connected layer 1: has 128 neurons and uses ReLU activation function to increase nonlinearity; Dropout layer: A Dropout layer is inserted into the model to randomly drop some neurons with a probability of 0.5; Fully connected layer 2: has 64 neurons and ReLU activation function; Output layer: It is a single neuron that uses the Sigmoid activation function and outputs a value between 0 and 1, indicating the probability of the magnet rotating counterclockwise or clockwise. A value close to 1 indicates positive rotation.

2. The identification method of a gas meter based on three-Hall countercurrent identification according to claim 1 is characterized in that: The preprocessed data is saved as a new feature matrix and randomly divided into a training set and a validation set, which are then input into the neural network for training; The loss function is defined as: In the above formula, N is the total number of samples, i is the sample index, and y is i is the actual label, y i ∈{0, 1}, p i is the probability of the model output for each sample; Using Adam as the optimizer, at the tth iteration, the update of the model parameter θ is: In the above formula, η is the learning rate; ε = 1e-8, which is a small constant used for numerical stability; m t is the first-order moment estimate, initially 0; v t is the second-order moment estimate, initially 0; is the bias-corrected first-order moment, β1 is the momentum decay rate, the default value is 0.9; is the bias-corrected second moment, β2 is the variance decay rate, and the default value is 0.

999.

3. The identification method of a gas meter based on three-Hall countercurrent identification according to claim 2 is characterized in that: The original learning rate η decreases with the number of training rounds t according to the following formula: or t =η0·γ t / T ; η0 is the initial learning rate; γ is the decay factor, which means that after every T rounds, the learning rate is reduced to γ ​​times of the original; T is the decay period.

4. The identification method of a gas meter based on three-Hall countercurrent identification according to claim 3 is characterized in that: A threshold K is set, K=0.5, to determine whether the output result of the reverse flow detection model is greater than K. If so, it is determined to be forward rotation, otherwise it is determined to be a reverse flow state.

5. The identification method of a gas meter based on three-Hall countercurrent identification according to claim 4 is characterized in that: Let V(t) be the performance index value of the model on the validation set at the tth iteration, set a threshold P, and a minimum change δ for performance improvement. If P consecutive iterations satisfy: If V(t)-V(tP)<δ, it is considered that the model performance is no longer significantly improved. At this time, the training is stopped and the model parameter state with the best performance so far is rolled back.

Citation Information

Patent Citations

  • Bi-directional detection sensor assembly for intelligent water meter

    CN203163780U

  • Anti-interference gas meter counting detection device

    CN211085373U

  • Intelligent water meter

    CN220039540U

  • High-reliability three-Hall two-way metering device and metering method

    CN110672175A