【免费】基于数据驱动的模型预测控制电力系统机组组合优化

简介: 【免费】基于数据驱动的模型预测控制电力系统机组组合优化

1 主要内容

该程序复现文章《Feature-Driven Economic Improvement for Network-Constrained Unit Commitment: A Closed-Loop Predict-and-Optimize Framework》,程序主要做的是一个基于数据驱动的电力系统机组组合调度模型,采用IEEE24节点系统作为研究对象,该模型的创新点在于:提出了一个闭环预测与优化(C-PO)框架,即利用NCUC模型的结构以及相关特征数据来训练一个以成本为导向的RES预测模型,该模型通过诱导的NCUC成本而不是统计预测误差来评估预测质量,并且在优化过程中采用拉格朗日松弛来加速训练过程,该模型理论深度较大,代码学习难度也较大,本次免费分享供相关方向同学参考。

原文模型及部分结果:

2 部分代码

Number_day          = Validate_day_end - Validate_day_1st + 1;
First_day_intuition = Validate_day_1st;
Final_day_intuition = Validate_day_end;
Scaler_load         = 0.22;
Scaler_SPG          = 0.39;
Scaler_WPG          = 0.39;
R_for_load          = 0.10;
R_for_RES           = 0.05;
Method_flag         = 'CPO';
Number_hour         = 24;
Number_RES          = 5;
%% -----------------------------SPO tunning----------------------------- %%
lamda                 = 100000;
Number_training_day   = 2;
Number_day_H_validity = 7; % The frequency of updating Predictor H.
Number_historic_day   = 7;
Solver_flag           = 'g';
Solver_gap            = 3;
Solver_time           = 10;
%% -----------------------Prepare box for recorder---------------------- %%
% Rec for UC
Rec_Decision_UC_I    = cell(Number_day, 1);
Rec_Decision_UC_P    = cell(Number_day, 1);
Rec_Decision_UC_R_h  = cell(Number_day, 1);
Rec_Decision_UC_R_c  = cell(Number_day, 1);
Rec_cost_UC_expected = cell(Number_day, 1);
Rec_cost_UC_SUSD     = cell(Number_day, 1);
Rec_RES_prediction   = cell(Number_day, 1);
Rec_infea_UC_flag    = cell(Number_day, 1);
Rec_UC_time          = cell(Number_day, 1);
% Rec for ED
Rec_cost_ACT      = cell(Number_day, 1);
Rec_cost_UC       = cell(Number_day, 1);
Rec_cost_SUSD_all = cell(Number_day, 1);
Rec_cost_SUSD_UC  = cell(Number_day, 1);
Rec_cost_SUSD_ED  = cell(Number_day, 1);
Rec_cost_P        = cell(Number_day, 1);
Rec_cost_LS       = cell(Number_day, 1);
Rec_cost_loss_ACT = cell(Number_day, 1);
Rec_cost_loss_UC  = cell(Number_day, 1);
Rec_infea_ED_flag = cell(Number_day, 1);
%% --------------------------Prepare box for CPO------------------------ %%
% Cost
CPO_cost_ACT      = zeros(Number_day, 1);
CPO_cost_UC       = zeros(Number_day, 1);
CPO_cost_SUSD_all = zeros(Number_day, 1);
CPO_cost_SUSD_UC  = zeros(Number_day, 1);
CPO_cost_SUSD_ED  = zeros(Number_day, 1);
CPO_cost_P        = zeros(Number_day, 1);
CPO_cost_LS       = zeros(Number_day, 1);
CPO_cost_loss_ACT = zeros(Number_day, 1);
CPO_cost_loss_UC  = zeros(Number_day, 1);
% Flag
CPO_infeasible_UC = zeros(Number_day, 1);
CPO_infeasible_ED = zeros(Number_day, 1);
%% -------------------------Set updating frequency---------------------- %%
Number_period = ceil(Number_day/Number_day_H_validity);
if Number_period == floor(Number_day/Number_day_H_validity)
    Number_day_in_period_full           = Number_day_H_validity;
    Number_day_in_period_last           = Number_day_H_validity;
    Period_size_list                    = ones(Number_period,1);
    Period_1st_list                     = zeros(Number_period,1);
    Period_end_list                     = zeros(Number_period,1);
    Period_size_list(1:Number_period-1) = Number_day_in_period_full;
    Period_size_list(Number_period)     = Number_day_in_period_last;
end
if Number_period > floor(Number_day/Number_day_H_validity)
    Number_day_in_period_full           = Number_day_H_validity;
    Number_day_in_period_last           = Number_day - (Number_period - 1)*Number_day_H_validity;
    Period_size_list                    = ones(Number_period,1);
    Period_1st_list                     = zeros(Number_period,1);
    Period_end_list                     = zeros(Number_period,1);
    Period_size_list(1:Number_period-1) = Number_day_in_period_full;
    Period_size_list(Number_period)     = Number_day_in_period_last;
end
for i_period = 1:Number_period
    Period_1st_list(i_period) = (Validate_day_end+1) - sum(Period_size_list(i_period:end));
    Period_end_list(i_period) = (Validate_day_1st-1) + sum(Period_size_list(1:i_period));
