Counterfactual causal inference based energy storage decision-making method and system for conformal risk control

CN123014471APending Publication Date: 2026-10-30NANTONG ALPHA ESS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611057604.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-16
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0003]上述现有方案存在致命的结构性技术缺陷,首先是混杂偏差导致的决策失效,现有深度学习模型仅学习变量间的统计相关性而非因果效应,无法识别由未观测混杂变量引起的虚假相关路径,例如高温天气同时导致光伏出力降低与空调负荷激增所形成的虚假关联,在分布式能源渗透率变化时会出现策略失效;其次是反事实查询能力的缺失,储能套利本质是对系统的干预,现有技术只能回答未来状态的预测问题,无法回答不同干预动作下净收益因果增量的反事实问题,导致系统在从未见过的市场状态下无法评估新策略的风险;最后是预测不确定性下的风险失控,边缘端模型存在认知不确定性与偶然不确定性,传统点预测输出在极端电价跳变时缺乏统计保证,极易导致严重套利亏损或电池过充风险

Benefits of technology

1、通过SSDAE结合后门调整机制,在传统损失函数中引入混杂互信息最小化项,利用梯度反转层显式剥离未观测混杂变量的影响,阻断虚假相关路径,解决了传统深度学习模型仅学习统计相关性而非因果效应的问题,使系统在分布式能源渗透率变化等场景下仍能保持稳定的决策效果;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123014471A_ABST
    Figure CN123014471A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of home energy storage control, in particular to a method and system for energy storage decision-making based on counterfactual causal inference and conformal risk control, a three-layer causal reasoning engine of "causal discovery-counterfactual estimation-risk calibration" is constructed, mixed bias is eliminated through stacking sparse denoising autoencoder combined with backdoor adjustment mechanism, potential results under different interventions are estimated in parallel by using multi-branch one-dimensional convolutional neural network, double machine learning is introduced to calculate the conditional average processing effect, a counterfactual prediction interval with 1-alpha coverage guarantee is constructed based on conformal prediction, and a conservative optimization decision considering battery health is executed; the present application solves the problems of decision failure, counterfactual ability loss and risk out of control caused by mixed bias in the prior art, the decision accuracy is improved by 34% compared with the traditional architecture, the loss times in the extreme electricity price scene are reduced by 87%, and the present application can be deployed in an edge gateway in a light weight manner, and the user data privacy and decision real-time performance are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of home energy storage control technology, specifically to a method and system for energy storage decision-making based on counterfactual causal inference and conformal risk control. Background Technology

[0002] With the highly market-oriented development of the electricity spot market, electricity prices exhibit significant non-stationarity and extreme volatility, including negative electricity prices and peak electricity prices, posing a severe challenge to the decision-making capabilities of home energy storage management systems. Current home energy storage forecasting technology has evolved through three generations: the first generation, based on statistical models such as ARIMA or Kalman filtering, cannot handle nonlinear fluctuations in the power system; the second generation, based on deep learning models such as LSTM and GRU, relies on cloud computing power for data processing and model inference, posing a risk of privacy leaks to user electricity consumption data; the third generation, based on edge prediction technology using lightweight CNN-Stacked Sparse Denoising Autoencoders (SSDAE), achieves edge deployment of the model, but is still limited to passive observation learning and cannot extract causal relationships between variables from observation data. Existing cutting-edge home energy storage management solutions generally adopt a serial architecture of "deep forecasting + model predictive control (MPC)," with the front end using CNN-SSDAE to denoise and extract features from load and electricity prices, and the back end using an MPC solver to make optimization decisions based on the predicted values.

[0003] The aforementioned existing solutions suffer from fatal structural and technical flaws. First, decision failures arise from confounding bias. Existing deep learning models only learn statistical correlations between variables, not causal effects, and cannot identify spurious correlation paths caused by unobserved confounding variables. For example, the spurious correlation formed by high temperatures simultaneously leading to a decrease in photovoltaic output and a surge in air conditioning load can cause strategy failures when the penetration rate of distributed energy changes. Second, there is a lack of counterfactual query capabilities. Energy storage arbitrage is essentially an intervention in the system. Existing technologies can only answer the question of predicting future states, but cannot answer the counterfactual question of the causal increment of net revenue under different intervention actions. This makes it impossible for the system to assess the risks of new strategies in market conditions that have never been seen before. Finally, there is the risk of runaway under predictive uncertainty. Edge models suffer from cognitive uncertainty and accidental uncertainty. Traditional point prediction outputs lack statistical guarantees when there are extreme changes in electricity prices, which can easily lead to serious arbitrage losses or battery overcharging risks.

[0004] Specifically, the existing "deep prediction + MPC" architecture adopts structural risk minimization rather than causal risk minimization. The loss function of CNN-SSDAE only includes reconstruction error and sparsity penalty, without explicit modeling of confounding variables, and the extracted features still contain spurious correlation paths. At the same time, the model outputs conditional expectations rather than the potential results under the structural causal model, resulting in counterfactual unidentifiableness and inability to extrapolate to the counterfactual distribution. In addition, MPC is optimized based on point prediction, ignoring the heavy-tailed characteristics of prediction errors. In the high-leverage scenario of the electricity spot market, a single extreme prediction error may completely offset the entire cycle of returns. Therefore, in view of the above situation, there is an urgent need to develop energy storage decision-making methods and systems based on counterfactual causal inference and conformal risk control to overcome the shortcomings in current practical applications. Summary of the Invention

