Mutual feedback method for whole process water dispatch simulation

Through the full-process water scheduling simulation mutual feed method, combined with multi-time scale runoff forecasting and joint scheduling simulation, the problems of lack of dynamic data, insufficient prediction capabilities and single time scale of traditional scheduling methods are solved, and more scientific and flexible water scheduling is achieved. Plan to meet the changing needs of water users.

CN118643931BActive Publication Date: 2025-01-17ZHONGKE SHANSHUI (BEIJING) TECH INFORMATION CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410666319.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2025-01-17
Estimated Expiration
2044-05-28

AI Technical Summary

Technical Problem

The traditional water volume scheduling method lacks dynamic data support, insufficient prediction capabilities, and a single time scale, which makes it difficult for the scheduling plan to adapt to the complex and changeable water resource environment, lack flexibility and adaptability, and difficult to meet the growing demands of water users.

Method used

The water volume scheduling simulation mutual feed method is adopted to obtain the water user demand data and the actual data of water engineering scheduling, build a multi-time scale runoff forecast mechanism, generate interactive strategy data, and conduct joint scheduling simulation to generate annual, monthly, ten-day, and Real-time scheduling planning.

Benefits of technology

It realizes the formulation of scheduling plans based on the latest and most accurate information, improves prediction capabilities, enhances the scientificity and flexibility of scheduling plans, can better meet water needs at different time scales, and provide scientific and reliable decision-making support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118643931B_ABST
    Figure CN118643931B_ABST
Patent Text Reader

Abstract

The present invention provides a full-process water scheduling simulation mutual feedback method, which can dynamically reflect the current water resources status and user needs by acquiring the water user demand data of the target area and the actual data of water project scheduling in real time. The method constructs a multi-time scale runoff forecasting mechanism, and uses advanced prediction technology and models to predict the runoff and water resources status at different time scales in the future to reduce risks. The full-process water scheduling simulation mutual feedback method not only considers the water scheduling of a single time scale, but also comprehensively considers the water scheduling needs of multiple time scales such as annual, set scheduling period, monthly, ten days, and real-time through a multi-time scale runoff forecasting mechanism, which can better meet the water demand of different time scales. Finally, based on the interactive strategy data of water resources management and control conditions, the method conducts a joint scheduling simulation of water resources of water projects in the target area, and can comprehensively consider multiple factors to generate a mutual feedback scheduling plan.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent processing technology, and in particular to a full-process water scheduling simulation mutual feedback method. Background Art

[0002] In modern water resource management, the rational dispatch and allocation of water plays a vital role in ensuring water supply security, optimizing water resource allocation, and improving water resource utilization efficiency. Especially in areas with water shortage and uneven spatial and temporal distribution, how to conduct water dispatch scientifically and efficiently is facing severe challenges.

[0003] Traditional water scheduling methods are mostly based on static or relatively simple scheduling rules, lacking dynamic analysis of actual data on water project scheduling and accurate prediction of future water resources conditions, resulting in scheduling plans often being difficult to adapt to the complex and changing water resources environment. In addition, traditional scheduling methods also lack comprehensive consideration of multiple time scales (such as annual, monthly, ten-day, real-time, etc.), making scheduling plans lack flexibility and adaptability, making it difficult to meet the growing needs of water users.

[0004] Specifically, the traditional water scheduling method has the following technical problems:

[0005] Lack of dynamic data support: Traditional scheduling methods often allocate water based on historical data and empirical rules. They lack the analysis and use of real-time, dynamic water project scheduling data and water user demand data, making it difficult for scheduling plans to accurately reflect current water resource conditions and user needs.

[0006] Insufficient forecasting capabilities: Traditional methods lack advanced hydrological forecasting technology and model support, making it difficult to accurately predict runoff and water resource conditions in the future, making it impossible to formulate reasonable and scientific water scheduling plans.

[0007] Single time scale: Traditional scheduling methods often only focus on water scheduling at a specific time scale, such as annual or monthly scheduling, and lack comprehensive consideration and coordination of multiple time scales, resulting in a lack of flexibility and adaptability in scheduling plans.

[0008] Inaccurate scheduling simulation: Due to the lack of a scheduling simulation mechanism that comprehensively considers multiple factors, traditional methods often find it difficult to accurately simulate the scheduling effects of water resources in water projects under different conditions, and thus cannot provide scientific and reliable decision-making support for water scheduling. Summary of the invention

[0009] In order to solve the above technical problems, the present application provides a full-process water scheduling simulation mutual feedback method to at least solve or alleviate the problems existing in the above-mentioned prior art.

[0010] In order to achieve the above object, according to one aspect of the present application, a full-process water scheduling simulation mutual feedback method is provided, which includes:

[0011] Obtain water demand data from users in the target area and actual data on water project scheduling and utilization;

[0012] Construct a multi-time scale runoff forecast mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling and utilization, and the multi-time scale runoff forecast mechanism matches and generates scheduling plans according to the year, set scheduling period, month, ten days, and real time;

[0013] Based on the interactive strategy data of the water resources control conditions, a joint scheduling simulation is performed on the water resources of the water projects in the target area to generate a mutually-feedback annual, set scheduling period, monthly, ten-day, and real-time scheduling plan.

[0014] In this application, by obtaining the user demand data of water use in the target area and the actual data of water project scheduling in real time, the scheduling plan can be formulated based on the latest and most accurate information. This method overcomes the limitations of traditional methods that rely on historical data and empirical rules, and can dynamically reflect the current water resources and user needs. In addition, the method constructs a multi-time scale runoff forecasting mechanism, and uses advanced prediction technology and models to predict the runoff and water resources conditions at different time scales (such as annual, monthly, ten-day, real-time, etc.) in the future. This multi-time scale prediction capability makes the scheduling plan more scientific and reasonable, and can respond to changes in water resources in advance and reduce risks. Furthermore, the full-process water scheduling simulation feedback method not only considers the water scheduling of a single time scale, but also comprehensively considers the water scheduling needs of multiple time scales such as annual, set scheduling period, monthly, ten-day, real-time, etc. through a multi-time scale runoff forecasting mechanism. This makes the scheduling plan more flexible and adaptable, and can better meet the water demand of different time scales. Finally, the method is based on the interactive strategy data of water resources control conditions to simulate the joint scheduling of water resources in the target area. This joint scheduling simulation can comprehensively consider multiple factors (such as water resource conditions, user needs, engineering capabilities, etc.) to generate a mutually feedback scheduling plan. Through continuous iteration and optimization, the scheduling simulation results are more accurate and reliable, providing scientific and reliable decision support for water scheduling. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:

[0016] Figure 1 This is a flow chart of a full-process water scheduling simulation mutual feedback method according to an embodiment of the present application. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to better understand the solution of the present application, the following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0018] Figure 1 This is a flow chart of a method for simulating mutual feedback of water quantity scheduling in the whole process according to an embodiment of the present application. Figure 1 As shown, it includes:

[0019] Obtain water demand data from users in the target area and actual data on water project scheduling and utilization;

[0020] Construct a multi-time scale runoff forecast mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling and utilization, and the multi-time scale runoff forecast mechanism matches and generates scheduling plans according to the year, set scheduling period, month, ten days, and real time;

[0021] Based on the interactive strategy data of the water resources control conditions, a joint scheduling simulation is performed on the water resources of the water projects in the target area to generate a mutually-feedback annual, set scheduling period, monthly, ten-day, and real-time scheduling plan.

[0022] In this application, by obtaining the user demand data of water use in the target area and the actual data of water project scheduling in real time, the scheduling plan can be formulated based on the latest and most accurate information. This method overcomes the limitations of traditional methods that rely on historical data and empirical rules, and can dynamically reflect the current water resources and user needs. In addition, the method constructs a multi-time scale runoff forecasting mechanism, and uses advanced prediction technology and models to predict the runoff and water resources conditions at different time scales (such as annual, monthly, ten-day, real-time, etc.) in the future. This multi-time scale prediction capability makes the scheduling plan more scientific and reasonable, and can respond to changes in water resources in advance and reduce risks. Furthermore, the full-process water scheduling simulation feedback method not only considers the water scheduling of a single time scale, but also comprehensively considers the water scheduling needs of multiple time scales such as annual, set scheduling period, monthly, ten-day, real-time, etc. through a multi-time scale runoff forecasting mechanism. This makes the scheduling plan more flexible and adaptable, and can better meet the water demand of different time scales. Finally, the method is based on the interactive strategy data of water resources control conditions to simulate the joint scheduling of water resources in the target area. This joint scheduling simulation can comprehensively consider multiple factors (such as water resource conditions, user needs, engineering capabilities, etc.) to generate a mutually feedback scheduling plan. Through continuous iteration and optimization, the scheduling simulation results are more accurate and reliable, providing scientific and reliable decision support for water scheduling.

[0023] Optionally, the obtaining of water user demand data and actual water project scheduling data in the target area includes:

[0024] Based on the intelligent sensor installed on the water user side, the actual water use data of the water user is monitored and sent to the edge computing device installed on the water user side for statistical analysis to predict the water user demand data, which at least includes water consumption, water use time, and water use rate;

[0025] Based on the intelligent sensors installed on the water project scheduling side, the actual water consumption data on the water project scheduling side is monitored and sent to the edge computing device installed on the water project scheduling side for statistical analysis to obtain the actual data of water project scheduling. The actual data of water project scheduling includes at least reservoir water level, pump station flow, and pipeline pressure.

[0026] To this end, the acquisition of water user demand data in the target area and actual data on water project scheduling and utilization has the following technical benefits:

[0027] (1) Using intelligent sensors to conduct real-time monitoring on the water user side and the water project dispatching side, the actual water consumption data of water users and the actual water consumption data of water project dispatching can be obtained in real time.

[0028] These data are transmitted to edge computing devices in real time for statistical analysis, which greatly reduces the delay in data transmission and improves the real-time and efficiency of data processing.

[0029] (2) Smart sensors are highly sensitive and reliable, and can accurately monitor key indicators such as water quality and water volume to ensure data accuracy. Edge computing devices process and analyze data close to the data source, avoiding distortion and errors in data transmission.

[0030] (3) With the development of the Internet of Things and cloud computing technologies, smart sensors and edge computing devices can be easily expanded and upgraded to meet the ever-changing needs of data collection and analysis. By adjusting the location and sampling frequency of smart sensors, it can flexibly adapt to the actual water demand and water project scheduling in different regions.

[0031] (4) Through real-time analysis of water demand and water project scheduling data, water supply planning and resource allocation can be optimized to avoid resource waste and over-consumption. Water supply and sewage treatment frequency can be dynamically adjusted according to changes in water demand to reduce energy consumption and operating costs.

[0032] The following is a code example to implement the above acquisition processing based on sensor data monitoring, statistical analysis of edge computing devices, and data transmission:

[0033] # Initialize the smart sensor interface

[0034] import SmartSensorLibrary#Sensor library

[0035] sensor=SmartSensorLibrary.WaterUsageSensor()

[0036] #Edge computing equipment installed on the water user side

[0037] import EdgeComputingDeviceedge_device=EdgeComputingDevice.EdgeDevice()

[0038] def monitor_water_usage():

[0039] #Circularly monitor the actual water consumption data of water users

[0040] while True:

[0041] #Read sensor data

[0042] water_data=sensor.read_data()

[0043] #water_data is a dictionary containing water consumption, water use time, and water use rate

[0044] #{'water_volume':100,'time':'2023-10-23 12:00:00','rate':5.0}

[0045] # Statistical analysis of water use data

