A real-time power supply and demand prediction method and system based on a cloud native architecture

By deploying containerized microservices and adaptive model updates under a cloud-native architecture, the problems of high latency and unstable accuracy in power supply and demand forecasting are solved, achieving efficient and accurate real-time supply and demand forecasting, which is suitable for power trading and dispatching decisions.

CN122347244APending Publication Date: 2026-07-07YUNNAN POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610437921.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-03
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing power supply and demand forecasting technologies suffer from high latency and unstable accuracy when facing high concurrency and sudden changes, making it difficult to meet real-time business needs. Furthermore, the diversity of data sources and inconsistent timestamps lead to unstable model input quality.

Method used

A real-time power supply and demand forecasting method based on cloud-native architecture is adopted. Data access services are deployed through containerized microservices, and timestamp alignment, missing value handling, and smoothing and noise reduction are performed. ARIMA and LSTM models are combined for forecasting, and resource utilization is optimized by scaling up and down mechanisms to achieve real-time data processing and adaptive model updates.

Benefits of technology

It improves the accuracy and robustness of forecasts, ensuring low-latency real-time supply and demand forecasts under high concurrency conditions, which can be directly applied to power trading and dispatch decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122347244A_ABST
    Figure CN122347244A_ABST
Patent Text Reader

Abstract

This application relates to a real-time power supply and demand forecasting method and system based on a cloud-native architecture. The method includes: deploying a data access service in a cloud-native cluster using containerized microservices to receive real-time supply and demand data streams and historical time-series data from a power trading system; writing the data streams to distributed storage and pushing them to the forecasting pipeline via a message queue; performing timestamp alignment, missing data handling, normalization, and smoothing / denoising on the supply and demand data by a preprocessing service to obtain a low-noise supply and demand sequence; updating model parameters in a rolling window by an ARIMA forecasting service and outputting linear forecast values ​​as the first forecast result; calculating the forecast residuals based on the first forecast result and the actual observations, constructing residual time-series samples, and outputting residual forecast values ​​by an LSTM forecasting service; and superimposing the first forecast result and the residual forecast values ​​by a fusion service to obtain the real-time supply and demand forecast result and publishing it to the real-time trading business interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power supply and demand forecasting technology, and in particular to a real-time power supply and demand forecasting method and system based on cloud-native architecture. Background Technology

[0002] With the deepening of power market reform and the continuous increase in the installed capacity of new energy sources (wind power and photovoltaics), the supply and demand balance of the power system is showing greater randomness and volatility. Spot markets, real-time trading, and ancillary services place higher demands on the timeliness and stability of supply and demand forecasts: on the one hand, transaction matching, clearing verification, and risk control often require forecast updates at the minute level or even finer granularity; on the other hand, forecast results not only affect trading strategies and pricing decisions, but also directly relate to dispatch safety, reserve allocation, and the level of new energy consumption.

[0003] Existing supply and demand forecasting techniques can generally be divided into two categories: statistical model methods and machine learning methods. Statistical models, represented by ARIMA, are characterized by strong interpretability and clear characterization of trends and seasonality, making them suitable for modeling relatively stable time series. Machine learning methods, represented by deep learning time series networks (such as LSTM), can learn nonlinear relationships from historical sequences and exogenous factors, and have a stronger ability to fit complex fluctuations.

[0004] However, the aforementioned methods still face several bottlenecks when implemented in real-time power operations. First, power supply and demand data come from diverse sources, including real-time streaming data generated by power trading systems, historical time-series data, and external characteristic data such as meteorological and holiday data. Different data sources suffer from inconsistent timestamps, missing data, noise interference, and inconsistent sampling frequencies. Without a unified streaming governance and alignment mechanism, the quality of model input can easily become unstable, leading to amplified prediction errors. Second, power load and renewable energy output are frequently affected by sudden events, abrupt weather changes, major events, and equipment failures, often resulting in structural abrupt changes or distribution drift. Traditional models often rely on fixed windows or offline training, which can easily lead to lag when facing impacts from changing points. The model parameter update and reconstruction process is time-consuming, making it difficult to meet the demands of real-time operations for rapid accuracy recovery. Summary of the Invention

[0005] To overcome, to some extent, the problems of high latency and unstable accuracy in real-time power supply and demand forecasting under high concurrency and sudden changes in related technologies, this application provides a real-time power supply and demand forecasting method and system based on cloud-native architecture.

[0006] The proposed solution is as follows: According to a first aspect of the embodiments of this application, a real-time power supply and demand forecasting method based on a cloud-native architecture is provided, characterized in that it includes: In a cloud-native cluster, a data access service is deployed in a containerized microservice manner to receive real-time supply and demand data streams and historical time-series data from the power trading system, and write the data streams into distributed storage. At the same time, the data is pushed to the prediction pipeline through a message queue. The preprocessing service performs timestamp alignment, missing value handling, and normalization on the supply and demand data, and performs smoothing and noise reduction on the aligned time series data to obtain a low-noise supply and demand sequence. Based on the low-noise supply and demand sequence, the ARIMA prediction service updates the ARIMA model parameters and outputs a linear prediction value within a scrolling window, which is denoted as the first prediction result. The predicted residual is calculated based on the first prediction result and the corresponding actual observation value. The residual time series sample is constructed, and the LSTM prediction service inputs the residual time series sample into the long short-term memory network to output the residual prediction value. The fusion service overlays and fuses the first prediction result with the residual prediction value to obtain the real-time supply and demand prediction result, and publishes the real-time supply and demand prediction result to the real-time transaction business interface.

[0007] Preferably, the method further includes: Obtain scaling metrics; the scaling metrics include at least one of the following: message queue backlog length, predicted request concurrency, and end-to-end inference latency; The cluster orchestration and elastic scheduling service automatically scales up and down the preprocessing service, ARIMA prediction service, LSTM prediction service and fusion service according to the scaling indicators, so that the real-time prediction throughput and response latency meet the preset thresholds under high concurrency conditions.

[0008] Preferably, the ARIMA prediction service updates the ARIMA model parameters and outputs a linear prediction value within a rolling window based on the low-noise supply and demand sequence, denoted as the first prediction result, including: Perform change point detection on the low-noise supply and demand sequence within the current scrolling window, and adaptively adjust the length of the scrolling window based on the change point detection results; Perform multi-scale decomposition on the low-noise supply and demand sequence to obtain trend components and seasonal components; A set of ARIMA trend candidate models and a set of ARIMA seasonal candidate models are constructed for the trend component and the seasonal component, respectively, and then fitted in parallel. The candidate models are comprehensively scored based on the preset evaluation indicators, and the model with the best score is selected as the target model. The evaluation indicators include at least one of the following: information criterion, residual white noise test results, and nearest neighbor window prediction error. The parameters of the target model are incrementally updated using a recursive update method, and trend prediction values ​​and seasonal prediction values ​​are output based on the incrementally updated target model. The trend forecast value and the seasonal forecast value are superimposed to obtain a linear forecast value, and the confidence interval corresponding to the linear forecast value is output; wherein the linear forecast value is used as the first forecast result.

[0009] Preferably, the change point detection includes: When the change point detection result indicates that the low-noise supply and demand sequence has undergone a sudden structural change, the rolling window length will be adaptively shortened to the preset minimum window length or shortened by a preset ratio, and a model reconstruction request will be reported to the cluster orchestration and elastic scheduling service. The parallel fitting includes: The cluster orchestration and elastic scheduling service performs temporary scaling up of the ARIMA prediction service based on the model reconstruction request; Multiple ARIMA prediction service instances are driven to perform parallel fitting and comprehensive scoring selection on the ARIMA trend candidate model set and the ARIMA seasonal candidate model set, so as to determine the target model within a preset time limit and output the first prediction result. If the target model cannot be determined within the preset time limit, the system switches to a preset backup model to output the first prediction result, and continues to perform parallel fitting in the background for subsequent parameter updates and model switching in the scrolling window.

