Reservoir monitoring data updating method and device

By responding to the data update request of the monitoring equipment in the reservoir monitoring system, determining the update sequence and configuring the mutex lock, the problem of monitoring data loss and inconsistency caused by concurrent updates is solved, and the update efficiency and accuracy of monitoring data are improved.

CN119311711AInactive Publication Date: 2025-01-14SHENZHEN WISDOM DOUBLE CARBON TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411855322.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-01-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In reservoir monitoring, when multiple monitoring equipment concurrently updates the monitoring data in the cache, the update data of a certain monitoring equipment may be overwritten, resulting in loss of monitoring data and affecting the update efficiency.

Method used

By responding to data update requests sent by each monitoring device, the data update sequence is determined based on the requested timestamp, and a mutex lock is configured between each monitoring device to ensure that only one target monitoring device can update data at a time, avoiding problems caused by concurrent updates. Data inconsistency issues.

Benefits of technology

This method effectively avoids the loss of monitoring data caused by concurrent updates, ensures the consistency and accuracy of data updates, improves the update efficiency of monitoring data, and enables the updated data to accurately reflect changes in the target area over time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311711A_ABST
    Figure CN119311711A_ABST
Patent Text Reader

Abstract

The invention provides a reservoir monitoring data updating method and device. The method comprises the following steps: in response to a data updating request sent by each monitoring device for monitoring a target area of a reservoir, determining a data updating sequence of each monitoring device according to a timestamp of each data updating request; according to the data updating sequence of all the monitoring devices, configuring mutual exclusion locks among all the monitoring devices for multiple times, determining the monitoring device currently configured with the mutual exclusion lock as a target monitoring device in each configuration, and when it is detected that the target monitoring device reaches a preset triggering condition, configuring the mutual exclusion lock to the next monitoring device according to the data updating sequence, and sending the current monitoring data to the target terminal, so that the target monitoring equipment obtains the current monitoring data cached by the target terminal for updating, and synchronizing the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal. According to the updating method of the reservoir monitoring data provided by the embodiment of the invention, the updating efficiency of the monitoring data can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for updating reservoir monitoring data. Background Art

[0002] In order to improve the safety of the reservoir, multiple monitoring devices for monitoring a certain water environment element are usually deployed in a certain area of ​​the reservoir, so that a certain water environment element in a certain area of ​​the reservoir, such as water quality or water level, can be monitored through each monitoring device, and the monitoring data corresponding to the water environment element cached in the target terminal can be updated according to the monitored data. A certain monitoring device can obtain the monitoring data corresponding to the water environment element from the cache of the target terminal, and modify the monitoring data according to the monitored data, and then re-upload it to the target terminal, so that both the monitoring device and the target terminal can update the monitoring data.

[0003] However, if multiple monitoring devices concurrently update the monitoring data in the cache, the monitoring data updated by one monitoring device may be overwritten by the monitoring data updated by other monitoring devices, resulting in the loss of monitoring data and affecting the updating efficiency of the monitoring data. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the related art. To this end, the present application proposes a method for updating reservoir monitoring data, which can improve the updating efficiency of the monitoring data.

[0005] The application also proposes a device for updating reservoir monitoring data.

[0006] The application also provides an electronic device.

[0007] The present application also proposes a computer-readable storage medium.

[0008] The method for updating reservoir monitoring data according to the first embodiment of the present application includes: In response to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, determine a data update order for each monitoring device according to a timestamp of each data update request; According to the data update sequence of each monitoring device, mutually exclusive locks are configured between each monitoring device for multiple times, and each configuration determines the monitoring device currently configured with the mutually exclusive lock as the target monitoring device, and when it is detected that the target monitoring device reaches a preset trigger condition, the mutually exclusive lock is configured to the next monitoring device according to the data update sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0009] By responding to the data update request sent by each monitoring device that monitors the target area of ​​the reservoir, the data update order of each monitoring device is determined according to the timestamp of each data update request, and the mutual exclusion lock is configured between each monitoring device multiple times according to the data update order of each monitoring device, and each configuration determines the monitoring device currently configured with the mutual exclusion lock as the target monitoring device, and in the case of detecting that the target monitoring device reaches the preset trigger condition, the mutual exclusion lock is configured to the next monitoring device according to the data update order, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and caches the updated current monitoring data to the target terminal to update the current monitoring data cached by the target terminal. Therefore, before the need to update the monitoring data, the data update order determined by the timestamp of the data update request of each monitoring device can be used to sequentially configure mutual exclusion locks for each monitoring device to ensure that only one monitoring device process can update the monitoring data at the same time, avoiding the problem of inconsistent cached monitoring data caused by concurrent updates, reducing the possibility of monitoring data loss, and at the same time enabling the updated monitoring data to reflect the changes of the target area over time, thereby improving the updating efficiency of the monitoring data.

