👨🎓个人主页:研学社的博客
💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
大多数随机MPC可以分为两组:第一组是基于分析方法(机会约束)的MPC,它根据指数成本的期望值求解OCP,受概率约束,通常在预测状态下。第二组是基于随机场景(基于场景)的那些,它们为确定数量的不确定性随机实现(也称为场景)求解 OCP。
该文件包含具有加性扰动的多变量线性系统的基本随机预测控制模拟器。扰动具有高斯概率分布,并且可以有界。总共有两个模拟器:基于状态机会约束的 MPC 模拟器;另一个基于实现干扰的情景。
📚2 运行结果
2.1 scenario_based_MPC
这个运行时间比较久。 运行结果可参考2.2.
2.2 chance_constrained_MPC
部分代码:
% Starting point for quadprog algoritm:
Vold = zeros(nu*N, 1);
% display information about the simulation on screen:
fprintf([...
'******************************************************************** \n', ...
' Stochastic Model Predictive Control (Chance-Constrained) simulator \n', ...
' for linear systems with additive disturbances \n', ...
'******************************************************************** \n']);
disp(['Sampling times to simulate: ', num2str(samples)]);
disp(['Prediction horizon: ', num2str(N)]);
disp(['Decision variables: ', num2str(nu*N)]);
disp(['Total chance constraints: ', num2str(numcc)]);
disp(['Total constraints: ', num2str(size(AR,1))]);
fprintf('******************************************************************** \n');
clear Mxx Mxv xmin xmax umin umax nmin nmax wlim vlim Qx Ru PN epsilon
commandwindow
%---------------------------------------------------------------------------------
% Online MPC execution
%---------------------------------------------------------------------------------
for k = 0:samples
if k == 0
disp(['current sample k: ', num2str(k+1)]);
elseif (0 < k) && (k < samples)
disp(['current sample k: ', num2str(k+1)]);
% current state. Real state or stimated state:
if isnan(P)
% the current state is the real state plant
xk = xreal;
else
% the current state is estimated using the Kalman filter
[xk, P] = kalman_filter(A, B, C, G, Qw, Qv, xk, P, y, u);
end
% Starting point for quadprog algorithm:
Vold = [V(nu+1:end); zeros(nu, 1)];
else
xrealv(k+1, :) = xreal';
break
end
% Calculated inputs using Quadratic Programming:
V = QP_optimization(PHI, THETA, AR, BRa, BRb, xk, Vold, optQP);
% Input calculation for current instant:
u = K*xk+V(1:nu);
% Storage of the real states and inputs for later graphing:
xrealv(k+1,:) = xreal';
uvec(k+1,:) = u';
% the calculated input is applied to the plant:
[y, xreal] = plant(A, B, G, C, pdw, pdv, xreal, u);
end
%----------------------------------------------------------------------------------------------------
% Graphs of the real states and inputs
%----------------------------------------------------------------------------------------------------
% graphs of the real states:
figure(1)
for j = 1:nx
subplot(nx,1,j)
plot(0: samples, xrealv(:,j));
if j==1
title('real states evolution')
end
hold on
ylabel(['x', num2str(j)])
if j ~= nx
xticklabels({})
end
end
xlabel('samples (k)')
% graphs of the inputs:
figure(2)
for j = 1:nu
subplot(nu,1,j)
plot(0:samples-1, uvec(:,j));
if j==1
title('inputs evolution')
end
hold on
ylabel(['u', num2str(j)])
if j ~= nu
xticklabels({})
end
end
xlabel('samples (k)')
🎉3 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]闫明文,刘惠颖,宫游,李兴刚,文茹馨,廖小兵.基于改进Benders分解的配电网扩展规划机会约束优化方法[J].电测与仪表,2023,60(01):124-131.DOI:10.19753/j.issn1001-1390.2023.01.018.
[2]孙艳,陈雁,莫东,李秋文,凌武能.基于风险分摊的多风电场机会约束机组组合求解方法[J].电网技术,2022,46(08):2996-3007.DOI:10.13335/j.1000-3673.pst.2022.0108.
[3]万欣,荀径,WU Guoyuan,赵子枞.基于MPC的混合动力汽车能量管理策略[J].北京交通大学学报,2022,46(05):149-158.
[4]Edwin Alonso González Querubín (2023). Stochastic Model Predictive Control Toolbox