[0010] Preferably, the method further includes: When a sudden structural change is detected, the parameters of the target model are reinitialized and / or switched to a backup model.

[0011] Preferably, the residual time-series samples are input into a Long Short-Term Memory network by an LSTM prediction service to output residual predicted values, including: Obtain the actual observed values ​​for the prediction period corresponding to the first prediction result, and calculate the difference between the actual observed values ​​and the first prediction result to obtain the residual sequence; When constructing the residual time series sample, the residual sequence is concatenated with the exogenous feature vector to form a multidimensional residual sample, the confidence interval width and prediction uncertainty corresponding to the first prediction result are determined, and the confidence interval width and prediction uncertainty are used as sample input features; the exogenous feature vector includes at least one of the following: meteorological features, holiday features, and weekday features; The residual sequence is decomposed into a multi-scale model to obtain at least one high-frequency residual component and one low-frequency residual component. The high-frequency residual component and the low-frequency residual component are then input into a dual-branch long short-term memory network for feature extraction. The residual contribution at different time steps is weighted by attention weights, and the residual prediction value and its confidence score are output. Based on the prediction uncertainty of the first prediction result and the reliability score of the residual prediction value, the residual correction coefficient is determined, and the final residual prediction value is output after the magnitude constraint is applied to the residual prediction value.

[0012] Preferably, the method further includes: Determine the distribution drift of the residual sequence; Online detection is performed on the distribution drift of the residual sequence. When the residual distribution drift index exceeds the preset drift threshold, a priority sample set containing burst peak samples is retrieved to perform incremental updates on the long short-term memory network.

[0013] Preferably, incremental updates are performed on the long short-term memory network, including: Identify sudden peak points in the residual sequence and mark the residual segments that meet the peak determination criteria as sudden peak samples; the peak determination criteria include: the absolute value of the residual exceeds a preset amplitude threshold, or exceeds a standard deviation multiple threshold obtained based on historical residual statistics, or exceeds a preset quantile threshold. Obtain the exogenous feature vectors corresponding to the burst peak samples, construct a priority sample pool based on the burst peak samples and their corresponding exogenous feature vectors, and assign priority weights to the samples in the priority sample pool; the priority weights are positively correlated with at least one of the residual amplitude, peak duration, and prediction uncertainty. When the incremental update is triggered, weighted sampling is performed from the priority sample pool according to the priority weight to form a priority sample set, and the priority sample set is mixed with the regular samples in the most recent scrolling window at a preset ratio to generate an incremental training batch. The Long Short-Term Memory network is subjected to mini-batch incremental training using the incremental training batches, and the updated network parameters are published to the online inference instance of the LSTM prediction service after training is completed for subsequent residual prediction.

[0014] Preferably, the fusion service overlays and fuses the first prediction result with the residual prediction value to obtain the real-time supply and demand prediction result, including: The first prediction result and the residual prediction value are time-aligned and prediction step size-aligned to obtain a linear prediction sequence and a residual prediction sequence in the same prediction time domain. The linear prediction sequence and the residual correction sequence are superimposed and fused to obtain an initial fused prediction result; The initial fusion prediction result is subjected to a consistency check using the confidence interval corresponding to the first prediction result. When the initial fusion prediction result exceeds the boundary of the confidence interval, the initial fusion prediction result is clipped to the boundary of the confidence interval or reverted to the first prediction result to suppress overcorrection caused by abnormal residual correction. The fusion prediction results that have passed the consistency check are subjected to business constraint verification and post-processing; the business constraint verification includes at least one of the following: non-negativity constraint, rate of change constraint, and capacity limit constraint; The real-time supply and demand forecast results that meet the business constraints are written into the result storage and published to the real-time transaction business interface. At the same time, the model version identifier and data version identifier corresponding to the real-time supply and demand forecast results are recorded for traceability.

[0015] According to a second aspect of the embodiments of this application, a real-time power supply and demand forecasting system based on a cloud-native architecture is provided, comprising: Processor and memory; The processor and memory are connected via a communication bus: The processor is used to call and execute the program stored in the memory; The memory is used to store a program, which is at least used to execute a real-time power supply and demand forecasting method based on a cloud-native architecture as described in any of the above.

[0016] The technical solution provided in this application may include the following beneficial effects: This technical solution leverages distributed storage and message queues to achieve stable access, asynchronous transmission, and scalable processing of real-time streams and historical data, reducing the impact of data link jitter on prediction and improving throughput. On the other hand, it first uses ARIMA to characterize interpretable linear structures such as trends and seasons, then models the prediction residuals to compensate for nonlinearity and short-term disturbances, and finally superimposes and fuses them to output real-time supply and demand prediction results. This improves prediction accuracy and robustness while ensuring low-latency online inference, and can be directly connected to real-time trading interfaces for engineering implementation and rapid deployment.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] Figure 1 This is a flowchart illustrating a real-time power supply and demand forecasting method based on a cloud-native architecture, provided in one embodiment of this application. Figure 2 This is a schematic diagram of the structure of a real-time power supply and demand forecasting system based on a cloud-native architecture, provided in one embodiment of this application.

[0020] Reference numerals: Processor-21; Memory-22. Detailed Implementation

[0021] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0022] Example 1 Figure 1 This is a flowchart illustrating a real-time power supply and demand forecasting method based on a cloud-native architecture, provided in one embodiment of this application. (Refer to...) Figure 1 A real-time power supply and demand forecasting method based on cloud-native architecture includes: S1. Deploy the data access service in a containerized microservice manner in a cloud-native cluster to receive real-time supply and demand data streams and historical time series data from the power trading system, write the data streams to distributed storage, and push the data to the prediction pipeline through a message queue. S2. The preprocessing service performs timestamp alignment, missing value handling and normalization on the supply and demand data, and performs smoothing and noise reduction on the aligned time series data to obtain a low-noise supply and demand sequence. S3. The ARIMA prediction service updates the ARIMA model parameters and outputs linear prediction values ​​within a rolling window based on low-noise supply and demand sequences, which is denoted as the first prediction result. S4. Calculate the prediction residuals based on the first prediction result and the corresponding actual observations, construct the residual time series samples, and input the residual time series samples into the Long Short-Term Memory Network by the LSTM prediction service to output the residual prediction values. S5. The fusion service overlays and merges the first forecast result with the residual forecast value to obtain the real-time supply and demand forecast result, and publishes the real-time supply and demand forecast result to the real-time transaction business interface.

[0023] For ease of understanding, the following explains some key terms in this embodiment: A cloud-native cluster refers to a collection of computing resources built upon cloud-native concepts such as container technology, microservice architecture, and continuous delivery. It provides capabilities such as elastic scaling, high availability, and resource isolation, offering a foundational environment for the deployment and operation of real-time power supply and demand forecasting methods.

[0024] Containerized microservices refer to packaging an application and all its dependencies into a single, portable container, and deploying and managing it using a microservice architecture. This approach facilitates rapid service deployment, independent scaling, and fault isolation.

[0025] Data access service refers to the service module responsible for receiving various data streams from external systems (such as power trading systems). Its main functions include data collection, preliminary verification, and transmission, ensuring that the raw data can be obtained by subsequent processing stages.

[0026] Distributed storage refers to a storage method where data is distributed across multiple physical nodes and accessed and managed via a network. It features high availability, scalability, and data redundancy, making it suitable for storing large-scale real-time data and historical time-series data.

[0027] Message queues are an asynchronous communication mechanism used to deliver messages in distributed systems. They decouple producers and consumers, buffer data streams, smooth out peak flows, and ensure reliable transmission, guaranteeing that data can be stably pushed from the data access service to the prediction pipeline.