[0046] usage_stats=edge_device.analyze_data(water_data)

[0047] #Predict water user demand data

[0048] predicted_usage=edge_device.predict_usage(usage_stats)

[0049] #send_to_server(predicted_usage)

[0050] print(f"Predicted Usage:{predicted_usage}")

[0051] # Wait for a while and monitor again

[0052] time.sleep(60)#Assume monitoring once per minute

[0053] #Start the monitoring process

[0054] monitor_water_usage()

[0055] Water project dispatching code

[0056] #Initialize the smart sensor interface on the water project scheduling side

[0057] import SmartSensorLibrary#Assumed sensor library

[0058] water_engineering_sensor=SmartSensorLibrary.WaterEngineeringSensor()

[0059] #Edge computing equipment installed on the water project scheduling side

[0060] import EdgeComputingDeviceedge_device_engineering=EdgeComputingDevice.EdgeDevice()

[0061] def monitor_water_engineering():

[0062] #Circular monitoring of actual data on water project scheduling

[0063] while True:

[0064] #Read sensor data

[0065] engineering_data=water_engineering_sensor.read_data()

[0066] #engineering_data is a dictionary containing reservoir water level, pump station flow, and pipe network pressure

[0067] #{'reservoir_level':100.5,'pump_station_flow':20.0,'pipe_network_pressure':1.5}

[0068] # Statistical analysis of water project data

[0069] engineering_stats=edge_device_engineering.analyze_data(engineering_data)

[0070] #Send the actual data to the server or data center for further processing

[0071] #send_to_server(engineering_stats)

[0072] print(f"Engineering Data:{engineering_stats}")

[0073] # Wait for a while and monitor again

[0074] time.sleep(60)#Assume monitoring once per minute

[0075] #Start the monitoring process

[0076] monitor_water_engineering()

[0077] Optionally, the monitoring of actual water use data of water users based on smart sensors arranged at the water user side and sending the data to an edge computing device arranged at the water user side for statistical analysis to predict water user demand data includes:

[0078] A timed sleep and wake-up mechanism is configured on the smart sensor, so that the smart sensor works in a low power consumption mode under the timed sleep and wake-up mechanism, monitors the actual water consumption data of the water users and synchronously encapsulates the data into actual water consumption data packets in real time based on the monitored timestamps based on a lightweight encapsulation algorithm (such as a binary encapsulation protocol), so as to send the data to the edge computing device arranged on the water user side for statistical analysis, so as to predict the water user demand data. The timed sleep and wake-up mechanism can be dynamically adjusted according to the predicted mode of the actual water consumption data of the monitored water users, and the dynamic adjustment is for at least one of the sleep duration and the wake-up frequency.

[0079] To this end, a timed sleep and wake-up mechanism is configured on the smart sensor on the water user side, and a lightweight encapsulation algorithm (such as a binary encapsulation protocol) is combined to monitor and transmit actual water consumption data, which has the following technical benefits:

[0080] (1) Low power mode: The timed sleep and wake-up mechanism allows the smart sensor to enter low power mode during periods when continuous monitoring is not required, significantly reducing energy consumption. During sleep, the sensor consumes almost no power, extending battery life and equipment maintenance cycle.

[0081] (2) Real-time synchronous encapsulation: Using lightweight encapsulation algorithms (such as binary encapsulation protocols), actual water usage data can be encapsulated into data packets in real time and efficiently. Binary encapsulation protocols usually have smaller data packet sizes and higher transmission efficiency, which is suitable for use in resource-constrained edge computing environments.

[0082] (3) Improve data transmission efficiency: Real-time synchronous encapsulation ensures the timeliness and accuracy of data, helping edge computing devices to quickly obtain and analyze the actual water consumption data of water users. Highly efficient data transmission reduces network congestion and delays, and improves the response speed of the entire system.

[0083] (4) Dynamically adjust the sleep and wake-up mechanism: Dynamic adjustment based on the predicted pattern of the actual water consumption data of the monitored water users can further optimize energy consumption and performance. For example, during peak water consumption, the wake-up frequency can be increased to obtain more frequent monitoring data; during low water consumption, the sleep time can be extended to save energy.

[0084] (5) Improving system intelligence: By dynamically adjusting the sleep and wake-up mechanisms, the system can more intelligently adapt to water demand in different time periods, thereby improving the flexibility and adaptability of the system, helping to better predict the demand data of water users, and providing strong support for the rational scheduling and management of water resources.

[0085] The above-mentioned timed sleep and wake-up mechanism, low power mode, data encapsulation and dynamic adjustment functions are implemented based on the following exemplary code:

[0086] import time

[0087] import math

[0088] from sensor_library import WaterUsageSensor#Sensor library

[0089] from edge_computing_device import EdgeDevice#Edge computing device library

[0090] from network_library import send_data#Network communication library

[0091] class SmartWaterSensor:

[0092] def__init__(self,sleep_duration=60,wake_up_frequency=1):

[0093] self.sensor=WaterUsageSensor()

[0094] self.edge_device=EdgeDevice()

[0095] self.sleep_duration = sleep_duration # Sleep duration (seconds)

[0096] self.wake_up_frequency=wake_up_frequency#Wake-up frequency (dynamically adjusted based on prediction mode)

[0097] self.last_wakeup_time=time.time()

[0098] def monitor_water_usage(self):

[0099] while True:

[0100] if time.time()-self.last_wakeup_time>=self.sleep_duration:

[0101] #Wake up the sensor and read data

[0102] water_data=self.sensor.read_data()

[0103] timestamp = time.time()

[0104] #Package data

[0105] packet=self.encapsulate_data(water_data,timestamp)

[0106] #Send to edge computing device

[0107] send_data(packet)

[0108] #Perform statistical analysis and predict demand data

[0109] predicted_usage=self.edge_device.predict_usage(water_data)

[0110] #Dynamically adjust the sleep duration and wake-up frequency according to the prediction mode

[0111] #If water consumption is high, shorten the sleep time

[0112] if predicted_usage>SOME_THRESHOLD:

[0113] self.sleep_duration = max(self.sleep_duration-1,10) # Sleep for at least 10 seconds

[0114] else:

[0115] self.sleep_duration = min(self.sleep_duration + 1,300) # Sleep for up to 300 seconds

[0116] #Update the last wakeup time

[0117] self.last_wakeup_time=time.time()

[0118] #Enter sleep mode (use time.sleep to simulate)

[0119] time.sleep(self.sleep_duration-(time.time()-self.last_wakeup_time))

[0120] def encapsulate_data(self,data,timestamp):

[0121] #Use lightweight encapsulation algorithms (such as binary encapsulation protocols) to encapsulate data

[0122] #Binary encoding and other operations

[0123] packet={

[0124] 'timestamp':timestamp,

[0125] 'data':data#data is structured data

[0126] }

[0127] #Convert the packet to binary format

[0128] binary_packet=convert_to_binary(packet)

[0129] return binary_packet

[0130] #Start function

[0131] def start_monitoring():

[0132] sensor = SmartWaterSensor()

[0133] sensor.monitor_water_usage()

[0134] #Start the monitoring process

[0135] start_monitoring()

[0136] sensor_library, edge_computing_device, and network_library are libraries or modules for implementing configurations. convert_to_binary is a function used to convert data packets into binary format. SOME_THRESHOLD is a threshold used to trigger dynamic adjustment of sleep duration and wake-up frequency. time.sleep is used to simulate the sleep state of the sensor.

[0137] Optionally, the monitoring of actual water use data of water users based on smart sensors arranged at the water user side and sending the data to an edge computing device arranged at the water user side for statistical analysis to predict water user demand data includes:

[0138] Based on the intelligent sensors installed on the water user side, the actual water consumption data of the water user is monitored, and the monitored actual water consumption data is packaged in reverse order according to the time stamps of the actual water consumption data, and compressed and cached in sequence, and sent to the edge computing device installed on the water user side in a descending order of freshness for statistical analysis, including total water consumption, water consumption trends, and peak water consumption periods, so as to predict the water user demand data.

[0139] Based on the intelligent sensors installed on the water user side, the actual water consumption data of the water user is monitored in real time, and the data is packaged, compressed and cached in reverse order, and then sent to the edge computing device for statistical analysis according to the freshness of the timeliness. It has the following technical benefits:

[0140] (1) Data real-time: By packaging in reverse order in real time, the latest water consumption data is processed first. This method ensures the freshness of the data, allowing edge computing devices to analyze based on the latest data, improving the accuracy of predicting water user demand data.

[0141] (3) Optimizing data processing efficiency: Reverse-order packaging and compression processing reduce the bandwidth requirements for data transmission and improve data transmission efficiency. This is particularly important in edge computing environments with limited network resources, as it can reduce data transmission delays and costs.

[0142] (4) Intelligent cache management: Through cache processing, some historical water use data can be saved locally, reducing dependence on network transmission. When the edge computing device needs to analyze data over a longer period of time, it can directly obtain it from the cache, improving the speed and efficiency of data access.

[0143] (5) Accurate statistical analysis: Based on real-time, chronologically arranged water use data, edge computing devices can perform accurate statistical analysis, including total water use, water use trends, and peak water use periods. These analysis results are crucial for predicting demand data for water users and help improve the efficiency and effectiveness of water resource management.

[0144] (6) Supporting prediction model optimization: By continuously collecting and analyzing real-time water use data, the prediction model can be continuously optimized. Over time, the model can more accurately reflect the user's water use behavior and improve the accuracy of the prediction of water user demand data.

[0145] (7) Reduce system costs: By improving the efficiency of data processing and transmission, the reliance on hardware and network resources can be reduced, thus reducing system costs. At the same time, accurate forecast data can help water resource management departments allocate resources more reasonably, avoid waste, and further reduce operating costs.

[0146] Write the following exemplary code to implement hardware interface (such as reading sensor data), data processing (including compression and caching), and network communication (sending data to edge computing devices) to ensure that the actual water use data of water users is monitored based on the smart sensors set on the water user side, and sent to the edge computing device set on the water user side for statistical analysis to predict the water user demand data:

[0147] import time

[0148] import zlib #Python library for compressing data

[0149] from collections import deque#Using a double-ended queue (deque) as a cache

[0150] from sensor_interface import read_water_usage#Sensor Interface

[0151] from edge_computing_interface import send_data#Edge Computing Interface

[0152] #Cache size

[0153] CACHE_SIZE = 100 # Maximum number of packets stored in the cache

[0154] #Cache data structure, using a double-ended queue deque, which is convenient for adding from one end and removing from the other end

[0155] cache=deque(maxlen=CACHE_SIZE)

[0156] #Read and process sensor data

[0157] def process_sensor_data():

[0158] while True:

[0159] #Read sensor data, including timestamp and water usage

[0160] timestamp,water_usage=read_water_usage()

[0161] # Encapsulate data into packets

[0162] data_packet = {

[0163] 'timestamp':timestamp,

[0164] 'water_usage':water_usage

[0165] }

[0166] #Compress the data packet (using zlib for compression here)

[0167] compressed_packet=zlib.compress(str.encode(str(data_packet)))

[0168] #Add the compressed data packet to the beginning of the cache (keep the latest data at the front)

[0169] cache.appendleft(compressed_packet)

[0170] #Send the cached data to the edge computing device (in descending order of freshness)

[0171] for packet in cache:

[0172] send_data(packet)

[0173] #Sleep for a while to reduce CPU usage and save energy

[0174] time.sleep(1)#Read sensor data once a second

[0175] # Start the data processing loop

[0176] process_sensor_data()