[0010] According to an embodiment of the present application, determining the data update order of each monitoring device according to the timestamp of each data update request includes: Determining an initial update order of each of the monitoring devices according to a timestamp of each of the data update requests; The monitoring devices with the same timestamp of the corresponding data update requests are divided into the same device set, and the initial update order of each monitoring device in any of the device sets is adjusted according to the corresponding monitoring positions of each monitoring device in the target area to obtain the data update order.

[0011] According to an embodiment of the present application, adjusting the initial update order of each monitoring device in any of the device sets according to the monitoring positions corresponding to each monitoring device in the target area includes: According to the corresponding monitoring positions of the monitoring devices in the target area and the water flow direction in the target area, obtaining target information indicating the upstream and downstream relationship of the monitoring devices in the device set; According to the target information, the initial update sequence of each monitoring device in the device set is adjusted in order from upstream to downstream.

[0012] According to one embodiment of the present application, it also includes: When the target monitoring device acquires the current monitoring data cached in the target terminal for updating and synchronizes the updated current monitoring data to the cache of the target terminal, it is determined that the target monitoring device completes the updating of the current monitoring data cached in the target terminal; or When the time duration during which the target monitoring device is configured with the mutex lock reaches a first preset time duration, it is determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0013] According to one embodiment of the present application, it also includes: It is determined that the monitoring device has not completed the configuration of the mutex lock within a second preset time period, and the mutex lock is configured for the next monitoring device according to the data update sequence.

[0014] According to one embodiment of the present application, it also includes: Determine that the update frequency of the current monitoring data in the target duration is less than a preset frequency, store the current monitoring data from the cache of the target terminal to the disk storage of the target terminal, and delete the current monitoring data from the cache.

[0015] According to one embodiment of the present application, the water environment elements monitored by each of the monitoring devices are the same.

[0016] The device for updating reservoir monitoring data according to the second aspect of the present application includes: An update sequence determination module, for responding to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, and determining the data update sequence of each monitoring device according to a timestamp of each data update request; A monitoring data update module, configured to configure mutual exclusion locks between each of the monitoring devices multiple times according to the data update sequence of each of the monitoring devices, and to determine the monitoring device currently configured with the mutual exclusion lock as the target monitoring device in each configuration, and to configure the mutual exclusion lock to the next monitoring device according to the data update sequence when it is detected that the target monitoring device reaches a preset trigger condition, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0017] According to an electronic device of an embodiment of the third aspect of the present application, the electronic device includes a processor and a memory storing a computer program, and when the processor executes the computer program, the method for updating reservoir monitoring data described in any of the above embodiments is implemented.

[0018] According to the computer-readable storage medium of the fourth aspect of the present application, a computer program is stored thereon, and when the computer program is executed by a processor, the method for updating reservoir monitoring data described in any of the above embodiments is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A first flow chart of a method for updating reservoir monitoring data according to some embodiments of the present application; Figure 2 A second flow chart of a method for updating reservoir monitoring data according to some embodiments of the present application; Figure 3 It is a structural schematic diagram of a device for updating reservoir monitoring data provided in an embodiment of the present application; Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] Below, the reservoir monitoring data updating method and device provided in the embodiments of the present application will be introduced and explained in detail through several specific embodiments.

[0023] In one embodiment, a method for updating reservoir monitoring data is provided, which is applied to a target terminal and is used to update the monitoring data of the reservoir stored in the target terminal. The target terminal can be any target terminal such as a mobile terminal, a desktop terminal or a server. The server can be an independent server or a server cluster composed of multiple servers, and can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence sampling point devices.

