Energy consumption control method and device of airflow sensor
By acquiring and analyzing the working status data of the airflow sensor, and adjusting the working frequency using the K-Means clustering algorithm, the problem of high energy consumption in long-term monitoring of the airflow sensor is solved, and energy consumption control and equipment performance improvement is achieved.
Patent Information
- Application Number
- CN202411730865.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-01-03
AI Technical Summary
Existing airflow sensor technology generates higher energy consumption during long-term monitoring, affecting the overall performance of the equipment.
By obtaining the working status data of the airflow sensor, pre-processing, calculating the median and variance, analyzing the energy consumption data using the K-Means clustering algorithm, and adjusting the working frequency based on the judgment results to achieve energy consumption control.
Reduces energy consumption of airflow sensors, extends battery life, and improves equipment performance.
Smart Images

Figure CN119235064A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic cigarette control, and in particular to an energy consumption control method and device of an airflow sensor. Background Art
[0002] In recent years, with the rapid development of microelectronics and sensor technology, airflow sensors are increasingly used in portable electronic devices, especially in new health alternatives. By accurately monitoring the user's airflow behavior, the device's working state can be more efficiently controlled, and the user experience and energy efficiency can be improved. In such devices, the airflow sensor triggers the core heating function by detecting the user's inhalation action, generating aerosol conveniently and efficiently.
[0003] In one prior art, a common airflow sensor technology uses the temperature difference between a heating element and a temperature sensor to detect airflow. When air flows through, the temperature of the heating element drops, and the temperature difference signal is used to determine the strength of the airflow, thereby supporting its control effect in various electronic devices.
[0004] In the existing technology, since the airflow sensor technology is based on the thermoelectric principle, it often generates high energy consumption during long-term monitoring. How to achieve low energy consumption control while maintaining efficient monitoring has become a key technical issue in improving the overall performance of the equipment. Summary of the invention
[0005] The present invention provides an energy consumption control method and device for an airflow sensor, aiming to solve the problem of high energy consumption of airflow sensors during long-term monitoring in the prior art, and to provide a more intelligent and efficient airflow sensor energy consumption control method to reduce energy consumption, extend battery life, and ensure device performance.
[0006] In a first aspect, in order to solve the above technical problems, the present invention provides an energy consumption control method of an airflow sensor, which is executed by a computer and includes: Acquiring working state data of the airflow sensor, wherein the working state data includes airflow velocity data, air pressure data and temperature data of the airflow sensor; Performing a data preprocessing operation on the working status data to obtain preprocessed data; Performing calculation operations according to the preprocessed data to obtain the median and variance of the preprocessed data; According to the median and the variance, performing a data storage configuration operation on the preprocessed data to obtain a storage feature vector; According to the stored feature vector, a cluster analysis operation is performed on the pre-processed data using a K-Means clustering algorithm to obtain energy consumption data of the airflow sensor; According to the energy consumption data and the variance, a working state judgment operation of the airflow sensor is performed to obtain a judgment result; According to the judgment result, the working frequency of the airflow sensor is adjusted to complete the energy consumption control of the airflow sensor.
[0007] As an optional implementation manner, performing a data preprocessing operation on the working status data to obtain preprocessed data includes: The working status data is taken as input data and stored in array A, and an abnormal data check operation is performed on array A to mark and remove abnormal data; Mark the array A after removing abnormal data as array , record the location of the abnormal data as the missing data index ; According to the array , use the median to replace the missing values of abnormal data to obtain the preprocessed data , and its calculation formula is: When count is an odd number, the median mid], where mid ; When count is an even number, the median , where mid ; Use the median to replace the value of the missing data: median; Among them, count represents the length of array A, mid represents the median median in the sorted array The position index in , Indicates the number of missing data in array A and the missing data index Range: count-n.
[0008] As an optional implementation, performing a data storage configuration operation on the preprocessed data according to the median and the variance to obtain a storage feature vector includes: The initial eigenvector is obtained according to the median and the variance , the initial eigenvector The composition is expressed as: in, respectively represent the array feature vectors after preprocessing of the working state data of the airflow sensor, is the median of the preprocessed data, is the variance of the preprocessed data; The preprocessed data of the airflow sensor is stored in the initial feature vector to obtain a stored feature vector .
[0009] As an optional implementation, the step of performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vectors includes: Step 1: Select Initial cluster centers; Step 2: For each data point , calculate its correlation with all cluster centers The minimum Euclidean distance criterion function is used to measure the similarity between data points in the same cluster, and the data points are Assign to the nearest cluster center , the formula is: Step 3: Once all data points are assigned to a cluster Then update the cluster center: Step 4: Repeat steps 2 and 3 until the cluster center no longer changes or changes very little, completing the storage of the feature vector Cluster analysis of For each cluster , sample data points Cluster Center The minimum Euclidean distance between is: in, It is a data point The characteristic vector of Represents clusters The center point of Then the criterion function is expressed as: in, Indicates that it belongs to a cluster All data points of Indicates the number of clusters.
[0010] As an optional implementation, the method of performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vector C to obtain the energy consumption data of the airflow sensor includes: Calculate the stored feature vector for each cluster The average energy consumption of all data points in ; Calculate the stored feature vector for each cluster The energy consumption variance; Energy consumption data is obtained according to the average energy consumption and the energy consumption variance; Among them, the calculation formulas of average energy consumption and energy consumption variance are expressed as follows: in, Represents data points The average energy consumption, Represents clusters The number of data points in Represents data points Energy consumption; Represents clusters Corresponding data points The energy consumption variance; Construct an energy consumption data array according to the average energy consumption and the energy consumption variance , the formula is: in, and Respectively represent all data points corresponding to the working status data The average energy consumption and energy consumption variance, Indicates the length of all data points; For the energy consumption data array All elements in the traversal operation are performed to obtain the energy consumption data value .
[0011] As an optional implementation manner, performing a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result includes: When the variance of the working state data of all the airflow sensors is less than 1, the airflow sensor stops working, otherwise it continues working; When the variance <1, and the energy consumption data 0, it is determined that the airflow sensor is in an idle state; When the variance ≥1, and the energy consumption data 10, it is determined that the airflow sensor is in working state.
[0012] As an optional implementation, the operating frequency adjustment operation of the airflow sensor is performed according to the judgment result to complete the energy consumption control of the airflow sensor, including: When the working state of the airflow sensor is judged to be an idle state, a working frequency adjustment operation is performed; When the energy consumption data When it is greater than or equal to a preset threshold, adjusting the operating frequency of the airflow sensor to a first frequency; When the energy consumption data When it is less than a preset threshold, the operating frequency of the airflow sensor is adjusted to a second frequency.
[0013] In a second aspect, the present invention provides an energy consumption control device for an airflow sensor, which is configured in a computer and includes: A working status data acquisition module, for use in which the working status data includes air flow velocity data, air pressure data and temperature data of the air flow sensor; A data preprocessing module, used for performing a data preprocessing operation on the working status data to obtain preprocessed data; A median and variance calculation module, used to perform calculation operations based on the preprocessed data to obtain the median and variance of the working status data; A data storage module, used to perform a data storage configuration operation on the preprocessed data according to the median and the variance to obtain a storage feature vector; A clustering analysis module, used to perform a clustering analysis operation on the pre-processed data according to the stored feature vectors using a K-Means clustering algorithm to obtain energy consumption data of the airflow sensor; A working state judgment module, used for performing a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result; The energy consumption control module is used to adjust the working frequency of the airflow sensor according to the judgment result to complete the energy consumption control of the airflow sensor.
[0014] In a third aspect, the present invention further provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements an energy consumption control method for an airflow sensor as described in any one of the above.
[0015] In a fourth aspect, the present invention further provides a computer-readable storage medium, the computer-readable storage medium comprising a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned energy consumption control methods for an airflow sensor.
[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides an energy consumption control method for an airflow sensor, the method comprising: acquiring working state data of the airflow sensor, the working state data comprising airflow velocity data, air pressure data and temperature data of the airflow sensor; performing data preprocessing operations on the working state data to obtain preprocessed data; performing calculation operations based on the preprocessed data to obtain the median and variance of the preprocessed data; performing data storage configuration operations on the preprocessed data based on the median and the variance to obtain a storage feature vector; performing cluster analysis operations on the preprocessed data using a K-Means clustering algorithm based on the storage feature vector to obtain energy consumption data of the airflow sensor; performing a working state judgment operation on the airflow sensor based on the energy consumption data and the variance to obtain a judgment result; and performing a working frequency adjustment operation on the airflow sensor based on the judgment result to complete energy consumption control of the airflow sensor.
[0017] The method utilizes a computer system to collect data. Based on the collected data, a formula is constructed to calculate the median and variance and the K-Means clustering algorithm is used to accurately analyze the working state of the airflow sensor. By deeply analyzing the working state of the sensor, the working frequency of the airflow sensor is intelligently adjusted to achieve energy consumption control of the airflow sensor and reduce additional energy waste. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flow chart of an energy consumption control method of an airflow sensor provided by an embodiment of the present invention; Figure 2 It is a schematic diagram of detailed implementation steps of adjusting the working frequency of the airflow sensor provided by an embodiment of the present invention; Figure 3 It is a structural schematic diagram of an energy consumption control device for an airflow sensor provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] In recent years, with the rapid development of microelectronics and sensor technology, airflow sensors are increasingly used in portable electronic devices, especially in new health alternatives. By accurately monitoring the user's airflow behavior, the device's working state can be more efficiently controlled, and the user experience and energy efficiency can be improved. In such devices, the airflow sensor triggers the core heating function by detecting the user's inhalation action, generating aerosol conveniently and efficiently.
[0021] In one prior art, a common airflow sensor technology uses the temperature difference between a heating element and a temperature sensor to detect airflow. When air flows through, the temperature of the heating element drops, and the temperature difference signal is used to determine the strength of the airflow, thereby supporting its control effect in various electronic devices.
[0022] In the existing technology, since the airflow sensor technology is based on the thermoelectric principle, it often generates high energy consumption during long-term monitoring. How to achieve low energy consumption control while maintaining efficient monitoring has become a key technical issue in improving the overall performance of the equipment.
[0023] To solve the above problems, refer to Figure 1 The first embodiment of the present invention provides an energy consumption control method of an airflow sensor, comprising the following steps: S1, obtaining working state data of the airflow sensor, wherein the working state data includes airflow velocity data, air pressure data and temperature data of the airflow sensor; S2, performing a data preprocessing operation on the working status data to obtain preprocessed data; S3, performing a calculation operation according to the preprocessed data to obtain the median and variance of the preprocessed data; S4, performing a data storage configuration operation on the preprocessed data according to the median and the variance to obtain a storage feature vector; S5, performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vector to obtain energy consumption data of the airflow sensor; S6, performing a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result; S7, according to the judgment result, adjusting the working frequency of the airflow sensor to complete the energy consumption control of the airflow sensor.
[0024] In step S1, the working state data of the airflow sensor is acquired, and the working state data includes the airflow velocity data, the air pressure data and the temperature data of the airflow sensor.
[0025] In one implementation, the acquisition of the working status data of the airflow sensor includes the following hardware devices: an airflow sensor, a data acquisition device, a communication interface (such as a serial port or I2C), and a software tool for data processing; Furthermore, a data acquisition device is configured, and a sampling frequency and a sampling time are set to ensure that the dynamic changes of the airflow can be captured. When collecting data, a sensor is connected to the acquisition device to record real-time data over a period of time; It should be noted that the working status data includes airflow velocity data, air pressure data and temperature data of the airflow sensor, and the working status data is sampling data of the airflow sensor corresponding to different sampling times w within a preset time period t.
[0026] In step S2, a data preprocessing operation is performed on the working status data to obtain preprocessed data.
[0027] In one implementation, performing a data preprocessing operation on the working status data to obtain preprocessed data includes: The working status data is taken as input data and stored in array A, and an abnormal data check operation is performed on array A to mark and remove abnormal data; Mark the array A after removing abnormal data as array , record the location of the abnormal data as the missing data index ; According to the array , use the median to replace the missing values of abnormal data to obtain the preprocessed data , and its calculation formula is: When count is an odd number, the median mid], where mid ; When count is an even number, the median , where mid ; Use the median to replace the value of the missing data: median; Among them, count represents the length of array A, mid represents the median median in the sorted array The position index in , Indicates the number of missing data in array A and the missing data index Range: count-n.
[0028] Furthermore, the method for describing and identifying abnormal data includes: It should be noted that the abnormal data is defined as extreme values that deviate from the overall trend of the data set. The extreme values are statistically located at the upper and lower tails of the entire data distribution and can be detected by setting upper and lower limit thresholds, standard deviation, IQR (interquartile range), etc.
[0029] In step S3, a data preprocessing operation is performed on the working status data to obtain preprocessed data.
[0030] In one implementation, performing a data preprocessing operation on the working status data to obtain preprocessed data includes: The preprocessed data are arranged in ascending order, and the calculation formula of the median is expressed as: When count is an odd number, median ( ) mid1], where mid1 ; When count is an even number, median ( ) , where mid1 ; Among them, count represents an array length, mid1 represents the median ( ) in sorted array Position index in ; Furthermore, the calculation formula of the variance is expressed as: Among them, mean For array The mean of In step S4, a calculation operation is performed based on the preprocessed data to obtain the median and variance of the preprocessed data.
[0031] In one implementation, the preprocessed data is subjected to a data storage configuration operation based on the median and the variance to obtain a storage feature vector. ,include: The initial eigenvector is obtained according to the median and the variance , the initial eigenvector The composition is expressed as: in, respectively represent the array feature vectors after preprocessing of the working state data of the airflow sensor, is the median of the preprocessed data, is the variance of the preprocessed data; The preprocessed data of the airflow sensor is stored in the initial feature vector to obtain a stored feature vector ; Further, performing a data storage configuration operation on the preprocessed data includes: Represent the preprocessed data as an array , the initial eigenvector is represented as an array ; in, represents the nth data point after preprocessing, represents the mth element in the initial eigenvector array; The preprocessed data of the air flow sensor Stored sequentially into the initial feature vector In , the storage method can be direct splicing or overwriting of the original partial features, depending on the requirements; Splicing method: Append to At the end of , construct a new eigenvector: Overwrite method: According to the preset storage location, use Replace part or all of the data in Partial value It should be noted that storing feature vectors It is composed of a vector consisting of the median and variance calculated from the airflow velocity, pressure, and temperature data of all airflow sensors within the sampling time w.
[0032] In step S5, a clustering analysis operation is performed on the preprocessed data using a K-Means clustering algorithm according to the stored feature vector to obtain energy consumption data of the airflow sensor.
[0033] In one implementation, performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm based on the stored feature vector to obtain energy consumption data of the airflow sensor includes: The clustering analysis operation of the pre-processed data using the K-Means clustering algorithm includes the following four steps: Step 1: Select Initial cluster centers; Step 2: For each data point , calculate its correlation with all cluster centers The minimum Euclidean distance criterion function is used to measure the similarity between data points in the same cluster, and the data points are Assign to the nearest cluster center , the formula is: Step 3: Once all data points are assigned to a cluster Then update the cluster center: Step 4: Repeat steps 2 and 3 until the cluster center no longer changes or changes very little, completing the storage of the feature vector Cluster analysis of For each cluster , sample data points Cluster Center The minimum Euclidean distance between is: in, It is a data point The characteristic vector of Represents clusters The center point of Then the criterion function is expressed as: in, Indicates that it belongs to a cluster All data points of Indicates the number of clusters; It should be noted that the K-Means clustering algorithm Indicates the number of clusters. In the K-Means clustering algorithm, the minimum Euclidean distance criterion function is used to calculate the distance between the sample data point and the cluster center, and this function value is used as a measure of the similarity between the data points in the same cluster. Furthermore, the energy consumption data of the airflow sensor is obtained by performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vector C, including: Calculate the stored feature vector for each cluster The average energy consumption of all data points in ; Calculate the stored feature vector for each cluster The energy consumption variance; Energy consumption data is obtained according to the average energy consumption and the energy consumption variance; Among them, the calculation formulas of average energy consumption and energy consumption variance are expressed as follows: in, Represents data points The average energy consumption, Represents clusters The number of data points in Represents data points Energy consumption; Represents clusters Corresponding data points The energy consumption variance; Construct an energy consumption data array according to the average energy consumption and the energy consumption variance , the formula is: in, and Respectively represent all data points corresponding to the working status data The average energy consumption and energy consumption variance, Indicates the length of all data points; For the energy consumption data array All elements in the traversal operation are performed to obtain the energy consumption data value ; It should be noted that the energy consumption data array The method for traversing all elements in is: initialize a variable , used to store the final energy consumption data value, for the energy consumption data array Update variables after performing accumulation, comparison, and filtering operations , until all elements are traversed.
[0034] In step S6, a working state judgment operation of the airflow sensor is performed according to the energy consumption data and the variance to obtain a judgment result.
[0035] In one implementation, the operation of determining the working state of the airflow sensor according to the energy consumption data and the variance to obtain a determination result includes: When the variance of the working state data of all the airflow sensors is less than 1, the airflow sensor stops working, otherwise it continues working; When the variance <1, and the energy consumption data 0, it is determined that the airflow sensor is in an idle state; When the variance ≥1, and the energy consumption data 10, it is determined that the airflow sensor is in working state.
[0036] In step S7, according to the judgment result, the operating frequency of the airflow sensor is adjusted to complete the energy consumption control of the airflow sensor.
[0037] In one implementation, the adjusting operation of the working frequency of the airflow sensor according to the judgment result to complete the energy consumption control of the airflow sensor includes: When the working state of the airflow sensor is judged to be an idle state, a working frequency adjustment operation is performed; When the energy consumption data When it is greater than or equal to a preset threshold, adjusting the operating frequency of the airflow sensor to a first frequency; When the energy consumption data When the value is less than a preset threshold, adjusting the operating frequency of the airflow sensor to a second frequency; It should be noted that the preset threshold of the energy consumption data is set to 10, the first operating frequency is set to 10 Hz, and the second operating frequency is set to 1 Hz.
[0038] The following describes the working process of the present invention using a relatively common scenario as an example. The working process is as follows: Step 1: Initialize the K-Means clustering model; Step 2: Call the K-Means clustering model; Step 3: Divide the stored feature vectors C into data groups equal to the cluster center Ci (1≤Ci≤4); Step 4: Loop and store the data in the feature vector C; Step 5: Get the variance data of the four cluster centers and sort them from large to small; Step 6: Output the energy consumption data of the air flow sensor; Step 7: Perform energy consumption control of air flow sensor; Preferably, in step 1, initializing the K-Means clustering model includes: Entering a preset time period t=1 minute on the computer system to obtain the time interval of the working status data of the airflow sensor; Input sampling time w=20 milliseconds on the computer system to obtain the sampling time of the airflow sensor state data (airflow velocity, pressure, temperature); Obtain the median and variance of each (air flow velocity, pressure, temperature) data within a preset time period, and store them in the storage feature vector C according to i=1, 2, 3, 4; Construct a K-Means clustering model. The K-Means clustering model takes K as a parameter. The parameter K is the number of clusters, which is set to 4. The object of the K-Means clustering model contains the variance and the stored feature vector C. Furthermore, the method for constructing a K-Means clustering model comprises: Selection of initial cluster centers: Randomly initialize cluster centers : The K-Means algorithm first randomly selects The cluster centers are denoted as , used to perform preliminary division of data. Each cluster center ( is a vector representing the center position of the cluster; Assign data points to the nearest cluster: For each data point , calculate its center to each cluster The commonly used distance measurement method is Euclidean, and the calculation formula is expressed as: in, Represents each data point To each cluster center The distance; Update cluster center: Recalculate the cluster center for each cluster, which is the average value of all data points in the cluster: in, Represents data points The cluster center, Representation Cluster The number of data points in Indicates that it belongs to a cluster data points; Repeat iteration: Repeat the above assignment and update steps until the cluster center No longer changes significantly, or reaches the preset maximum number of iterations; Variance calculation: In each iteration, the variance of each cluster is calculated to measure the degree of deviation of the data point from the cluster center. The formula for calculating the variance is: The total variance is the sum of the variances of all clusters and is used to measure the clustering effect of the entire model. It is calculated as: in, Represents each cluster ,variance, represents the total variance of all clusters; Output of the K-Means clustering model: cluster assignment results, the cluster label to which each data point belongs. Through an iterative process, each data point will eventually be assigned to a cluster; cluster center vector: After multiple iterations, the center position of each cluster tends to be stable, and the final cluster center vector is obtained; the intra-cluster variance ( ): The final variance value for each cluster, and the total variance for the entire dataset , used to evaluate the clustering effect of the model; It should be noted that the median is the median of the working state data of the sensor in the sampling period, and the variance is the variance of the working state data of the sensor in the sampling period.
[0039] Preferably, in step 2, calling the K-Means clustering model includes: Set a sample set X=X[(X1, X2...Xm)], where each data sample in the sample set X is similar to the data obtained by initializing the K-Means clustering model; Set the number of clusters k, the cluster center is Ci, and each cluster center in Ci is set to 4. k = 4 means 4 groups of state data, and the variance and vector of each group of state data is C; Based on the cluster center Ci (i=1, 2, 3, 4), the difference Ds(i) between the vector C and the cluster center Ci is calculated; Preferably, in step 3, dividing the stored feature vectors C into data groups equal to the cluster centers Ci (1≤Ci≤4) comprises: Set the initial sample cluster and use each vector in the stored feature vector C as the initial cluster center; Read the data vectors in the stored feature vector C from left to right, and take each data vector in the stored feature vector C one by one in order; Read the difference Ds(i) between each data vector and each cluster center Ci (i=1, 2, 3, 4); Select the smallest difference as the cluster center, that is, the cluster center j of Ds(i) = min{Ds(C1), Ds(C2), Ds(C3), Ds(C4)}; Furthermore, the sample data points Cluster Center The minimum difference calculation formula between is expressed as: in, It is a data point The characteristic vector of Represents clusters The center point of Update cluster center: Ds(Cj)+=Ci, loop through the steps of reading difference Ds(i) and selecting the smallest difference, until all data in the stored feature vector C are read, and set loop counter loop=0.
[0040] Preferably, in step 4, the cyclic storage of data in the feature vector C includes: Loop counter loop, when loop < 4, the loop continues to read data; Calculate the variance of each group of data at the cluster center: set the cycle of cluster center j, and cycle cluster center Cj, j = 1, 2, 3, 4. The calculation formula of the variance is expressed as: in, Represents data points The variance of Indicates The number of clusters, Represents the square of the Euclidean distance from the point to the center; After the data variances of all the data vectors are calculated, the loop counter loop=loop+1; It should be noted that the cluster center with the smallest difference in the cycle count is selected as 1, and the other three cluster centers are set to 2, 3, and 4, that is, the variance is set to Variance can calculate the discreteness of the data set. The larger the value, the more dispersed the data distribution, and the smaller the value, the more concentrated the data. Therefore, by obtaining the variance, the sensor state can be judged and corresponding control can be performed.
[0041] Preferably, in step 5, the variance data of the four cluster centers are obtained and sorted from large to small, including: The variance data of the four cluster centers obtained are: After calculating the variance of each cluster, sort the variances of the four clusters from large to small: It should be noted that, based on the sorting results, it is determined which clusters have larger variances and which have smaller variances. Clusters with larger variances indicate that their data points are more dispersed, while clusters with smaller variances indicate that the data are more concentrated.
[0042] Preferably, in step 6, the energy consumption data of the output airflow sensor includes: According to the sorting result of step 5, the first cluster, i.e., the cluster with the largest variance, is determined as the central group, and the central group has 6 data combinations, i.e., 4 data types; The more discrete the data type of the central group is, that is, the larger the variance value is, the greater the energy consumption of the airflow sensor is. On the contrary, the more concentrated the data type is, that is, the smaller the variance value is, the lower the energy consumption of the airflow sensor is. The operating frequency is set according to the discrete degree value of the data.
[0043] Preferably, in step seven, the energy consumption control of the airflow sensor includes: When the energy consumption data When it is greater than or equal to a preset threshold, adjusting the operating frequency of the airflow sensor to a first frequency; When the energy consumption data When the value is less than a preset threshold, adjusting the operating frequency of the airflow sensor to a second frequency; It should be noted that the preset threshold of the energy consumption data is set to 10, the first operating frequency is set to 10 Hz, and the second operating frequency is set to 1 Hz.
[0044] Reference Figure 2 , the working frequency adjustment process of the airflow sensor, based on the stored feature vector C, uses the K-Means clustering algorithm to analyze all the working state data of the airflow sensor to obtain the variance of the working state data; when the variances of the airflow velocity, pressure and temperature of the airflow sensor are all less than 1, the sensor stops working; when the variances of the airflow velocity, pressure and temperature of the airflow sensor are all greater than 1, the sensor continues to work; Furthermore, when the sensor stops working, the airflow sensor is in an idle state, and the working state of the airflow sensor is judged to be an idle state. At this time, the energy consumption data of the airflow sensor is 0; Furthermore, when the sensor continues to work, the airflow sensor is in a working state, and the working state of the airflow sensor is judged to be a working state. At this time, the energy consumption data of the airflow sensor is 10; Further, according to the energy consumption data The working frequency of the airflow sensor is adjusted according to the value of to complete the energy consumption control of the airflow sensor; It should be noted that, when judging whether the electronic cigarette airflow sensor is working, if the airflow sensor is in working state, jump to the above step S1, if the airflow sensor is in idle state, jump to the above step S5.
[0045] In summary, the present invention provides an energy consumption control method for an airflow sensor, the method comprising: acquiring working status data of the airflow sensor, the working status data comprising airflow velocity data, air pressure data and temperature data of the airflow sensor; performing data preprocessing operations on the working status data to obtain preprocessed data; performing calculation operations based on the preprocessed data to obtain the median and variance of the preprocessed data; performing data storage configuration operations on the preprocessed data based on the median and the variance to obtain a storage feature vector; performing clustering analysis operations on the preprocessed data using a K-Means clustering algorithm based on the storage feature vector to obtain energy consumption data of the airflow sensor; performing a working status judgment operation on the airflow sensor based on the energy consumption data and the variance to obtain a judgment result; and performing a working frequency adjustment operation on the airflow sensor based on the judgment result to complete the energy consumption control of the airflow sensor.
[0046] The method detects the working status data of the airflow sensor, including but not limited to speed, pressure, and temperature. The data is processed by presetting the time period t and sampling time w, and the median and variance of each data within the sampling period are calculated and stored in the storage feature vector C. Combined with the K-Means clustering algorithm, the energy-saving control of the sensor is achieved by adjusting the working frequency of the airflow sensor.
[0047] Reference Figure 3 The second embodiment of the present invention provides an energy consumption control device for an airflow sensor, which is configured in a computer and includes: 101 working state data acquisition module, used for the working state data including air flow velocity data, air pressure data and temperature data of the air flow sensor; 102 data preprocessing module, used for performing data preprocessing operation on the working status data to obtain preprocessed data; 103 a median and variance calculation module, used to perform calculation operations according to the preprocessed data to obtain the median and variance of the working status data; 104 data storage module, used to perform data storage configuration operation on the pre-processed data according to the median and the variance to obtain a storage feature vector; 105 a cluster analysis module, for performing a cluster analysis operation on the pre-processed data using a K-Means clustering algorithm according to the stored feature vectors, to obtain energy consumption data of the airflow sensor; 106 a working state judgment module, used to perform a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result; 107 energy consumption control module, used for adjusting the working frequency of the airflow sensor according to the judgment result to complete the energy consumption control of the airflow sensor.
[0048] It should be noted that the energy consumption control device of an airflow sensor provided in an embodiment of the present invention is used to execute all the process steps of the energy consumption control method of an airflow sensor in the above embodiment. The working principles and beneficial effects of the two correspond one to one, and thus will not be described in detail.
[0049] In summary, the present invention provides an energy consumption control method for an airflow sensor, the method comprising: acquiring working status data of the airflow sensor, the working status data comprising airflow velocity data, air pressure data and temperature data of the airflow sensor; performing data preprocessing operations on the working status data to obtain preprocessed data; performing calculation operations based on the preprocessed data to obtain the median and variance of the preprocessed data; performing data storage configuration operations on the preprocessed data based on the median and the variance to obtain a storage feature vector; performing clustering analysis operations on the preprocessed data using a K-Means clustering algorithm based on the storage feature vector to obtain energy consumption data of the airflow sensor; performing a working status judgment operation on the airflow sensor based on the energy consumption data and the variance to obtain a judgment result; and performing a working frequency adjustment operation on the airflow sensor based on the judgment result to complete the energy consumption control of the airflow sensor.
[0050] The method utilizes a computer system to collect data. Based on the collected data, a formula is constructed to calculate the median and variance and the K-Means clustering algorithm is used to accurately analyze the working state of the airflow sensor. By deeply analyzing the working state of the sensor, the working frequency of the airflow sensor is intelligently adjusted to achieve energy consumption control of the airflow sensor and reduce additional energy waste.
[0051] An embodiment of the present invention further provides an electronic device. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a program for an energy consumption control method of an airflow sensor. When the processor executes the computer program, the steps in the above-mentioned energy consumption control method based on the airflow sensor are implemented, such as Figure 1 Alternatively, when the processor executes the computer program, the functions of the modules / units in the above-mentioned device embodiments are realized, for example, the working status data acquisition module 101.
[0052] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the electronic device.
[0053] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than the above components, or may combine certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0054] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device.
[0055] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the electronic device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0056] Wherein, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0057] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0058] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for controlling energy consumption of an airflow sensor, characterized in that: Executed by a computer, including: Acquiring working state data of the airflow sensor, wherein the working state data includes airflow velocity data, air pressure data and temperature data of the airflow sensor; Performing a data preprocessing operation on the working status data to obtain preprocessed data; Performing calculation operations according to the preprocessed data to obtain the median and variance of the preprocessed data; According to the median and the variance, performing a data storage configuration operation on the preprocessed data to obtain a storage feature vector; According to the stored feature vector, a cluster analysis operation is performed on the pre-processed data using a K-Means clustering algorithm to obtain energy consumption data of the airflow sensor; According to the energy consumption data and the variance, a working state judgment operation of the airflow sensor is performed to obtain a judgment result; According to the judgment result, the working frequency of the airflow sensor is adjusted to complete the energy consumption control of the airflow sensor.
2. The energy consumption control method of the airflow sensor according to claim 1, characterized in that: Performing a data preprocessing operation on the working status data to obtain preprocessed data includes: The working status data is taken as input data and stored in array A, and an abnormal data check operation is performed on array A to mark and remove abnormal data; Mark the array A after removing abnormal data as array , record the location of the abnormal data as the missing data index ; According to the array , use the median to replace the missing values of abnormal data to obtain the preprocessed data , and its calculation formula is: When count is an odd number, the median mid], where mid ; When count is an even number, the median , where mid ; Use the median to replace the value of the missing data: median; Among them, count represents the length of array A, mid represents the median median in the sorted array The position index in , Indicates the number of missing data in array A and the missing data index Range: count-n.
3. The energy consumption control method of the airflow sensor according to claim 1, characterized in that: The performing a data storage configuration operation on the preprocessed data according to the median and the variance to obtain a storage feature vector comprises: The initial eigenvector is obtained according to the median and the variance , the initial eigenvector The composition is expressed as: in, respectively represent the array feature vectors after preprocessing of the working state data of the airflow sensor, is the median of the preprocessed data, is the variance of the preprocessed data; The preprocessed data of the airflow sensor is stored in the initial feature vector to obtain a stored feature vector .
4. The energy consumption control method of the airflow sensor according to claim 1, characterized in that: The step of performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vectors includes: Step 1: Select Initial cluster centers; Step 2: For each data point , calculate its correlation with all cluster centers The minimum Euclidean distance criterion function is used to measure the similarity between data points in the same cluster, and the data points are Assign to the nearest cluster center , the formula is: Step 3: Once all data points are assigned to a cluster Then update the cluster center: Step 4: Repeat steps 2 and 3 until the cluster center no longer changes or changes very little, completing the storage of the feature vector Cluster analysis of For each cluster , sample data points Cluster Center The minimum Euclidean distance between is: in, It is a data point The characteristic vector of Represents clusters The center point of Then the criterion function is expressed as: in, Indicates that it belongs to a cluster All data points of Indicates the number of clusters.
5. The energy consumption control method of the airflow sensor according to claim 4, characterized in that: The step of performing a cluster analysis operation on the preprocessed data using a K-Means clustering algorithm according to the stored feature vector C to obtain the energy consumption data of the airflow sensor includes: Calculate the stored feature vector for each cluster The average energy consumption of all data points in ; Calculate the stored feature vector for each cluster The energy consumption variance; Energy consumption data is obtained according to the average energy consumption and the energy consumption variance; Among them, the calculation formulas of average energy consumption and energy consumption variance are expressed as follows: in, Represents data points The average energy consumption, Represents clusters The number of data points in Represents data points Energy consumption; Represents clusters Corresponding data points The energy consumption variance; Construct an energy consumption data array according to the average energy consumption and the energy consumption variance , the formula is: in, and Respectively represent all data points corresponding to the working status data The average energy consumption and energy consumption variance, Indicates the length of all data points; For the energy consumption data array All elements in the traversal operation are performed to obtain the energy consumption data value .
6. The energy consumption control method of the airflow sensor according to claim 5, characterized in that: The step of performing a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result includes: When the variance of the working state data of all the airflow sensors is less than 1, the airflow sensor stops working, otherwise it continues working; When the variance <1, and the energy consumption data 0, it is determined that the airflow sensor is in an idle state; When the variance ≥1, and the energy consumption data 10, it is determined that the airflow sensor is in working state.
7. The energy consumption control method of the airflow sensor according to claim 6, characterized in that: The step of adjusting the operating frequency of the airflow sensor according to the judgment result to complete the energy consumption control of the airflow sensor includes: When the working state of the airflow sensor is judged to be an idle state, a working frequency adjustment operation is performed; When the energy consumption data When it is greater than or equal to a preset threshold, adjusting the operating frequency of the airflow sensor to a first frequency; When the energy consumption data When it is less than a preset threshold, the operating frequency of the airflow sensor is adjusted to a second frequency.
8. An energy consumption control device for an airflow sensor, characterized in that: Configured in the computer, including: A working status data acquisition module, for use in which the working status data includes air flow velocity data, air pressure data and temperature data of the air flow sensor; A data preprocessing module, used for performing a data preprocessing operation on the working status data to obtain preprocessed data; A median and variance calculation module, used to perform calculation operations based on the preprocessed data to obtain the median and variance of the working status data; A data storage module, used to perform a data storage configuration operation on the preprocessed data according to the median and the variance to obtain a storage feature vector; A clustering analysis module, used to perform a clustering analysis operation on the pre-processed data according to the stored feature vectors using a K-Means clustering algorithm to obtain energy consumption data of the airflow sensor; A working state judgment module, used for performing a working state judgment operation of the airflow sensor according to the energy consumption data and the variance to obtain a judgment result; The energy consumption control module is used to adjust the working frequency of the airflow sensor according to the judgment result to complete the energy consumption control of the airflow sensor.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, an energy consumption control method for an airflow sensor as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the energy consumption control method of an airflow sensor according to any one of claims 1 to 7.
