【电力系统】基于纳什谈判理论的风-光-氢多主体能源系统合作运行方法附Matlab复现

发布时间:2026/7/11 12:41:33
【电力系统】基于纳什谈判理论的风-光-氢多主体能源系统合作运行方法附Matlab复现 ✅作者简介热爱科研的Matlab仿真开发者擅长毕业设计辅导、数学建模、数据处理、建模仿真、程序设计、完整代码获取、论文复现及科研仿真。 往期回顾关注个人主页Matlab科研工作室 关注我领取海量matlab电子书和数学建模资料个人信条格物致知,完整Matlab代码获取及仿真咨询内容私信。 内容介绍以可再生能源制氢为特征的能源系统将是今后能源互联网建设的重要方向之一.该文针对风-光-氢多主体能源系统的合作运行展开研究.首先,考虑主体间的电能交易建立各主体的优化运行模型,然后基于纳什谈判理论建立风-光-氢多主体合作运行模型,接着将其等效为联盟效益最大化和电能交易支付谈判两个子问题.为保护各主体隐私,运用交替方向乘子法提出上述两个子问题的分布式求解方法.最后通过算例验证所提合作运行模型以及分布式算法的有效性.仿真结果表明通过风-光-氢多主体的合作运行,可以较大幅度提高各主体的运行效益以及合作联盟的整体效益.此外,风光发电上网电价的降低,将促进风-光-氢多主体展开合作,以提升各自运行效益.⛳️ 运行结果 部分代码function out yalmiptest(prefered_solver,auto)%YALMIPTEST Runs a number of test problems.%% YALMIPTEST is recommended when a new solver or a new version% of YALMIP installed.%% EXAMPLES% YALMIPTEST % Without argument, default solver used% YALMIPTEST(solver tag) % Test with specified solver% YALMIPTEST(options) % Test with specific options structure from%% See also SDPSETTINGS​if ~exist(sedumi2pen.m)disp(Add /yalmip/extras etc to your path first...)disp(Read the a hrefhttps://yalmip.github.io/tutorial/installation/Installation notes/a.)returnend​if ~exist(callsedumi.m)disp(Still missing paths...Just do an addpath(genpath(yalmiprootdirectory));)disp(Read the a hrefhttps://yalmip.github.io/tutorial/installation/Installation notes/a.)returnend​% SDPT3 has a function called constraint.m which causes issuesdetected which(constraint.m);if isa(detected,cell)if length(detected)0if isempty(strfind(detected{1},extras\constraint))clcdisp(You seem to have some other toolbox with a function called constraint.m);disp(Delete that toolbox, or delete the function/class, or change path so that YALMIP is on top.);disp(detected{1})endreturnendend​detected which(yalmip.m,-all);% Will not work in Octave as Octave only reports first item found?if isa(detected,cell)if length(detected)1clcdisp(You seem to have multiple installations of YALMIP in your path.)disp(Please correct this...);disp(detected)returnendend​% Pagination really doesnt work well with solversmore off​if exist(OCTAVE_VERSION, builtin)OctaveRunning 1;elseOctaveRunning 0;end​donttest 0;if (nargin1) isa(prefered_solver,char) strcmp(prefered_solver,test)donttest 0;prefered_solver ;elsedonttest 1;end​if nargin0prefered_solver ;elseif ~(isa(prefered_solver,struct) | isa(prefered_solver,char))error(Argument should be a solver tag, or a sdpsettings structure);endif isa(prefered_solver,char)donttest 1;endend​if ~(exist(callsedumi)2)clcdisp(The directory yalmip/solvers is not in your path.)disp(These must be in path:)disp( yalmip/);disp( yalmip/extras);disp( yalmip/operators);disp( yalmip/modules);disp( yalmip/solvers);disp(See a hrefhttps://yalmip.github.io/tutorial/installation/installation guide/a)returnend​foundstring {not found,found,internal};teststring {-failed,passed};if ~donttestheader {Solver,Version,Status,Unit test};elseheader {Solver,Version,Status};end​[solvers,found] getavailablesolvers(0);j 1;status ones(length(solvers),1);s {solvers.tag};for i 1:length(solvers)if solvers(i).showsame find(strcmpi(solvers(i).tag,s));% Find all instances of same solver different versionsfor k setdiff(same,i)% No reason to show for all versionssolvers(k).show 0;enddata{j,1} upper(solvers(i).tag);found_versions same(find(found(same)));if ~isempty(found_versions)idx min(found_versions);version solvers(idx).version;if ~any(strcmpi(version,{geometric,standard}))data{j,2} [solvers(idx).version solvers(idx).subversion];endelseidx i;endstatus(j) found(idx)1solvers(idx).builtin;data{j,3} foundstring{found(idx)1solvers(idx).builtin};j j1;endend​if isa(prefered_solver,char)ops sdpsettings(Solver,prefered_solver);elseops prefered_solver;endops.saveyalmipmodel 1;​if ~((nargin2) (ops.verbose0))[sortedName,loc] sort({data{:,1}});loc [loc(find(status(loc)3)) loc(find(status(loc)2)) loc(find(status(loc)1))];dataSorted reshape({data{loc,:}},[],3);yalmiptable({Searching for installed solvers},header,dataSorted);disp( )endif nargin2disp(Press any key to continue test)pauseend​i1;test{i}.fcn test_core;test{i}.desc Core functionalities;i i1;​test{i}.fcn test_linear_programming;test{i}.desc Linear programming (LP);i i1;​test{i}.fcn test_quadratic_programming;test{i}.desc Quadratic programming (QP);i i1;​test{i}.fcn test_socp_programming;test{i}.desc Second-order cone programming (SOCP);i i1;​test{i}.fcn test_semidefinite_programming;test{i}.desc Semidefinite programming (SDP);i i1;​test{i}.fcn test_geometric_programming;test{i}.desc Geometric programming (GP);i i1;​test{i}.fcn test_nonlinear_programming;test{i}.desc Nonlinear programming (NLP);i i1;​test{i}.fcn test_nonlinear_semidefinite_programming;test{i}.desc Nonlinear SDP (NLSDP);i i1;​test{i}.fcn test_exponential_cone_programming;test{i}.desc Exponential cone programming (ECP);i i1;​test{i}.fcn test_milinear_programming;test{i}.desc Mixed-integer LP (MIQP);i i1;​test{i}.fcn test_miquadratic_programming;test{i}.desc Mixed-integer QP (MIQP);i i1;​test{i}.fcn test_misocp_programming;test{i}.desc Mixed-integer SOCP (MISOCP);i i1;​test{i}.fcn test_nonconvex_quadratic_programming;test{i}.desc Global nonconvex quadratic programming;i i1;​test{i}.fcn test_nonconvex_global_programming;test{i}.desc Global nonconvex programming;i i1;​pass_strings {Error,Passed,Solver not available};​% Run test-problemsfor i 1:length(test)tryif ops.verbosedisp( );disp([Testing function test{i}.fcn]);disp( );end% First make call to figure out solverinfo eval([test{i}.fcn (ops)]);if ~OctaveRunningsols{i} addLink(upper(cleanversion(info.yalmipmodel.solver.tag)));elsesols{i} cleanversion(info.yalmipmodel.solver.tag);endpass(i) info.problem 0;if pass(i)results{i}Success;elseresults{i}Failed;endcatchpass(i) 0;results{i} Failed;sols{i} ;endend​clear data;header {Test,Status, Solver};for i 1:length(pass)data{i,1} test{i}.desc;data{i,2} results{i};data{i,3} sols{i};endif ops.verbosedisp( );endformats{1}.data.just right;formats{2}.data.just right;formats{3}.data.just right;​formats{1}.header.just right;formats{2}.header.just right;formats{3}.header.just right;​clcyalmiptable([],header,data,formats)​% Test if any LMI solver is installed.x sdpvar(2);[p,aux1,aux2,m] export(x0,[],[],[],[],0);if ~isempty(m)only_lmilab strcmpi(m.solver.tag,lmilab);only_fmincon strcmpi(m.solver.tag,fmincon-standard);elseonly_lmilab 0;only_fmincon 0;endif isempty(m)disp(You do not have any LMI solver installed)disp( If you intend to solve LMIs you must install a solver.)elseif only_lmilabdisp(You do not have any good LMI solver installed)disp( (only found a hrefhttps://yalmip.github.io/solver/lmilab/LMILAB which should be avoided in YALMIP/a).)disp(If you intend to solve LMIs, please install a better solver.)elseif only_fmincondisp(You do not have any LMI solver installed)disp( (YALMIP will use a nonlinear solver which cannot be expected to work))disp( If you intend to solve LMIs you must install a solver.)endendx binvar(1);[p,aux1,aux2,m] export(x0,x,[],[],[],0);if isempty(m)disp(You do not have any LP/MILP solver installed)disp( If you intend to solve LPs/MILPs, you have to install one.)elseonly_bnb strcmpi(m.solver.tag,bnb);if only_bnbdisp(You do not have any MILP solver installed)disp( (only found internal a hrefhttps://yalmip.github.io/solver/bnb/BNB/a).)disp( If you intend to solve MILP, please install a better solver.)endendx binvar(1);[p,aux1,aux2,m] export(x0,x^2,[],[],[],0);if isempty(m)disp(You do not have any QP/SOCP/MIQP/MISOCP solver installed)disp( If you intend to solve QP/SOCP/MIQP/MISOCP you must install solver.)elseonly_bnb strcmpi(m.solver.tag,bnb);if only_bnbdisp(You do not have any MIQP/MISOCP solver installed (only found internal a hrefhttps://yalmip.github.io/solver/bnb/BNB/a))disp( If you intend to solve MIQP/MISOCP, please install a better solver.)endenddisp(See a hrefhttps://yalmip.github.io/allsolversguide on interfaced solvers/a)​​​function sol test_core(ops)​% Fakesol.yalmipmodel.solver.tag ;sol.problem 0;tryx sdpvar(2,2);x sdpvar(2,2,symmetric);x sdpvar(2,2,full);x sdpvar(2,2,toeplitz);x sdpvar(2,2,hankel);x sdpvar(2,2,skew);if ~ishermitian(sdpvar(2,2,hermitian,complex))error(bug)endif ~issymmetric(sdpvar(2,2,symmetric,complex))error(bug)endif ~isreal(real(sdpvar(2,2,symmetric,complex)))error(bug)endif isreal(sqrt(-1)*real(sdpvar(2,2,symmetric,complex)))error(bug)endx sdpvar(2,1,,co);if ~isreal(x*x)error(bug)endx sdpvar(2,2,,co);if ~isreal(diag(x*x))error(bug)endx sdpvar(1,1);y sdpvar(2,2);x*eye(2);eye(2)*x;y*3;3*y;x sdpvar(2,3);y sdpvar(2,3);assign(x,randn(2,3));z replace(x,x(1,1:2),[8 9]);z xy;z x-y;z x1;z x-1;z xones(2,3);z x-ones(2,3);z ones(2,3)-x;z ones(2,3)-x;z eye(2)*x;z x*eye(3);z diag(x);z trace(x(1:2,1:2));z diff(x);z fliplr(x);z flipud(x);z kron(x,eye(3));z kron(eye(3),x);z rot90(x);z sum(x);z diff(x);z x;z x.;z tril(x);z triu(x);z [x y];z [x;y];sdpvar x ydiag([x y])*[x^-1;y^-1];assert(isequal([x x;x x]*x-[x x;x x].*x,zeros(2)))assert(isequal(trace([x x;x x]*[x y;y x])-(x*xx*yy*xx*x),0))% Regression ??yalmip(clear)sdpvar x(1xx^4)*(1-x^2);% Regression complex multiplcationA randn(10,5)sqrt(-1)*randn(10,5);b randn(10,1)sqrt(-1)*randn(10,1);x sdpvar(5,1);res A*x-b;assert(nnz(clean([res res]*[res res]-res*res,1e-8))0)assert(isreal(clean(res*res,1e-8)))assert(isreal(x*x))catchsol.problem 9;sol.info Problems;end​function sol test_semidefinite_programming(ops)t sdpvar(1,1);Y sdpvar(2,2);F [Yt*eye(2), Y[1 0.2;0.2 1]];sol optimize(F,t,ops);​function sol test_linear_programming(ops)N 5;A [2 -1;1 0];B [1;0];C [0.5 0.5];[H,S] create_CHS(A,B,C,N);x [2;0];t sdpvar(2*N,1);U sdpvar(N,1);Y H*xS*U;F (U1)(U-1);F F(Y(N)-1);F F(Y(N)1);F F([Y;U]t)([Y;U]-t);sol optimize(F,sum(t),ops);​function sol test_socp_programming(ops)x sdpvar(2,1);a [0;1];b [1;1];F norm(x-a)1;F F[norm(x-b) 1];sol optimize(F,sum(x),ops);​function sol test_misdp_programming(ops)x intvar(4,1);e magic(4)*x-1;sdpvar tobj t;sol optimize([t e;e eye(4)]0,obj,ops);​function sol test_misocp_programming(ops)x intvar(4,1);obj norm(magic(4)*x-1,2);sol optimize([-5 x 5],obj,ops);​function sol test_miquadratic_programming(ops)x intvar(4,1);obj norm(magic(4)*x-1,2)^2;sol optimize([-5 x 5],obj,ops);​function sol test_milinear_programming(ops)x intvar(4,1);obj norm(magic(4)*x-1,1);sol optimize([-5 x 5],obj,ops);​function sol test_quadratic_programming(ops)x sdpvar(10,1);sol optimize([sum(x)2, -1 x 1],x*x,ops);​function sol test_nonconvex_quadratic_programming(ops)x sdpvar(10,1);ops.forceglobal 1;sol optimize([sum(x)2, -1 x 1],-x*x,ops);​function sol test_nonconvex_global_programming(ops)x sdpvar(3,1);ops.forceglobal 1;sol optimize([sum(x.^3)2, -1 x 1],-x*x,ops);​function sol test_nonlinear_semidefinite_programming(ops)A [-1 2;-3 -4];P sdpvar(2,2);alpha sdpvar(1,1);F (Peye(2))(A*PP*A -2*alpha*P)(alpha 0);sol optimize([F,P(:) 100],-alpha,ops);​function sol test_geometric_programming(ops)t1 sdpvar(1,1);t2 sdpvar(1,1);t3 sdpvar(1,1);t [t1 t2 t3];obj (40*t1^-1*t2^-0.5*t3^-1)(20*t1*t3)(40*t1*t2*t3);F ((1/3)*t1^-2*t2^-2(4/3)*t2^0.5*t3^-1 1);F [F, t0];sol optimize(F,obj,ops);​function sol test_nonlinear_programming(ops)sdpvar x ysol optimize(x^2 x^4 exp(x) 1, x^2y^2,ops);​function sol test_exponential_cone_programming(ops)sdpvar x y zsol optimize([expcone([x;2;z]),x1],z,ops);​function html addLink(x)​if length(x)0html [a hrefhttps://yalmip.github.io/solver/ lower(x) upper(x) /a];elsehtml ;end​function x cleanversion(x)​s strfind(x,-);if ~isempty(s)xx(1:s-1);end​ 参考文献[1]马腾飞,裴玮,肖浩,等.基于纳什谈判理论的风-光-氢多主体能源系统合作运行方法[J].中国电机工程学报, 2021, 41(1):15.DOI:10.13334/j.0258-8013.pcsee.200956.往期回顾扫扫下方二维码

相关新闻