[0177] #Sensor interface function

[0178] def read_water_usage():

[0179] #Read sensor data and return timestamp and water consumption

[0180] timestamp = time.time()

[0181] water_usage = round (random.random() * 100, 2) # Random water usage data

[0182] return timestamp,water_usage

[0183] #Edge computing interface function

[0184] def send_data(packet):

[0185] #Send data packets to edge computing devices

[0186] print(f"Sending data packet:{packet}")

[0187] #In actual applications, data will be sent through the network interface

[0188] In the above example code, sensor_interface and edge_computing_interface can be adjusted according to the actual hardware and network interface used. The read_water_usage function is used to read data from the sensor. The send_data function is used to send data to the edge computing device. Data compression uses Python's zlib library, and the cache uses collections.deque, which allows elements to be added and removed quickly at both ends, making it very suitable as a fixed-size cache. time.sleep(1) is to simulate reading sensor data once a second. When sending data, the entire cache is traversed and all data is sent. In actual applications, some conditions (such as when the cache is full or a certain time interval is reached) may be set to send data in batches to reduce network communication overhead.

[0189] Optionally, the smart sensor is provided with a trained demand prediction model to perform the following steps to predict water demand data of water users:

[0190] Extracting features from actual water consumption data of water users to obtain time series features, seasonal features, holiday features, weather features, and user behavior features. The time series features include daily, weekly, monthly, or annual water consumption, as well as trends and periodic changes in water consumption. The seasonal features are used to consider the impact of different seasons on water consumption. The holiday features are used to consider that water consumption during holidays is different from that on weekdays. The weather features include the impact of temperature, humidity, and rainfall on water consumption. User behavior features include users' water use habits and water use time distribution.

[0191] According to the time series characteristics, season characteristics, holiday characteristics, weather characteristics, and user behavior characteristics, feature derivation processing is performed to obtain time series derived characteristics, season derived characteristics, holiday derived characteristics, weather derived characteristics, user behavior derived characteristics, and cross-derived characteristics to predict water user demand data, wherein:

[0192] The time series derived features include: trend features, which are used to characterize the growth rate, change rate or moving average of water consumption; periodic features, which are used to extract weekly or monthly periodic patterns, including daily water consumption patterns and weekly water consumption patterns; hysteresis features: users characterize the hysteresis effect of water consumption in time, including using the water consumption of the previous day or the previous week as features;

[0193] The seasonal derivative characteristics include: seasonal index, which is used to calculate the index of average water consumption of each season relative to the whole year; seasonal variation characteristics, which are used to characterize the difference in water consumption between the current season and the previous season or the same season in history; holiday derivative characteristics, which are used to identify holidays: setting a virtual variable for holidays, where 0 represents non-holidays and 1 represents holidays; pre- and post-holiday effects, which are used to consider the change in water consumption several days before and after holidays;

[0194] The weather-derived features include: temperature-related features, including average temperature, maximum temperature, minimum temperature, and difference value and cumulative value with temperature; humidity-related features, including average humidity and humidity change rate; rainfall-related features, including rainfall, number of rainy days, and rainfall intensity; weather types, including sunny, cloudy, and rainy days, and corresponding virtual variables are set;

[0195] Derived characteristics of user behavior include: water use habits, including daily water use peak hours and water use trough hours; water use time distribution, used to calculate the proportion of water use in different time periods, including morning, noon, and evening; user classification, used to classify users according to water use and water use habits, and characterize the characteristics of different types of users;

[0196] The cross-derivative features include: intersection of time series and weather, including "water consumption on hot days in summer" and "water consumption on rainy days in winter"; intersection of holidays and weather, including "water consumption on sunny days during holidays" and "water consumption on rainy days during holidays"; intersection of user behavior and holidays: including "peak water consumption hours for users during holidays".

[0197] To this end, a trained demand forecasting model is set on the smart sensor, and multiple features (including time series features, seasonal features, holiday features, weather features, user behavior features and their derivative features) are used to predict the demand data of water users, which has the following technical benefits:

[0198] (1) Improving prediction accuracy: By comprehensively considering multiple factors that affect water consumption, the model can more accurately capture changes in users' water consumption patterns, thereby improving the accuracy of predictions.

[0199] (2) Real-time and dynamic: By directly executing predictions on smart sensors, the latest water usage data can be obtained in real time and the prediction results can be dynamically updated, which helps to respond to changes in water demand in a timely manner and optimize water resource management.

[0200] (3) Reduce communication burden: By performing predictions on local sensors, the number of communications and data transmission with remote servers can be reduced, reducing network burden and communication costs.

[0201] (4) Feature richness: The various features extracted and derived can comprehensively reflect multiple aspects of users’ water use behaviors, making the prediction model more robust and flexible and able to adapt to different user types and water use scenarios.

[0202] (5) Support decision making: Accurate prediction results can provide strong data support for water resources management departments, helping them to formulate reasonable water supply plans, dispatch water resources, and optimize resource allocation.

[0203] (6) Predicting future trends: By utilizing time series derivative characteristics (such as trend characteristics and periodic characteristics), the model can predict future trends in water consumption and provide a reference for long-term planning and strategic decision-making.

[0204] (7) Optimizing user services: Based on the derived characteristics of user behavior, the model can identify the water usage habits and preferences of different users, providing a basis for personalized services, such as customized water use reminders and energy-saving suggestions.

[0205] (8) Responding to emergencies: By considering weather-derived characteristics and holiday-derived characteristics, the model can predict the impact of emergencies (such as extreme weather and holidays) on water consumption and take corresponding response measures in advance.

[0206] The following sample code shows how to implement the above process:

[0207] import pandas as pd

[0208] import numpy as np

[0209] from sklearn.model_selection import train_test_split

[0210] from sklearn.ensemble import RandomForestRegressor

[0211] def generate_mock_data(days=365):

[0212] data = {

[0213] 'timestamp':pd.date_range(start='2023-01-01',periods=days),

[0214] 'water_usage':np.random.rand(days)*100,#Water usage

[0215] #Other features (such as weather, holidays, etc.)

[0216] }

[0217] df = pd.DataFrame(data)

[0218] #Add simulated data for seasons, holidays, weather, etc.

[0219] return df

[0220] #Feature extraction and derivative functions

[0221] def extract_and_derive_features(df):

[0222] # Timing features

[0223] df['daily_usage']=df['water_usage'].resample('D').sum()

[0224] df['weekly_trend']=df['water_usage'].rolling(window=7).mean()

[0225] #...Add other time series features

[0226] #Seasonal characteristics (season column)

[0227] df['season_index']=df['season'].map({'Spring':1,'Summer':2,'Autumn':3,'Winter':4})

[0228] #...Continue to add other seasonal features

[0229] #Holiday features (with holiday identification column)

[0230] df['is_holiday']=df['holiday'].map({0:'Non-Holiday',1:'Holiday'}).astype('category')

[0231] #...Add other holiday features

[0232] #Weather characteristics (with weather data)

[0233] #...Add features such as temperature, humidity, rainfall, etc.

[0234] #User behavior characteristics (based on user behavior data)

[0235] #...Add features such as water use habits and water use time distribution

[0236] # Cross-derived features

[0237] #...Add features such as time series and weather intersection, holidays and weather intersection, etc.

[0238] return df

[0239] #Simulated data set

[0240] df = generate_mock_data()

[0241] #Add simulated seasons, holidays, weather, etc.

[0242] #Extract and derive features

[0243] df_with_features=extract_and_derive_features(df)

[0244] #Use random forest regression model for prediction

[0245] #Select 'water_usage' as the target variable and use all other features for prediction

[0246] X=df_with_features.drop('water_usage',axis=1)

[0247] y=df_with_features['water_usage']

[0248] # Divide into training set and test set

[0249] X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=42)

[0250] #Train model

[0251] #model=RandomForestRegressor()

[0252] #model.fit(X_train,y_train)

[0253] #predict

[0254] #predictions=model.predict(X_test)

[0255] Optionally, the smart sensor is provided with a trained demand prediction model, and further performs the following steps to predict water user demand data:

[0256] Encoding the time series derived features, season derived features, holiday derived features, weather derived features, user behavior derived features, cross-derived features, and the time series features, season features, holiday features, weather features, and user behavior features to obtain a derived feature encoding vector and a meta-feature encoding vector;

[0257] A fused feature vector is obtained by fusing the derived feature coding vector and the meta-feature coding vector to establish a mapping relationship between the fused feature vector and the water user demand data, so as to predict the water user demand data according to the mapping relationship.

[0258] To this end, using the above technology to predict water user demand data has the following technical benefits:

[0259] (1) Standardization of feature encoding: By encoding time series derived features, seasonal derived features, holiday derived features, weather derived features, user behavior derived features, and corresponding meta-features, a standardized feature encoding vector can be obtained. This encoding method enables different types of features to be compared and calculated on the same dimension, thereby improving the accuracy and robustness of the model.

[0260] (2) Comprehensiveness of feature fusion: By fusing the derived feature coding vector and the meta-feature coding vector, a fused feature vector can be obtained. This fused feature vector contains all the information of the original features and the derived features, thus being able to more comprehensively reflect the demand patterns of water users. This comprehensive feature fusion helps to improve the accuracy and generalization ability of the prediction model.

[0261] (3) Establishment of mapping relationship: By establishing the mapping relationship between the fused feature vector and the water user demand data, the model can learn the mapping rules from features to demand data. The establishment of this mapping relationship enables the model to accurately predict the water user demand data based on the input feature vector, thereby achieving the goal of demand prediction.

[0262] (4) Prediction accuracy: Due to the use of comprehensive feature fusion and accurate mapping relationship establishment methods, this technology can improve the accuracy of predicting water user demand data. Accurate prediction results can help water resources management departments better formulate water supply plans and scheduling strategies, thereby improving water resource utilization efficiency and management level.

[0263] (5) Model generalization ability: By encoding and fusing different types of features, the prediction model obtained by this technology has strong generalization ability. This means that the model can process water user demand data under different circumstances and give accurate prediction results. This generalization ability enables the model to adapt to different application scenarios and changing demand patterns.

[0264] (6) Real-time and flexibility: Since the technology is implemented on smart sensors, it can collect and process data in real time and update the prediction model based on the latest data. In addition, due to the flexible encoding and fusion methods, the technology can easily add new features or adjust feature weights to meet different prediction needs.

[0265] The following is an exemplary code to implement the above-mentioned feature encoding, feature fusion and prediction of water user demand data:

[0266] Python

[0267] import pandas as pd

[0268] from sklearn.preprocessing import OneHotEncoder

[0269] from sklearn.compose import ColumnTransformer

[0270] from sklearn.linear_model import LinearRegression

[0271] from sklearn.pipeline import Pipeline

[0272] from sklearn.model_selection import train_test_split

[0273] #DataFrame containing features and labels

[0274] data = {

[0275] 'timestamp':pd.date_range(start='2023-01-01',periods=100),

[0276] 'daily_usage':np.random.rand(100)*100,#water consumption

[0277] #...other features, such as weather, holidays, etc.

[0278] 'season':['Spring','Spring','Summer',...]*25,#season (example)

[0279] 'holiday':[0,0,1,0,...]*20,#Holiday mark

[0280] #...other similar classification features

[0281] }

[0282] df = pd.DataFrame(data)

[0283] #Feature Engineering: Extracting and deriving features

[0284] #df_engineered already contains all original and derived features

[0285] #Feature encoding: Encode categorical features

[0286] categorical_features = ['season', 'holiday', ...] # categorical features