[0024] like Figure 1 As shown, a method for updating reservoir monitoring data provided in this embodiment includes: Step 101, in response to a data update request sent by each monitoring device that monitors a target area of ​​a reservoir, determining a data update order of each monitoring device according to a timestamp of each data update request; Step 102, according to the data update sequence of each monitoring device, configure a mutual exclusion lock between each monitoring device for multiple times, determine the monitoring device currently configured with the mutual exclusion lock as the target monitoring device in each configuration, and when it is detected that the target monitoring device reaches a preset trigger condition, configure the mutual exclusion lock to the next monitoring device according to the data update sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0025] In some embodiments, the target area may be a certain area obtained by dividing the river where the reservoir is located. The target area may include the upstream area and the downstream area of ​​the river where the reservoir is located, such as the area where the reservoir is used for water storage and the area where the reservoir is used for irrigation. For the target area, various monitoring devices for monitoring water environment elements may be deployed. For example, multiple water quality monitoring devices for monitoring the water quality of the target area, multiple water level monitoring devices for monitoring the water level of the target area, etc. may be deployed.

[0026] The monitoring device can monitor the target area regularly, and when the monitoring is triggered, send a data update request to the target terminal to request that the acquired data be uploaded to the target terminal. Alternatively, when the monitoring device detects abnormal data, such as abnormal water quality, it can send a data update request to the target terminal to request that the monitored abnormal data be uploaded to the target terminal.

[0027] When receiving data update requests sent by multiple monitoring devices, the target terminal can respond to any data update request, parse the data update request, and obtain the timestamp in the data update request. After obtaining the timestamp of the data update request sent by each monitoring device, the monitoring devices that sent the data update request can be sorted according to the timestamps of each data update request and in the order of the timestamps from the earliest to the latest, to obtain the data update order of each monitoring device.

[0028] For example, assuming that the monitoring devices monitoring the target area include monitoring device A, monitoring device B and monitoring device C, and monitoring device A, monitoring device B and monitoring device C all send data update requests to the target device, wherein the timestamp of the data update request sent by monitoring device A is earlier than the timestamp of the data update request sent by monitoring device B, and the timestamp of the data update request sent by monitoring device C, then the data update sequence of monitoring device A, monitoring device B and monitoring device C is: monitoring device A→monitoring device B→monitoring device C. That is, monitoring device A updates data first, then it is the turn of monitoring device B to update data, and finally monitoring device C updates data.

[0029] After obtaining the data update order of each monitoring device, you can configure mutual exclusion locks between each monitoring device multiple times according to the data update order of each monitoring device. Specifically, you can determine the first monitoring device as the target monitoring device according to the data update order, starting from the first monitoring device, and configure a mutual exclusion lock for the target monitoring device, such as using ZooKeeper or Redisson service to configure a mutual exclusion lock for the target monitoring device. At this time, the process of the target monitoring device will acquire the mutual exclusion lock. After acquiring the mutual exclusion lock, the process of the target monitoring device can execute a read of the cache to obtain the current monitoring data cached by the target terminal from the cache for update, such as adding the data monitored by the target monitoring device in the target area to the current monitoring data to update the current monitoring data, and while storing the updated current monitoring data locally, the updated current monitoring data is synchronously cached to the target terminal, overwriting the old monitoring data, to update the current monitoring data cached by the target terminal. When the target monitoring device completes the update of the current monitoring data and caches the updated current monitoring data to the target terminal, it means that the target monitoring device completes the update of the current monitoring data cached in the target terminal. At this time, the mutex lock acquired by the target monitoring device can be released, and then according to the data update sequence, the mutex lock is configured to the next monitoring device, so that the next monitoring device is used as the target monitoring device, and the above data update process is repeated. And so on, until all monitoring devices have completed the update of monitoring data. Among them, the monitoring data can be one of water quality data or water level data.