[0028] A prediction pipeline refers to a series of sequentially executed data processing and model prediction steps. It transforms data from its raw state into a final prediction result, typically including data preprocessing, model inference, and result fusion.

[0029] Preprocessing services refer to the service modules that clean, transform, and standardize the raw supply and demand data. Their main functions include timestamp alignment, missing value handling, normalization, and smoothing and noise reduction, aiming to improve data quality and provide high-quality input for subsequent predictive models.

[0030] ARIMA forecasting service refers to a service module that performs time series forecasting based on the Autoregressive Integrated Moving Average (ARIMA) model. It analyzes historical data to capture trends, seasonality, and random fluctuations, and outputs linear forecast values.

[0031] A rolling window, in time series analysis, refers to a continuous segment of time series data used for model training and parameter updates. This window slides forward over time, allowing the model to continuously learn from the latest data patterns.

[0032] The first forecast result refers to the linear forecast value output by the ARIMA forecasting service based on low-noise supply and demand series. This result typically reflects the main trends and seasonal characteristics of the time series.

[0033] Prediction residuals refer to the differences between model predictions and actual observations. By analyzing and predicting residuals, we can capture the nonlinear or stochastic fluctuations that the model fails to fully explain.

[0034] Residual time series samples refer to historical residual sequence data used to train residual prediction models. These samples typically contain residual values ​​and their potentially related external features.

[0035] LSTM prediction service refers to a service module that uses Long Short-Term Memory (LSTM) networks to predict residuals. LSTM networks are a special type of recurrent neural network that excels at processing and predicting long-term dependencies in time series data.

[0036] Long Short-Term Memory (LSTM) networks are a type of deep learning model, a variant of Recurrent Neural Networks (RNNs). They effectively address the vanishing or exploding gradient problems that traditional RNNs encounter when processing long sequences by introducing gating mechanisms (input gate, forget gate, output gate), enabling them to learn and remember long-term dependencies.

[0037] The residual prediction value refers to the prediction result output by the LSTM prediction service based on the residual time series samples. This result aims to correct for nonlinear or random errors that were not captured in the first prediction result.

[0038] Fusion services refer to service modules that combine the outputs of different prediction models. They combine linear prediction results with residual prediction results through overlay and fusion methods to obtain a more comprehensive and accurate final prediction result.

[0039] Real-time supply and demand forecast results refer to the final output of electricity supply and demand forecast data after multi-stage processing and model fusion. These results are highly timely and can be directly used for electricity trading and dispatch decisions.

[0040] A real-time trading interface refers to a standardized interface used to publish supply and demand forecast results to external power trading systems or other business systems for interaction. It ensures that the forecast results are consumed by downstream businesses in a timely and accurate manner.

[0041] In this embodiment, the implementation of the real-time power supply and demand forecasting method includes the following steps: First, deploy a data access service in a cloud-native cluster. This data access service runs as a containerized microservice, responsible for receiving real-time supply and demand data streams and historical time-series data from the power trading system. For example, the data access service can be configured to receive data via a message queue or API gateway and write the received data streams to a distributed storage system. Simultaneously, to achieve efficient asynchronous data transmission, the data access service can push data to the next processing stage in the forecast pipeline via message queues such as Kafka or RabbitMQ. As an alternative implementation, the data access service can adopt a batch processing mode, pulling data from the data source at fixed time intervals and storing it in a centralized database, from which the forecast pipeline periodically reads data.

[0042] Secondly, the received supply and demand data is processed by a preprocessing service. This preprocessing service performs timestamp alignment, missing value handling, and normalization on the raw supply and demand data. For example, timestamp alignment can be achieved through interpolation or resampling techniques; missing value handling can employ linear interpolation, mean imputation, or forward / backward imputation methods; and normalization can use Min-Max normalization or Z-score standardization. Furthermore, the preprocessing service performs smoothing and noise reduction on the aligned time-series data, using techniques such as moving averages, wavelet transforms, or Savitzky-Golay filters to remove random noise from the data, thereby obtaining a low-noise supply and demand sequence. As an alternative, the preprocessing service can perform only basic timestamp alignment and simple missing value imputation without complex normalization or smoothing and noise reduction processing.

[0043] Next, the ARIMA forecasting service updates the ARIMA model parameters and outputs a linear forecast value within a rolling window based on this low-noise supply and demand sequence. This linear forecast value is recorded as the first forecast result. Specifically, the ARIMA forecasting service maintains a historical data rolling window and periodically uses the data within the window to train and update the parameters of the ARIMA model. For example, a fixed-length rolling window can be set, and whenever new data enters, the oldest data is removed, and then the model parameters are re-estimated. Thus, the ARIMA forecasting service can output linear forecast values ​​that reflect the main trends and seasonal characteristics of the data. As a simplified implementation, the ARIMA forecasting service can use a pre-trained fixed-parameter model, performing offline updates only at longer intervals (e.g., monthly), without real-time parameter updates within the rolling window.

[0044] Subsequently, the predicted residuals are calculated based on the first prediction result and the corresponding actual observations, and a residual time series sample is constructed. For example, the predicted residuals can be obtained by subtracting the first prediction result from the actual observations. These residual values, along with other relevant information, are organized into a residual time series sample. Further, the LSTM prediction service inputs this residual time series sample into a Long Short-Term Memory (LSTM) network to output predicted residual values. LSTM networks can capture nonlinear patterns and long-term dependencies in the residual sequence. For example, an LSTM network can be configured to receive the residual sequence as input and output predicted residual values ​​for several future time steps. As an alternative, simple statistical models, such as exponential smoothing or autoregressive models, can be used to predict the residuals instead of using an LSTM network.

[0045] Finally, the fusion service overlays and merges the first forecast result with the residual forecast value to obtain the real-time supply and demand forecast result. For example, the fusion service can directly add the first forecast result and the residual forecast value point by point to obtain a more refined forecast result. This real-time supply and demand forecast result is then published to the real-time trading business interface. For example, the fusion service can push the final forecast result to the power trading system or other downstream business systems via message queues or HTTP APIs. As a simple implementation, the fusion service can output only the first forecast result without residual correction, or write the forecast result to a local file for other systems to read periodically.

[0046] This embodiment achieves real-time and efficient access and preprocessing of power supply and demand data by deploying containerized microservices in a cloud-native cluster, effectively solving the problems of unstable data quality and low processing efficiency in traditional methods. By capturing linear trends using the ARIMA model and combining it with an LSTM network to perform nonlinear correction on the residuals, this method can more comprehensively characterize the complex fluctuations in power supply and demand, improving prediction accuracy. In addition, the model parameter update mechanism within the rolling window enables the model to adapt to changes in data patterns, providing highly timely and stable prediction results for businesses such as the power spot market and real-time trading.

[0047] Example 2 It should be noted that the method also includes: Obtain scaling metrics; scaling metrics include at least one of the following: message queue backlog length, predicted request concurrency, and end-to-end inference latency; The cluster orchestration and elastic scheduling service automatically scales up and down the preprocessing service, ARIMA prediction service, LSTM prediction service and fusion service according to the scaling indicators, so that the real-time prediction throughput and response latency meet the preset thresholds under high concurrency conditions.