[0005] The purpose of this invention is to provide a method and system for energy storage decision-making based on counterfactual causal inference and conformal risk control, so as to solve the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: The energy storage decision-making method based on counterfactual causal inference and conformal risk control includes the following steps: S1: Causal discovery and confounding removal: Acquire multi-source observation data, extract deconfounding causal features by stacking sparse noise reduction autoencoders combined with backdoor adjustment mechanisms, and construct a directed acyclic causal graph between variables based on the deconfounding causal features; S2: Counterfactual prediction and causal effect estimation: Based on the directed acyclic causal graph, a multi-branch one-dimensional convolutional neural network is used to estimate the potential results of different intervention actions of the energy storage system in parallel, and the conditional average treatment effect is calculated through a dual machine learning framework. S3: Conformal Risk Calibration and Decision-Making: Based on conformal prediction theory, a counterfactual prediction interval with statistical coverage guarantee is constructed, and a conservative optimization strategy is adopted to select the intervention action that maximizes the net benefit in the worst case. S4: Output and execute the charging / discharging command corresponding to the optimal intervention action.

[0007] As a further aspect of the present invention: step S1 specifically includes: Construct a total loss function that includes a reconstruction error term, a sparse penalty term, and a term that minimizes promiscuous mutual information:

[0008] in, Reconstruction error; Target sparsity, typically set to 0.05; : The average activation rate of the l-th layer, where m is the number of training samples; Hidden layer features Confounding variables with unobserved Mutual information; and : These are the weight coefficients for the sparsity penalty term and the confounding elimination term, respectively; The hybrid mutual information minimization term is approximately optimized by using a gradient reversal layer, so that the hidden layer features satisfy conditional independence W⊥Y∣H, thus blocking false correlation paths; Based on the aforementioned deconfounded causal features, a directed acyclic causal graph is constructed using an attention-based graph neural network, and a differentiable DAG constraint is introduced. To ensure the acyclicity of the cause-effect graph, where, For the trace of the matrix, For Hadamard product, This is a matrix exponentiation operation, where d is the dimension of the variable.

[0009] As a further aspect of the present invention: step S2 specifically includes: Independent one-dimensional convolutional branches are configured for the three intervention actions of charging, discharging, and idle, and the potential benefits under each intervention action are estimated in parallel. Train the propensity score model and outcome regression model, and calculate the residual results and residual interventions; Based on the residual results and the residual intervention calculation, the conditional average treatment effect is calculated, which represents the causal benefit increment of performing the target intervention action relative to the baseline intervention action under given characteristics; Add counterfactual consistency constraints to the loss function:

[0010] in, For the actual intervention actions observed, Let X be the gradient of the counterfactual estimate with respect to feature X.

[0011] As a further aspect of the present invention: step S3 specifically includes: The inconsistency score is calculated using historical calibration data. The inconsistency score is obtained by weighted summation of fact prediction error and counterfactual outcome variance. Calculate the empirical quantile of the inconsistency score, construct a counterfactual prediction interval for each intervention action, and ensure that the probability of the actual potential outcome falling into the prediction interval is not less than 1-α, where α is the acceptable risk level set by the user. The intervention action that maximizes the worst-case net benefit is selected, where the worst-case net benefit is the lower bound of the prediction interval minus the battery health degradation cost, which is calculated based on the cell temperature, state of charge, and equivalent full cycle count reported in real time by the battery management system.

[0012] As a further aspect of the present invention, it also includes a lightweight model deployment step: The complete causal model is compressed into a lightweight student model through knowledge distillation; The lightweight student model is quantized using INT8, so that the quantized model can be deployed on a resource-constrained home edge gateway. Caching calibration data and calculated quantiles in the edge gateway reduces the memory footprint of real-time inference.

[0013] An energy storage decision-making system based on counterfactual causal inference and conformal risk control includes: The data acquisition module is used to acquire multi-source observation data; The causal discovery and confounding removal module is used to extract deconfounding causal features by stacking sparse noise reduction autoencoders combined with a backdoor adjustment mechanism, and to construct a directed acyclic causal graph between variables based on the deconfounding causal features. The counterfactual prediction and causal effect estimation module is used to estimate the potential results of different intervention actions of the energy storage system in parallel using a multi-branch one-dimensional convolutional neural network based on the directed acyclic causal graph, and to calculate the conditional average processing effect through a dual machine learning framework. The conformal risk calibration decision module is used to construct counterfactual prediction intervals with statistical coverage guarantees based on conformal prediction theory, and to select intervention actions that maximize the net benefit in the worst case using a conservative optimization strategy. The output module is used to output and execute the charging and discharging commands corresponding to the optimal intervention action.

[0014] As a further aspect of the present invention: the causal discovery and confounding elimination module includes: Stacked sparse noise reduction autoencoder units are used for noise reduction and dimensionality reduction of high-dimensional observable features; The backdoor adjustment unit is used to introduce a promiscuous mutual information minimization term into the loss function of the stacked sparse noise reduction autoencoder and remove the influence of unobserved promiscuous variables through a gradient reversal layer. The causal graph learning unit is used to construct a directed acyclic causal graph based on deconfounded causal features through an attention mechanism in a graph neural network, and introduces a differentiable DAG constraint. Ensure the causal graph is acyclic.

[0015] As a further aspect of the present invention: the counterfactual prediction and causal effect estimation module includes: A multi-branch one-dimensional convolutional neural network unit is configured with independent convolutional branches for three intervention actions: charging, discharging, and idle, and the potential benefits under each intervention action are estimated in parallel. A dual machine learning unit is used to train a propensity score model and an outcome regression model, calculate residual outcomes and residual interventions, and calculate the conditional average treatment effect based on the residual outcomes and residual interventions; The counterfactual consistency constraint unit is used to add counterfactual consistency constraints to the loss function to ensure the stability and generalization ability of the counterfactual estimation.

[0016] As a further aspect of the present invention: the conformal risk calibration decision module includes: The inconsistency score calculation unit is used to calculate the inconsistency score obtained by weighted summation of fact prediction error and counterfactual outcome variance using historical calibration data; A prediction interval construction unit is used to calculate the empirical quantile of the inconsistency score and construct a counterfactual prediction interval with a 1-α statistical coverage guarantee for each intervention action; A conservative optimization unit is used to select the intervention action that maximizes the worst-case net benefit, wherein the worst-case net benefit is the lower bound of the prediction interval minus the battery health degradation cost, and the battery health degradation cost is calculated based on the physical parameters reported in real time by the battery management system.

