Multi-technology collaborative farm environment monitoring network disconnection continuous transmission system
By adopting a multi-technology collaborative network disconnection transmission system in the breeding farm, the problem of data being unable to be uploaded in time due to abnormal network connection in the breeding farm is solved, and the stable transmission and timely processing of environmental data is achieved, ensuring the smooth progress of breeding production.
Patent Information
- Application Number
- CN202510003966.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-04-08
AI Technical Summary
In farms, network connections often occur abnormalities, resulting in the environmental data collected by the sensor being unable to be uploaded in time, affecting the real-time monitoring and regulation of the breeding environment, and thus pose potential risks to the growth of poultry and livestock and economic benefits.
A multi-technology collaborative breeding farm environmental monitoring network disconnection transmission system is adopted, which includes a data edge storage module and a disconnection transmission module. The data edge storage module performs local preliminary processing and analysis of the collected data through edge computing devices, and transmits it to the cloud platform through the MQTT protocol. The disconnection and continuous transmission module includes a disconnection warning layer, a cloud data prediction layer and a continuous transmission data layer, which is used to ensure the complete and continuous transmission of data during network recovery.
It ensures stable transmission and timely processing of farm environmental data when network connection is abnormal, provides reliable technical support, and ensures the smooth progress of breeding production.
Smart Images