[0030] Exemplarily, assuming that the data update order of each monitoring device including monitoring device A, monitoring device B and monitoring device C is monitoring device A>monitoring device B>monitoring device C, then a mutex lock can be configured for monitoring device A first, that is, a mutex lock can be configured for the process of monitoring device A, so that the process of monitoring device A obtains the current monitoring data cached by the target terminal for update, and locally stores the updated current monitoring data, and synchronizes it to the cache of the target terminal at the same time, overwriting the old monitoring data in the cache of the target terminal, so as to update the current monitoring data cached by the target terminal. After monitoring device A completes the update of the current monitoring data cached in the target terminal, the mutex lock configured for monitoring device A can be released, and then the mutex lock can be configured to monitoring device B, so that the process of monitoring device B obtains the current monitoring data cached by the target terminal for update, and locally stores the updated current monitoring data, and synchronizes it to the cache of the target terminal at the same time, overwriting the old monitoring data in the cache of the target terminal, so as to update the current monitoring data cached by the target terminal. After monitoring device B completes the update of the current monitoring data cached in the target terminal, it can release the mutex lock configured for monitoring device B, and then configure the mutex lock to monitoring device C, so that the process of monitoring device C obtains the current monitoring data cached in the target terminal for update, and stores the updated current monitoring data locally, and synchronizes it to the cache of the target terminal, overwriting the old monitoring data in the cache of the target terminal to update the current monitoring data cached in the target terminal. After monitoring device C completes the update of the current monitoring data cached in the target terminal, the update of the current monitoring data cached in the target terminal can be ended.

[0031] Considering that when updating the monitoring data, if the water environment elements monitored by the monitoring devices are different, the updating of the monitoring data in a timely and concurrent manner will not affect the consistency of the data. For example, if the water environment element monitored by the monitoring device D is water quality, and the water environment element monitored by the monitoring device E is water level, at this time, the monitoring device D needs to obtain the water quality data from the cache of the target terminal for updating, while the monitoring device E needs to obtain the water level data from the cache of the target terminal for updating, and the updating of the water quality data will not affect the updating of the water level data, and the two can be executed concurrently. Therefore, in order to further improve the efficiency of data updating, in some embodiments, the water environment elements monitored by each monitoring device are the same. That is, when the water environment elements monitored by each monitoring device that sends a data update request are the same, the data update order of each monitoring device is determined based on the timestamp of the data update request of each monitoring device.

[0032] By responding to the data update request sent by each monitoring device that monitors the target area of ​​the reservoir, the data update order of each monitoring device is determined according to the timestamp of each data update request, and the mutual exclusion lock is configured between each monitoring device multiple times according to the data update order of each monitoring device, and each configuration determines the monitoring device currently configured with the mutual exclusion lock as the target monitoring device, and in the case of detecting that the target monitoring device reaches the preset trigger condition, the mutual exclusion lock is configured to the next monitoring device according to the data update order, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and caches the updated current monitoring data to the target terminal to update the current monitoring data cached by the target terminal. Therefore, before the need to update the monitoring data, the data update order determined by the timestamp of the data update request of each monitoring device can be used to sequentially configure mutual exclusion locks for each monitoring device to ensure that only one monitoring device process can update the monitoring data at the same time, avoiding the problem of inconsistent cached monitoring data caused by concurrent updates, reducing the possibility of monitoring data loss, and at the same time enabling the updated monitoring data to reflect the changes of the target area over time, thereby improving the updating efficiency of the monitoring data.

[0033] Considering that there may be data update requests with the same timestamp among the data update requests sent by each monitoring device, in order to avoid the same data update order of multiple monitoring devices due to the same timestamp of the data update requests, thereby affecting subsequent data updates, in some embodiments, the data update order of each monitoring device is determined according to the timestamp of each data update request, including: Determining an initial update order of each of the monitoring devices according to a timestamp of each of the data update requests; The monitoring devices with the same timestamp of the corresponding data update requests are divided into the same device set, and the initial update order of each monitoring device in any of the device sets is adjusted according to the corresponding monitoring positions of each monitoring device in the target area to obtain the data update order.

[0034] In some embodiments, after receiving data update requests from each monitoring device, the monitoring devices that send data update requests can be sorted according to the timestamps of each data update request in order from early to late to obtain the initial update sorting of each monitoring device.

[0035] After obtaining the initial update ranking of each monitoring device, it is possible to first detect whether there are any monitoring devices among the monitoring devices that have sent data update requests with the same timestamp. If not, the initial update ranking of each monitoring device can be determined as the data update order of each monitoring device; if so, it means that there are monitoring devices with the same initial update ranking among the monitoring devices. At this time, the monitoring devices can be clustered according to the timestamps of the data update requests sent by each monitoring device, so that the monitoring devices with the same timestamps of the data update requests sent can be divided into the same data set.

[0036] For example, assuming that the monitoring devices include monitoring device A, monitoring device B and monitoring device C, the timestamp of the data update request sent by monitoring device A is earlier than the timestamp of the data update request sent by monitoring device C, and the timestamp of the data update request sent by monitoring device B is the same as the timestamp of the data update request sent by monitoring device C, then monitoring device B and monitoring device C can be classified into the same device set.