[0017] As a further aspect of the present invention, it also includes a cloud-edge collaboration module and a lightweight deployment unit. The cloud-edge collaboration module is used to perform global causal graph learning and model pre-training in the cloud, and to distribute compressed model weights to the edge via OTA. The lightweight deployment unit is used to compress the causal model to a lightweight level through knowledge distillation and INT8 quantization techniques, enabling the model to be deployed on a home edge gateway and to make decisions independently in a network-off environment.

[0018] Compared with the prior art, the beneficial effects of the present invention are: 1. By combining SSDAE with a backdoor adjustment mechanism, a confounding mutual information minimization term is introduced into the traditional loss function. The gradient reversal layer is used to explicitly remove the influence of unobserved confounding variables and block the false correlation path. This solves the problem that traditional deep learning models only learn statistical correlation rather than causal effects, and enables the system to maintain stable decision-making performance in scenarios such as changes in the penetration rate of distributed energy. 2. Construct a multi-branch intervention-specific 1D-CNN architecture, configure independent convolutional branches for different intervention actions such as charging, discharging, and idle, estimate the potential results under different interventions in parallel, and introduce a dual machine learning framework to correct observation bias and accurately calculate the conditional average treatment effect. This enables the system to answer the counterfactual question of the causal increment of net income under different intervention actions, and can effectively assess the risk of new strategies even in unseen market conditions. 3. Based on conformal prediction theory, a counterfactual prediction interval with limited sample coverage is constructed to ensure that the probability of the actual potential result falling into the interval is not less than 1-α. A conservative optimization strategy is adopted to select the intervention action that maximizes the net profit in the worst case, avoiding serious losses caused by extreme prediction errors. At the same time, the cost of battery health degradation is incorporated into the decision optimization to achieve a balance between short-term arbitrage income and long-term asset value. 4. By using knowledge distillation and INT8 quantization technology, the causal model is compressed to a lightweight size of only 180KB. The conformal prediction module occupies about 500KB of memory and can be deployed on resource-constrained home edge gateways. It can still independently perform causal inference and risk calibration decisions in the absence of network, avoiding the privacy leakage risk caused by uploading sensitive user electricity data to the cloud. 5. Utilize high-performance cloud computing resources for global causal graph learning and model pre-training. Deploy compressed model weights to the edge via OTA. The edge only performs forward inference, which significantly reduces the computing power consumption on the edge while meeting the real-time requirement of 15-minute decision-making. 6. In extreme electricity price scenarios, it can effectively identify false causal relationships and avoid extreme losses; the verification results of edge deployment show that the causal decision accuracy of the present invention is 34% higher than that of the traditional "deep prediction + MPC" architecture, and the number of losses in extreme electricity price scenarios is reduced by 87%. Attached Figure Description

[0019] Figure 1 This is a flowchart of the energy storage decision-making method based on counterfactual causal inference and conformal risk control in an embodiment of the present invention. Detailed Implementation

[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0021] The specific implementation of the present invention will be described in detail below with reference to specific embodiments.

[0022] Please see Figure 1 The present invention provides a method and system for energy storage decision-making based on counterfactual causal inference and conformal risk control. It constructs a three-layer causal inference engine of "causal discovery-counterfactual estimation-risk calibration", which reconstructs the "prediction-optimization" serial architecture of the traditional home energy storage management system into an end-side causal decision agent architecture. This fundamentally solves the problems of decision failure caused by mixed bias, lack of counterfactual query capability and risk runaway under prediction uncertainty in the existing technology.

[0023] The overall technical process of this invention is as follows: First, a stacked sparse denoising autoencoder (SSDAE) combined with a backdoor adjustment mechanism is used to extract deconfounded causal features from high-dimensional observation data. Then, an attention graph neural network is used to learn a directed acyclic causal graph (DAG) between variables. Subsequently, a multi-branch one-dimensional convolutional neural network (1D-CNN) is constructed based on the causal graph structure prior to estimate the potential results under different intervention actions in parallel. The observation bias is corrected through a dual machine learning (DML) framework, and the conditional average treatment effect (CATE) is calculated. Finally, a counterfactual prediction interval with statistical coverage guarantee is constructed based on conformal prediction theory. Conservative optimization decisions are performed at the edge to select the charging and discharging action that maximizes the worst-case net benefit. The efficient collaboration between model training and edge inference is achieved through a cloud-edge collaborative architecture.

[0024] I. Causal Discovery and Confounding Elimination Module The purpose of this module is to automatically learn the causal structure between variables from multi-source heterogeneous observation data, identify and block spurious correlation paths caused by unobserved confounding variables, and provide reliable causal priors for subsequent counterfactual inference.

[0025] S1.1 Definition of the set of causal variables First, define the complete set of causal variables for the system. ,in: : Observable feature vector, including historical household load sequence, electricity spot market price sequence, photovoltaic irradiance sequence, ambient temperature sequence, etc., where d is the dimension of the observable feature; : A set of intervention actions for the energy storage system, where -1 represents a discharge action, 0 represents an idle action, and 1 represents a charging action; Outcome variable, defined as the cumulative net arbitrage profit within the next 4 hours after the intervention action is performed; : The set of unobserved confounding variables, including user behavior patterns, grid-side market game behavior, changes in the overall penetration rate of distributed energy, and other variables that cannot be directly measured, k is the dimension of the confounding variables.

[0026] By defining the variables as described above, all key elements affecting energy storage decisions in the system are identified, a complete causal modeling space is constructed, and causal structure learning bias caused by the omission of dependent variables is avoided.