[0048] Specifically, scaling metrics are key parameters used to measure the current load and performance of a system, serving as the basis for triggering and guiding system resource adjustments. These metrics can include at least one of the following: message queue backlog length, prediction request concurrency, and end-to-end inference latency. Message queue backlog length refers to the number of messages waiting to be processed in the message queue. When this length exceeds a certain threshold, it indicates that the downstream service's processing capacity is insufficient, requiring scaling. This metric can be obtained in real-time through the built-in metric interface of monitoring message queues (e.g., Kafka, RabbitMQ, etc.). Prediction request concurrency refers to the number of prediction requests processed simultaneously by the system per unit of time. High concurrency usually means more computing resources are needed for parallel processing, and can be measured in real-time through API gateways, service meshes, or the request counters of each microservice. End-to-end inference latency refers to the time required from receiving a prediction request to outputting the final prediction result. Excessive latency directly affects real-time performance and is a direct reflection of system performance. It can be measured through a distributed tracing system or by embedding timing points at service entry and exit points. These metrics can be collected periodically by a dedicated monitoring agent or monitoring modules integrated into various services and reported to the cluster orchestration and elastic scheduling service.

[0049] Cluster orchestration and elastic scheduling services are core components in cloud-native environments responsible for managing and scheduling containerized applications. Their role is to dynamically adjust the number of microservice instances based on preset policies and real-time metrics to optimize resource utilization and ensure service performance. Typical implementations include Kubernetes' Horizontal Pod Autoscaler (HPA) or Vertical Pod Autoscaler (VPA). HPA can automatically increase or decrease the number of Pods (i.e., microservice instances) based on CPU utilization, memory utilization, or custom metrics (such as message queue backlog length, request concurrency, etc.). When scaling metrics (such as message queue backlog length, predicted request concurrency, end-to-end inference latency) exceed preset upper thresholds, the cluster orchestration and elastic scheduling service triggers scaling operations, increasing the number of instances of preprocessing services, ARIMA prediction services, LSTM prediction services, and fusion services to distribute the load. Conversely, when the metrics fall below lower thresholds, scaling operations are performed to release unnecessary resources. Scaling up and down operations target the core computational services in the prediction pipeline, namely the preprocessing service, ARIMA prediction service, LSTM prediction service, and fusion service, because these services are computationally intensive or I / O intensive and have the greatest impact on system performance. In this way, the system can ensure that even when the concurrency of prediction requests increases sharply or when there are instantaneous peaks in the data flow, it can maintain its performance within an acceptable range by increasing resources, thus avoiding performance bottlenecks.

[0050] Through the above technical solution, this application introduces an intelligent elastic scheduling mechanism in a cloud-native environment. By acquiring key scaling indicators such as message queue backlog length, prediction request concurrency, and end-to-end inference latency in real time, the cluster orchestration and elastic scheduling service can accurately perceive changes in system load. When the load increases, the system can automatically scale up core prediction microservices such as preprocessing service, ARIMA prediction service, LSTM prediction service, and fusion service to quickly increase processing capacity and effectively distribute pressure; when the load decreases, it automatically scales down, releasing redundant resources and improving resource utilization. This dynamic resource management approach ensures that even when power supply and demand forecasting faces high concurrency requests or instantaneous data flow peaks, the system can still maintain stable high prediction throughput and low response latency, thereby guaranteeing the timeliness and accuracy of real-time prediction results and significantly improving the robustness and economy of the entire prediction system.

[0051] Example 3 It should be noted that the ARIMA prediction service updates the ARIMA model parameters and outputs linear prediction values ​​within a rolling window based on low-noise supply and demand sequences. This is denoted as the first prediction result, which includes: Perform change point detection on the low-noise supply and demand sequence within the current scrolling window, and adaptively adjust the length of the scrolling window based on the change point detection results; Perform multi-scale decomposition on the low-noise supply and demand series to obtain trend and seasonal components; A set of ARIMA trend candidate models and set of ARIMA seasonal candidate models are constructed for the trend component and the seasonal component respectively, and parallel fitting is performed. The candidate models are comprehensively scored based on the preset evaluation indicators, and the model with the best score is selected as the target model. The evaluation indicators include at least one of the following: information criterion, residual white noise test results, and nearest neighbor window prediction error. The parameters of the target model are incrementally updated using a recursive update method, and trend forecast values ​​and seasonal forecast values ​​are output based on the incrementally updated target model. The trend forecast value is superimposed with the seasonal forecast value to obtain the linear forecast value, and the confidence interval corresponding to the linear forecast value is output; the linear forecast value is used as the first forecast result.

[0052] Specifically, within the current scrolling window, change point detection is first performed on the low-noise supply and demand series. Change point detection aims to identify points in the series where statistical characteristics change significantly, such as abrupt changes in the mean, variance, or trend. This can be achieved through various statistical methods, such as cumulative sum (CUSUM) control charts, exponentially weighted moving average (EWMA) control charts, Pettitt's test, Mann-Kendall's test, or machine learning-based anomaly detection algorithms.

[0053] When a change point is detected, it indicates that the intrinsic generation mechanism of the sequence may have changed, and a fixed-length rolling window may no longer be applicable. Therefore, adaptively adjusting the rolling window length based on the change point detection results—for example, shortening the window to respond more quickly to new data patterns, or appropriately extending the window to capture longer-term trends when there are no significant changes—helps the model better adapt to data dynamics.

[0054] Subsequently, multi-scale decomposition is performed on the low-noise supply and demand series to obtain trend and seasonal components. Multi-scale decomposition breaks down complex time-series data into components at different frequencies or time scales. Common decomposition methods for low-noise supply and demand series include Seasonal-Trend Decomposition (STL), Empirical Mode Decomposition (EMD), wavelet decomposition, or Fourier Transform. Through decomposition, the long-term evolution direction (trend component) and periodic patterns (seasonal components, such as daily, weekly, monthly, and yearly cycles) in the series can be separated. This decomposition helps to model components with different characteristics separately, thereby improving the overall forecast accuracy.

[0055] For the trend component and seasonal component obtained from the decomposition, ARIMA trend candidate model set and ARIMA seasonal candidate model set are constructed respectively and fitted in parallel.

[0056] ARIMA models are typically represented as ARIMA(p, d, q), where p, d, and q represent the autoregressive order, differencing order, and moving average order, respectively. Constructing a candidate set means setting different ranges or combinations of values ​​for the p, d, and q parameters, forming multiple potential ARIMA model structures. For example, for the trend component, ARIMA(1,1,0), ARIMA(0,1,1), etc., can be tried; for the seasonal component, SARIMA(P,D,Q)s, etc., can be tried. Parallel fitting refers to training these candidate models simultaneously to improve the efficiency of model selection. This can be achieved by distributing different model training tasks across different computing nodes or processors in a distributed computing environment.

[0057] After parallel fitting is completed, each candidate model is comprehensively scored based on preset evaluation metrics, and the model with the best score is selected as the target model. Preset evaluation metrics may include: information criteria, such as the Akaike Information Criterion (AIC) or Bayesian Information Criterion (BIC), which penalize model complexity while measuring goodness of fit to avoid overfitting; residual white noise test results, such as the Ljung-Box test, used to determine whether the model residuals are white noise, i.e., whether the residuals still contain information not explained by the model; and nearest neighbor window prediction error, which calculates the error between the candidate model and the actual observations (such as mean squared error MSE, mean absolute error MAE, etc.) on the adjacent historical windows of the current rolling window. By weighting or comprehensively evaluating these metrics, a comprehensive score for each candidate model can be obtained, thereby selecting the target model most suitable for the current data characteristics.

[0058] Subsequently, the parameters of the target model are incrementally updated using a recursive update method, and trend predictions and seasonal predictions are output based on the incrementally updated target model. Recursive update (or incremental update) means that when new data points enter the rolling window, instead of retraining the entire model from scratch, an efficient algorithm (such as Kalman filtering, recursive least squares, or online gradient descent) is used to fine-tune the existing model parameters. This method significantly reduces computational overhead, enabling the model to adapt to the latest data changes in real time, maintaining the timeliness and effectiveness of the parameters. The incrementally updated target model will predict the trend component and seasonal component separately, outputting trend predictions and seasonal predictions.

