Real-time early warning system for Internet of Things equipment based on machine learning
By designing a real-time early warning system for IoT devices based on machine learning in an industrial production environment, and utilizing the data processing and early warning rules of PLC equipment and training modules, real-time analysis and prediction of environmental data is achieved, solving the problem of difficulty in advance in the existing technology. Identifying safety risk issues ensures the safety of industrial production.
Patent Information
- Application Number
- CN202410949682.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In an industrial production environment, how to effectively analyze and predict the trends of environmental data and issue early warnings to ensure safe production, it is difficult to achieve real-time and accurate risk identification with existing technology.
Design a real-time early warning system for Internet of Things equipment based on machine learning. Environmental data is collected through PLC equipment, and the access gateway sends the data to the training module for processing and model training. The random forest algorithm is used to generate a prediction model, and judgment is made based on the early warning rule configuration file. Whether to trigger an alert and send the alert message to the Web client through the WebSocket module.
It realizes the real-time collection, storage and management of key data in the industrial production environment, uses machine learning algorithms to identify potential safety risks in advance, and issues early warnings to ensure the safety of industrial production.
Smart Images

Figure CN118865614A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Internet of Things, and in particular to a real-time early warning system for Internet of Things devices based on machine learning. Background Art
[0002] The large-scale application of Internet of Things technology has promoted the rapid development of smart industry. Smart industry will continuously integrate various terminals with environmental perception capabilities into all aspects of industrial production, which can significantly improve the production efficiency of industrial products, effectively improve product quality, and reduce product costs and resource consumption. Production process control and production environment monitoring are typical application scenarios of smart industry.
[0003] In the industrial production environment, PLC devices collect various environmental data, and then send these data to the access gateway through the TCP protocol. The access gateway then sends these data to the big data system for storage and management. Data collected in the production environment, such as temperature, humidity, formaldehyde, gas density, etc., are closely related to safe production. Once these data exceed the predetermined threshold, they may trigger a safety accident. Therefore, it is extremely important to analyze and mine these collected environmental data and predict their future trends, so as to issue early warnings and remind people to take safety precautions.
[0004] In view of this, the present invention proposes a real-time early warning system for Internet of Things devices based on machine learning. Summary of the invention
[0005] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0006] The present invention has been proposed in view of the above-mentioned problems.
[0007] In order to solve the above technical problems, the present invention provides the following technical solutions: a real-time early warning system for IoT devices based on machine learning, comprising:
[0008] PLC equipment: used to collect environmental data in industrial production and send the environmental data to the access gateway;
[0009] Access gateway: used to receive environmental data collected by PLC devices and send the environmental data to the training module;
[0010] Training module: used to receive and process environmental data, update historical data sets, and train prediction models;
[0011] Early warning module: used to use the trained model to predict future data and determine whether an early warning needs to be triggered based on the early warning rule configuration file;
[0012] WebSocket module: used to receive warning messages and send them to the Web client module through a WebSocket bidirectional connection;
[0013] Web client module: used to display the warning messages received from the WebSocket module;
[0014] The system operation process includes:
[0015] Step 1: The PLC device initiates a TCP connection request to the access gateway, and both parties establish a TCP long connection;
[0016] Step 2: The PLC device collects environmental data in industrial production and encapsulates the environmental data into a PLC_Data message and sends it to the access gateway. The PLC_Data message content includes createTime, plcID, plcType and plcValue, where createTime indicates the data collection time, plcID indicates the PLC device ID, plcType indicates the PLC device type, and plcValue indicates the collection value of the PLC device.
[0017] Step 3: The access gateway initiates a gRPC connection request to the training module and sends the message to the training module;
[0018] Step 4, the training module parses the fields [createTime, plcType, plcValue] of PLC_Data, inserts the data of these fields into the historical data set and saves them in the specified directory;
[0019] Step 5, the training module traverses all records of the historical data set, and if the plcType field of the record has the same value as the plcType field in PLC_Data, the record is inserted into the set S;
[0020] Step 6: The training module loads the random forest algorithm, and then performs fitting calculations on the values of createTime and plcValue of the set S to generate a prediction model, and then saves the prediction model to the specified directory. Different types of PLC devices correspond to different prediction models.
[0021] Step 7, the training module creates a prediction request message carrying the plcType value of PLC_Data and sends the prediction request message to the early warning module;
[0022] Step 8: The warning module loads the warning rule configuration file. The warning rule configuration file includes different plcTypes and the maximum value, minimum value and number of days of warning corresponding to each plcType. The warning module obtains the maximum value, minimum value and number of days of warning corresponding to the type of data according to the plcType value in the prediction request message, and then loads the corresponding prediction model according to the plcType field of the PLC_Data message.
[0023] Step 9: The warning module converts the warning days into future date values according to the current date value, and then calls the prediction model to predict the future date data to obtain the prediction data, and determines whether to create a warning message according to the prediction data;
[0024] Step 10, the warning module initiates a gRPC connection request to the WebSocket module, sends the warning message to the WebSocket module, the WebSocket module establishes a Web Socket two-way connection with the Web client module, and then sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
[0025] As a preferred solution of the real-time early warning system of Internet of Things devices based on machine learning of the present invention, the PLC device in step 2 specifically collects environmental data in industrial production through the Modubs protocol.
[0026] As a preferred solution of the real-time early warning system for Internet of Things devices based on machine learning of the present invention, the environmental data specifically includes temperature, humidity, formaldehyde density and gas density.
[0027] As a preferred solution of the real-time early warning system for Internet of Things devices based on machine learning of the present invention, the method for determining whether to create an early warning message in step 9 is specifically: comparing the predicted data with the maximum value and the minimum value of the early warning, and if the predicted data is not within the range, creating an early warning message.
[0028] As a preferred solution of the real-time early warning system for Internet of Things devices based on machine learning of the present invention, the content of the early warning message created in step 9 specifically includes the number of warning days, plcType and forecast data.
[0029] As a preferred solution of the real-time early warning system for Internet of Things devices based on machine learning of the present invention, the historical data set is in CSV format and its header fields are createTime, plcType and plcValue.
[0030] As a preferred solution of the real-time early warning system for IoT devices based on machine learning of the present invention, step 10 specifically includes:
[0031] Step 10.1, the warning module encapsulates the warning message into the protobuf message body, then initiates a gRPC connection to the WebSocket module, and sends the protobuf message body to the webSocket module;
[0032] Step 10.2, the WebSocket module listens to the gRPC request initiated by the warning module on the specified port, and parses the warning message after receiving the protobuf message body sent by the warning module;
[0033] Step 10.3, the WebSocket module establishes a Web Socket bidirectional connection with the Web client module, obtains the ChannelContext corresponding to the WebSocket data channel, and the ChannelContext sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
[0034] As a preferred solution of the real-time early warning system for Internet of Things devices based on machine learning of the present invention, in step 10.2, the WebSocket module listens to the gRPC request initiated by the early warning module at the designated port as follows: the WebSocket module loads the Python grpc module and calls the function server() to listen to the gRPC request initiated by the early warning module at the designated port.
[0035] The beneficial effects of the present invention are as follows: the present invention realizes the real-time collection, storage and management of various key data in the industrial production environment through the Internet of Things technology, and uses machine learning algorithms to analyze and predict historical data, which can identify potential safety risks in advance and issue early warnings, thereby ensuring the safety of industrial production. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.
[0037] Figure 1 This is an architecture diagram of a real-time early warning system for Internet of Things devices based on machine learning in the present invention.
[0038] Figure 2This is an operation flow chart of a real-time early warning system for Internet of Things devices based on machine learning in the present invention. DETAILED DESCRIPTION
[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0040] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0041] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0042] Secondly, the present invention is described in detail with reference to the schematic diagram. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0043] Embodiment 1
[0044] A real-time early warning system for IoT devices based on machine learning, comprising:
[0045] PLC equipment: used to collect environmental data in industrial production and send the environmental data to the access gateway;
[0046] Access gateway: used to receive environmental data collected by PLC devices and send the environmental data to the training module;
[0047] Training module: used to receive and process environmental data, update historical data sets, and train prediction models;
[0048] Early warning module: used to use the trained model to predict future data and determine whether an early warning needs to be triggered based on the early warning rule configuration file;
[0049] WebSocket module: used to receive warning messages and send them to the Web client module through a WebSocket bidirectional connection;
[0050] Web client module: used to display the warning messages received from the WebSocket module;
[0051] The system operation process includes:
[0052] Step 1: The PLC device initiates a TCP connection request to the access gateway, and both parties establish a TCP long connection;
[0053] Step 2: The PLC device collects environmental data in industrial production and encapsulates the environmental data into a PLC_Data message and sends it to the access gateway. The PLC_Data message content includes createTime, plcID, plcType and plcValue, where createTime indicates the data collection time, plcID indicates the PLC device ID, plcType indicates the PLC device type, and plcValue indicates the collection value of the PLC device. The PLC device specifically collects environmental data in industrial production through the Modubs protocol. The environmental data specifically includes temperature, humidity, formaldehyde density and gas density.
[0054] Step 3: The access gateway initiates a gRPC connection request to the training module and sends the message to the training module;
[0055] Step 4, the training module parses the fields [createTime, plcType, plcValue] of PLC_Data, inserts the data of these fields into the historical data set and saves them in the specified directory. The historical data set is in CSV format and its header fields are createTime, plcType and plcValue;
[0056] Step 5, the training module traverses all records of the historical data set, and if the plcType field of the record has the same value as the plcType field in PLC_Data, the record is inserted into the set S;
[0057] Step 6: The training module loads the random forest algorithm, and then performs fitting calculations on the values of createTime and plcValue of the set S to generate a prediction model, and then saves the prediction model to the specified directory. Different types of PLC devices correspond to different prediction models.
[0058] Step 7, the training module creates a prediction request message carrying the plcType value of PLC_Data and sends the prediction request message to the early warning module;
[0059] Step 8: The warning module loads the warning rule configuration file. The warning rule configuration file includes different plcTypes and the maximum value, minimum value and number of days of warning corresponding to each plcType. The warning module obtains the maximum value, minimum value and number of days of warning corresponding to the type of data according to the plcType value in the prediction request message, and then loads the corresponding prediction model according to the plcType field of the PLC_Data message.
[0060] Step 9: The warning module converts the warning days into future date values according to the current date value, and then calls the prediction model to predict the future date data to obtain the prediction data. It determines whether to create a warning message according to the prediction data. The judgment method is: compare the prediction data with the maximum value of the warning and the minimum value of the warning. If the prediction data is not within the range, create a warning message. The content of the warning message specifically includes the warning days, plcType and prediction data.
[0061] Step 10, the warning module initiates a gRPC connection request to the WebSocket module, sends the warning message to the WebSocket module, the WebSocket module establishes a Web Socket two-way connection with the Web client module, and then sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
[0062] Embodiment 2
[0063] A real-time early warning system for IoT devices based on machine learning, based on Example 1, step 10 specifically includes:
[0064] Step 10.1, the warning module encapsulates the warning message into the protobuf message body, then initiates a gRPC connection to the WebSocket module, and sends the protobuf message body to the webSocket module;
[0065] Step 10.2, the WebSocket module listens to the gRPC request initiated by the warning module on the specified port, and parses the warning message after receiving the protobuf message body sent by the warning module;
[0066] Step 10.3, the WebSocket module establishes a Web Socket bidirectional connection with the Web client module, obtains the ChannelContext corresponding to the WebSocket data channel, and the ChannelContext sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
[0067] It should be noted that in step 10.2, the WebSocket module monitors the gRPC request initiated by the early warning module at the designated port as follows: the WebSocket module loads the Python grpc module and calls the function server() to monitor the gRPC request initiated by the early warning module at the designated port.
[0068] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A real-time early warning system for IoT devices based on machine learning, It is characterized in that include: PLC equipment: used to collect environmental data in industrial production and send the environmental data to the access gateway; Access gateway: used to receive environmental data collected by PLC devices and send the environmental data to the training module; Training module: used to receive and process environmental data, update historical data sets, and train prediction models; Early warning module: used to use the trained model to predict future data and determine whether an early warning needs to be triggered based on the early warning rule configuration file; WebSocket module: used to receive warning messages and send them to the Web client module through a WebSocket bidirectional connection; Web client module: used to display the warning messages received from the WebSocket module; The system operation process includes: Step 1: The PLC device initiates a TCP connection request to the access gateway, and both parties establish a TCP long connection; Step 2: The PLC device collects environmental data in industrial production and encapsulates the environmental data into a PLC_Data message and sends it to the access gateway. The PLC_Data message content includes createTime, plcID, plcType and plcValue, where createTime indicates the data collection time, plcID indicates the PLC device ID, plcType indicates the PLC device type, and plcValue indicates the collection value of the PLC device. Step 3: The access gateway initiates a gRPC connection request to the training module and sends the message to the training module; Step 4, the training module parses the fields [createTime, plcType, plcValue] of PLC_Data, inserts the data of these fields into the historical data set and saves them in the specified directory; Step 5, the training module traverses all records of the historical data set, and if the plcType field of the record has the same value as the plcType field in PLC_Data, the record is inserted into the set S; Step 6: The training module loads the random forest algorithm, and then performs fitting calculations on the values of createTime and plcValue of the set S to generate a prediction model, and then saves the prediction model to the specified directory. Different types of PLC devices correspond to different prediction models. Step 7, the training module creates a prediction request message carrying the plcType value of PLC_Data and sends the prediction request message to the early warning module; Step 8: The warning module loads the warning rule configuration file. The warning rule configuration file includes different plcTypes and the maximum value, minimum value and number of days of warning corresponding to each plcType. The warning module obtains the maximum value, minimum value and number of days of warning corresponding to the type of data according to the plcType value in the prediction request message, and then loads the corresponding prediction model according to the plcType field of the PLC_Data message. Step 9: The warning module converts the warning days into future date values according to the current date value, and then calls the prediction model to predict the future date data to obtain the prediction data, and determines whether to create a warning message according to the prediction data; Step 10, the warning module initiates a gRPC connection request to the WebSocket module, sends the warning message to the WebSocket module, the WebSocket module establishes a Web Socket two-way connection with the Web client module, and then sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
2. According to the real-time early warning system for IoT devices based on machine learning as claimed in claim 1, Features: In step 2, the PLC device specifically collects environmental data in industrial production through the Modubs protocol.
3. According to the real-time early warning system for IoT devices based on machine learning as claimed in claim 2, Features: Environmental data specifically include temperature, humidity, formaldehyde density and gas density.
4. According to the real-time early warning system for IoT devices based on machine learning as claimed in claim 1, It is characterized in that The method for determining whether to create a warning message in step 9 is specifically: comparing the predicted data with the maximum value of the warning and the minimum value of the warning, and if the predicted data is not within the range, creating a warning message.
5. According to claim 4, a real-time early warning system for IoT devices based on machine learning, Features: The content of the warning message created in step 9 specifically includes the warning days, plcType and forecast data.
6. According to claim 1, a real-time early warning system for IoT devices based on machine learning, Features: The historical data set is in CSV format and its header fields are createTime, plcType and plcValue.
7. According to claim 1, a real-time early warning system for IoT devices based on machine learning, It is characterized in that Step 10 specifically includes: Step 10.1, the warning module encapsulates the warning message into the protobuf message body, then initiates a gRPC connection to the WebSocket module, and sends the protobuf message body to the webSocket module; Step 10.2, the WebSocket module listens to the gRPC request initiated by the warning module on the specified port, and parses the warning message after receiving the protobuf message body sent by the warning module; Step 10.3, the WebSocket module establishes a Web Socket bidirectional connection with the Web client module, obtains the ChannelContext corresponding to the WebSocket data channel, and the ChannelContext sends the warning message Alert_Data to the Web client module, and the Web client module displays the warning message on the web page.
8. According to claim 7, a real-time early warning system for IoT devices based on machine learning, Features ,In step 10.2, the WebSocket module listens to the gRPC request initiated by the warning module at the specified port. Specifically, the WebSocket module loads the Python grpc module and calls the function server() to listen to the gRPC request initiated by the warning module at the specified port.