[0287] numeric_features = ['daily_usage', 'temperature', ...] # Numerical features

[0288] #Create feature encoder

[0289] categorical_encoder=OneHotEncoder(handle_unknown='ignore')

[0290] numeric_encoder='passthrough'

[0291] # Create a feature converter

[0292] preprocessor=ColumnTransformer(

[0293] transformers=[

[0294] ('cat',categorical_encoder,categorical_features),

[0295] ('num',numeric_encoder,numeric_features) ] )

[0298] # Split features and target variables

[0299] X = df_engineered.drop('daily_usage',axis=1) #'daily_usage' is the target variable y = df_engineered['daily_usage']

[0300] # Divide into training set and test set

[0301] X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=42)#Fuse features and build models

[0302] #Use Pipeline to combine feature preprocessing and linear regression model

[0303] model=Pipeline([

[0304] ('preprocessor',preprocessor),

[0305] ('regressor',LinearRegression()) ])

[0307] #Train model

[0308] model.fit(X_train,y_train)

[0309] #predict

[0310] predictions=model.predict(X_test)

[0311] #Print prediction results (or further evaluate model performance)

[0312] print(predictions)

[0313] df_engineered in the above code should contain all the original features and derived features. OneHotEncoder is used to encode categorical features, which converts each categorical feature into one or more binary columns (i.e. one-hot encoding). ColumnTransformer allows different transformers to be applied to different columns in the DataFrame. In this example, OneHotEncoder is used for categorical features. LinearRegression is used as the prediction model, but other models such as random forest, neural network, etc. can be selected as needed. train_test_split is used to divide the dataset into training and test sets in order to evaluate the performance of the model. Finally, the trained model is used to predict the test set and the prediction results are printed. In actual applications, you may also need to evaluate the performance of the model, such as calculating the mean square error (MSE), root mean square error (RMSE), etc.

[0314] Optionally, the actual water usage data of the water project scheduling side is monitored based on the intelligent sensor arranged at the water project scheduling side, and sent to the edge computing device arranged at the water project scheduling side for statistical analysis to obtain the actual data of water project scheduling, including:

[0315] Multiple smart sensors arranged on the water project scheduling side are paired into several groups, each group includes at least two smart sensors, and each group of smart sensors can monitor the actual water use data on the water project scheduling side, and different groups of smart sensors asynchronously monitor the actual water use data on the water project scheduling side in different set time periods, and the actual water use data monitored by each group of smart sensors and the identifier of the corresponding group of smart sensors are encapsulated and stored in a data warehouse. When encapsulating, the monitored actual water use data is serialized to obtain a JSON file, and the identifier of the corresponding group of smart sensors is used as a label of the JSON file to be sent to an edge computing device arranged on the water project scheduling side for statistical analysis to obtain actual data on water project scheduling.

[0316] To this end, a technical solution based on intelligent sensors installed on the water project dispatching side is used to monitor the actual water consumption data on the water project dispatching side and perform statistical analysis through edge computing devices. This has the following technical benefits:

[0317] (1) High efficiency and real-time performance: Smart sensors can monitor the actual water usage data of water project dispatching in real time and continuously, ensuring the timeliness and accuracy of the data. This real-time performance is crucial for the rational allocation and dispatch of water resources, and helps to promptly detect and respond to potential water shortages or surpluses.

[0318] (2) Data integrity: Asynchronous monitoring by multiple sets of smart sensors can cover different areas and time periods on the water project dispatching side, achieving all-round and multi-angle data collection. This helps ensure the integrity and representativeness of the data, providing a solid data foundation for subsequent statistical analysis.

[0319] (3) Data processing efficiency: The actual water consumption data monitored by each group of smart sensors and the identifier of the corresponding group of smart sensors are encapsulated into a JSON file and sent to the edge computing device for statistical analysis, which can greatly improve the data processing efficiency. The edge computing device has powerful data processing and analysis capabilities and can quickly process and analyze large amounts of data to obtain actual data for water project scheduling.

[0320] (4) Data security: By encapsulating the actual water use data with the smart sensor identifier, the source of the data can be ensured to be clear and traceable. At the same time, during the data transmission process, security measures such as encryption can be used to ensure the security and privacy of the data.

[0321] (5) Flexibility and scalability: This technical solution has good flexibility and scalability. The number and layout of smart sensors can be adjusted according to actual needs, as well as the set time period and monitoring frequency. In addition, with the continuous development and upgrading of technology, the functions and performance of smart sensors and edge computing devices can be easily updated and expanded.

[0322] (6) Intelligent decision support: Based on real-time, accurate and complete actual data of water project scheduling, more scientific and reasonable decision support can be provided for water project scheduling. Through data analysis and mining, potential problems and laws can be discovered, providing a strong basis for the optimal allocation and scheduling of water resources.

[0323] The following example code is provided to implement the process of collecting, packaging, and sending smart sensor data to edge computing devices for statistical analysis:

[0324] import json

[0325] import datetime

[0326] from typing import List,Tuple

[0327] class Sensor:

[0328] def__init__(self,id:str):

[0329] self.id = id

[0330] def monitor_water_usage(self)->float:

[0331] #Actual water consumption data monitored by smart sensors

[0332] return round(random.random()*100,2)

[0333] class EdgeComputingDevice:

[0334] def __init__(self):

[0335] pass

[0336] def analyze_data(self,data:List[Tuple[str,float]]):

[0337] #Statistical analysis implementation

[0338] print(f"Analyzing data from sensors:{data}")

[0339] #Return analysis results

[0340] class DataWarehouse:

[0341] def __init__(self):

[0342] self.data_store = []

[0343] def store_data(self,sensor_id:str,water_usage:float):

[0344] #Encapsulate data and store it in the data warehouse

[0345] json_data={'sensor_id':sensor_id,'water_usage':water_usage,'timestamp':datetime.datetime.now().isoformat()}

[0346] self.data_store.append(json_data)

[0347] #Smart Sensors and Edge Computing Devices

[0348] sensors = [Sensor (f'sensor_{i}') for i in range (1,5)] # There are 4 sensors

[0349] edge_device=EdgeComputingDevice()

[0350] data_warehouse=DataWarehouse()

[0351] #Simulate asynchronous monitoring and data sending process

[0352] def async_monitoring(sensor_group:List[Sensor],interval:int):

[0353] while True:

[0354] data_points=[(sensor.id,sensor.monitor_water_usage())for sensor insensor_group]

[0355] for sensor_id,water_usage in data_points:

[0356] data_warehouse.store_data(sensor_id,water_usage)

[0357] #Statistical analysis is performed after a certain amount of data has been collected if len(data_warehouse.data_store)>=10: #Example: Analyze every 10 pieces of data collected

[0358] edge_device.analyze_data(data_points)

[0359] #Reset the data warehouse (or perform other processing)

[0360] data_warehouse.data_store=[]

[0361] #Simulate asynchronous waiting

[0362] time.sleep(interval)#interval is the simulation value of the set time period

[0363] #There are two sets of sensors that perform asynchronous monitoring at different set time periods

[0364] group1=[sensors[0],sensors[1]]

[0365] group2=[sensors[2],sensors[3]]

[0366] #Run the async_monitoring function in a different thread or process to simulate asynchronous monitoring

[0367] try:

[0368] import threading

[0369] thread1 = threading.Thread (target = async_monitoring, args = (group1, 5)) # Set the time period to 5 seconds

[0370] thread2 = threading.Thread (target = async_monitoring, args = (group2, 10)) # Set the time period to 10 seconds

[0371] thread1.start()

[0372] thread2.start()

[0373] thread1.join()

[0374] thread2.join()

[0375] except ImportError:

[0376] async_monitoring(group1,5)

[0377] async_monitoring(group2,10)

[0378] Optionally, each of the smart sensors is provided with a radio frequency transmitter and a radio frequency receiver. When the smart sensor enters a working state to monitor the actual water consumption data on the water project scheduling side, a first status signal is generated and sent to other smart sensors that are not in the same group through the radio frequency transmitter. When the smart sensor ends monitoring, a second status signal is generated and sent to other smart sensors that are not in the same group through the radio frequency transmitter. The radio frequency receiver is used for the first status signal and the second status signal sent by smart sensors that are not in the same group to control different groups of smart sensors to asynchronously monitor the actual water consumption data on the water project scheduling side at different set time periods, and encapsulates the actual water consumption data monitored by each group of smart sensors with the identifier of the corresponding group of smart sensors for storage in the data warehouse.

[0379] When a radio frequency transmitter and a radio frequency receiver are set on each smart sensor and used to coordinate asynchronous monitoring of different groups of smart sensors in different set time periods, the following technical benefits are achieved:

[0380] (1) Collaborative work and conflict avoidance: Through radio frequency communication, different groups of smart sensors can sense each other’s working status. This ensures that they do not monitor the same area at the same time, thus avoiding data conflicts and overlaps and improving monitoring efficiency.

[0381] (2) Accurate time synchronization: RF communication can achieve accurate time synchronization, ensuring that each group of smart sensors accurately starts and ends monitoring within a predetermined time period. This is crucial for applications that require precise time control, such as the need to accurately grasp changes in water consumption in water project scheduling.

[0382] (3) Real-time status updates: When a smart sensor enters or exits a working state, it can immediately notify other sensors through a radio frequency transmitter. This real-time status update helps the system respond quickly to changes and adjust the monitoring plan to adapt to sudden water demand or equipment failure.

[0383] (4) Improve system reliability: The collaborative work achieved through RF communication can ensure that all sensors in the system remain synchronized and work properly. If a sensor fails or loses contact, other sensors can immediately sense it and take appropriate measures, such as starting a backup sensor or reallocating monitoring tasks.

[0384] (5) Optimizing resource allocation: Through the radio frequency communication and collaborative work of smart sensors, the system can allocate monitoring tasks more intelligently, ensuring that each sensor monitors when and where it is most needed, which helps to optimize resource allocation and improve the overall performance and efficiency of the system.

[0385] The following provides an exemplary code to implement the above process including the asynchronous monitoring of the smart sensor through radio frequency communication:

[0386] import threading

[0387] import time

[0388] import json

[0389] from typing import List,Dict

[0390] #Data Warehouse

[0391] data_warehouse={}

[0392] #Smart Sensor Class

[0393] class SmartSensor:

[0394] def__init__(self,id:str,group_id:int):

[0395] self.id = id

[0396] self.group_id = group_id

[0397] self.is_monitoring = False

[0398] self.lock = threading.Lock()

[0399] #Function to monitor actual water usage data

[0400] def monitor_water_usage(self)->float:

[0401] #Simulate the monitoring process (for example, obtain water consumption data)

[0402] return round(10+50*(time.time()%1),2)#Generate data that changes over time

[0403] #Send status signal to other groups

[0404] def send_status(self,status:str):

[0405] #Function used to send status signals through the RF transmitter

[0406] print(f"Sensor{self.id}in group{self.group_id}is{status}")

[0407] for group_id in range(1,3):#There are two groups of sensors

[0408] if group_id! =self.group_id:

[0409] #Notify sensors in other groups

[0410] for other_sensor in sensors[group_id]:

[0411] other_sensor.receive_status(self.id,status)

[0412] #Receive status signals sent by other sensors

[0413] def receive_status(self,sensor_id:str,status:str):

[0414] print(f"Sensor{self.id}received status from{sensor_id}:{status}")

[0415] #Start monitoring and sending the first status signal

[0416] def start_monitoring(self):

[0417] with self.lock:

[0418] if not self.is_monitoring:

[0419] self.is_monitoring = True