[0027] S1.2 SSDAE Encoding and Backdoor Adjustment An L-layer stacked sparse denoising autoencoder (SSDAE) is constructed to denoise and reduce the dimensionality of the high-dimensional observable features X. The encoding process of the l-th layer is as follows:

[0028] in, : No. A noisy version of the layer output, which is probabilistically added during training. Randomly set to zero or add Gaussian noise To improve the robustness of the model; The weight matrix of the l-th layer encoder, n l This represents the number of neurons in the l-th layer. : The bias vector of the l-th layer encoder; : Activation function, which can be ReLU or Tanh function.

[0029] The decoder output is: ; Among them, W dec Let b be the decoder weight matrix. dec h is the decoder bias vector. (L) H represents the hidden layer feature H of the encoder's last layer output.

[0030] This invention introduces a confounding elimination term into the loss function of traditional SSDAE to construct the total loss function:

[0031] in, Reconstruction error; Target sparsity, typically set to 0.05; : The average activation rate of the l-th layer, where m is the number of training samples; Hidden layer features Confounding variables with unobserved Mutual information; and : These are the weight coefficients for the sparse penalty term and the confounding elimination term, respectively; KL refers to the Kullback-Leibler divergence (KL divergence for short), which measures the difference between the "standard sparse distribution" and the "actual activation distribution".

[0032] For the confounding variable Z, which cannot be directly observed, this invention approximates the mutual information minimization term through a gradient inversion layer (GRL): 1. Train a discriminator D to predict confounding variable Z from hidden layer features H, with the loss function being:

[0033] 2. During encoder training, the gradient inversion layer inverts the gradient of the discriminator's loss, making the learned feature H as unpredictable as possible by the discriminator, thereby achieving... The goal.

[0034] Through the aforementioned backdoor adjustment mechanism, the influence of unobserved confounding variables on features can be explicitly removed, ensuring that the hidden layer features H satisfy the conditional independence W⊥Y∣H. This fundamentally blocks the spurious correlation path X←Z→Y and solves the problem that traditional deep learning models only learn statistical correlations rather than causal effects.

[0035] S1.3 DAG Structure Learning Based on Attention Mechanism After obtaining the decontamination features H, an attention-based graph neural network (GNN) is constructed to learn the causal graph structure. The specific steps are as follows: 1. Initialize a continuously relaxed adjacency matrix A ij This represents the causal strength from variable i to variable j; 2. Calculate the causal association weights between variables using an attention mechanism:

[0036] in, : These are the characteristic representations of variables i and j, respectively; : Linear transformation matrix, used to map the original features to the attention space; Attention parameter vector; Vector concatenation operation; : The set of adjacent nodes of variable i.

[0037] 3. Introduce a differentiable DAG constraint to ensure that the learned causal graph is acyclic: ,in, For matrix trace, For Hadamard product, This is a matrix exponentiation operation, where d is the dimension of the variable.

[0038] 4. Output the final learned causal graph. Where E is the set of causal edges, all backdoor paths can be clearly identified through this causal graph. and .

[0039] The attention mechanism can adaptively capture the causal strength between variables, while the differentiable DAG constraint ensures the structural rationality of the causal graph, avoiding the combinatorial explosion problem in traditional causal discovery algorithms, and realizing end-to-end causal structure learning.

[0040] II. Counterfactual Prediction and Causal Effect Estimation Module The purpose of this module is to build upon the causal graph learned above. The potential outcomes Y(w) under different intervention actions are estimated, and the causal benefit increment of the intervention action relative to the baseline is calculated, providing a quantitative causal basis for decision-making.

[0041] S2.1 Feature Space Reshaping Causal features output by SSDAE (where T is the time step, d) h Reshape the data (in terms of feature dimensions) into a tensor format suitable for one-dimensional convolution operations, i.e., with shape (batch_size, T, d). h The three-dimensional tensor of ) is used to extract local causal features in time series using 1D-CNN.

[0042] S2.2 Multi-branch Counterfactual 1D-CNN Architecture This invention constructs an intervention-specific convolutional network, rather than a traditional single-output prediction network, tailored to each intervention action. Each convolutional branch is configured independently, and the convolutional output at the i-th time step is:

[0043] in, :action The corresponding convolution kernel weight matrix, The size of the receptive field of the convolution kernel. The number of convolution channels; One-dimensional convolution operation; Time step arrive Feature slices; :action The corresponding convolution bias vector.

[0044] After performing max pooling and flattening operations on the convolutional output of each branch, the result is fed into an action-specific fully connected layer to obtain an estimate of the potential reward for that action.

[0045] Where σ is the activation function, and Actions The corresponding fully connected layer weights and biases, For action The estimated potential returns.

[0046] S2.3 Dual Machine Learning (DML) Residual Correction To address the selection bias caused by the non-randomness of intervention allocation in the observation data (i.e., W depends on X), this invention introduces a dual machine learning framework for causal effect estimation, with the specific steps as follows: 1. Training the propensity score model It is used to estimate the probability of performing a charging action given a feature X, and is trained using the cross-entropy loss function; 2. Regression Model Based on Training Results The expected return is estimated for a given feature X and is obtained by joint training of SSDAE and 1D-CNN. 3. Calculate residual results and residual intervention:

[0047] in and These are the predicted values ​​from the outcome regression model and the propensity score model, respectively. 4. Calculate the Conditional Average Treatment Effect (CATE):

[0048] This value indicates the execution under feature X. (Charging) relative to The causal benefit increment.

[0049] Dual machine learning eliminates the influence of observable features on intervention allocation and outcomes through residual processing, enabling accurate estimation of causal effects in observational data with selection bias, thus solving the problem that traditional methods cannot handle non-random interventions.

[0050] S2.4 Counterfactual Consistency Constraint To ensure the rationality and stability of counterfactual estimation, this invention incorporates counterfactual consistency constraints into the loss function:

[0051] in, For the actual intervention actions observed, Let X be the gradient of the counterfactual estimate with respect to feature X.

[0052] This constraint has two aspects: firstly, it is a factual constraint, ensuring that the actions actually performed are subject to certain conditions. The model's predicted values ​​and the actual observed values The model is designed to be as close as possible to the real facts; secondly, it employs counterfactual smoothness constraints to ensure that counterfactual estimates do not change abruptly under similar features. Based on the neighborhood counterfactual stability assumption, this improves the model's generalization ability in unseen market conditions.

[0053] III. Conformal Risk Calibration Decision Module The purpose of this module is to provide a risk calibration mechanism with strict statistical coverage guarantees for energy storage decisions in the presence of forecast uncertainty, so as to ensure the worst-case return and avoid serious losses caused by extreme forecast errors.

[0054] S3.1 Calculation of Inconsistent Scores Retain the most recent N in the edge gateway cal Historical data from the past 10 days is used as the calibration set. For each sample in the calibration set... i, calculate the inconsistency score:

[0055] The first term is the factual prediction error, which measures the accuracy of the model's prediction of actual outcomes; the second term is the counterfactual outcome variance, which measures the diversity of potential outcomes under different intervention actions. This represents the diversity penalty coefficient. Variance calculation: Calculates the variance of the potential outcome estimates for all actions.

[0056] Inconsistent score calculation:

[0057] The meanings of each parameter in the formula are as follows:

[0058] Explanation of key correspondences: The first term (fact prediction error): corresponds to the formula in... This measure is the accuracy of the model's predictions of actual actions. If the model accurately predicts the actual outcome, this term approaches 0.

[0059] The second term (variance of counterfactual outcomes): corresponds to the formula in... This measures the degree of difference between the potential outcomes estimated by the model for different actions. If the predicted returns for charging, discharging, and idling differ significantly, the variance is large, indicating high decision-making risk and requiring a wider prediction range to cover uncertainty.

[0060] By comprehensively considering both factual prediction error and counterfactual outcome variance, the predictive uncertainty of the model can be fully quantified, providing a reliable basis for subsequent risk calibration.

[0061] S3.2 Quantile Calculation and Prediction Interval Construction Calculate the empirical quantiles of all non-consistent scores on the calibration set:

[0062] The parameters have the following meanings:

[0063] Features of the current moment For each intervention action Constructing counterfactual prediction intervals:

[0064]

[0065] This invention provides a strict finite sample coverage guarantee:

[0066] The meanings of each parameter in the formula are as follows:

[0067] That is, the probability that the actual potential result falls into the corresponding prediction interval is not less than 1-α. This guarantee does not depend on any model assumptions, but is based solely on the independent and identically distributed assumption of the calibration set, and has extremely strong robustness.

[0068] S3.3 Conservative Decision Optimization This invention does not employ the traditional point estimation maximum decision-making strategy, but instead adopts a conservative optimization strategy, selecting the intervention action that maximizes the worst-case net benefit:

[0069] in, :action The lower bound of the return, i.e. the worst-case return; :action The resulting costs associated with degraded battery state of health (such as depth of discharge costs); : Profit-Health Tradeoff Coefficient, used to balance arbitrage profits and battery life.

[0070] Battery health degradation cost The calculation relies on physical parameters reported in real time by the battery management system (BMS), including the current cell temperature T. cell The state of charge (SOC) and the equivalent number of full cycles over the battery's lifetime are used to quantify the action, combining the ampere-hour integral and internal resistance increment model. The expected depth of discharge (DoD) is calculated and converted into economic costs.

[0071] Battery health degradation cost The calculation formula is as follows: ; Among them, the economic cost of unit capacity decay The calculation formula is:

[0072] The meanings of each parameter in the formula are as follows:

[0073] action equivalent capacity decay The calculation formula is:

[0074] Actual charge throughput The calculation formula is:

[0075] The meanings of each parameter in the formula are as follows:

[0076] DoD stress factor The nonlinear acceleration effect of discharge depth on cycle life is characterized by the following formula:

[0077]

[0078] The meanings of each parameter in the formula are as follows:

[0079] Temperature acceleration factor The Arrhenius acceleration effect, characterizing the cell temperature on the aging rate, is calculated using the following formula:

[0080] The meanings of each parameter in the formula are as follows:

[0081] Internal resistance increment correction factor The secondary accelerating effect of the decrease in current internal resistance relative to the factory internal resistance on aging is represented by the following formula:

[0082] The meanings of each parameter in the formula are as follows:

[0083] Through the above-mentioned conservative decision optimization, the worst-case return can be guaranteed under statistical uncertainty, while taking into account the long-term health of the battery and avoiding irreversible damage to the battery caused by overcharging and discharging, thus achieving a balance between short-term arbitrage income and long-term asset value.

[0084] S3.4 Lightweight Deployment To enable the aforementioned causal reasoning engine to run efficiently in resource-constrained home edge gateways, this invention employs knowledge distillation and quantization techniques for model lightweighting: Knowledge distillation: The trained complete causal model is used as the teacher model to train a lightweight student model. The student model adopts an architecture of 1 layer SSDAE + single shared convolutional layer + 3 lightweight fully connected heads, compressing the number of parameters from 2.1M to 180K. INT8 quantization: The weights and activation values ​​of the student model are quantized from 32-bit floating-point to 8-bit integers, further compressing the model size to 180KB and reducing the inference latency from 45ms (GPU) to 12ms (ARM Cortex-A53). Conformal prediction caching: Only the calibration data from the most recent 30 days is retained in the edge gateway (N cal =2880 points), and cache the calculated quantiles. Based on the calibration error distribution, the memory footprint is approximately 500KB.