[0059] Finally, the trend forecast value and the seasonal forecast value are superimposed to obtain a linear forecast value, and the confidence interval corresponding to the linear forecast value is output. After obtaining the trend forecast value and the seasonal forecast value respectively, they are superimposed to reconstruct the complete linear forecast value, i.e., the first forecast result. Simultaneously, to quantify the uncertainty of the forecast, a confidence interval corresponding to this linear forecast value needs to be output. The confidence interval represents the range within which the true value falls with a certain probability (e.g., 95%), and it can be calculated using the model's residual variance, forecast step size, and statistical methods (e.g., based on the normal distribution assumption or guided methods). Providing the confidence interval not only provides an important reference for subsequent residual correction services but also provides decision-makers with a reliability assessment of the forecast results.

[0060] Through the aforementioned technical solutions, ARIMA's forecasting service can process real-time power supply and demand data more flexibly and accurately. Change point detection and adaptive window adjustment mechanisms enable the model to respond promptly to sudden structural changes in the data sequence, avoiding the lag issues caused by fixed windows, thereby improving the model's adaptability to dynamic environments. Multi-scale decomposition decouples complex time-series data into trend and seasonal components that are easier to model. Combined with parallel fitting and comprehensive scoring selection using a targeted candidate model set, this ensures that the optimal solution is found among various model structures, significantly improving the efficiency and accuracy of model selection. Furthermore, the incremental update of target model parameters using a recursive update method avoids frequent full training, greatly reducing computational resource consumption and ensuring the real-time nature of model parameters and the timeliness of predictions. Finally, by superimposing trend and seasonal forecast values ​​and outputting confidence intervals, not only are accurate linear prediction results provided, but the uncertainty of the prediction is also quantified, providing more reliable input for subsequent residual correction and fusion services, thus improving the overall accuracy and robustness of real-time power supply and demand forecasting.

[0061] Specifically, change point detection includes: When the change point detection result indicates a sudden structural change in the low-noise supply and demand sequence, the rolling window length will be adaptively shortened to the preset minimum window length or shortened by a preset ratio, and a model reconstruction request will be reported to the cluster orchestration and elastic scheduling service. Based on this, parallel fitting includes: The cluster orchestration and elastic scheduling service temporarily scales up the ARIMA prediction service based on model reconstruction requests. Multiple ARIMA forecasting service instances are driven to perform parallel fitting and comprehensive scoring selection on the ARIMA trend candidate model set and the ARIMA seasonal candidate model set, so as to determine the target model and output the first prediction result within a preset time limit; If the target model cannot be determined within the preset time limit, switch to the preset backup model to output the first prediction result, and continue to perform parallel fitting in the background for subsequent parameter updates and model switching in the rolling window.

[0062] Specifically, when change point detection results indicate a sudden structural change in the low-noise supply and demand sequence—for example, when statistical tests (such as CUSUM, PELT algorithms, or Bayesian methods) detect significant, unexpected changes in the sequence mean, variance, or trend—the system will immediately take action. At this time, to enable the model to adapt to the new data pattern more quickly, the length of the rolling window will be adaptively shortened. This shortening can be adjusted to a preset minimum window length to ensure a lower limit on the amount of training data for the model, or reduced by a preset proportion, such as 70% or 50% of the original length, thereby reducing the impact of old data on the new model. Simultaneously, the system will send a model reconstruction request to the cluster orchestration and elastic scheduling service. This request acts as a signal to the cluster, notifying it that additional computing resources are needed for the ARIMA prediction service to cope with the sudden change.

[0063] Upon receiving a model reconstruction request, the cluster orchestration and elastic scheduling service immediately performs temporary scaling up of the ARIMA prediction service. This means that in the cloud-native cluster, the number of ARIMA prediction service instances is dynamically increased to provide more computing power. This scaling up is temporary and designed to handle computational peaks during model reconstruction. Subsequently, these scaled-up ARIMA prediction service instances are driven to perform parallel fitting and comprehensive scoring selection on the ARIMA trend candidate model set and the ARIMA seasonal candidate model set.

[0064] Specifically, different service instances can simultaneously train and evaluate different candidate models. For example, one instance might be responsible for fitting an ARIMA(p,d,q) trend model, while another instance might be responsible for fitting an ARIMA(P,D,Q) seasonal model. Alternatively, multiple instances can fit candidate models with different parameter combinations in parallel. Parallel processing significantly reduces the time required for model fitting and selection. The comprehensive scoring and selection process evaluates each candidate model based on preset evaluation metrics (such as information criteria, residual white noise test results, and nearest neighbor window prediction errors), and selects the model with the highest score as the target model. The goal of the entire parallel fitting and selection process is to complete it within a preset timeframe to ensure the timeliness of real-time predictions.

[0065] However, in certain extreme cases, such as when data changes drastically or computing resources are temporarily limited, it may be impossible to determine the target model within the preset time limit. In this case, to ensure the continuity of the prediction service, the system will immediately switch to a preset backup model to output the first prediction result. This backup model can be based on a different algorithm (e.g., a more robust statistical model or machine learning model), or it can be a pre-trained ARIMA model for specific abnormal scenarios (such as extreme loads or specific holidays), which can provide an immediate and acceptable prediction result. Meanwhile, the parallel fitting process that could not be completed will not be interrupted, but will continue in the background. Once the background parallel fitting is completed and a new optimal target model is determined, this model will be used for parameter updates and model switching in subsequent rolling windows, thereby gradually improving the accuracy of the prediction.

[0066] Through the above technical solutions, when a sudden structural change occurs in the low-noise supply and demand sequence, the system can respond rapidly by adaptively shortening the rolling window length, allowing the model to focus more on recent data. Simultaneously, the cluster orchestration and elastic scheduling services temporarily expand the ARIMA prediction service and drive multiple service instances to perform parallel fitting and comprehensive scoring to select candidate models, significantly shortening the model reconstruction and optimization time. This ensures that the target model can be quickly determined and the first prediction result output within the preset time limit, effectively addressing the problem of insufficient model adaptability in scenarios with high real-time requirements. Even if the optimal model cannot be determined in time under extreme circumstances, switching to the preset backup model ensures the continuity of the prediction service and continuous optimization in the background, thereby gradually improving the accuracy of predictions while ensuring timeliness and avoiding prediction interruptions or long-term deviations caused by sudden changes.

[0067] It should be noted that the method also includes: When a sudden structural change is detected, the parameters of the target model are reinitialized and / or switched to a backup model.

[0068] Specifically, the sudden structural change refers to a significant and non-gradual alteration in the statistical characteristics (such as mean, variance, trend, and seasonality) of the electricity supply and demand sequence within a short period. This change may be caused by external events, such as extreme weather (e.g., cold waves, high temperatures), sudden policy adjustments (e.g., power rationing, subsidy policies), large-scale industrial production fluctuations, sudden shifts in major holiday patterns, or major faults within the power system. Change point detection technology can be used to identify such changes. When a sudden structural change is detected in a low-noise supply and demand sequence, it means that the original model parameters or model structure may no longer be applicable to the new data pattern.

[0069] The parameter reinitialization of the target model refers to resetting the parameters of the currently used ARIMA target model to its initial state, or re-estimating the parameters based on the latest data. When a sudden structural change is detected, parameters accumulated through previous recursive updates can be discarded, and the parameter fitting process of the ARIMA model can be re-executed using low-noise supply and demand sequence data from a recent period (e.g., a shortened rolling window). This helps the model quickly break free from the constraints of old patterns and adapt to new data distributions. Reinitialization may include re-estimating the coefficients of the AR, I, and MA components, and even redetermining the model's order.