[0420] print(f"Sensor{self.id}starting monitoring...")

[0421] self.send_status("started")

[0422] #Monitor the process and store data

[0423] water_usage=self.monitor_water_usage()

[0424] data={"sensor_id":self.id,"water_usage":water_usage,"timestamp":time.time()}

[0425] data_warehouse[self.id]=data

[0426] #The monitoring process lasts for a while and then ends

[0427] time.sleep(5)#Simulation monitoring duration

[0428] self.stop_monitoring()

[0429] #End monitoring and send the second status signal

[0430] def stop_monitoring(self):

[0431] with self.lock:

[0432] if self.is_monitoring:

[0433] self.is_monitoring = False

[0434] print(f"Sensor{self.id}stopping monitoring...")

[0435] self.send_status("stopped")

[0436] #Initialize the sensor list (two groups of sensors)

[0437] sensors={

[0438] 1:[SmartSensor(f'sensor_{i}',1)for iin range(1,3)],#The first group of sensors

[0439] 2:[SmartSensor(f'sensor_{i}',2)for iin range(3,5)]#The second set of sensors

[0440] }

[0441] #Asynchronous monitoring process

[0442] def monitor_async(group_id:int):

[0443] while True:

[0444] for sensor in sensors[group_id]:

[0445] if not sensor.is_monitoring:

[0446] #Check if there are other groups of sensors monitoring

[0447] other_groups_monitoring=any(any(s.is_monitoring for s in group)forgroup insensors.values()if group_id!=group_id)

[0448] if not other_groups_monitoring:

[0449] #Start monitoring

[0450] threading.Thread(target=sensor.start_monitoring).start()

[0451] #Wait for a while, then check whether you can start monitoring the next sensor

[0452] time.sleep(1)

[0453] break

[0454] Optionally, each of the smart sensors maintains a timed task workflow, which records the working status of the corresponding smart sensor. The working status defines a monitoring time period defined by the start and end time points of the monitoring of the smart sensor. The monitoring time periods defined by the start and end time points of the monitoring of different smart sensors are spaced according to a set time step. When the smart sensor enters the working state and is ready to start monitoring, a "start monitoring" signal is generated, and a radio frequency transmitter is used to broadcast a first status signal to other smart sensors that are not in the same group. When the smart sensor ends monitoring, an "end monitoring" signal is generated, and a radio frequency transmitter is also used to broadcast a second status signal to other smart sensors that are not in the same group. The radio frequency receiver of each smart sensor is used to receive the first status signal and the second status signal sent by the smart sensors that are not in the same group. When the second status signal is received, it is checked whether the timestamp of the timer thereon is within the set monitoring time period. If not, the signal is ignored; if so, monitoring is started according to the corresponding smart sensor.

[0455] To this end, when each smart sensor maintains a scheduled task workflow and coordinates the monitoring time between different groups of sensors through radio frequency communication, it has the following technical benefits:

[0456] (1) Reduce conflicts and overlaps: By ensuring that the monitoring time periods of different smart sensors are spaced according to the set time step, data conflicts and overlaps can be significantly reduced or even eliminated. Each sensor knows when to start and end monitoring, so repeated monitoring of the same area in the same time period can be avoided.

[0457] (2) Improve system efficiency: Through precise time management and collaborative work, the system can ensure that all sensors are monitored at the optimal time, thereby improving the overall efficiency and performance of the system.

[0458] (3) Increased system reliability: Since each sensor has a clear monitoring period, the system can more easily predict and plan future operations. This helps reduce system instability and uncertainty caused by sensor failure or communication problems.

[0459] (4) Flexibility and scalability: The system’s monitoring plan can be easily modified or expanded by adjusting the time settings in the scheduled task workflow. This enables the system to adapt to different monitoring needs and environmental changes.

[0460] (5) Intelligent resource allocation: By allocating monitoring tasks according to the scheduled task workflow, the system can intelligently utilize limited resources such as battery life, computing power, and communication bandwidth. This helps extend the service life of sensors and reduce maintenance costs.

[0461] (6) Easy to manage and monitor: Since each sensor has a clear working status and monitoring time period, system administrators can more easily monitor and manage the entire system. They can easily view the status, historical data, and monitoring plan of each sensor to make more informed decisions.

[0462] (7) Error handling and fault tolerance: When a sensor fails or fails to send a status signal on time, other sensors can still continue to work normally according to their scheduled task workflow. This increases the fault tolerance and robustness of the system.

[0463] The following is an exemplary code to implement the above process:

[0464] import threading

[0465] import time

[0466] import socket

[0467] from typing import List,Tuple

[0468] #RF Communication

[0469] class RFCommunication:

[0470] def __init__(self):

[0471] # Initialize RF hardware or related libraries

[0472] pass

[0473] def send_signal(self,signal:str,recipient_group:int):

[0474] #Global sensor group dictionary

[0475] for sensor in sensors[recipient_group]:

[0476] sensor.receive_signal(signal)

[0477] def receive_signal(self,callback):

[0478] #Function to monitor RF signal and call callback function

[0479] #Call the callback function and pass the simulated signal

[0480] #Sensors from other groups sent signals

[0481] callback("start_monitoring"if random.choice([True,False])else"stop_monitoring")

[0482] #Smart Sensor Class

[0483] class SmartSensor:

[0484] def__init__(self,id:str,group_id:int,rf_comm:RFCommunication,monitoring_interval:Tuple[float,float]):

[0485] self.id = id

[0486] self.group_id = group_id

[0487] self.rf_comm = rf_comm

[0488] self.monitoring_interval=monitoring_interval#(start_time,end_time)inseconds sinceepoch

[0489] self.is_monitoring = False

[0490] self.lock = threading.Lock()

[0491] def start_monitoring(self):

[0492] with self.lock:

[0493] if not self.is_monitoring and time.time()>=self.monitoring_interval[0]:

[0494] self.is_monitoring = True

[0495] print(f"Sensor{self.id} starting monitoring...")

[0496] self.rf_comm.send_signal("start_monitoring", 1 - self.group_id) # There are two groups, 1 - self.group_id is the ID of the other group

[0497] self._monitor()

[0498] def _monitor(self):

[0499] # Simulate the monitoring process

[0500] print(f"Sensor{self.id} is monitoring...")

[0501] time.sleep(5) # Assume the monitoring process lasts for 5 seconds

[0502] self.stop_monitoring()

[0503] def stop_monitoring(self):

[0504] with self.lock:

[0505] if self.is_monitoring and time.time() <= self.monitoring_interval[1]:

[0506] self.is_monitoring = False

[0507] print(f"Sensor{self.id} stopping monitoring...")

[0508] self.rf_comm.send_signal("stop_monitoring", 1 - self.group_id)

[0509] def receive_signal(self, signal: str):

[0510] if signal=="stop_monitoring":

[0511] if self.is_monitoring and time.time()<=self.monitoring_interval[1]:

[0512] #The stop signal will only be responded to if the current sensor is in the monitoring state and within the monitoring time period

[0513] self.stop_monitoring()

[0514] elif signal=="start_monitoring":

[0515] if not self.is_monitoring and time.time()>=self.monitoring_interval[0]:

[0516] #Only respond to the start signal when the current sensor is not in monitoring state and the monitoring period starts self.start_monitoring()

[0517] #Sensor groups and monitoring time periods

[0518] sensors={

[0519] 1:[SmartSensor(f'sensor_{i}',1,RFCommunication(),(10,20))for iinrange(1,3)],#The first set of sensors, 10-20 seconds monitoring

[0520] 2:[SmartSensor(f'sensor_{i}',2,RFCommunication(),(15,25))for iinrange(3,5)]#Second set of sensors, 15-25 seconds monitoring

[0521] }

[0522] #Start monitoring of all sensors

[0523] for group in sensors.values():

[0524] for sensor in group:

[0525] threading.Thread(target=sensor.start_monitoring).start()

[0526] #Simulate RF signal reception

[0527] def simulate_rf_reception():

[0528] rf_comm = RFCommunication()

[0529] while True:

[0530] rf_comm.receive_signal(lambda signal:[s.receive_signal(signal)forgroup in sensors.values()for s in group])

[0531] time.sleep(1)

[0532] Optionally, the multi-time scale runoff forecasting mechanism is constructed to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling, including:

[0533] Generate hydrological time series data based on historical runoff data, and transform the hydrological time series data into a phase space that reflects the dynamic changes of the hydrological sequence;

[0534] Based on the phase space reflecting the dynamic changes of the hydrological sequence, extracting the chaotic degree characteristics of the historical runoff data;

[0535] The chaos degree characteristics are subjected to polynomial chaos expansion to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling.

[0536] To this end, a multi-time scale runoff forecasting mechanism is constructed, and interactive strategy data for water resource control conditions in the target area is generated based on historical runoff data, water user demand data, and actual data on water project scheduling. This has the following technical benefits:

[0537] (1) Improve forecast accuracy: By introducing a multi-time scale runoff forecast mechanism, the runoff variation characteristics at different time scales can be more comprehensively considered, thereby improving the accuracy and reliability of the forecast. This is crucial for water resources management and scheduling, and can help decision makers formulate water resources management strategies more accurately.

[0538] (2) Adapting to complex hydrological systems: Converting hydrological time series data into a phase space that reflects the dynamic changes of hydrological sequences can better capture the nonlinear, non-stationary and chaotic characteristics of the hydrological system. This helps to deeply understand the complex dynamic behavior of the hydrological system and provide a scientific basis for formulating targeted water resources management strategies.

[0539] (3) Optimizing water resource allocation: Based on the extraction of chaos degree characteristics and polynomial chaos expansion, a mathematical model that reflects the law of runoff change can be constructed. Through this model, the runoff change trend at different time scales in the future can be predicted, providing decision support for the optimal allocation and scheduling of water resources. This helps to achieve sustainable utilization and efficient management of water resources.

[0540] (4) Enhanced system robustness: The multi-time scale runoff forecast mechanism can take into account the runoff changes at different time scales, making the water resources management strategy more flexible and adaptable. Even in the face of extreme climate events or emergencies, the strategy can be quickly adjusted based on real-time data to ensure the stable supply and rational use of water resources.

[0541] (5) Promote data-driven decision-making: By integrating historical runoff data, water user demand data, and actual data on water project scheduling, a data-based decision support system can be built. This helps to achieve data-driven decision-making and improve the scientificity and effectiveness of decision-making. At the same time, it also helps to promote digital transformation and intelligent upgrading in the field of water resources management.

[0542] An example code is provided below to construct a multi-time scale runoff forecast mechanism and generate interactive strategy data for water resource management conditions:

[0543] Data preprocessing: Load historical runoff data and convert it into time series data.

[0544] Phase space reconstruction: Convert hydrological time series data into phase space using time delay embedding or similar methods.

[0545] Chaotic feature extraction: Analyze the chaotic characteristics of data in phase space, such as calculating Lyapunov exponents, power spectrum, etc.

[0546] Polynomial chaos expansion: Utilize the chaotic characteristics and combine the polynomial expansion method to construct a multi-time scale runoff forecast model.

[0547] Generation of water resource management strategies: Combined with water user demand data and actual data on water project scheduling, the constructed forecast model is used to generate interactive strategy data for water resource management conditions.

[0548] #1. Data preprocessing

[0549] def preprocess_data(historical_flow_data):

[0550] #Convert historical runoff data into time series data

[0551] return time_series_data

[0552] #2. Phase space reconstruction

[0553] def reconstruct_phase_space(time_series_data,delay,dimension):