[0037] After determining each device set, for any device set, the corresponding monitoring position of each monitoring device in the device set in the target area can be obtained, so as to determine the update order of each monitoring device in the device set from a record table that records the mapping relationship between the monitoring position and the update order based on the monitoring position of each monitoring device, so as to adjust the initial update order of each monitoring device in the device set based on the update order of each monitoring device in the device set.

[0038] Exemplarily, the target terminal may store a record table that records the mapping relationship between the monitoring position and the update order, such as monitoring position 1, monitoring position 2...monitoring position N recorded in the record table, and the update order of each monitoring position is recorded, such as the update order of monitoring position 1 is greater than monitoring position 2, greater than monitoring position 3...greater than monitoring position N. Assuming that a certain device set includes monitoring device B and monitoring device C, and the monitoring position of monitoring device B is monitoring position 1, and the monitoring position of monitoring device C is monitoring position 2, then the initial update order of monitoring device B can be adjusted to be greater than the initial update order of monitoring device C. After completing the adjustment of the initial update order of the monitoring devices in all device sets, the data update order of each monitoring device can be obtained. If the initial update order of each monitoring device is monitoring device A>monitoring device B=monitoring device C, the data update order obtained after adjustment is monitoring device A>monitoring device B>monitoring device C. In this way, it is possible to avoid the situation where the data update order of multiple monitoring devices is the same, resulting in the inability to configure a mutex lock for a single monitoring device, reduce the impact on the update of monitoring data, and improve the update efficiency of monitoring data.

[0039] Considering that the water flow in the upstream will affect the water flow in the downstream, in order to facilitate the traceability of the updated current monitoring data, in some embodiments, such as Figure 2 As shown, adjusting the initial update order of each monitoring device in any of the device sets according to the corresponding monitoring positions of each monitoring device in the target area includes: Step 201, obtaining target information indicating the upstream and downstream relationship of each monitoring device in the device set according to the corresponding monitoring position of each monitoring device in the target area and the water flow direction in the target area; Step 202: According to the target information, the initial update sequence of each monitoring device in the device set is adjusted in order from upstream to downstream.

[0040] In some embodiments, for any device set, the corresponding monitoring position of each monitoring device in the device set in the target area can be obtained, so as to determine the upstream and downstream relationship between each monitoring position according to the water flow direction in the target area, so as to use the upstream and downstream relationship between each monitoring position to represent the upstream and downstream relationship of each monitoring device in the device set, thereby obtaining target information representing the upstream and downstream relationship of each monitoring device in the device set. Exemplarily, assuming that the device set includes monitoring device B and monitoring device C, the monitoring position of monitoring device B is position 1, the monitoring position of monitoring device C is position 2, and the water flow direction in the target area is from position 1 to position 2, which means that position 1 is upstream of position 2. At this time, the upstream and downstream relationship between monitoring device B and monitoring device C can be determined as monitoring device B is the upstream device of monitoring device C, so as to use the upstream and downstream relationship between monitoring device B and monitoring device C as target information.

[0041] After obtaining the target information representing the upstream and downstream relationship of each monitoring device in the device set, the initial update order of each monitoring device in the device set can be adjusted from upstream to downstream according to the target information. If it is assumed that the target information includes that monitoring device B is the upstream device of monitoring device C, the initial update order of monitoring device B can be adjusted to be greater than the initial update order of monitoring device C. In this way, when the data is updated later, the monitoring data of the monitoring device located upstream can be updated first, so that the downstream monitoring device can obtain the data changes of its upstream position at the same time point when updating the monitoring data. At the same time, the updated current monitoring data can also reflect the water flow changes in the target area based on the water flow direction at the same time point, which is convenient for the subsequent analysis of the monitoring data of the target area of ​​the reservoir.

[0042] After obtaining the data update order of each monitoring device, a mutex lock can be configured for each monitoring device in turn according to the data update order of each monitoring device, and the monitoring device configured with the mutex lock is determined as the target monitoring device, so that the target monitoring device obtains the current monitoring data cached by the target terminal from the cache for update, and after the target monitoring device completes the update of the current monitoring data cached in the target terminal, the mutex lock obtained by the target monitoring device is released, and then the mutex lock is configured to the next monitoring device according to the data update order, so that the next monitoring device is used as the target monitoring device, and the above data update process is repeated.