[0085] Edge gateways typically use ARM Cortex-A series processors with at least 256MB RAM and 8GB Flash storage, which can meet the inference and data storage requirements of the aforementioned lightweight models. Furthermore, they can still independently perform causal inference and risk calibration decisions in a network-off environment, ensuring the reliability and privacy of the system.

[0086] IV. Cloud-edge collaborative architecture and underlying physical execution closed loop This invention adopts a cloud-edge collaborative architecture of "cloud training-edge inference", which makes full use of the high computing power resources in the cloud to complete complex model training, while realizing low-latency real-time decision-making and physical control at the edge.

[0087] S4.1 Cloud-based Joint Training and Causal Graph Deployment Given the high computational demands of causal discovery and dual machine learning during the training phase, this invention performs global model training on a cloud server: 1. Collect massive amounts of historical electricity consumption data, meteorological data, and historical electricity spot market transaction data from households in the cloud to construct a large-scale training dataset; 2. Execute the causal discovery module in the cloud to learn the global causal graph structure and pre-train the counterfactual 1D-CNN model; 3. After training is completed, the extracted fixed causal topological priors and the compressed and quantized student model weights are distributed to the edge computing gateways of each household via OTA (Over-The-Air).

[0088] OTA upgrades use the standard HTTP / HTTPS protocol, supporting breakpoint resumption and signature verification to ensure the integrity and security of model weights. In daily operation, the edge gateway no longer undergoes intensive training; it only performs forward causal inference by observing streaming data in real time, significantly reducing the computational power consumption on the edge.

[0089] S4.2 Edge-side Conformal Calibration and Physical Control Interface The edge gateway collects multi-source heterogeneous data in real time (15-minute intervals) from smart meters, including current electricity price, household load, photovoltaic output, and battery SOC. It then executes the aforementioned conformal prediction calibration process to determine the optimal intervention action W under the worst-case scenario. ∗ (For example: discharging at a power of 3kW).

[0090] Subsequently, the edge gateway maps this action into an underlying active power scheduling command via the local area network. The communication protocol can be RS485 or Modbus TCP. These two protocols are standard protocols commonly used in the field of industrial control and are widely used in the communication of devices such as smart meters and energy storage converters, ensuring that the command can be sent to the energy storage converter for execution with low latency and high reliability.

[0091] S4.3 BMS Physical Constraints and SOH Degradation Quantification When executing charge and discharge commands, the energy storage converter must strictly adhere to the physical constraints of the battery management system (BMS), including maximum charge and discharge power, permissible state of charge (SOC) range, and cell temperature limits. The BMS reports the battery's physical parameters to the edge gateway in real time via the CAN bus, and the edge gateway dynamically adjusts its configuration based on these parameters. The calculated value allows the causal benefits at the algorithm level to be offset against the physical losses at the underlying electrochemical level on the same dimension.

[0092] Through the aforementioned physical execution closed loop, the technical effect of transforming from pure algorithm calculation to physical equipment safety control is realized, ensuring the safe and stable operation of the energy storage system.

[0093] Example 1: Extreme Electricity Price Scenario in the Australian NEM Market This embodiment verifies the effectiveness of the present invention under extreme electricity price scenarios in the Australian National Electricity Market (NEM).

[0094] Scenario: At 2:00 PM one afternoon, the weather forecast indicates a sudden thunderstorm (confounding variable Z), causing a sharp 30% drop in grid-level photovoltaic output, while residential air conditioning load surges by 40%. Historical data shows that extreme electricity price fluctuations often occur during this period, ranging from -50 AUD / MWh (negative electricity price) to 15,000 AUD / MWh (peak electricity price).

[0095] Current technical performance: The traditional CNN-SSDAE+MPC architecture prediction model only learns the statistical correlation of "low PV output + high load → high electricity price", thus recommending that the energy storage system be charged at full power. However, in reality, thunderstorms affect both grid-level PV and residential PV simultaneously, resulting in a complex causal path. This leads to a 300% error in the model's electricity price prediction, and performing charging would pose a huge risk of loss.

[0096] Execution flow of this invention: 1. Causal discovery: SSDAE successfully isolated the influence of the confounding factor of "thunderstorm" through the backdoor adjustment mechanism, and identified that there is no direct causal relationship between "energy storage charging action" and "local electricity price" (local electricity price is mainly dominated by grid-level supply and demand relationship), thus blocking the false decision-making path; 2. Counterfactual estimation: Multi-branch 1D-CNN is used to estimate the potential gains of different actions in parallel, and the results are calculated. The CATE is -2.3AUD (negative return). The CATE is 0.5 AUD; 3. Risk calibration: At the user-defined confidence level of α=0.05, a counterfactual prediction range is constructed. The revenue range for charging actions is [-15, +5] AUD, and the revenue range for idle actions is [0, +2] AUD. 4. Decision Output: The conservative optimizer selects the action that maximizes the worst-case benefit, i.e. This successfully avoided the severe losses that could have been caused by extreme electricity price fluctuations.

[0097] Example 2: Model Compression and Edge Deployment Verification This embodiment verifies the lightweight effect of the model and the performance of edge deployment of the present invention.

[0098] Original model configuration: 3 layers of SSDAE (128 neurons per layer) + 3 branches of 1D-CNN (32 channels per branch), with a total of 2.1M parameters and an inference latency of 45ms on the GPU.

[0099] Lightweight process: 1. Knowledge distillation: Using the original model as the teacher, train the student model (1-layer SSDAE + single shared convolutional layer + 3 lightweight fully connected heads), compressing the number of parameters to 180K, with a model accuracy loss of less than 2%; 2. INT8 quantization: The weights and activation values ​​of the student model are quantized with 8-bit integers, compressing the model size from 720KB to 180KB; 3. Conformal prediction cache: Retains calibration data from the most recent 30 days (2880 samples), stores quantiles and calibration error distribution, and occupies approximately 500KB of memory.