[0554] #Reconstruct phase space using time delay embedding method

[0555] return phase_space_data

[0556] #3. Chaotic feature extraction

[0557] def extract_chaos_features(phase_space_data):

[0558] #Calculate chaotic characteristics such as Lyapunov exponent, power spectrum, etc.

[0559] return chaos_features

[0560] #4. Polynomial Chaos Expansion and Prediction Model Construction

[0561] def build_multiscale_forecast_model(chaos_features,polynomial_degree):

[0562] return forecast_model

[0563] #5. Water resource management strategy generation

[0564] def generate_water_management_strategies(forecast_model,water_demand_data,engineering_operation_data):

[0565] # Generate strategies based on forecast models, water user demand data and water project scheduling using actual data

[0566] #Strategy is a data structure containing various control parameters

[0567] return water_management_strategies

[0568] historical_flow_data = load_data('historical_flow.csv') #Assume that the data is loaded from a CSV file

[0569] time_series_data=preprocess_data(historical_flow_data)

[0570] phase_space_data=reconstruct_phase_space(time_series_data,delay=5,dimension=3)

[0571] chaos_features=extract_chaos_features(phase_space_data)

[0572] forecast_model=build_multiscale_forecast_model(chaos_features,polynomial_degree=2)

[0573] water_demand_data = load_data('water_demand.csv') # Assume that data is loaded from a CSV file

[0574] engineering_operation_data = load_data('engineering_operation.csv') #Assume that data is loaded from a CSV file

[0575] water_management_strategies=generate_water_management_strategies(forecast_model,water_demand_data,engineering_operation_data)

[0576] #Save or output water resource management strategy data

[0577] save_data(water_management_strategies,'water_management_strategies.csv')

[0578] Optionally, generating hydrological time series data based on historical runoff data and converting the hydrological time series data into a phase space reflecting the dynamic changes of the hydrological sequence includes: based on the Martingale model, extracting trend characteristics, periodic characteristics, and seasonal characteristics of the historical runoff data to generate hydrological time series data, and performing sampling processing through a set embedded dimension vector to convert the hydrological time series data into a phase space reflecting the dynamic changes of the hydrological sequence.

[0579] To this end, by converting historical runoff data into hydrological time series data, and further converting it into a phase space reflecting the dynamic changes of the hydrological series through a set embedding dimension vector, especially based on the Martingale model (usually may refer to the Mann-Kendall trend test or other similar models, because "Martingale" is not a well-known specific model name) to extract trend characteristics, periodic characteristics, and seasonal characteristics, it has the following technical benefits:

[0580] (1) Accurately capture hydrological changes: By extracting trend characteristics, periodic characteristics, and seasonal characteristics, the long-term trends, periodic fluctuations, and seasonal effects in the hydrological series can be captured more accurately. This helps to more accurately predict future runoff changes.

[0581] (2) Improving prediction capabilities: Converting hydrological time series data into phase space can reveal the dynamic changes of hydrological series in a higher-dimensional space. This helps to discover hidden patterns and structures in time series data, thereby enhancing the performance of prediction models.

[0582] (3) Adaptation to nonlinear systems: Hydrological systems are usually nonlinear and non-stationary. Phase space reconstruction can better adapt to these complex characteristics. Phase space transformation can expand one-dimensional time series data to multidimensional space, thereby more comprehensively reflecting the dynamic changes of the system.

[0583] (4) Support for multi-time scale analysis: Phase space reconstruction combined with feature extraction methods such as the Martingale model can support multi-time scale analysis. This means that hydrological characteristics at different time scales can be considered simultaneously, providing support for the formulation of multi-time scale water resources management strategies.

[0584] (5) Optimizing water resource management: The runoff forecasting mechanism based on phase space reconstruction and feature extraction can provide more accurate and reliable decision support for water resource management. By predicting future runoff changes, the allocation and scheduling of water resources can be optimized and the utilization efficiency of water resources can be improved.

[0585] (6) Enhanced system robustness: By considering the multiple characteristics and complexities of the hydrological sequence, the constructed runoff forecasting mechanism is more robust. It can better respond and adapt to extreme climate events or uncertain factors, thus ensuring a stable supply of water resources.

[0586] The following is an example code that describes the process of generating hydrological time series data based on historical runoff data and converting it into a phase space that reflects the dynamic changes of the hydrological series:

[0587] import numpy as np

[0588] from scipy.stats import mannwhitneyu

[0589] from statsmodels.tsa.seasonal import seasonal_decompose

[0590] # Load historical runoff data as a NumPy array

[0591] historical_flow_data=np.loadtxt('historical_flow_data.csv',delimiter=',')

[0592] #Extract trend features based on Mann-Kendall trend test

[0593] def extract_trend_feature(data):

[0594] #Use Mann-Kendall trend test

[0595] trend,h,p,z=mannwhitneyu(np.arange(len(data)),data)

[0596] #Return the result of the trend test (h is 1 for an upward trend, 0 for no trend, -1 for a downward trend)

[0597] return h

[0598] #Seasonal decomposition extracts periodic and seasonal features

[0599] def extract_seasonal_features(data,model='additive',period=12):

[0600] #Use statsmodels' seasonal_decompose function for seasonal decomposition

[0601] result=seasonal_decompose(data,model=model,period=period)

[0602] #Extract trend terms, seasonal terms and residual terms (which can be regarded as periodic terms)

[0603] trend = result.trend

[0604] seasonal = result.seasonal

[0605] residual = result.resid

[0606] #Return seasonal terms and residual terms as periodic features

[0607] return seasonal,residual

[0608] #Generate hydrological time series data

[0609] def generate_hydro_time_series(data):

[0610] return data

[0611] #Sampling and conversion to phase space

[0612] def transform_to_phase_space(time_series_data,embedding_dim):

[0613] #Set embedding dimension

[0614] n_samples=len(time_series_data)-embedding_dim+1

[0615] phase_space=np.zeros((n_samples,embedding_dim))

[0616] #Sampling process, create phase space matrix

[0617] for i in range(n_samples):

[0618] phase_space[i,:]=time_series_data[i:i+embedding_dim]

[0619] return phase_space

[0620] #Process Integration

[0621] #Extract features

[0622] trend_feature=extract_trend_feature(historical_flow_data)

[0623] seasonal_feature,periodic_feature=extract_seasonal_features(historical_flow_data)

[0624] #Generate hydrological time series data

[0625] hydro_time_series=generate_hydro_time_series(historical_flow_data)

[0626] #Convert to phase space

[0627] embedding_dim = 5 #Assume that the embedding dimension is 5, which needs to be determined according to the actual situation

[0628] phase_space_data=transform_to_phase_space(hydro_time_series,embedding_dim)

[0629] #phase_space_data contains phase space data reflecting the dynamic changes of hydrological sequences

[0630] #import matplotlib.pyplot as plt

[0631] #plt.scatter(phase_space_data[:,0],phase_space_data[:,1])#Draw the point cloud of the first two dimensions

[0632] #plt.show()

[0633] Optionally, the extracting of chaos degree characteristics of the historical runoff data based on the phase space reflecting the dynamic changes of the hydrological sequence includes: calculating the average exponential divergence rate of adjacent orbits in the phase space reflecting the dynamic changes of the hydrological sequence to construct a chaos feature quantity, and extracting the chaos degree characteristics of the historical runoff data based on the chaos feature quantity.

[0634] To this end, the method of extracting the chaotic degree characteristics of historical runoff data based on the phase space reflecting the dynamic changes of the hydrological sequence, especially constructing the chaotic characteristic quantity by calculating the average exponential divergence rate of adjacent tracks in the phase space, has the following technical advantages:

[0635] (1) Deep understanding of the dynamic characteristics of the hydrological system: Chaotic characteristics can provide a deep understanding of the complexity and instability of the hydrological system. This helps us to more accurately describe the nonlinear behavior of the hydrological series and understand its long-term evolution trend.

[0636] (2) Enhance the accuracy of the prediction model: Using chaotic characteristics as the input of the prediction model can help the model better capture the dynamic changes of the hydrological series. This is crucial to improving the accuracy of runoff prediction, especially when dealing with extreme climate events.

[0637] (3) Supporting the optimization of water resource management: Understanding the degree of chaos in hydrological sequences can help water resource managers develop more reasonable strategies. For example, in areas with higher levels of chaos, more flexible and adaptive management options may be needed to cope with uncertainty and risk.

[0638] (4) Improve system robustness: Under the guidance of chaotic characteristic quantities, more robust prediction and management systems can be designed. These systems can better cope with the uncertainty and changes of hydrological systems and ensure a stable supply of water resources.

[0639] (5) Support for multi-scale analysis: By calculating chaotic characteristics at different time scales, the dynamic changes of hydrological sequences at different scales can be analyzed. This helps to formulate multi-scale water resources management strategies to cope with hydrological changes at different scales.

[0640] (6) Easy visualization and interpretation: Chaotic characteristics can be visualized in the form of charts, images, etc., making it easier for non-professionals to understand and interpret the dynamic changes of hydrological sequences. This helps to enhance the public's awareness and understanding of water resource issues and promote the sustainable use of water resources.

[0641] An exemplary implementation code is provided below. In order to extract the chaotic degree characteristics of historical runoff data, the average exponential divergence rate of adjacent tracks in the phase space is first calculated, which involves calculating the Lyapunov index or its approximate value. In addition, a simplified method is used to simulate the calculation of the average exponential divergence rate of adjacent tracks in the phase space, and the chaotic degree characteristics are extracted based on this value:

[0642] import numpy as np

[0643] #phase_space_data is the generated phase space data, where each row is a state vector

[0644] #phase_space_data=np.random.rand(n_samples,embedding_dim)

[0645] def calculate_average_exponential_divergence(phase_space_data,delta=0.01,num_iterations=10):

[0646] parameter:

[0647] phase_space_data: NumPy array of shape (n_samples, embedding_dim) representing phase space data

[0648] delta: initial distance between adjacent tracks

[0649] num_iterations: The number of iterations used to estimate the divergence rate

[0650] return:

[0651] average_divergence: An estimate of the average exponential divergence rate

[0652] n_samples,embedding_dim=phase_space_data.shape

[0653] # Consider adjacent track pairs

[0654] divergences = []

[0655] #Traverse all adjacent point pairs

[0656] for i in range(n_samples-1):

[0657] # Initial distance

[0658] initial_distance = np.linalg.norm(phase_space_data[i] - phase_space_data[i + 1])

[0659] # Iteratively calculate the change in distance

[0660] for j in range(num_iterations):

[0661] # A function (or model) predicts the next state

[0662] # next_state = model.predict(current_state)

[0663] # Use the next point as the "prediction"

[0664] current_state = phase_space_data[i + j]

[0665] next_state = phase_space_data[i + j + 1] if i + j + 1 < n_samples else current_state # Avoid out-of-bounds

[0666] # Calculate the change in distance

[0667] distance_change = np.linalg.norm(next_state - current_state)

[0668] # Accumulate exponential divergence

[0669] divergences.append(np.log(distance_change / initial_distance))

[0670] # Calculate the average divergence rate

[0671] average_divergence = np.mean(divergences)

[0672] return average_divergence

[0673] # Use simulated phase space data

[0674] # phase_space_data = np.random.rand(100, 5)

[0675] #chaos_degree=calculate_average_exponential_divergence(phase_space_data)

[0676] #print(f"Chaos degree characteristics: {chaos_degree}")

[0677] The calculate_average_exponential_divergence function in the above code example uses an accumulation of logarithmic distance changes to approximate the exponential divergence.