[0043] However, considering that when the target monitoring device updates the current monitoring data, the current monitoring data may not be updated due to a malfunction of the target monitoring device, such as a power outage of the target monitoring device. At this time, since the target monitoring device has not updated the current monitoring data, the mutex lock cannot be released, resulting in the inability of subsequent monitoring devices to update the current monitoring data, affecting the updating efficiency of the monitoring data. To this end, in some embodiments, the method further includes: when the target monitoring device obtains the current monitoring data cached in the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal, determining that the target monitoring device has completed the update of the current monitoring data cached in the target terminal; or, When the time duration during which the target monitoring device is configured with the mutex lock reaches a first preset time duration, it is determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0044] In some embodiments, when a certain monitoring device is configured with a mutex lock, it can be determined that the detection device is a target detection device, and then the target detection device is detected whether it obtains the current monitoring data cached by the target terminal for updating, and synchronizes the updated current monitoring data to the cache of the target terminal. If it is detected that the target detection device obtains the current monitoring data for updating, and synchronizes the updated current monitoring data to the cache of the target terminal, it can be determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal, and then the mutex lock is released, and the mutex lock is configured to the next monitoring device. If it is detected that the target detection device has not yet synchronized the updated current monitoring data to the cache of the target terminal, it can be detected whether the duration of the target monitoring device being configured with a mutex lock reaches a first preset duration. Among them, the first preset duration can be set according to actual conditions. If it is detected that the target detection device has not synchronized the updated current monitoring data to the cache of the target terminal, and the duration of the target monitoring device being configured with a mutex lock reaches the first preset duration, it can be directly determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal, and then the mutex lock is released, and the mutex lock is configured to the next monitoring device. In this way, it is possible to avoid the situation where the subsequent monitoring devices are unable to update the monitoring data due to the target monitoring device not updating the current monitoring data for a long time or not synchronizing the current monitoring data to the cache of the target terminal, thereby improving the updating efficiency of the monitoring data.

[0045] Considering that in the process of configuring a mutual exclusion lock for a monitoring device, a situation may occur where a mutual exclusion lock cannot be configured for the monitoring device due to a monitoring device failure. At this time, the subsequent monitoring device cannot configure the mutual exclusion lock, resulting in the subsequent monitoring device being unable to update the current monitoring data, affecting the updating efficiency of the monitoring data. To this end, in some embodiments, the method further includes: It is determined that the monitoring device has not completed the configuration of the mutex lock within a second preset time period, and the mutex lock is configured for the next monitoring device according to the data update sequence.

[0046] In some embodiments, when configuring a mutex lock for a certain monitoring device, it can be detected whether the monitoring device completes the configuration of the mutex lock within a second preset time period starting from the moment when the configuration of the mutex lock for the monitoring device is triggered. The second preset time period can be set according to actual conditions. If the monitoring device completes the configuration of the mutex lock within the second preset time period, the monitoring device is determined as the target monitoring device, so that the target monitoring device obtains the current monitoring data from the cache of the target terminal for update; if the monitoring device does not complete the configuration of the mutex lock within the second preset time period, the monitoring device is skipped, and the mutex lock is configured for the next monitoring device according to the data update order. This can avoid the situation where the mutex lock cannot be obtained for a long time due to a failure of the monitoring device, resulting in the inability of subsequent monitoring devices to update the monitoring data, thereby improving the updating efficiency of the monitoring data.

[0047] In order to reduce the situation where the current monitoring data in the cache disappears due to power failure of the target terminal, in some embodiments, the method further includes: Determine that the update frequency of the current monitoring data in the target duration is less than a preset frequency, store the current monitoring data from the cache of the target terminal to the disk storage of the target terminal, and delete the current monitoring data from the cache.

[0048] In some embodiments, the target terminal may detect the update frequency of the current monitoring data stored in the cache within the target duration. The target duration may be set according to actual conditions, such as 5 minutes. If the update frequency of the current detection data stored in the cache is less than the preset frequency, such as less than 1 time, within the target duration, it means that the current monitoring data stored in the cache tends to be stable. At this time, the current monitoring data in the cache may be stored in the disk storage of the target terminal, and the current monitoring data may be deleted from the cache to reduce the possibility that the current monitoring data in the cache cannot be stored in time due to power failure of the target terminal.