[0100] Deployment Verification: The lightweight model was deployed to a home edge gateway configured with an ARM Cortex-A53 processor and 256MB of RAM, and ran continuously for 30 days. The test results showed: The average inference latency is 12ms, which meets the real-time requirement for 15-minute decision-making. The accuracy of causal decision-making is improved by 34% compared to the traditional CNN-SSDAE+MPC architecture; Under extreme electricity price scenarios, the number of loss incidents decreased by 87%, verifying the effectiveness and robustness of the invention.

[0101] Example 3: Comparative Experiment Verification and Performance Evaluation To verify the actual technical effect of this invention compared to existing technologies, a large-scale comparative experiment was conducted in a real market environment. The specific experimental setup and results are as follows: S5.1 Experimental Dataset and Source The experiment used 5-minute historical electricity price data from the NEM electricity spot market, publicly released by the Australian Energy Market Operator (AEMO), spanning from January 1, 2023 to December 31, 2023, totaling 105,120 time steps, fully covering seasonal electricity price fluctuations and extreme weather events (such as the Sydney thunderstorms in February 2023 and the Melbourne cold wave in July 2023, which led to negative and peak electricity price events).

[0102] Household load and PV output data are sourced from AEMO's SolarHomeDataset. A total of 120 real households in Sydney, Melbourne, and Brisbane with rooftop PV and residential energy storage systems were selected. Each household's data includes 1-minute active power, PV inverter output, and battery SOC records. After resampling and alignment to 15-minute intervals, the total sample size was determined. One decision point.

[0103] S5.2 Comparison Benchmark Scheme The comparison scheme adopts a typical "depth prediction + MPC" serial architecture in existing technologies, with the following specific configuration: Prediction layer: 3-layer CNN-SSDAE (128 neurons per layer, sparsity) The input is the historical load, electricity price, and irradiance sequence of the past 4 hours, and the output is the electricity price forecast for the next 4 hours. Optimization side: Linear MPC solver based on point prediction, with the objective function being to maximize arbitrage profit, and the constraints being the upper and lower limits of battery SOC and power limit; This comparison scheme is consistent with existing literature (such as [1-2 similar patents or papers may be cited here]) to ensure the fairness and reproducibility of the comparison.

[0104] The configuration of the present invention is as follows: Causal discovery layer: 3-layer SSDAE (128 neurons) + attention GNN, with backdoor adjustment coefficients. ; Counterfactual estimation end: 3-branch 1D-CNN (32 channels per branch, kernel size) +DML residual correction; Risk calibration end: Calibration set length (30 days × 96 points / day), risk level ; Decision-making: Conservative optimization, battery health trade-off coefficient .

[0105] S5.3 Evaluation Indicator Definition Causal Decision Accuracy (CDA) is defined as: the intervention action output by the algorithm across all time steps in the test set. The optimal action calculated afterward based on the actual electricity price Consistency ratio: in, The optimal action is obtained after the fact by deterministic optimization based on the real future electricity price sequence.

[0106] The Extreme Price Loss Count (EPLC) is defined as the number of losses in an extreme electricity price scenario when the absolute value of the electricity price exceeds a certain threshold. During extreme periods (including negative electricity prices and peak electricity prices), algorithmic decisions result in negative net returns (i.e., actual returns). (The frequency of ).

[0107] S5.4 Experimental Results The comparison results of the two schemes on the same test set of 120 households are as follows:

[0108] The above experimental results are based on the average of three groups of different random seed initializations, with a standard deviation of less than 1.5%, which is statistically significant.

[0109] S5.5 Results Analysis Experimental results show that this invention achieves significant technical improvements on real market datasets by identifying confounding biases through causal discovery, quantifying intervention effects through counterfactual estimation, and mitigating risks through conformal prediction. Particularly noteworthy is the extreme event in February 2023 in Sydney where thunderstorms caused a shift from negative to peak electricity prices. The comparative scheme, due to learning a spurious correlation of "low PV → high electricity price," incorrectly performed charging, resulting in a single household incurring a loss of 340 AUD. In contrast, this invention, through backdoor adjustment, identified the thunderstorm as a confounding variable and correctly selected idle actions, thus avoiding this loss.

[0110] It should be noted that, in this invention, although the specification describes the embodiments, not every embodiment contains only one independent technical solution. This way of describing the specification is only for clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A counterfactual causal inference and conformal risk control energy storage decision-making method, characterized in that, Includes the following steps: S1: Causal discovery and confounding removal: Acquire multi-source observation data, extract deconfounding causal features by stacking sparse noise reduction autoencoders combined with backdoor adjustment mechanisms, and construct a directed acyclic causal graph between variables based on the deconfounding causal features; S2: Counterfactual prediction and causal effect estimation: Based on the directed acyclic causal graph, a multi-branch one-dimensional convolutional neural network is used to estimate the potential results of different intervention actions of the energy storage system in parallel, and the conditional average treatment effect is calculated through a dual machine learning framework. S3: Conformal Risk Calibration and Decision-Making: Based on conformal prediction theory, a counterfactual prediction interval with statistical coverage guarantee is constructed, and a conservative optimization strategy is adopted to select the intervention action that maximizes the net benefit in the worst case. S4: Output and execute the charging / discharging command corresponding to the optimal intervention action.

2. The energy storage decision-making method based on counterfactual causal inference and conformal risk control according to claim 1, characterized in that, Step S1 specifically includes: Construct a total loss function that includes a reconstruction error term, a sparse penalty term, and a term that minimizes promiscuous mutual information: in, Reconstruction error; Target sparsity, typically set to 0.05; : The average activation rate of the l-th layer, where m is the number of training samples; Hidden layer features Confounding variables with unobserved Mutual information; and : These are the weight coefficients for the sparsity penalty term and the confounding elimination term, respectively; The hybrid mutual information minimization term is approximately optimized by using a gradient reversal layer, so that the hidden layer features satisfy conditional independence W⊥Y∣H, thus blocking false correlation paths; Based on the deconfounded causal features, a directed acyclic causal graph is constructed using an attention-based graph neural network, and a differentiable DAG constraint is introduced. To ensure the acyclicity of the cause-effect graph, where, For matrix trace, For Hadamard product, This is a matrix exponentiation operation, where d is the dimension of the variable.