[0678] Optionally, the chaotic degree characteristics are subjected to polynomial chaos expansion to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and actual data of water project scheduling, including:

[0679] The chaos degree characteristics are mapped into orthogonal polynomial response variables through orthogonal polynomial basis functions to perform polynomial chaos expansion on the chaos degree characteristics, so as to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling.

[0680] To this end, a polynomial chaos expansion (PCE) is performed on the chaos degree characteristics and applied in the construction of a multi-time scale runoff forecasting mechanism to generate interactive strategy data for water resources control conditions in the target area, which has the following technical benefits:

[0681] (1) Improved prediction accuracy: Polynomial chaos expansion can effectively capture the nonlinear dynamic characteristics of chaotic systems, thereby improving the accuracy of runoff prediction. This is crucial for water resources management and planning because it can help decision makers more accurately predict future water supply and demand.

[0682] (2) Multi-time scale analysis: PCE allows the analysis of chaotic characteristics of runoff data at different time scales. This is crucial for developing multi-time scale water resource management strategies, as water resource systems often exhibit different dynamic behaviors at different time scales.

[0683] (3) Model flexibility: By selecting appropriate orthogonal polynomial basis functions, PCE can construct a flexible and efficient forecasting model that can adapt to complex hydrological systems and generate accurate forecast results under different scenarios.

[0684] (4) Interactive strategy optimization: The runoff forecasting mechanism based on PCE can generate interactive strategy data for water resource management conditions. These data can help decision makers develop more optimized water resource management strategies to meet the needs of water users and take into account the actual situation of water project scheduling.

[0685] (5) Uncertainty reduction: By capturing the uncertainty in chaotic systems, PCE can provide uncertainty estimates for runoff forecast results. This is very important for developing risk management and decision support programs because it can help decision makers understand the reliability and uncertainty range of the forecast results.

[0686] (6) Easy to explain: Polynomial chaos expansion is based on orthogonal polynomial basis functions, and its coefficients have clear mathematical meaning and interpretability. This makes the forecast model based on PCE easier to explain and understand, which helps decision makers better understand the forecast results and make decisions.

[0687] (7) Potential for real-time applications: The PCE method is computationally efficient and can be combined with real-time data streams to achieve real-time runoff prediction and water resources management. This is of great significance for responding to sudden water resource events and formulating emergency water resources management strategies.

[0688] The following is an example code that illustrates how to use orthogonal polynomial basis functions to perform polynomial chaos expansion (PCE) on chaos degree characteristics and build a multi-time scale runoff forecast mechanism to achieve the above process:

[0689] Legendre polynomials are used as orthogonal bases. Then, the chaotic degree characteristics will be simulated and polynomial chaos expansion will be performed using these basis functions. Finally, a simplified forecasting mechanism will be constructed, which will use water user demand data and water project scheduling data to generate interactive strategy data for water resource control conditions.

[0690] import numpy as np

[0691] from scipy.special import legendre

[0692] #Simulated data of chaos_features

[0693] np.random.seed(0) #For reproducibility of results

[0694] chaos_features = np.random.rand(100,1) #There are 100 samples, each with a chaotic feature value

[0695] #Define orthogonal polynomial basis function (Legendre polynomial is used here)

[0696] def legendre_polynomials(x,degree):#Calculate the value of Legendre polynomial at a given point x and a specified degree

[0697] polynomials=[legendre(i)(x)for iin range(degree+1)]

[0698] return np.array(polynomials)

[0699] #Proceed to the third-order polynomial chaos expansion

[0700] degree=3

[0701] # Initialize the polynomial coefficients

[0702] coefficients=np.random.rand(degree+1,1)

[0703] #Perform polynomial chaos expansion on chaotic features

[0704] #Use chaotic eigenvalues ​​as x values ​​for polynomial evaluation

[0705] x=chaos_features[:,0]#Extract chaos feature values

[0706] polynomials_evaluated=legendre_polynomials(x,degree)

[0707] pce_result=np.dot(polynomials_evaluated,coefficients)

[0708] #Water user demand data (demand_data) and water project dispatch data (dispatch_data)

[0709] # Will be used to generate interactive strategy data for water resource control conditions

[0710] demand_data = np.random.rand(100,1) # Get water user demand data

[0711] dispatch_data = np.random.rand(100,1)#Water project dispatch data

[0712] #Build a forecasting mechanism

[0713] #Use a linear combination of PCE results, water user demand data, and water project scheduling data to simulate interactive strategy data

[0714] interaction_strategy=0.5*pce_result+0.3*demand_data+0.2*dispatch_data

[0715] #Print the first few samples of interactive strategy data

[0716] print("Interaction Strategy Data:")

[0717] print(interaction_strategy[:5])

[0718] Optionally, the interactive strategy data of the water resources control conditions is used to perform a joint scheduling simulation on the water resources of the water projects in the target area, and generate a scheduling plan for the year, set scheduling period, month, ten-day, or real-time generation of mutual feedback, including:

[0719] According to the interactive strategy data of the water resources control conditions, the target conditions, constraints and decision variables of the joint simulation scheduling are constructed. The target conditions include maximizing water supply benefits, minimizing water abandonment and mathematical expressions of ecological water demand. The constraints include reservoir capacity restrictions, water transfer capacity restrictions, water quality standards and mathematical expressions of ecological protection needs.

[0720] An initial solution of the scheduling plan is constructed according to the decision variables, and the target conditions and constraint conditions are iteratively solved at multiple time scales based on joint scheduling to simulate the joint scheduling of water projects and water resources in the target area, and generate mutually-feedback annual, set scheduling period, monthly, ten-day, and real-time scheduling plans.

[0721] To this end, according to the interactive strategy data of the water resources control conditions, a joint scheduling simulation is performed on the water resources of the water projects in the target area, and a mutually fed annual, set scheduling period, monthly, ten-day, and real-time scheduling plan is generated, which has the following technical benefits:

[0722] (1) Improve water resource utilization efficiency: By maximizing the water supply efficiency, we can ensure that water resources are optimally allocated and efficiently utilized while meeting various water demands. Minimizing water abandonment helps reduce water waste, especially during the flood season, by reducing reservoir water release through reasonable scheduling to prepare for use during the dry season.

[0723] (2) Protecting the ecological environment: Incorporating ecological water demand into the target conditions and, through the constraints of ecological protection needs, ensuring that the allocation of water resources does not harm the ecological environment and maintains the health of the water ecosystem.

[0724] (3) Ensure water supply safety: Consider constraints such as reservoir capacity limitations and water transfer capacity limitations in the scheduling plan to ensure the stable operation of the water supply system and reduce water supply risks caused by improper scheduling.

[0725] (4) Adaptability and flexibility: Through iterative solutions at multiple time scales, it is possible to generate scheduling plans at different time scales, such as annual, set scheduling period, monthly, ten-day, and real-time, to meet the water resource scheduling needs under different seasons and different water demands. The scheduling plan generated in real time can respond quickly according to the real-time water resource status and water demand, thereby improving the flexibility and adaptability of water resource scheduling.

[0726] (5) Data-driven and intelligent: Based on interactive strategy data of water resource control conditions, combined with data analysis technology and optimization algorithms, intelligent scheduling and management of water resources can be achieved. Through continuous iteration and optimization, the accuracy and efficiency of scheduling plans can be improved, providing scientific decision-making support for water resource management.

[0727] (6) Improve decision-making efficiency and accuracy: Joint scheduling simulation can comprehensively consider multiple factors and goals, avoiding decision-making errors caused by incomplete information or lack of consideration in traditional scheduling methods. Through iterative solutions at multiple time scales, potential contradictions between water supply and demand can be discovered, and measures can be taken in advance to prevent and resolve them, thereby improving the predictability and initiative of water resource management.

[0728] (7) Reasonable water resource scheduling plans can reduce economic losses and social impacts caused by water shortage or surplus, and promote sustainable economic and social development. By optimizing water resource allocation and utilization, water supply costs can be reduced, water supply service quality can be improved, and the people’s demand for high-quality water resources can be met.

[0729] An exemplary code is provided below to implement the above-mentioned technical processing process including water project water resources joint scheduling simulation and plan generation involving complex mathematical models, constraints, optimization algorithms and a large amount of real-time data:

[0730] import numpy as np

[0731] from scipy.optimize import minimize

[0732] # Calculate the objective function values (water supply benefits, water waste, etc.) and constraint conditions based on the decision variables

[0733] def calculate_objectives_and_constraints(decision_variables, water_demand, reservoir_capacities, water_quality_standards, ecological_needs):

[0734] supply_efficiency = np.sum(decision_variables * water_demand) # The water supply benefit is simplified to the sum of the water supply volumes

[0735] wasted_water = np.sum(decision_variables[water_demand < decision_variables]) # The water waste is simplified to the water supply volume exceeding the demand

[0736] ecological_satisfaction = np.sum(decision_variables >= ecological_needs) # Degree of satisfaction of ecological water needs

[0737] # Constraint condition check

[0738] reservoir_overflow = np.any(np.cumsum(decision_variables) > reservoir_capacities) # Whether the reservoir overflows

[0739] water_quality_violation = np.any(decision_variables < water_quality_standards) # Whether the water quality meets the standards

[0740] # Package the results

[0741] objectives={'supply_efficiency':supply_efficiency,'wasted_water':-wasted_water,'ecological_satisfaction':ecological_satisfaction}#The negative sign indicates minimization

[0742] constraints={'reservoir_overflow':not reservoir_overflow,'water_quality_violation':notwater_quality_violation}

[0743] return objectives, constraints

[0744] #Generate the initial solution of decision variables based on the interaction strategy data

[0745] def generate_initial_solution(interaction_strategy_data,water_demand,ecological_needs):

[0746] #Generate initial values ​​of decision variables based on interaction strategy data and other factors

[0747] # shows that the initial solution is generated according to a certain proportion of the demand

[0748] initial_solution=np.clip(interaction_strategy_data*water_demand,ecological_needs,None)

[0749] return initial_solution

[0750] #Multi-time scale iterative solution

[0751] def multi_timescale_iteration(initial_solution,water_demand,reservoir_capacities,water_quality_standards,ecological_needs):

[0752] # Implement iterative solution logic for multiple time scales

[0753] result=minimize(lambda x:-calculate_objectives_and_constraints(x,water_demand,reservoir_capacities,water_quality_standards,ecological_needs)['supply_efficiency'],

[0754] x0=initial_solution,

[0755] method = 'SLSQP', # Sequential least squares programming, suitable for optimization problems with constraints

[0756] constraints=[{'type':'ineq','fun':lambda x:x-ecological_needs},#ecological water needs constraints

[0757] {'type':'ineq','fun':lambda x:reservoir_capacities-np.cumsum(x)}])#Reservoir capacity constraints

[0758] return result.x

[0759] interaction_strategy_data = np.random.rand(12) #interaction strategy data, assuming 12 months of the year water_demand = np.random.randint(50,100,12) #monthly water demand

[0760] reservoir_capacities = np.array([1000,2000,3000,...]) # Reservoir capacity limit (may need to be set by month or year)

[0761] water_quality_standards = np.full(12,90) # Water quality standards, assumed to be the same every month

[0762] ecological_needs = np.random.randint(20,40,12) #Ecological water demand

[0763] # Generate initial solution

[0764] initial_solution=generate_initial_solution(interaction_strategy_data,water_demand,ecological_needs)

[0765] #Perform multi-time scale iterative solution

[0766] annual_plan=multi_timescale_iteration(initial_solution,water_demand,reservoir_capacities,water_quality_standards,ecological_needs)