[0070] Switching to a backup model refers to discontinuing the use of the current target model and activating a pre-trained or specifically designed backup prediction model when a sudden structural change is detected. When a sudden structural change occurs, the system can immediately select the most suitable backup model based on the type or severity of the change to ensure the continuity and accuracy of predictions. This switch is usually instantaneous, designed to respond quickly to changes and avoid prediction errors caused by model adaptation lag.

[0071] Through the above technical solution, this application effectively addresses the problem of insufficient adaptability of traditional incremental update models when unexpected and drastic fluctuations occur in power supply and demand data. When the system identifies a sudden structural change in the low-noise supply and demand sequence, it immediately reinitializes the parameters of the target model, enabling the model to quickly discard outdated historical information and learn and adapt to new data patterns based on the latest data, thereby improving the response speed and accuracy of predictions. Simultaneously, a mechanism for switching to a backup model is introduced, providing the system with a strategy for quickly responding to extreme or unknown emergencies. The backup model can be pre-optimized for specific abnormal scenarios and can immediately take over the prediction task when the main model struggles to adapt quickly, ensuring the continuity and robustness of predictions. This mechanism significantly enhances the adaptability and prediction accuracy of ARIMA's prediction service in complex and volatile power supply and demand environments. Especially when dealing with emergencies, it effectively suppresses the sharp increase in prediction errors, ensuring the reliability of real-time supply and demand prediction results, and thus supporting the stable operation of the power trading system.

[0072] Example 4 It should be noted that the LSTM prediction service inputs the residual time series samples into the Long Short-Term Memory network to output residual prediction values, including: Obtain the actual observed values ​​for the prediction period corresponding to the first prediction result, and calculate the difference between the actual observed values ​​and the first prediction result to obtain the residual sequence; When constructing residual time series samples, the residual sequence is concatenated with exogenous feature vectors to form multidimensional residual samples. The confidence interval width and prediction uncertainty corresponding to the first prediction result are determined, and the confidence interval width and prediction uncertainty are used as sample input features. The exogenous feature vectors include at least one of the following: meteorological features, holiday features, and weekday features. Multi-scale decomposition is performed on the residual sequence to obtain at least one high-frequency residual component and one low-frequency residual component. The high-frequency residual component and the low-frequency residual component are respectively input into a two-branch long short-term memory network for feature extraction. The residual contribution at different time steps is weighted by attention weights, and the residual prediction value and its confidence score are output. The residual correction coefficient is determined based on the prediction uncertainty and the reliability score of the residual prediction value of the first prediction result. After applying amplitude constraints to the residual prediction value, the final residual prediction value is output.

[0073] Specifically, after obtaining the actual observations for the prediction period corresponding to the first prediction result, the residual sequence is obtained by subtracting the actual observations from the first prediction result point by point. This residual sequence reflects the power supply and demand fluctuations that the ARIMA model failed to fully capture, and is the target for subsequent correction and optimization of the LSTM model.

[0074] When constructing residual time-series samples, this application concatenates the residual sequence with exogenous feature vectors to form multidimensional residual samples. Exogenous feature vectors can include meteorological features (such as temperature, humidity, wind speed, and rainfall), holiday features (such as whether it is a statutory holiday, the type of holiday, and the duration of the holiday), and weekday features (such as whether it is a weekday, what day of the week, and whether it is a special weekday). These features have a significant impact on electricity supply and demand. Simultaneously, the confidence interval width and prediction uncertainty corresponding to the first prediction result are used as sample input features. This allows the LSTM model to perceive the reliability of the first prediction result when predicting residuals, thus enabling more intelligent adjustments during residual correction. For example, when the uncertainty of the first prediction result is high, the LSTM model may apply a larger correction weight to the residual prediction.

[0075] Performing multi-scale decomposition on the residual sequence yields at least one high-frequency residual component and one low-frequency residual component. The high-frequency component typically represents short-term, rapid fluctuations, while the low-frequency component reflects long-term, stable trends. Multi-scale decomposition methods can employ wavelet transform, empirical mode decomposition (EMD), or variational mode decomposition (VMD), among others. These components are then fed into a two-branch long short-term memory network, allowing each branch to learn and extract residual features at a specific scale. By introducing an attention weighting mechanism, the network dynamically weights the residual contributions at different time steps, thereby more effectively capturing key, predictive residual patterns and outputting residual predictions and their confidence scores.

[0076] Based on the prediction uncertainty of the first prediction result and the confidence score of the residual prediction value, a residual correction coefficient can be determined. This correction coefficient is used to adjust the strength of the residual prediction value. For example, when the uncertainty of the first prediction result is high and the confidence of the residual prediction is high, the correction coefficient may be large; conversely, it may be small. Subsequently, the amplitude of the residual prediction value is constrained to ensure that the corrected residual value is within a reasonable range, avoiding overcorrection or unrealistic prediction results caused by abnormal residual predictions. Finally, the corrected and constrained final residual prediction value is output. The amplitude constraint can be implemented by setting a maximum allowable residual value or based on a statistical range of historical residual distribution.

[0077] Through the above technical solutions, this application can capture the complex characteristics of power supply and demand residuals more comprehensively and precisely. Introducing exogenous feature vectors allows the residual prediction model to fully consider the impact of external environmental factors on power supply and demand, improving the interpretability and accuracy of the prediction. Using the confidence interval width and prediction uncertainty of the first prediction result as input features enables the residual prediction model to adaptively adjust according to the reliability of the basic prediction, avoiding blind correction. By performing multi-scale decomposition on the residual sequence and processing it using a dual-branch long short-term memory network, residual patterns of different frequencies are effectively separated and learned. Combined with an attention weight mechanism, the model's ability to capture information at key time steps is significantly enhanced, thereby improving the accuracy of residual prediction and its responsiveness to sudden fluctuations. Finally, correction coefficients are determined based on the prediction uncertainty and the confidence score of the residual prediction values, and amplitude constraints are applied, effectively suppressing overcorrection problems that may be caused by abnormal residual corrections, ensuring the stability and reliability of the final fused prediction results. Overall, the residual prediction method of this application significantly improves the overall accuracy and robustness of real-time power supply and demand prediction.

[0078] Furthermore, the methods also include: Determine the distribution drift of the residual sequence; Online detection is performed on the distribution drift of the residual sequence. When the residual distribution drift index exceeds the preset drift threshold, a priority sample set containing burst peak samples is retrieved to perform incremental updates on the long short-term memory network.

[0079] Specifically, determining the distribution drift of the residual sequence refers to monitoring and evaluating the changes in the statistical properties of the residual sequence over time. This can be achieved through various statistical methods, such as calculating the statistical moments of the residual sequence within a sliding window (mean, variance, skewness, kurtosis, etc.) and comparing them with historical benchmarks; or using more complex statistical tests, such as the Kolmogorov-Smirnov test, Kullback-Leibler divergence, or Jensen-Shannon divergence, to quantify the difference between the current residual distribution and the reference distribution.

[0080] Performing online detection of distribution drift in the residual sequence means that the system continuously or periodically analyzes newly generated residual data to determine in real time whether its distribution has changed significantly. For example, a monitoring module can be configured to collect the latest residual data and calculate the corresponding distribution drift index at the end of each prediction period. This online detection mechanism ensures that the system can respond promptly to changes in data distribution.

[0081] When the residual distribution drift index exceeds a preset drift threshold, it indicates that the statistical characteristics of the residual sequence have changed significantly beyond the acceptable range. In this case, the Long Short-Term Memory (LSTM) network needs to be adjusted to adapt to the new data pattern. The preset drift threshold is a critical value pre-set based on historical data analysis, expert experience, or model performance requirements. It distinguishes between normal fluctuations and distribution drift requiring intervention. For example, if the p-value of a statistical test is used as the index, the threshold might be set to 0.05; if a divergence index is used, it might be set to a specific value.