Figure CN119788667A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a multi-technology coordinated farm environment monitoring network disconnection and continuation transmission system. Background Art
[0002] In the modern breeding industry, the breeding environment is of vital importance to the healthy growth and production efficiency of poultry and livestock. Accurately monitoring and controlling various environmental parameters such as temperature, humidity, light, air quality, etc. in the house can effectively improve the survival rate, growth rate and egg quality of poultry and livestock, thereby creating more substantial economic benefits for farmers. In order to achieve the goal of fine management of the breeding environment, it is necessary to rely on a variety of sensors to collect a large amount of environmental data in real time, and quickly transmit this data to the local server and cloud platform for analysis and processing. Through the analysis of the data, the farmer can know the real-time status of the breeding environment, detect abnormal conditions in time and take corresponding measures to adjust them, so as to ensure that the chicken house environment is always maintained under conditions suitable for chicken growth.
[0003] In actual farming scenarios, the network situation is usually complicated and lacks stability. Farms are generally located in areas far away from cities, and the network infrastructure may be relatively weak. They are easily affected by natural factors such as weather and terrain, as well as human factors such as base station coverage, causing the network connection between the device and the target server to frequently experience abnormal conditions. Once the network connection is interrupted, the data collected by the sensor cannot be uploaded in time, making it impossible for farmers to obtain real-time farming environment information, and thus unable to adjust environmental equipment in time, which brings potential risks to the growth of poultry and livestock, causing economic losses.
[0004] The existing patent publication number CN112968815A discloses a network-resuming method in the field of industrial automation control. It does not fully consider the situation that when the network connection is in an abnormal state for a long time, the environmental parameters may change due to the inability to upload data for a long time, and lacks a prediction mechanism for relevant data; at the same time, the consideration of the environment for network-resuming operation is too limited and single, for example, the actual application scenario in the specific field of animal husbandry is not taken into consideration. Animal husbandry may have unstable network signals and special equipment conditions, and the existing network-resuming scheme may not be able to adapt to these characteristics well, thus affecting its effective application in this field. Summary of the invention
[0005] The purpose of the present invention is to provide a multi-technology collaborative farm environment monitoring network disconnection and resumption system, which can effectively solve a series of problems caused by abnormal network connection, ensure the stable transmission and timely processing of chicken house environmental data, provide reliable technical support for farmers, and ensure the smooth progress of breeding production.
[0006] To achieve the above-mentioned purpose, the present invention provides a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system, including a data edge storage module and a disconnection and resuming transmission module. The working steps of the data edge storage module are as follows:
[0007] S1. Use sensors to collect required data;
[0008] S2, using edge computing devices to perform local preliminary processing and analysis of the data collected by sensors;
[0009] S3: Data transmission: Configure MQTT clients on the device and server sides, publish and subscribe data by establishing topics, and transmit the data processed by the edge computing device to the cloud platform or database server in a lightweight communication mode.
[0010] S4. After the data is transferred to the cloud platform, a web application based on the Flask framework is used to create a visualization platform;
[0011] The network disconnection and resuming transmission module includes a network disconnection warning layer, a cloud data prediction layer, and a resuming data layer; wherein the network disconnection warning layer is used to perform real-time and continuous detection of the network connection status;
[0012] The cloud data prediction layer is used to receive the network disconnection signal from the network disconnection warning layer;
[0013] The resume data layer continues to upload data after the network connection is restored.
[0014] Preferably, the local preliminary processing in step S2 is specifically to perform real-time filtering operations on the collected data to remove noise interference, and to perform data compression to reduce the amount of data.
[0015] Preferably, in step S3, a MySQL database is built on the device side and the server side, and a data table structure is designed to store different types of data, so as to perform long-term storage and management of the data.
[0016] Preferably, in step S4, a cloud-edge communication mechanism is established inside the cloud platform to realize the interaction of data and instructions through network connection. At the same time, the cloud platform registers, monitors and manages edge nodes, and dynamically allocates tasks and resources according to the load conditions and data processing requirements of the edge.
[0017] Preferably, once the network disconnection warning layer detects that the signal strength is significantly reduced, the network fluctuates violently, or data transmission errors frequently occur, the layer immediately and rapidly sends out an accurate warning signal.
[0018] Preferably, once the cloud data prediction layer receives the warning signal from the network disconnection warning layer, it will start and operate efficiently within half an hour after the network disconnection.
[0019] Preferably, the resume data layer cleverly overlays the data collected during the MySQL database server network outage onto the cloud prediction data.
[0020] Therefore, the present invention adopts the above-mentioned multi-technology collaborative farm environment monitoring network disconnection and retransmission system, which can collect various environmental parameters in the farm in real time and accurately, such as temperature, humidity, light, etc., as well as equipment operation status data. Compared with other data receiving devices, it can better ensure fast data transmission, stable transmission, etc. After the data is collected, it is processed by edge computing and stored in the MySQL database, and transmitted using the MQTT protocol, which reduces the cloud computing pressure, reduces data transmission delay, and improves real-time response capabilities.
[0021] It can effectively reduce network bandwidth consumption and ensure efficient data transmission, thereby achieving lightweight data transmission and reducing costs. After the data is transmitted to the cloud, it can be easily processed by the Flask framework to realize data visualization, user interaction functions and system configuration management. Through the network disconnection and resuming transmission, it can ensure that data is not lost. The network disconnection warning layer can timely discover network problems. The cloud data prediction layer predicts the required data supplement integrity during the network disconnection. The resuming data layer continues to transmit data accurately and completely after the network is restored, ensuring the continuity of the farm environment data.
[0022] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a data edge storage module framework diagram of an embodiment of a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system of the present invention;
[0024] Figure 2 It is a framework diagram of a network disconnection and resuming transmission module of an embodiment of a multi-technology coordinated farm environment monitoring network network disconnection and resuming transmission system of the present invention. DETAILED DESCRIPTION
[0025] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0026] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0027] Embodiment 1
[0028] like Figure 1The figure shows the framework diagram of the data edge storage module. At the beginning of the entire data collection process, Siemens PLC is selected as the core data collection device. It is closely connected with meteorological sensors and temperature and humidity sensors to build a channel for data. During the connection process, 485 protocol and Modbus protocol are used. This enables accurate data transmission between the sensor and Siemens PLC. After a series of connections and protocol interactions, the data finally flows to the local computer.
[0029] When the data is transmitted to the local computer through the interface, it is processed using Python code. By writing Python code, an interface channel is created to perform the mission of data transmission, and the data is accurately sent to the MySQL database to ensure data transmission speed, stability, etc.
[0030] In the local database, edge computing algorithms are used to create a branch. In this branch, the data will be filtered and noise interference will be removed. The data will be more "lightweight", reducing the data processing of the cloud platform.
[0031] When the data is stored in the local MySQL database, an interface channel is created using python code and the MQTT protocol to make data transmission more efficient and complete to the cloud platform.
[0032] Establish prediction algorithms in the cloud platform to prepare for follow-up.
[0033] Use the Flask framework (Flask is a lightweight Python web framework) to create a platform accessed in the browser, where data can be displayed in intuitive ways such as graphs and charts.
[0034] like Figure 2 The figure shows the framework diagram of the network disconnection and transmission module. After the environmental data acquisition and processing module is built, if the network connection is disconnected, the data transmission will be disconnected. If the cloud platform cannot receive the data, an alarm will appear in the cloud platform to remind the farmer.
[0035] A heartbeat mechanism is established between the local database and the cloud platform. The local database will periodically send a small "heartbeat" data packet to the cloud platform. This data packet is only used to indicate that the device is still working normally and the network connection is normal.
[0036] Set a timer to send heartbeat packets periodically. The heartbeat packet is a simple custom message format, where a byte sequence is sent to represent the heartbeat.
[0037] On the server side, the socket is also used to monitor the database connection. When data is received, it is determined whether it is a heartbeat packet. If so, the last activity time of the database connection is updated.
[0038] The server can periodically check the interval between the last activity time and the current time of different database connections. If the interval exceeds the set threshold (two to three times the heartbeat interval), the connection is considered disconnected.
[0039] During the operation of the local MySQL database, if the network is interrupted, the data collection work will continue. The collected data will continue to be properly stored, and the transmission process can be restarted after the network is restored to normal to ensure the integrity and consistency of the data.
[0040] When the network disconnection time reaches half an hour or more (no heartbeat packet is received within the time), the prediction algorithm is started. The half-hour is used as the dividing line here because the changes in the farm are not drastic within half an hour and will not affect the breeding environment.
[0041] When the network is disconnected, the prediction algorithm: Long Short-Term Memory Network (LSTM) is used to predict the data collected by the sensors before. Here, the data at the same time in the past is used to predict the data when the network is disconnected (the network is disconnected at 9 o'clock today, and the data obtained at 9 o'clock and later in the past is used for training and prediction).
[0042] The working steps of the network-disconnected resuming module are as follows:
[0043] (1) First, the sensor data at the reference time is input for offline training and then the LSTM network model is used to output the predicted data.
[0044] Determine the choice of reference time, extract the available in-house sensor data, divide the obtained data into two parts: training set and test set to ensure more accurate prediction results, and find the best reference time at different times for performance evaluation based on mean square error and mean absolute error.
[0045] Mean square error formula:
[0046]
[0047] Where MSE stands for mean square error; n stands for the number of samples; y i represents the actual value of the i-th observation; represents the predicted value of the i-th observation; ∑ represents the sum of all samples;
[0048] Calculation steps: For each sample, calculate the difference between the actual value and the predicted value These differences are squared to eliminate the effects of positive and negative differences. The squared differences of all samples are added together. Finally, the sum is divided by the number of samples n to get the mean square error (MSE). This optimizes the performance of the LSTM model.
[0049] (2) Initialize the LSTM, weights and biases. LSTM has multiple weight matrices and bias items that need to be initialized. For an input with dimension x t (the dimension of the input vector), the hidden layer dimension h t The LSTM unit has the following main weight matrices and bias terms:
[0050] The weight matrix W of the forget gate f and bias b f .
[0051] The weight matrix W of the input gate i and bias b i .
[0052] The weight matrix W of the output gate o and bias b o .
[0053] The weight matrix W used to calculate the candidate cell state c and bias b c , initialize these weight matrices and bias terms to random numbers in the interval {-0.1, 0.1}.
[0054] (3) The initial cell state c o and the initial hidden state h o Initialized to a vector of all zeros.
[0055] (4) Forget gate calculation (determines how much information to discard from the previous hidden state)
[0056] Input the hidden state h of the previous moment t-1 and the current feature x t , outputs a number f between 0 and 1 through the sigmoid layer t , 1 means "keep this content completely" and 0 means "get rid of this content completely". The formula is: t =σ(W f ·[h t-1 ,x t ]+b f ).
[0057] (5) Input gate and candidate memory cell calculation (determine how much new data to store in the candidate memory cell)
[0058] Enter h t-1 and x t , output i through the sigmoid layer t , and then output the candidate memory cell through the tanh layer
[0059] Formula:i t =σ(W i ·[h t-1 ,x t ]+b i );
[0060] (6) Memory element update: multiply the memory element of the previous moment by f t , then add the candidate memory element multiplied by i t , and finally calculate the memory element C at the current moment t .
[0061] formula:
[0062] (7) Output gate and hidden state update, input h t-1 and x t , output O through the sigmoid layer t , then multiply by C t Through the output value of the tanh layer, the hidden state h at the current moment is finally output t .
[0063] Formula: t =σ(W o [h t-1 ,x t ]+b o );h t =o t *tanh(C t ).
[0064] (8) Calculate the loss function for h starting from the last output t and C t Gradient. Gradients are propagated back step by step from time step T, and the gradients of forget gate, input gate, output gate, memory cell state and hidden state are calculated in turn. Using the gradients of each gate, combined with the hidden state and input of the previous time step, the weight W is calculated. f , W i , W o , W c and bias b f , b i , b o , b c gradient.
[0065] (9) Based on the calculated gradient, the weights and biases are updated through the optimization algorithm Adam to minimize the loss function. Calculate the first-order moment estimate of the current gradient (average gradient): m: m = β1m + (1-β1)g; Calculate the second-order moment estimate of the current gradient (exponentially weighted moving average of the squared gradient): v: v = β2v + (1-β2)g 2(where g represents the current gradient, and β1 and β2 are adjustable exponential decay rates).
[0066] Correct the first-order moment estimation variable m: Correct the second-order moment estimation variable v: (where t represents the current iteration number).
[0067] Estimation of variables based on corrected first-order moments and the second moment estimation variable And the learning rate α, update the model parameters: (where θ represents the parameters of the model and ε is a very small number) is optimized.
[0068] (10) Then use the hidden state h at the current moment t and the feature x at the next moment t+1 As input, steps (2) to (9) are repeated until the entire sequence is processed to obtain the predicted data.
[0069] When the network is restored, the local database continues to transmit data.
[0070] When the network is restored, the cloud platform will receive the heartbeat packet sent by the database again. The local database resends the heartbeat packet to the port, and the cloud platform detects the arrival of the heartbeat packet, which triggers a prompt that the network connection is restored.
[0071] After receiving the heartbeat packet, the prediction algorithm stops operating. When the prediction stops, the cloud platform interface occupancy ends and the local database retransmits data.
[0072] After receiving data from the local database, the cloud platform cancels the alarm.
[0073] After the network is restored, the data stored in the local database during the network outage time is transferred to the database of the cloud platform that stores the collected data, making the data more authentic and ensuring data consistency.
[0074] Therefore, the present invention adopts the above-mentioned multi-technology collaborative farm environment monitoring network disconnection and resumption system, which can effectively solve a series of problems caused by abnormal network connection, ensure the stable transmission and timely processing of chicken house environmental data, provide reliable technical support for farmers, and ensure the smooth progress of breeding production.
[0075] It is worth noting that the contents not elaborated in detail in the present invention are all prior art and are well known to those skilled in the art.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution 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 they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system, characterized by: It includes a data edge storage module and a network disconnection and resuming module. The working steps of the data edge storage module are as follows: S1. Use sensors to collect required data; S2, using edge computing devices to perform local preliminary processing and analysis of the data collected by sensors; S3: Data transmission: Configure MQTT clients on the device and server sides, publish and subscribe data by establishing topics, and transmit the data processed by the edge computing device to the cloud platform or database server in a lightweight communication mode. S4. After the data is transferred to the cloud platform, a web application based on the Flask framework is developed to create a visualization platform; The network disconnection and resuming transmission module includes a network disconnection warning layer, a cloud data prediction layer, and a resuming data layer; wherein the network disconnection warning layer is used to perform real-time and continuous detection of the network connection status; The cloud data prediction layer is used to receive the network disconnection signal from the network disconnection warning layer; The resume data layer continues to upload data after the network connection is restored.
2. According to claim 1, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: The local preliminary processing in step S2 specifically includes performing real-time filtering operations on the collected data to remove noise interference, and performing data compression to reduce the amount of data.
3. According to claim 1, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: In step S3, a MySQL database is built on the device and server sides, and a data table structure is designed to store different types of data for long-term storage and management of the data.
4. According to claim 1, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: In step S4, a cloud-edge communication mechanism is established inside the cloud platform to realize the interaction of data and instructions through network connection. At the same time, the cloud platform registers, monitors and manages edge nodes, and dynamically allocates tasks and resources according to the load conditions and data processing requirements of the edge.
5. According to claim 1, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: Once the network disconnection warning layer detects a significant decrease in signal strength, severe network fluctuations, or frequent data transmission errors, it will quickly issue an accurate warning signal.
6. According to claim 5, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: Once the cloud data prediction layer receives the warning signal from the network outage warning layer, it will start and operate efficiently within half an hour after the network outage.
7. According to claim 1, a multi-technology collaborative farm environment monitoring network disconnection and resuming transmission system is characterized by: The resume data layer will overlay the data collected during the MySQL database network outage on top of the cloud prediction data.
Citation Information
Patent Citations
Method for realizing continuous transmission in case of network disconnection
CN112968815A
An edge computing gateway for device pre-maintenance
CN112737936A
Chicken house environment information virtual acquisition system based on LSTM network
CN117651282A
Cited By
Electrical automation electrical cabinet intelligent control method and system based on Internet of Things
CN121115648A
An intelligent control method and system for an electrical automation electrical cabinet based on an internet of things
CN121115648B