3. The energy storage decision-making method based on counterfactual causal inference and conformal risk control according to claim 1, characterized in that, Step S2 specifically includes: Independent one-dimensional convolutional branches are configured for the three intervention actions of charging, discharging, and idle, and the potential benefits under each intervention action are estimated in parallel. Train the propensity score model and outcome regression model, and calculate the residual results and residual interventions; Based on the residual results and the residual intervention calculation, the conditional average treatment effect is calculated, which represents the causal benefit increment of performing the target intervention action relative to the baseline intervention action under given characteristics; Add counterfactual consistency constraints to the loss function: in, For the actual intervention actions observed, Let X be the gradient of the counterfactual estimate with respect to feature X.

4. The energy storage decision-making method based on counterfactual causal inference and conformal risk control according to claim 1, characterized in that, Step S3 specifically includes: The inconsistency score is calculated using historical calibration data. The inconsistency score is obtained by weighted summation of fact prediction error and counterfactual outcome variance. Calculate the empirical quantile of the inconsistency score, construct a counterfactual prediction interval for each intervention action, and ensure that the probability of the actual potential outcome falling into the prediction interval is not less than 1-α, where α is the acceptable risk level set by the user. The intervention action that maximizes the worst-case net benefit is selected, where the worst-case net benefit is the lower bound of the prediction interval minus the battery health degradation cost, which is calculated based on the cell temperature, state of charge, and equivalent full cycle count reported in real time by the battery management system.

5. The energy storage decision-making method based on counterfactual causal inference and conformal risk control according to claim 1, characterized in that, It also includes lightweight model deployment steps: The complete causal model is compressed into a lightweight student model through knowledge distillation; The lightweight student model is quantized using INT8, so that the quantized model can be deployed on a resource-constrained home edge gateway. Caching calibration data and calculated quantiles in the edge gateway reduces the memory footprint of real-time inference.

6. An energy storage decision-making system based on counterfactual causal inference and conformal risk control, characterized in that: include: The data acquisition module is used to acquire multi-source observation data; The causal discovery and confounding removal module is used to extract deconfounded causal features by stacking sparse noise reduction autoencoders combined with a backdoor adjustment mechanism, and to construct a directed acyclic causal graph between variables based on the deconfounded causal features. The counterfactual prediction and causal effect estimation module is used to estimate the potential results of different intervention actions of the energy storage system in parallel using a multi-branch one-dimensional convolutional neural network based on the directed acyclic causal graph, and to calculate the conditional average processing effect through a dual machine learning framework. The conformal risk calibration decision module is used to construct counterfactual prediction intervals with statistical coverage guarantees based on conformal prediction theory, and to select intervention actions that maximize the worst-case net benefit using a conservative optimization strategy. The output module is used to output and execute the charging and discharging commands corresponding to the optimal intervention action.

7. The energy storage decision-making system based on counterfactual causal inference and conformal risk control according to claim 6, characterized in that, The causality detection and confounding elimination module includes: Stacked sparse noise reduction autoencoder units are used for noise reduction and dimensionality reduction of high-dimensional observable features; The backdoor adjustment unit is used to introduce a promiscuous mutual information minimization term into the loss function of the stacked sparse noise reduction autoencoder and remove the influence of unobserved promiscuous variables through a gradient reversal layer. The causal graph learning unit is used to construct a directed acyclic causal graph based on deconfounded causal features through an attention mechanism in a graph neural network, and introduces a differentiable DAG constraint. Ensure the causal graph is acyclic.

8. The energy storage decision-making system based on counterfactual causal inference and conformal risk control according to claim 6, characterized in that, The counterfactual prediction and causal effect estimation module includes: A multi-branch one-dimensional convolutional neural network unit is configured with independent convolutional branches for three intervention actions: charging, discharging, and idle, and the potential benefits under each intervention action are estimated in parallel. A dual machine learning unit is used to train a propensity score model and an outcome regression model, calculate residual outcomes and residual interventions, and calculate the conditional average treatment effect based on the residual outcomes and residual interventions; The counterfactual consistency constraint unit is used to add counterfactual consistency constraints to the loss function to ensure the stability and generalization ability of the counterfactual estimation.

9. The energy storage decision-making system based on counterfactual causal inference and conformal risk control according to claim 6, characterized in that, The conformal risk calibration decision module includes: The inconsistency score calculation unit is used to calculate the inconsistency score obtained by weighted summation of fact prediction error and counterfactual outcome variance using historical calibration data; A prediction interval construction unit is used to calculate the empirical quantile of the inconsistency score and construct a counterfactual prediction interval with a 1-α statistical coverage guarantee for each intervention action; A conservative optimization unit is used to select the intervention action that maximizes the worst-case net benefit, wherein the worst-case net benefit is the lower bound of the prediction interval minus the battery health degradation cost, and the battery health degradation cost is calculated based on the physical parameters reported in real time by the battery management system.

10. The energy storage decision-making system based on counterfactual causal inference and conformal risk control according to claim 6, characterized in that, It also includes a cloud-edge collaboration module and a lightweight deployment unit: The cloud-edge collaboration module is used to perform global causal graph learning and model pre-training in the cloud, and to distribute compressed model weights to the edge via OTA. The lightweight deployment unit is used to compress the causal model to a lightweight level through knowledge distillation and INT8 quantization techniques, enabling the model to be deployed on a home edge gateway and to make decisions independently in a network-off environment.