[0082] To efficiently adapt to such changes, the system retrieves a priority sample set containing burst peak samples. Burst peak samples are those with unusually large residual values ​​or unusually long durations; they typically represent sudden events or structural changes in the system and have higher informational value for the model to learn new patterns. The priority sample set is a filtered and weighted collection of samples containing the data points most critical to model updates.

[0083] Subsequently, incremental updates are performed on the Long Short-Term Memory (LSTM) network. Incremental updates are a lightweight model training method that, instead of retraining the entire network from scratch, makes small adjustments and optimizations to the parameters of the existing network using a preferred sample set. This is typically achieved by using a small learning rate and a limited number of training iterations, aiming to allow the model to quickly adapt to new data distributions while avoiding forgetting existing knowledge.

[0084] Through the above technical solution, this application can monitor the distribution status of the residual sequence in real time and promptly detect drifts in its statistical characteristics. When the residual distribution drift index exceeds a preset threshold, the system can intelligently trigger the incremental update mechanism of the Long Short-Term Memory (LSTM) network and prioritize training using a priority sample set containing burst peak samples. This targeted incremental update method avoids the time-consuming and resource-intensive full model retraining, enabling the LTM network to quickly adapt to new data distributions and residual pattern changes caused by sudden events. This significantly improves the model's adaptability and robustness in dynamic environments, thereby ensuring consistently high accuracy in residual prediction and ultimately improving the accuracy and reliability of the overall real-time supply and demand forecast results.

[0085] Incremental updates are performed on the Long Short-Term Memory (LSTM) network, including: Identify sudden peak points in the residual sequence and mark the residual segments that meet the peak determination criteria as sudden peak samples. The peak determination criteria include: the absolute value of the residual exceeds a preset amplitude threshold, or exceeds a standard deviation multiple threshold obtained based on historical residual statistics, or exceeds a preset quantile threshold. Obtain the exogenous feature vectors corresponding to the burst peak samples, construct a priority sample pool based on the burst peak samples and their corresponding exogenous feature vectors, and assign priority weights to the samples in the priority sample pool; the priority weights are positively correlated with at least one of the residual amplitude, peak duration, and prediction uncertainty. When an incremental update is triggered, a priority sample set is formed by weighted sampling from the priority sample pool according to the priority weight, and the priority sample set is mixed with the regular samples in the most recent scrolling window according to a preset ratio to generate an incremental training batch. We use incremental training batches to perform mini-batch incremental training on the Long Short-Term Memory network, and after training is complete, we publish the updated network parameters to the online inference instance of the LSTM prediction service for subsequent residual prediction.

[0086] This method identifies sudden peak points in the residual sequence and marks residual segments that meet peak determination criteria as sudden peak samples. The aim is to accurately capture outliers or segments in the residual sequence that deviate from the normal fluctuation range. The peak determination criteria can include various strategies, which can effectively filter out sudden peak samples with high information content and significant value for model updates from a large amount of residual data.

[0087] Exogenous feature vectors, such as meteorological features, holiday features, and weekday features, can provide information about the external environment when sudden peaks occur, helping the model understand the background of the peaks. The establishment of a priority sample pool allows for the long-term preservation and management of these important historical sudden event samples. Assigning priority weights to samples, for example, positively correlated with residual magnitude, peak duration, and prediction uncertainty, means that samples with larger residual magnitudes, longer peak durations, and higher prediction uncertainties are more important and have a higher probability of being selected in subsequent incremental training. This ensures that the model can prioritize learning and adapting to those events with the greatest impact and are the most difficult to predict.

[0088] When an incremental update is triggered, a priority sample set is formed by weighted sampling from the priority sample pool according to priority weights. This priority sample set is then mixed with regular samples from the most recent rolling window at a preset ratio to generate the incremental training batch. This is to ensure the model's efficiency in learning from sudden events while also considering its generalization ability to regular patterns. The weighted sampling mechanism ensures that high-priority sudden peak samples have a greater chance of being selected, allowing the model to quickly focus on recently occurring anomalies. Simultaneously, mixing these priority sample sets with regular samples from the most recent rolling window at a preset ratio prevents the model from forgetting or weakening its predictive ability for normal operating patterns after overlearning sudden events, thus maintaining the overall stability and accuracy of the model.

[0089] Performing mini-batch incremental training on the Long Short-Term Memory (LSTM) network using incremental training batches, and then publishing the updated network parameters to the online inference instance of the LSTM prediction service after training for subsequent residual prediction, is a key step in achieving rapid model adaptation and deployment. Mini-batch incremental training efficiently utilizes newly generated training batches to quickly adjust model parameters without retraining the entire model, significantly shortening the model update cycle. Timely publishing of the updated network parameters to the online inference instance after training ensures that the online prediction service can immediately adopt the latest, optimized model for residual prediction, enabling the entire prediction system to respond rapidly to dynamic changes in power supply and demand and unexpected events.

[0090] Example 5 It should be noted that the fusion service overlays and merges the first forecast result with the residual forecast value to obtain the real-time supply and demand forecast result, including: The first prediction result and the residual prediction value are aligned in time and prediction step size to obtain the linear prediction sequence and the residual prediction sequence in the same prediction time domain. The linear prediction sequence and the residual correction sequence are superimposed and fused to obtain the initial fused prediction result; The initial fusion prediction result is checked for consistency using the confidence interval corresponding to the first prediction result. When the initial fusion prediction result exceeds the confidence interval boundary, the initial fusion prediction result is clipped to the confidence interval boundary or reverted to the first prediction result to suppress overcorrection caused by abnormal residual correction. Perform business constraint verification and post-processing on the fusion prediction results after consistency verification; business constraint verification includes at least one of the following: non-negativity constraint, rate of change constraint, and capacity limit constraint; Real-time supply and demand forecast results that meet business constraints are written to the results storage and published to the real-time transaction business interface. At the same time, the model version identifier and data version identifier corresponding to the real-time supply and demand forecast results are recorded for traceability.

[0091] This application, when fusing the first prediction result and the residual prediction value, first ensures the temporal consistency of prediction sequences from different sources, laying the foundation for accurate superposition. Subsequently, a consistency verification mechanism based on the confidence interval of the first prediction result is introduced, effectively avoiding overcorrection problems that may arise from residual correction. Especially when there is significant uncertainty in the residual prediction, it can limit abnormal fusion results to a reasonable range, thereby significantly improving the robustness and reliability of the final prediction result. Furthermore, through business constraint verification and post-processing, it ensures that the prediction results conform to the physical laws and operating specifications of the actual power system. For example, it avoids negative values, limits unreasonable rates of change, and respects system capacity limitations, making the prediction results more practical and operable. Finally, by recording model version identifiers and data version identifiers, end-to-end traceability of the prediction results is achieved, greatly facilitating model iteration optimization, performance evaluation, and fault diagnosis, providing more accurate, stable, and reliable decision support for real-time power trading.

[0092] Example 6 Figure 2 This is a schematic diagram of the structure of a real-time power supply and demand forecasting system based on a cloud-native architecture, provided in one embodiment of this application. (Refer to...) Figure 2 A real-time power supply and demand forecasting system based on a cloud-native architecture includes: Processor 21 and memory 22; Processor 21 and memory 22 are connected via a communication bus: The processor 21 is used to call and execute the program stored in the memory 22; The memory 22 is used to store a program, which is at least used to execute a real-time power supply and demand forecasting method based on a cloud-native architecture as described in the above embodiments.

[0093] It is understood that the same or similar parts in the above embodiments can be referred to each other, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.

[0094] It should be noted that in the description of this application, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means at least two.

[0095] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the function involved, as will be understood by those skilled in the art to which embodiments of this application pertain.

[0096] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0097] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0098] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0099] The storage media mentioned above can be read-only memory, disk, or optical disk, etc.

