Instrument and equipment detection method based on K-means clustering algorithm
Through the instrument and equipment detection method based on the K-means clustering algorithm, the Internet of Things sensors are used to collect multi-parameter data, perform data preprocessing and machine learning model training, the problem of relying on manual recording of equipment working time statistics is solved, and intelligent judgment of equipment status and accurate statistics of working time are realized.
Patent Information
- Application Number
- CN202411780146.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-05-02
AI Technical Summary
In the prior art, the working time statistics of equipment mainly relies on manual recording, which is inefficient and cannot accurately distinguish effective working hours, and there are a lot of errors.
The instrument and equipment detection method based on the K-means clustering algorithm is adopted, and the Internet of Things sensors continuously collect multi-parameter data such as voltage, current, active power, etc. of the device, and data preprocessing and machine learning model training are carried out to achieve intelligent classification judgment of the device status and accurate statistics of working hours.
It realizes automatic judgment of equipment status, improves statistical efficiency and accuracy, reduces the workload of manual observation and recording, and can efficiently summarize the working time data of massive equipment.
Smart Images

Figure CN119917885A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of equipment detection, and more specifically, to an instrument equipment detection method based on a K-means clustering algorithm. Background Art
[0002] With the widespread application of modern equipment and instruments, various types of equipment and instruments are widely used in industrial production, scientific research and other fields. How to accurately obtain the effective load operation time of the equipment is extremely important for equipment management and maintenance. The evaluation of the equipment's operating status is not only to evaluate the equipment's utilization efficiency and reasonable scheduling, but also one of the basic data for equipment maintenance and life prediction.
[0003] At present, the traditional manual recording statistical method is often inefficient. Manual recording is not only labor-intensive and inefficient, but also cannot be carried out continuously around the clock, and is prone to statistical errors. This makes it difficult to meet the needs of large-scale monitoring of equipment utilization, and it is also impossible to meet the needs of accurate monitoring of a large number of equipment and subsequent analysis and statistics. Therefore, the traditional manual recording equipment method of using the switch state to count the working time has obvious defects. In addition, the algorithm using a single power parameter, such as setting the current magnitude threshold, is used to judge the working state. This type of simple judgment method has the problem of high judgment error rate when the current value changes greatly. Due to the differences in the optimal thresholds of different types of equipment, it is difficult to unify the judgment standard. However, it is impossible to judge the specific working conditions of the instrument and equipment based solely on the current magnitude, such as no-load, overload, fault status, etc., ignoring the important reference value of other parameters such as voltage and power. Therefore, based on a single current parameter, the judgment result is more susceptible to interference and the accuracy is difficult to guarantee. In addition, the small number of simple machine learning methods have limited effects. They try to use simple machine learning algorithms to judge the equipment status, but feature engineering relies on expert experience, training samples are limited, and the effect is not ideal. The application effect of simple unsupervised learning algorithms also has limitations and fails to achieve intelligent and accurate equipment status judgment. In view of this, we propose an instrument and equipment detection method based on the K-means clustering algorithm. Summary of the invention
[0004] The purpose of the present invention is to provide an instrument equipment detection method based on K-means clustering algorithm to solve the technical problems that the current equipment working time statistics mainly rely on manual records, are inefficient, cannot distinguish effective working time, and have a large number of errors.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions: an instrument and equipment detection method based on K-means clustering algorithm, the method is implemented based on an instrument and equipment detection system, and the instrument and equipment detection system comprises:
[0006] A power data acquisition module for continuously collecting multi-parameter power data such as voltage, current, active power, reactive power, etc. during the operation of the device through an IoT sensor located at the power connection of the device; a data preprocessing module for cleaning and constructing the collected raw power data to form a structured device power multi-parameter time series database; a machine learning module for applying a distributed machine learning platform to implement targeted training and optimization of the K-means clustering state judgment model for each device; a state judgment module for applying a distributed machine learning platform spark to intelligently classify and judge the operation status of the device based on the newly collected time series data of power parameters, marking and storing the judgment results; and a working time statistics module for statistically analyzing the total effective working time of the device according to the working status of the device in each time period output by the state judgment module;
[0007] The instrument and equipment detection method based on the K-means clustering algorithm comprises the following steps:
[0008] S1, data collection;
[0009] The power data of the statistical equipment is collected through the power data collection module, including current, voltage, power, power factor, active power, reactive power, and frequency information;
[0010] S2, data preprocessing;
[0011] After obtaining the equipment power parameter data set, the data is cleaned through the data preprocessing module to remove outliers and erroneous data;
[0012] Use SparkDataFrame to process the data. The specific method is as follows:
[0013] The power parameter data during the equipment operation time is converted into DataFrame format, and then timestamp information is added to form time series data in chronological order;
[0014] S3, data identification and annotation;
[0015] Through the machine learning module, the K-means clustering algorithm of SparkMLlib is used to identify and label the equipment operation status;
[0016] Use power parameters as feature attributes, and then specify classification parameters, such as dividing the equipment status into working status and non-working status;
[0017] Use K-means clustering algorithm to train the input data and obtain the classification label of each data point;
[0018] Repeat the training several times and adjust the K-means clustering model until the clustering results are stable;
[0019] The calculation formula for clustering the data of each device is:
[0020]
[0021] Where k is the number of clusters, n is the number of data points, and x (i) is the i-th data point to be assigned, μ j is the centroid of the jth cluster, ||x (i) -μ j || 2 It is point x (i) With the center of mass μ j The square of the distance between
[0022] By iteratively refining the location of the centroid and redistributing data points to the nearest centroid, the algorithm gradually reduces this cost function J until it reaches a stopping condition;
[0023] S4. Working time statistics;
[0024] According to the working status mark of each device at each time point, the effective operating time of the device is calculated, that is, the effective operating time of the device per day is obtained;
[0025] On this basis, statistics can be made according to different time granularities, such as effective working time in one day, one week, one month and one year;
[0026] At the same time, these calculation results are stored in a relational database to count the effective operating time of the equipment.
[0027] Preferably, in S1, in order to obtain comprehensive operation data of the equipment, it is necessary to continuously collect these power parameter information during the operation of the equipment, and the collection time interval is set according to the equipment type and actual needs, such as a 30-second time interval.
[0028] Preferably, in S2, through the correspondence between the equipment and the collection line, the current, voltage, power, power factor, active power, reactive power, and frequency information of various equipment collected are added to the specific equipment number and stored in the time series database. At the same time, to ensure the efficiency of calculation and storage, these data are stored in the Influxdb database as the input data source of the K-means clustering algorithm.
[0029] Preferably, in S3, as an improvement of the above calculation, the initialization phase of clustering is modified by adding two parameters, 'random_state' and 'n_ini'. The 'random_state' parameter controls the random number generation process of the algorithm. The specific formula is as follows:
[0030]
[0031] in represents the initial centroid, RandomSelect(X, seed = random_state) is a function that provides a seed value to randomly select the initial centroid from the data set X;
[0032] 'random_state' acts as a seed value to ensure consistency in random selection.
[0033] Preferably, fixed values are set to specify the random number sequence generated when running the algorithm and the selection of the initial centroid position at each run, while ensuring the repeatability of the algorithm, allowing accurate repeated clustering to correct the precise determination of working time and non-working time;
[0034] The 'n_ini' parameter controls the number of times the algorithm tries different initial centroid configurations. The specific calculation formula is as follows:
[0035]
[0036] Among them C (n) and μ (n) are the cluster assignment and centroid position of the nth iteration respectively. For each attempt, a new set of initial centroids is randomly selected from the data, and then the whole clustering process is run. Multiple runs increase the robustness of the algorithm, reduce the recklessness of different initial conditions, and reduce the impact of complex or noisy data sets on the clustering effect. At the same time, the algorithm has more opportunities to find a configuration that makes the cost function reach a lower value, thereby increasing the accuracy of clustering.
[0037] Preferably, 'random_state' and 'n_ini' jointly affect the convergence of the algorithm. A fixed 'random_state' provides a consistent starting point, while 'n_ini' increases the possibility of escaping the local optimal solution through multiple attempts.
[0038] Preferably, through the K-means clustering training results, the state category of the equipment at each time point can be parsed, and then marked according to the category label to mark the equipment operation status at each time stage.
[0039] Compared with the prior art, the present invention has the following beneficial effects:
[0040] 1. The present invention uses K-means clustering intelligent algorithm to analyze the power data of the equipment. The algorithm model can process the data at high speed, quickly output the prediction results of the equipment status, realize the automatic judgment of the equipment status, avoid a lot of manual observation and recording work, and greatly improve the statistical efficiency. Compared with the traditional statistics that require a lot of work, this method enables the working time of a large number of equipment to be efficiently summarized. Secondly, this method realizes the accuracy of the equipment working time statistics. Parameters such as current and voltage can effectively reflect the real-time status of the equipment. At the same time, this method adopts data preprocessing technology to ensure the quality of input data. Compared with the misjudgment of manual records, this method combines intelligent algorithms to achieve accurate judgment. Repeated adjustment of the model also makes the statistical results more accurate and reliable. Finally, the present invention has wide practicability. Based on the general power parameter indicators and K-means clustering algorithm ideas, it can be extended to various types of equipment in multiple fields such as industry and scientific research, and realize general-purpose working time monitoring, which is not limited by the type of equipment. At the same time, the method is simple and feasible. Compared with the traditional method, the present invention has significant technical progress and is of great significance to promoting scientific management of equipment. It is convenient for wide promotion and implementation. It has broad application prospects and important social and economic value, and solves the problem that the current equipment working time statistics mainly rely on manual records, which is inefficient, unable to distinguish effective working time, and has a large number of errors.
[0041] 2. The present invention also realizes intelligent and autonomous judgment by applying K-means clustering unsupervised learning algorithm, without relying on artificial features and labels; multi-parameter clustering, comprehensive judgment of equipment working status, more accurate and comprehensive judgment; based on the judgment results, automatic statistics of equipment effective working time, without human participation; providing accurate and reliable equipment utilization time data to promote production decision-making and optimization. Modular design, flexible expansion of new functional modules; strong software and hardware compatibility, can integrate different equipment, databases, algorithms; based on universal technology, lower implementation cost; no special sensors are required, reducing data collection costs; can be extended to equipment efficiency evaluation in industries, scientific research and other fields, providing equipment and system operation management data support. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a schematic diagram of the system flow of the present invention. DETAILED DESCRIPTION
[0043] In order to facilitate those skilled in the art to understand the technical solution of the present invention, the technical solution of the present invention is further described in conjunction with the accompanying drawings of the specification.
[0044] An instrument and equipment detection method based on a K-means clustering algorithm is implemented based on an instrument and equipment detection system. The instrument and equipment detection system includes:
[0045] A power data acquisition module for continuously collecting multi-parameter power data such as voltage, current, active power, reactive power, etc. during the operation of the device through an IoT sensor located at the power connection of the device; a data preprocessing module for cleaning and constructing the collected raw power data to form a structured device power multi-parameter time series database; a machine learning module for applying a distributed machine learning platform to implement targeted training and optimization of the K-means clustering state judgment model for each device; a state judgment module for applying a distributed machine learning platform spark to intelligently classify and judge the operation status of the device based on the newly collected time series data of power parameters, marking and storing the judgment results; and a working time statistics module for statistically analyzing the total effective working time of the device according to the working status of the device in each time period output by the state judgment module;
[0046] The instrument and equipment detection method based on K-means clustering algorithm includes the following steps:
[0047] S1, data collection;
[0048] The power data of the statistical equipment is collected through the power data collection module, including current, voltage, power, power factor, active power, reactive power, and frequency information;
[0049] S2, data preprocessing;
[0050] After obtaining the equipment power parameter data set, the data is cleaned through the data preprocessing module to remove outliers and erroneous data;
[0051] Use SparkDataFrame to process the data. The specific method is as follows:
[0052] The power parameter data during the equipment operation time is converted into DataFrame format, and then timestamp information is added to form time series data in chronological order;
[0053] S3, data identification and annotation;
[0054] Through the machine learning module, the K-means clustering algorithm of SparkMLlib is used to identify and label the equipment operation status;
[0055] Use power parameters as feature attributes, and then specify classification parameters, such as dividing the equipment status into working status and non-working status;
[0056] Use K-means clustering algorithm to train the input data and obtain the classification label of each data point;
[0057] Repeat the training several times and adjust the K-means clustering model until the clustering results are stable;
[0058] The calculation formula for clustering the data of each device is:
[0059]
[0060] Where k is the number of clusters, n is the number of data points, and x (i) is the i-th data point to be assigned, μ j is the centroid of the jth cluster, ‖ x i) -μ j‖ 2 It is point x i) With the center of mass μ j The square of the distance between
[0061] By iteratively refining the location of the centroid and redistributing data points to the nearest centroid, the algorithm gradually reduces this cost function J until it reaches a stopping condition;
[0062] S4. Working time statistics;
[0063] According to the working status mark of each device at each time point, the effective operating time of the device is calculated, that is, the effective operating time of the device per day is obtained;
[0064] On this basis, statistics can be made according to different time granularities, such as effective working time in one day, one week, one month and one year;
[0065] At the same time, these calculation results are stored in a relational database to count the effective operating time of the equipment.
[0066] In an embodiment of the present invention, in S1, in order to obtain comprehensive operation data of the equipment, it is necessary to continuously collect these power parameter information during the operation of the equipment, and the collection time interval is set according to the equipment type and actual needs, such as a 30-second time interval.
[0067] In S2 of the embodiment of the present invention, through the correspondence between the equipment and the collection line, the current, voltage, power, power factor, active power, reactive power, and frequency information of various equipment collected are added to the specific number of the equipment and stored in the time series database. At the same time, in order to ensure the high efficiency of calculation and storage, these data are stored in the Influxdb database as the input data source of the K-means clustering algorithm.
[0068] In S3 of the embodiment of the present invention, as an improvement of the above calculation, the initialization phase of clustering is modified by adding two parameters, 'random_state' and 'n_ini'. The 'random_state' parameter controls the random number generation process of the algorithm. The specific formula is as follows:
[0069]
[0070] in represents the initial centroid, RandomSelect(X, seed = random_state) is a function that provides a seed value to randomly select the initial centroid from the data set X;
[0071] 'random_state' acts as a seed value to ensure consistency in random selection.
[0072] In the embodiment of the present invention, fixed values are set to specify the random number sequence generated when running the algorithm and the selection of the initial centroid position at each run, while ensuring the repeatability of the algorithm, allowing accurate repeated clustering to correct the precise determination of working time and non-working time;
[0073] The 'n_ini' parameter controls the number of times the algorithm tries different initial centroid configurations. The specific calculation formula is as follows:
[0074]
[0075] Among them C (n) and μ (n) are the cluster allocation and centroid position of the nth iteration respectively. For each attempt, a new initial centroid set is randomly selected from the data, and then the entire clustering process is run. Multiple runs increase the robustness of the algorithm, reduce the recklessness of different initial conditions, and reduce the impact of complex or noisy data sets on the clustering effect. At the same time, the algorithm has more opportunities to find a configuration that makes the cost function reach a lower value, thereby increasing the accuracy of clustering. 'random_state' and 'n_ini' jointly affect the convergence of the algorithm. The fixed 'random_state' provides a consistent starting point, while 'n_ini' increases the possibility of escaping the local optimal solution through multiple attempts. Through the K-means clustering training results, the state category of the device at each time point can be parsed, and then labeled according to the category label to label the device operation status at each time stage.
[0076] The embodiments of the present invention disclose preferred embodiments, but are not limited thereto. A person skilled in the art can easily understand the spirit of the present invention based on the above embodiments and make different extensions and changes. However, as long as they do not deviate from the spirit of the present invention, they are all within the protection scope of the present invention.
Claims
1. An instrument and equipment detection method based on K-means clustering algorithm, characterized in that: The method is implemented based on an instrument and equipment detection system, and the instrument and equipment detection system comprises: A power data acquisition module for continuously collecting multi-parameter power data such as voltage, current, active power, reactive power, etc. during the operation of the device through an IoT sensor located at the power connection of the device; a data preprocessing module for cleaning and constructing the collected raw power data to form a structured device power multi-parameter time series database; a machine learning module for applying a distributed machine learning platform to implement targeted training and optimization of the K-means clustering state judgment model for each device; a state judgment module for applying a distributed machine learning platform spark to intelligently classify and judge the operation status of the device based on the newly collected time series data of power parameters, marking and storing the judgment results; and a working time statistics module for statistically analyzing the total effective working time of the device according to the working status of the device in each time period output by the state judgment module; The instrument and equipment detection method based on the K-means clustering algorithm comprises the following steps: S1, data collection; The power data of the statistical equipment is collected through the power data collection module, including current, voltage, power, power factor, active power, reactive power, and frequency information; S2, data preprocessing; After obtaining the equipment power parameter data set, the data is cleaned through the data preprocessing module to remove outliers and erroneous data; Use SparkDataFrame to process the data. The specific method is as follows: The power parameter data during the equipment operation time is converted into DataFrame format, and then timestamp information is added to form time series data in chronological order; S3, data identification and annotation; Through the machine learning module, the K-means clustering algorithm of SparkMLlib is used to identify and label the equipment operation status; Use power parameters as feature attributes, and then specify classification parameters, such as dividing the equipment status into working status and non-working status; Use K-means clustering algorithm to train the input data and obtain the classification label of each data point; Repeat the training several times and adjust the K-means clustering model until the clustering results are stable; The calculation formula for clustering the data of each device is: Where k is the number of clusters, n is the number of data points, and x (i) is the i-th data point to be assigned, μ j is the centroid of the jth cluster, ||x (i) -μ j || 2 It is point x (i) With the center of mass μ j The square of the distance between By iteratively refining the location of the centroid and redistributing data points to the nearest centroid, the algorithm gradually reduces this cost function J until it reaches a stopping condition; S4. Working time statistics; According to the working status mark of each device at each time point, the effective operating time of the device is calculated, that is, the effective operating time of the device per day is obtained; On this basis, statistics can be made according to different time granularities, such as effective working time in one day, one week, one month and one year; At the same time, these calculation results are stored in a relational database to count the effective operating time of the equipment.
2. The instrument and equipment detection method based on K-means clustering algorithm according to claim 1, characterized in that: In S1, in order to obtain comprehensive operation data of the equipment, it is necessary to continuously collect these power parameter information during the operation of the equipment. The collection time interval is set according to the equipment type and actual needs, such as a 30-second time interval.
3. The instrument and equipment detection method based on K-means clustering algorithm according to claim 2 is characterized in that: In S2, the current, voltage, power, power factor, active power, reactive power, and frequency information of various devices collected are added to the specific device number through the correspondence between the device and the collection line, and stored in the time series database. At the same time, in order to ensure the efficiency of calculation and storage, these data are stored in the Influxdb database as the input data source of the K-means clustering algorithm.
4. The instrument and equipment detection method based on K-means clustering algorithm according to claim 3 is characterized in that: In S3, as an improvement to the above calculation, the initialization phase of clustering is modified by adding two parameters, 'random_state' and 'n_ini'. The 'random_state' parameter controls the random number generation process of the algorithm. The specific formula is as follows: in represents the initial centroid, RandomSelect(X, seed = random_state) is a function that provides a seed value to randomly select the initial centroid from the data set X; 'random_state' acts as a seed value to ensure consistency in random selection.
5. The instrument and equipment detection method based on K-means clustering algorithm according to claim 4 is characterized in that: Setting fixed values to specify the random number sequence generated when running the algorithm and the selection of the initial centroid position at each run, while ensuring the repeatability of the algorithm, allowing accurate repeated clustering to correct the precise determination of working time and non-working time; The 'n_ini' parameter controls the number of times the algorithm tries different initial centroid configurations. The specific calculation formula is as follows: Among them C (n) and μ (n) are the cluster assignment and centroid position of the nth iteration respectively. For each attempt, a new set of initial centroids is randomly selected from the data, and then the whole clustering process is run. Multiple runs increase the robustness of the algorithm, reduce the recklessness of different initial conditions, and reduce the impact of complex or noisy data sets on the clustering effect. At the same time, the algorithm has more opportunities to find a configuration that makes the cost function reach a lower value, thereby increasing the accuracy of clustering.
6. The instrument and equipment detection method based on K-means clustering algorithm according to claim 5 is characterized in that: 'random_state' and 'n_ini' jointly affect the convergence of the algorithm. A fixed 'random_state' provides a consistent starting point, while 'n_ini' increases the possibility of escaping from the local optimal solution through multiple attempts.
7. The instrument and equipment detection method based on K-means clustering algorithm according to claim 6 is characterized in that: Through the K-means clustering training results, we can parse out the status category of the equipment at each time point, and then mark it according to the category label to mark the equipment operation status at each time stage.
Citation Information
Cited By
Lightning arrester resistive current data classification method and lightning arrester working state judgment method
CN120162615A