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

目录

1 主要内容

2 部分代码

3 程序结果

4 下载链接


主要内容

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

原文模型及部分结果​:

部分代码

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);

程序结果

4 下载链接

  • 21
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值