[0767] # Output annual plan

[0768] print("Annual Water Resource Dispatch Plan:",annual_plan)

[0769] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A full-process water scheduling simulation mutual feedback method, characterized in that: include: Obtain water demand data from users in the target area and actual data on water project scheduling and utilization; Construct a multi-time scale runoff forecast mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling and utilization, and generate annual, set scheduling period, monthly, ten-day, and real-time scheduling plans according to the multi-time scale runoff forecast mechanism; Based on the interactive strategy data of the water resources control conditions, a joint scheduling simulation is performed on the water resources of the water projects in the target area to generate a mutually-feedback annual, set scheduling period, monthly, ten-day, and real-time scheduling plan; The acquisition of water user demand data and actual water project scheduling data in the target area includes: Based on the intelligent sensor installed on the water user side, the actual water use data of the water user is monitored and sent to the edge computing device installed on the water user side for statistical analysis to predict the water user demand data, wherein the water user demand data includes at least water consumption, water use time, and water use rate; Based on the intelligent sensors installed on the water project dispatching side, the actual water consumption data on the water project dispatching side is monitored and sent to the edge computing device installed on the water project dispatching side for statistical analysis to obtain the actual data of water project dispatching operation, wherein the actual data of water project dispatching operation includes at least the reservoir water level, pump station flow, and pipe network pressure; The method of monitoring the actual water consumption data of water users based on the intelligent sensors arranged at the water users' side and sending the data to the edge computing device arranged at the water users' side for statistical analysis to predict the water users' demand data includes: A timed sleep and wake-up mechanism is configured on the smart sensor, so that the smart sensor works in a low power consumption mode under the timed sleep and wake-up mechanism, monitors the actual water consumption data of the water user and encapsulates it into an actual water consumption data packet in real time based on the monitored timestamp based on a lightweight encapsulation algorithm, so as to send it to an edge computing device arranged on the water user side for statistical analysis, so as to predict the demand data of the water user. The timed sleep and wake-up mechanism can be dynamically adjusted according to the prediction mode of the actual water consumption data of the monitored water user, and the dynamic adjustment is for at least one of the sleep duration and the wake-up frequency; The method of monitoring the actual water consumption data of water users based on the intelligent sensor arranged at the water user side and sending it to the edge computing device arranged at the water user side for statistical analysis to predict the water consumption user demand data includes: Based on the intelligent sensor installed on the water user side, the actual water use data of the water user is monitored and the monitored actual water use data is packaged and packed in reverse order in real time according to the time stamp of the actual water use data, so as to compress and cache the data in sequence, and then sent to the edge computing device installed on the water user side in a descending order of freshness for statistical analysis, including total water use, water use trend, and peak water use period, so as to predict the demand data of the water user; The multi-time scale runoff forecasting mechanism is constructed to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling and operation, including: Generate hydrological time series data based on historical runoff data, and transform the hydrological time series data into a phase space that reflects the dynamic changes of the hydrological sequence; Based on the phase space reflecting the dynamic changes of the hydrological sequence, extracting the chaotic degree characteristics of the historical runoff data; Performing polynomial chaos expansion on the chaos degree characteristics to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling; The method of generating hydrological time series data according to historical runoff data and converting the hydrological time series data into a phase space reflecting the dynamic changes of the hydrological sequence includes: extracting trend characteristics, periodic characteristics, and seasonal characteristics of the historical runoff data based on a Martingale model to generate hydrological time series data, and performing sampling processing through a set embedded dimension vector to convert the hydrological time series data into a phase space reflecting the dynamic changes of the hydrological sequence; The polynomial chaos expansion of the chaos degree characteristics is performed to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling, including: The chaotic degree characteristics are mapped into orthogonal polynomial response variables through orthogonal polynomial basis functions to perform polynomial chaos expansion on the chaotic degree characteristics, so as to construct a multi-time scale runoff forecasting mechanism to generate interactive strategy data of water resource control conditions in the target area according to the water user demand data and the actual data of water project scheduling; Among them, according to the interactive strategy data of the water resources control conditions, the water resources of the water projects in the target area are jointly dispatched and simulated to generate the annual, set dispatch period, monthly, ten-day, and real-time dispatch plans of mutual feedback, including: According to the interactive strategy data of the water resources control conditions, the target conditions, constraints and decision variables of the joint simulation scheduling are constructed. The target conditions include maximizing water supply benefits, minimizing water abandonment and mathematical expressions of ecological water demand. The constraints include reservoir capacity restrictions, water transfer capacity restrictions, water quality standards and mathematical expressions of ecological protection needs. An initial solution of the scheduling plan is constructed according to the decision variables, and the target conditions and constraint conditions are iteratively solved at multiple time scales based on joint scheduling to simulate the joint scheduling of water projects and water resources in the target area, and generate mutually-feedback annual, set scheduling period, monthly, ten-day, and real-time scheduling plans.

2. A full-process water scheduling simulation mutual feedback method according to claim 1, characterized in that: The smart sensor is provided with a trained demand prediction model to perform the following steps to predict water user demand data: Extracting features from actual water consumption data of water users to obtain time series features, seasonal features, holiday features, weather features, and user behavior features. The time series features include daily, weekly, monthly, or annual water consumption, as well as trends and periodic changes in water consumption. The seasonal features are used to consider the impact of different seasons on water consumption. The holiday features are used to consider that water consumption during holidays is different from that on weekdays. The weather features include the impact of temperature, humidity, and rainfall on water consumption. User behavior features include users' water use habits and water use time distribution. According to the time series characteristics, season characteristics, holiday characteristics, weather characteristics, and user behavior characteristics, feature derivation processing is performed to obtain time series derived characteristics, season derived characteristics, holiday derived characteristics, weather derived characteristics, user behavior derived characteristics, and cross-derived characteristics to predict water user demand data, wherein: The time series derived features include: trend features, which are used to characterize the growth rate, change rate or moving average of water consumption; periodic features, which are used to extract weekly or monthly periodic patterns, including daily water consumption patterns and weekly water consumption patterns; hysteresis features: used to characterize the time lag effect of water consumption, including using the water consumption of the previous day or week as a feature; The seasonal derivative characteristics include: seasonal index, which is used to calculate the index of average water consumption of each season relative to the whole year; seasonal variation characteristics, which are used to characterize the difference in water consumption between the current season and the previous season or the same season in history; holiday derivative characteristics, which are used to identify holidays: setting a virtual variable for holidays, where 0 represents non-holidays and 1 represents holidays; pre- and post-holiday effects, which are used to consider the change in water consumption several days before and after holidays; The weather-derived features include: temperature-related features, including average temperature, maximum temperature, minimum temperature, and difference value and cumulative value with temperature; humidity-related features, including average humidity and humidity change rate; rainfall-related features, including rainfall, number of rainy days, and rainfall intensity; weather types, including sunny, cloudy, and rainy days, and corresponding virtual variables are set; Derived characteristics of user behavior include: water use habits, including daily water use peak hours and water use trough hours; water use time distribution, used to calculate the proportion of water use in different time periods, including morning, noon, and evening; user classification, used to classify users according to water use and water use habits, and characterize the characteristics of different types of users; The cross-derivative features include: intersection of time series and weather, including "water consumption on hot days in summer" and "water consumption on rainy days in winter"; intersection of holidays and weather, including "water consumption on sunny days during holidays" and "water consumption on rainy days during holidays"; intersection of user behavior and holidays: including "peak water consumption hours for holiday users".

3. A full-process water scheduling simulation mutual feedback method according to claim 2, characterized in that: The smart sensor is provided with a trained demand prediction model, and also performs the following steps to predict water user demand data: Encoding the time series derived features, season derived features, holiday derived features, weather derived features, user behavior derived features, cross-derived features, and the time series features, season features, holiday features, weather features, and user behavior features to obtain a derived feature encoding vector and a meta-feature encoding vector; A fused feature vector is obtained by fusing the derived feature coding vector and the meta-feature coding vector to establish a mapping relationship between the fused feature vector and the water user demand data, so as to predict the water user demand data according to the mapping relationship.

4. A full-process water scheduling simulation mutual feedback method according to claim 2, characterized in that: The actual water consumption data of the water project scheduling side is monitored based on the intelligent sensor arranged at the water project scheduling side, and sent to the edge computing device arranged at the water project scheduling side for statistical analysis to obtain the actual data of water project scheduling, including: Multiple smart sensors arranged on the water project scheduling side are paired into several groups, each group includes at least two smart sensors, and each group of smart sensors can monitor the actual water use data on the water project scheduling side, and different groups of smart sensors asynchronously monitor the actual water use data on the water project scheduling side in different set time periods, and the actual water use data monitored by each group of smart sensors and the identifier of the corresponding group of smart sensors are encapsulated and stored in a data warehouse. When encapsulating, the monitored actual water use data is serialized to obtain a JSON file, and the identifier of the corresponding group of smart sensors is used as a label of the JSON file to be sent to an edge computing device arranged on the water project scheduling side for statistical analysis to obtain actual data on water project scheduling.

5. A full-process water scheduling simulation mutual feedback method according to claim 4, characterized in that: Each of the smart sensors is provided with a radio frequency transmitter and a radio frequency receiver. When the smart sensor enters a working state to monitor the actual water consumption data on the water project scheduling side, a first state signal is generated and sent to other smart sensors not in the same group through the radio frequency transmitter. When the smart sensor ends monitoring, a second state signal is generated and sent to other smart sensors not in the same group through the radio frequency transmitter. The radio frequency receiver is used for the first state signal and the second state signal sent by the smart sensors not in the same group to control different groups of smart sensors to asynchronously monitor the actual water consumption data on the water project scheduling side at different set time periods, and the actual water consumption data monitored by each group of smart sensors is packaged with the identifier of the corresponding group of smart sensors to be stored in the data warehouse; Wherein, each of the smart sensors maintains a timed task workflow, and the timed task workflow records the working status of the corresponding smart sensor. The working status defines a monitoring time period defined by the start and end time points of the monitoring of the smart sensor. The monitoring time periods defined by the start and end time points of the monitoring of different smart sensors are spaced according to a set time step. When the smart sensor enters the working state and is ready to start monitoring, a "start monitoring" signal is generated, and a radio frequency transmitter is used to broadcast a first state signal to other smart sensors that are not in the same group. When the smart sensor ends monitoring, an "end monitoring" signal is generated, and a radio frequency transmitter is also used to broadcast a second state signal to other smart sensors that are not in the same group. The radio frequency receiver of each smart sensor is used to receive the first state signal and the second state signal sent by the smart sensors that are not in the same group. When the second state signal is received, it is checked whether the timestamp of the timer thereon is within the set monitoring time period. If not, the signal is ignored; if so, the corresponding smart sensor is started for monitoring.

6. A full-process water scheduling simulation mutual feedback method according to claim 1, characterized in that: The method of extracting the chaos degree characteristics of the historical runoff data based on the phase space reflecting the dynamic changes of the hydrological sequence includes: calculating the average exponential divergence rate of adjacent tracks in the phase space reflecting the dynamic changes of the hydrological sequence to construct a chaos feature quantity, and extracting the chaos degree characteristics of the historical runoff data based on the chaos feature quantity.

Citation Information

Patent Citations

  • Real-time scheduling method for reservoir group water supply and transfer system

    CN105096004A

  • Daily water consumption volume predicating method

    CN107909195A

  • Underground space air multi-gas component content monitoring sensor array and preparation method thereof

    CN117607360A