end
%% ------------------Prepare box for training details------------------- %%
% Training detail
CPO_TRA_Predictor_H     = cell(Number_period, 1);
CPO_TRA_Predictor_H_ele = cell(Number_period, 1);
CPO_TRA_obj             = zeros(Number_period, 1);
CPO_TRA_cost_ERM        = zeros(Number_period, 1);
CPO_TRA_regulation      = zeros(Number_period, 1);
CPO_TRA_time            = zeros(Number_period, 1);
%% --------------------------Prepare box for pick----------------------- %%
Picked_TRA_intuition        = zeros(Number_training_day,Number_period);
Picked_TRA_feature          = cell(Number_period,1);
Picked_TRA_load_city        = cell(Number_period,1);
Picked_TRA_reserve_load_req = cell(Number_period,1);
Picked_TRA_reserve_RES_req  = cell(Number_period,1);
Picked_TRA_cost_perfect     = cell(Number_period,1);
%% ------------------------------Let's go------------------------------- %%
for Current_period = 1:Number_period
    Number_dispatch_day = Period_size_list(Current_period);
    Dispatch_day_1st    = Period_1st_list(Current_period);
    Dispatch_day_end    = Period_end_list(Current_period);
    %% -----------------------Select training day----------------------- %%
    [Picked_TRA_intuition(:,Current_period),...
     Picked_TRA_feature{Current_period},...
     Picked_TRA_load_city{Current_period},...
     Picked_TRA_reserve_load_req{Current_period},...
     Picked_TRA_reserve_RES_req{Current_period},...
     Picked_TRA_cost_perfect{Current_period}]...
         = Step_00_Select_train_day(Dispatch_day_1st,...
                                    Dispatch_day_end,...
                                    Number_training_day,...
                                    Number_dispatch_day,...
                                    Scaler_load,...
                                    Scaler_SPG,...
                                    Scaler_WPG,...
                                    R_for_load,...
                                    R_for_RES,...
                                    Number_historic_day);
    %% -----------------------------Setp 01----------------------------- %%
    [CPO_TRA_Predictor_H{Current_period},...
     CPO_TRA_Predictor_H_ele{Current_period},...
     CPO_TRA_obj(Current_period),...
     CPO_TRA_cost_ERM(Current_period),...
     CPO_TRA_regulation(Current_period),...
     CPO_TRA_time(Current_period)]...
     = Step_01_CPO_train(lamda,...
                         Scaler_load,...
                         Scaler_SPG,...
                         Scaler_WPG,...
                         Solver_flag, Solver_gap, Solver_time,...
                         Picked_TRA_feature{Current_period},...
                         Picked_TRA_load_city{Current_period},...
                         Picked_TRA_reserve_load_req{Current_period},...
                         Picked_TRA_reserve_RES_req{Current_period},...
                         Picked_TRA_cost_perfect{Current_period},...
                         Number_training_day,...
                         Method_flag);


3 程序结果

4 下载链接

相关文章
|
6月前
|
数据可视化 数据挖掘 调度
【Python数据挖掘】优化电能能源策略:基于非侵入式负荷检测与分解的智能解决方案
【Python数据挖掘】优化电能能源策略:基于非侵入式负荷检测与分解的智能解决方案
94 0
|
6月前
|
算法 调度 决策智能
基于元模型优化算法的主从博弈多虚拟电厂动态定价和能量管理(matlab代码)
基于元模型优化算法的主从博弈多虚拟电厂动态定价和能量管理(matlab代码)
|
6月前
生态学模拟对广义线性混合模型GLMM进行功率(功效、效能、效力)分析power analysis环境监测数据
生态学模拟对广义线性混合模型GLMM进行功率(功效、效能、效力)分析power analysis环境监测数据
|
算法 搜索推荐 数据挖掘
基于天牛须(BAS)与NSGA-Ⅱ混合算法的交直流混合微电网多场景多目标优化调度(Matlab代码实现)
基于天牛须(BAS)与NSGA-Ⅱ混合算法的交直流混合微电网多场景多目标优化调度(Matlab代码实现)
144 0
基于天牛须(BAS)与NSGA-Ⅱ混合算法的交直流混合微电网多场景多目标优化调度(Matlab代码实现)
|
算法 搜索推荐
串稳定混合交通的协同自适应巡航控制:基准和以人为本的设计(Matlab代码实现)
串稳定混合交通的协同自适应巡航控制:基准和以人为本的设计(Matlab代码实现)
|
算法 自动驾驶 数据挖掘
【鲁棒优化】基于联合聚类和定价的鲁棒功率控制方法(Matlab代码实现)
【鲁棒优化】基于联合聚类和定价的鲁棒功率控制方法(Matlab代码实现)
122 0
|
新能源
两级电力市场环境下计及风险的省间交易商最优购电模型(Matlab代码实现)
两级电力市场环境下计及风险的省间交易商最优购电模型(Matlab代码实现)
121 0
参与辅助服务的用户侧储能优化配置及经济分析(Matlab代码实现)
参与辅助服务的用户侧储能优化配置及经济分析(Matlab代码实现)
|
算法 调度
云环境中使用飞蛾火焰和萨尔普群算法组合的工作流调度(Matlab代码实现)
云环境中使用飞蛾火焰和萨尔普群算法组合的工作流调度(Matlab代码实现)
云环境中使用飞蛾火焰和萨尔普群算法组合的工作流调度(Matlab代码实现)
|
供应链
使用鲁棒优化的定价策略进行微电网不平衡管理研究(Matlab代码实现)
使用鲁棒优化的定价策略进行微电网不平衡管理研究(Matlab代码实现)
使用鲁棒优化的定价策略进行微电网不平衡管理研究(Matlab代码实现)