1Main Content
This program replicates the article “Energy Sharing and Demand Response Model of Photovoltaic User Groups Under Market Patterns“. In order to enable orderly energy transactions among economic entities within the photovoltaic user group, an internal price model based on the photovoltaic energy supply-demand ratio (SDR) is proposed. Considering both economy and comfort, a utility cost model for user participation in demand response (DR) is introduced. Since the internal electricity price is based on the supply-demand ratio within the photovoltaic user group during each time period, the demand response behavior of users towards electricity prices can form a non-cooperative game. After proving the existence of a Nash equilibrium solution for this game problem, a distributed optimization algorithm is proposed to solve the Nash equilibrium strategy for users. Finally, through practical examples, the effectiveness of the proposed model in reducing electricity costs and improving the level of photovoltaic power sharing is verified. The program is written in Matlab and is suitable for students with programming experience to further learn and improve!
[Image]
-
Photovoltaic User Group Structure
[Image] For distributed photovoltaic users, the first choice is to self-consume the photovoltaic power. When there is excess photovoltaic power, it is purchased by the service provider at the internal electricity purchase price, and when there is insufficient photovoltaic power, it is purchased from the service provider at the internal electricity selling price. For nearby distributed photovoltaic users, external environmental factors such as sunlight and temperature are similar, leading to roughly the same photovoltaic power output characteristics. However, due to the inherent differences in load characteristics among different users, the difference in net power provides the basic conditions for photovoltaic power sharing.
-
Energy Sharing Price Model
[Image]
-
Program Process
[Image]
2Partial Code
clear ;clc;load RU2;RU2 = RU2(:,[1 3 4 2 5]);s1 = [0;0;0;0;0;0;0.04;1.276;3.66;4.72;5.52;5.6;5.4;5.28;5.16;4.48;3.48;1.24;0.04;0;0;0;0;0];s2 = [0;0;0;0;0;0;0;0;0.17;0.69;1.38;3.11;4.67;5.01;5.01;4.84;5.36;4.67;2.07;0.69;0.17;0;0;0];s3 = [0;0;0;0;0;0;0;0;0.105;2.385;3.681;4.716;5.91;5.7;5.55;5.07;4.05;1.92;0.21;0;0;0;0;0];s4 = [0;0;0;0;0;0;0;0;1.01;2.53;3.7;4.55;5.06;5.08;4.65;3.79;2.6;0.55;0.05;0;0;0;0;0];s5 = [0;0;0;0;0;0;0.018;0.97;2.255;3.465;4.552;5.29;5.57;5.45;5.225;4.33;3.06;1.75;0.378;0;0;0;0;0];% psell = [0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.4 0.8 0.8 0.8 1.3 1.3 1.3 1.3 0.8 0.8 0.8 0.8 1.3 1.3 1.3 0.8 0.8];% load solar;% solar = solar';solar = [40*s1,20*s2,40*s3,30*s4,60*s5];solar = solar(:,[1 3 4 2 5]);% RU2 = RU2/1000;% solar = solar/1000;%solar = solar*5;% global p;% k ;Load = RU2 - solar;%[RU2(:,1)-40*s1,RU2(:,2)-20*s2,RU2(:,3)-40*s3,RU2(:,4)-30*s4,RU2(:,5)-60*s5];% Set photovoltaic assembly quantity
% p = p*1000;
t_start = tic;MAX_ITER = 40;ABSTOL = 0.01;RELTOL = 1e-3;
N = 5;%x = zeros(24,N);
% k = 1; u = zeros(24,N);rs = zeros(2,MAX_ITER);totfeerecord = zeros(1,MAX_ITER);pSrecord = zeros(24,MAX_ITER);pBrecord = zeros(24,MAX_ITER);x1record = zeros(24,MAX_ITER);x2record = zeros(24,MAX_ITER);x3record = zeros(24,MAX_ITER);x4record = zeros(24,MAX_ITER);x5record = zeros(24,MAX_ITER); x1record(:,1) = RU2(:,1); x2record(:,1) = RU2(:,2); x3record(:,1) = RU2(:,3); x4record(:,1) = RU2(:,4); x5record(:,1) = RU2(:,5); pSrecord(:,1) = 0.4*ones(24,1); pBrecord(:,1) = ones(24,1);x1L = zeros(24,MAX_ITER);x2L = zeros(24,MAX_ITER);x3L = zeros(24,MAX_ITER);x4L= zeros(24,MAX_ITER);x5L = zeros(24,MAX_ITER);% exitfalgrecord = zeros(N,96);p = getPrice(Load);% Cluster buy-sell electricity pricepacture = p;
for i=2:MAX_ITER
pSrecord(:,i) = p(:,1); pBrecord(:,i) = p(:,2); [x,exitflag] = update_x(x,RU2,solar,p); %Load = [x(:,1)-25*s1,x(:,2)-30*s2,x(:,3)-10*s3];% Set photovoltaic assembly quantity
3Program Results
[Image]
[Image] [Image] [Image] [Image] Partial Original Results
[Image] [Image]
“Read the Original to Get Program Source Code