[0100] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0101] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A real-time power supply and demand forecasting method based on cloud-native architecture, characterized in that, include: In a cloud-native cluster, a data access service is deployed in a containerized microservice manner to receive real-time supply and demand data streams and historical time-series data from the power trading system, and write the data streams into distributed storage. At the same time, the data is pushed to the prediction pipeline through a message queue. The preprocessing service performs timestamp alignment, missing value handling, and normalization on the supply and demand data, and performs smoothing and noise reduction on the aligned time series data to obtain a low-noise supply and demand sequence. Based on the low-noise supply and demand sequence, the ARIMA prediction service updates the ARIMA model parameters and outputs a linear prediction value within a scrolling window, which is denoted as the first prediction result. The predicted residual is calculated based on the first prediction result and the corresponding actual observation value. The residual time series sample is constructed, and the LSTM prediction service inputs the residual time series sample into the long short-term memory network to output the residual prediction value. The fusion service overlays and fuses the first prediction result with the residual prediction value to obtain the real-time supply and demand prediction result, and publishes the real-time supply and demand prediction result to the real-time transaction business interface.

2. The method according to claim 1, characterized in that, The method further includes: Obtain scaling metrics; the scaling metrics include at least one of the following: message queue backlog length, predicted request concurrency, and end-to-end inference latency; The cluster orchestration and elastic scheduling service automatically scales up and down the preprocessing service, ARIMA prediction service, LSTM prediction service and fusion service according to the scaling indicators, so that the real-time prediction throughput and response latency meet the preset thresholds under high concurrency conditions.

3. The method according to claim 1, characterized in that, The ARIMA prediction service updates the ARIMA model parameters and outputs a linear prediction value within a scrolling window based on the low-noise supply and demand sequence, denoted as the first prediction result, including: Perform change point detection on the low-noise supply and demand sequence within the current scrolling window, and adaptively adjust the length of the scrolling window based on the change point detection results; Perform multi-scale decomposition on the low-noise supply and demand sequence to obtain trend components and seasonal components; A set of ARIMA trend candidate models and a set of ARIMA seasonal candidate models are constructed for the trend component and the seasonal component, respectively, and then fitted in parallel. The candidate models are comprehensively scored based on the preset evaluation indicators, and the model with the best score is selected as the target model. The evaluation indicators include at least one of the following: information criterion, residual white noise test results, and nearest neighbor window prediction error. The parameters of the target model are incrementally updated using a recursive update method, and trend prediction values ​​and seasonal prediction values ​​are output based on the incrementally updated target model. The trend forecast value and the seasonal forecast value are superimposed to obtain a linear forecast value, and the confidence interval corresponding to the linear forecast value is output; wherein the linear forecast value is used as the first forecast result.

4. The method according to claim 3, characterized in that, The change point detection includes: When the change point detection result indicates that the low-noise supply and demand sequence has undergone a sudden structural change, the rolling window length will be adaptively shortened to the preset minimum window length or shortened by a preset ratio, and a model reconstruction request will be reported to the cluster orchestration and elastic scheduling service. The parallel fitting includes: The cluster orchestration and elastic scheduling service performs temporary scaling up of the ARIMA prediction service based on the model reconstruction request; Multiple ARIMA prediction service instances are driven to perform parallel fitting and comprehensive scoring selection on the ARIMA trend candidate model set and the ARIMA seasonal candidate model set, so as to determine the target model within a preset time limit and output the first prediction result. If the target model cannot be determined within the preset time limit, the system switches to a preset backup model to output the first prediction result, and continues to perform parallel fitting in the background for subsequent parameter updates and model switching in the scrolling window.

5. The method according to claim 3, characterized in that, The method further includes: When a sudden structural change is detected, the parameters of the target model are reinitialized and / or switched to a backup model.

6. The method according to claim 1, characterized in that, The LSTM prediction service inputs the residual time series samples into the Long Short-Term Memory network to output residual prediction values, including: Obtain the actual observed values ​​for the prediction period corresponding to the first prediction result, and calculate the difference between the actual observed values ​​and the first prediction result to obtain the residual sequence; When constructing the residual time series sample, the residual sequence is concatenated with the exogenous feature vector to form a multidimensional residual sample, the confidence interval width and prediction uncertainty corresponding to the first prediction result are determined, and the confidence interval width and prediction uncertainty are used as sample input features; the exogenous feature vector includes at least one of the following: meteorological features, holiday features, and weekday features; The residual sequence is decomposed into a multi-scale model to obtain at least one high-frequency residual component and one low-frequency residual component. The high-frequency residual component and the low-frequency residual component are then input into a dual-branch long short-term memory network for feature extraction. The residual contribution at different time steps is weighted by attention weights, and the residual prediction value and its confidence score are output. Based on the prediction uncertainty of the first prediction result and the reliability score of the residual prediction value, the residual correction coefficient is determined, and the final residual prediction value is output after the magnitude constraint is applied to the residual prediction value.

7. The method according to claim 6, characterized in that, The method further includes: Determine the distribution drift of the residual sequence; Online detection is performed on the distribution drift of the residual sequence. When the residual distribution drift index exceeds the preset drift threshold, a priority sample set containing burst peak samples is retrieved to perform incremental updates on the long short-term memory network.

8. The method according to claim 7, characterized in that, Performing incremental updates on the Long Short-Term Memory network includes: Identify sudden peak points in the residual sequence and mark the residual segments that meet the peak determination criteria as sudden peak samples; the peak determination criteria include: the absolute value of the residual exceeds a preset amplitude threshold, or exceeds a standard deviation multiple threshold obtained based on historical residual statistics, or exceeds a preset quantile threshold. Obtain the exogenous feature vectors corresponding to the burst peak samples, construct a priority sample pool based on the burst peak samples and their corresponding exogenous feature vectors, and assign priority weights to the samples in the priority sample pool; the priority weights are positively correlated with at least one of the residual amplitude, peak duration, and prediction uncertainty. When the incremental update is triggered, weighted sampling is performed from the priority sample pool according to the priority weight to form a priority sample set, and the priority sample set is mixed with the regular samples in the most recent scrolling window at a preset ratio to generate an incremental training batch. The Long Short-Term Memory network is subjected to mini-batch incremental training using the incremental training batches, and the updated network parameters are published to the online inference instance of the LSTM prediction service after training is completed for subsequent residual prediction.

9. The method according to claim 6, characterized in that, The fusion service overlays and fuses the first prediction result with the residual prediction value to obtain a real-time supply and demand prediction result, including: The first prediction result and the residual prediction value are time-aligned and prediction step size-aligned to obtain a linear prediction sequence and a residual prediction sequence in the same prediction time domain. The linear prediction sequence and the residual correction sequence are superimposed and fused to obtain an initial fused prediction result; The initial fusion prediction result is subjected to a consistency check using the confidence interval corresponding to the first prediction result. When the initial fusion prediction result exceeds the boundary of the confidence interval, the initial fusion prediction result is clipped to the boundary of the confidence interval or reverted to the first prediction result to suppress overcorrection caused by abnormal residual correction. The fusion prediction results that have passed the consistency check are subjected to business constraint verification and post-processing; the business constraint verification includes at least one of the following: non-negativity constraint, rate of change constraint, and capacity limit constraint; The real-time supply and demand forecast results that meet the business constraints are written into the result storage and published to the real-time transaction business interface. At the same time, the model version identifier and data version identifier corresponding to the real-time supply and demand forecast results are recorded for traceability.

10. A real-time power supply and demand forecasting system based on a cloud-native architecture, characterized in that, include: Processor and memory; The processor and memory are connected via a communication bus: The processor is used to call and execute the program stored in the memory; The memory is used to store a program, which is at least used to execute the real-time power supply and demand forecasting method based on cloud-native architecture as described in any one of claims 1-9.