[0049] The following is a description of the reservoir monitoring data updating device provided in the present application. The reservoir monitoring data updating device described below and the reservoir monitoring data updating method described above can refer to each other.

[0050] In one embodiment, if Figure 3 As shown, a device for updating reservoir monitoring data is provided, comprising: An update sequence determination module 210, for responding to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, and determining the data update sequence of each monitoring device according to the timestamp of each data update request; The monitoring data updating module 220 is used to configure a mutual exclusion lock between each of the monitoring devices multiple times according to the data updating sequence of each of the monitoring devices, and each time the configuration determines the monitoring device currently configured with the mutual exclusion lock as the target monitoring device, and when it is detected that the target monitoring device reaches a preset trigger condition, the mutual exclusion lock is configured to the next monitoring device according to the data updating sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0051] By responding to the data update request sent by each monitoring device that monitors the target area of ​​the reservoir, the data update order of each monitoring device is determined according to the timestamp of each data update request, and the mutual exclusion lock is configured between each monitoring device multiple times according to the data update order of each monitoring device, and each configuration determines the monitoring device currently configured with the mutual exclusion lock as the target monitoring device, and in the case of detecting that the target monitoring device reaches the preset trigger condition, the mutual exclusion lock is configured to the next monitoring device according to the data update order, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and caches the updated current monitoring data to the target terminal to update the current monitoring data cached by the target terminal. Therefore, before the need to update the monitoring data, the data update order determined by the timestamp of the data update request of each monitoring device can be used to sequentially configure mutual exclusion locks for each monitoring device to ensure that only one monitoring device process can update the monitoring data at the same time, avoiding the problem of inconsistent cached monitoring data caused by concurrent updates, reducing the possibility of monitoring data loss, and at the same time enabling the updated monitoring data to reflect the changes of the target area over time, thereby improving the updating efficiency of the monitoring data.

[0052] In one embodiment, the update sequence determination module 210 is specifically used to: Determining an initial update order of each of the monitoring devices according to a timestamp of each of the data update requests; The monitoring devices with the same timestamp of the corresponding data update requests are divided into the same device set, and the initial update order of each monitoring device in any of the device sets is adjusted according to the corresponding monitoring positions of each monitoring device in the target area to obtain the data update order.

[0053] In one embodiment, the update sequence determination module 210 is specifically used to: According to the corresponding monitoring positions of the monitoring devices in the target area and the water flow direction in the target area, obtaining target information indicating the upstream and downstream relationship of the monitoring devices in the device set; According to the target information, the initial update sequence of each monitoring device in the device set is adjusted in order from upstream to downstream.

[0054] In one embodiment, the monitoring data updating module 220 is further used to: When the target monitoring device acquires the current monitoring data cached in the target terminal for updating and synchronizes the updated current monitoring data to the cache of the target terminal, it is determined that the target monitoring device completes the updating of the current monitoring data cached in the target terminal; or When the time duration during which the target monitoring device is configured with the mutex lock reaches a first preset time duration, it is determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0055] In one embodiment, the monitoring data updating module 220 is further used to: It is determined that the monitoring device has not completed the configuration of the mutex lock within a second preset time period, and the mutex lock is configured for the next monitoring device according to the data update sequence.

[0056] In one embodiment, the monitoring data updating module 220 is further used to: Determine that the update frequency of the current monitoring data in the target duration is less than a preset frequency, store the current monitoring data from the cache of the target terminal to the disk storage of the target terminal, and delete the current monitoring data from the cache.

[0057] In one embodiment, the water environment elements monitored by each of the monitoring devices are the same.

[0058] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call a computer program in the memory 830 to execute a method for updating reservoir monitoring data, for example, including: In response to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, determine a data update order for each monitoring device according to a timestamp of each data update request; According to the data update sequence of each monitoring device, mutually exclusive locks are configured between each monitoring device for multiple times, and each configuration determines the monitoring device currently configured with the mutually exclusive lock as the target monitoring device, and when it is detected that the target monitoring device reaches a preset trigger condition, the mutually exclusive lock is configured to the next monitoring device according to the data update sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0059] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0060] On the other hand, an embodiment of the present application further provides a storage medium, the storage medium includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the reservoir monitoring data update method provided by the above embodiments, for example, including: In response to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, determine a data update order for each monitoring device according to a timestamp of each data update request; According to the data update sequence of each monitoring device, mutually exclusive locks are configured between each monitoring device for multiple times, and each configuration determines the monitoring device currently configured with the mutually exclusive lock as the target monitoring device, and when it is detected that the target monitoring device reaches a preset trigger condition, the mutually exclusive lock is configured to the next monitoring device according to the data update sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

[0061] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., 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. Those of ordinary skill in the art may understand and implement it without creative effort.

[0062] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for updating reservoir monitoring data, characterized in that: include: In response to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, determine a data update order for each monitoring device according to a timestamp of each data update request; According to the data update sequence of each monitoring device, mutually exclusive locks are configured between each monitoring device for multiple times, and each configuration determines the monitoring device currently configured with the mutually exclusive lock as the target monitoring device, and when it is detected that the target monitoring device reaches a preset trigger condition, the mutually exclusive lock is configured to the next monitoring device according to the data update sequence, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

2. The method for updating reservoir monitoring data according to claim 1, characterized in that: Determining the data update order of each monitoring device according to the timestamp of each data update request includes: Determining an initial update order of each of the monitoring devices according to a timestamp of each of the data update requests; The monitoring devices with the same timestamp of the corresponding data update requests are divided into the same device set, and the initial update order of each monitoring device in any of the device sets is adjusted according to the corresponding monitoring positions of each monitoring device in the target area to obtain the data update order.

3. The method for updating reservoir monitoring data according to claim 2, characterized in that: According to the monitoring positions corresponding to the monitoring devices in the target area, adjusting the initial update order of the monitoring devices in any of the device sets includes: According to the corresponding monitoring positions of the monitoring devices in the target area and the water flow direction in the target area, obtaining target information indicating the upstream and downstream relationship of the monitoring devices in the device set; According to the target information, the initial update sequence of each monitoring device in the device set is adjusted in order from upstream to downstream.

4. The method for updating reservoir monitoring data according to any one of claims 1 to 3, characterized in that: Also includes: When the target monitoring device acquires the current monitoring data cached in the target terminal for updating and synchronizes the updated current monitoring data to the cache of the target terminal, it is determined that the target monitoring device completes the updating of the current monitoring data cached in the target terminal; or When the time duration during which the target monitoring device is configured with the mutex lock reaches a first preset time duration, it is determined that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

5. The method for updating reservoir monitoring data according to any one of claims 1 to 3, characterized in that: Also includes: It is determined that the monitoring device has not completed the configuration of the mutex lock within a second preset time period, and the mutex lock is configured for the next monitoring device according to the data update sequence.

6. The method for updating reservoir monitoring data according to any one of claims 1 to 3, characterized in that: Also includes: Determine that the update frequency of the current monitoring data in the target duration is less than a preset frequency, store the current monitoring data from the cache of the target terminal to the disk storage of the target terminal, and delete the current monitoring data from the cache.

7. The method for updating reservoir monitoring data according to any one of claims 1 to 3, characterized in that: The water environment elements monitored by each of the monitoring devices are the same.

8. A device for updating reservoir monitoring data, characterized in that: include: An update sequence determination module, for responding to data update requests sent by each monitoring device that monitors a target area of ​​the reservoir, and determining the data update sequence of each monitoring device according to a timestamp of each data update request; A monitoring data update module, configured to configure mutual exclusion locks between each of the monitoring devices multiple times according to the data update sequence of each of the monitoring devices, and to determine the monitoring device currently configured with the mutual exclusion lock as the target monitoring device in each configuration, and to configure the mutual exclusion lock to the next monitoring device according to the data update sequence when it is detected that the target monitoring device reaches a preset trigger condition, so that the target monitoring device obtains the current monitoring data cached by the target terminal for update, and synchronizes the updated current monitoring data to the cache of the target terminal to update the current monitoring data cached by the target terminal; The preset trigger condition includes that the target monitoring device completes the update of the current monitoring data cached in the target terminal.

9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the method for updating reservoir monitoring data according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for updating reservoir monitoring data according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Water quality environmental monitoring system based on wireless transducers

    CN105761465A

  • Data updating method and device, storage medium and equipment

    CN109597818A

  • Data updating method and device, electronic equipment and storage medium

    CN111488365A