当前位置: 首页 > news >正文

为建筑物的供暖系统实施MPC控制器的小型项目(Matlab代码实现)

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

​目前,我国较为先进的供热系统对二级管网进行平衡调节,并通过安装在散热器上的手动调节阀、温控阀调节水流量,从而改变室温。但供暖期间大多数用户不能合理、及时调节温控装置,导致部分建筑室温分布不均甚至出现开窗散热的现象,供暖能耗浪费严重。因此,通过采用室温控制技术维持室温稳定,可保证房间的热舒适性,减少开窗散热等无效热损失,从而实现高效费比节能。 

这个项目为一栋建筑的供暖系统实现了MPC控制器。本文设计了一个MPC控制器,以最大限度地降低运行的总成本,同时考虑到天气的预测,并研究了额外储热的影响。

本项目需要多次模拟(3次以内)。可以减少问题的范围(但在合理的范围内)或采样时间。大多数情况下,计算器的性能比较重要。

📚2 运行结果

主函数部分代码:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%              MPC -- Mini Project             %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
​
clc;
close all;
​
yalmip('clear');
clear all;
​
%% Model data
​
load building.mat;
load battery.mat;
​
%Parameters of the Building ModelA = ssM.A;
Bu = ssM.Bu;
Bd = ssM.Bd;
C = ssM.C;
Ts = ssM.timestep;
​
% Parameters of the Storage Model
a = ssModel.A;
b = ssModel.Bu;   
​
% Installation Test
yalmip('version')
sprintf('The Project files are successfully installed')
​
% Other parameters
nx = length(A); %number of states
ny = size(C,1); %number of outputs
nu = size(Bu,2); %number of inputs
nd = size(Bd,2); %number of disturbances
​
umax = 15*ones(nu,1); umin = 0*ones(nu,1); %input constraints
ymax = 26*ones(ny,1); ymin = 22*ones(ny,1); %output constraints
​
vmax = 20; vmin = -20;
xbmax = 20; xbmin = 0;
​
%% Controller Design (Setting-up MPC optimizer)
​
figure,
subplot(1,2,1),
stairs(refDist(2:3,:)'); %
plot two of disturbance inputslegend(ssM.disturbance(2:3));
xlabel('Step-Time: 20min');
ylabel('Disturbances (kW)');
subplot(1,2,2),
stairs(refDist(1,:)'); %plot one of disturbance inputs
legend(ssM.disturbance(1));
xlabel('
Step-
Time:
20
min
');
ylabel('
Disturbances (C)
');
​
savefig('
disturbances.fig
'); %save figure
disp('
Click on Enter to continue with the Section 
1
.
'); pause;
%% Section 1: tracking MPC
​
%define objective parameters
param_objective.R = eye(ny); %cost weight
param_objective.yref = [24 24 24]'
; %reference outputs​
%define constraints matrix
param_constraints.Mu = [eye(nu); -eye(nu)];
param_constraints.My = [eye(ny); -eye(ny)];
param_constraints.mu = [umax; -umin];
param_constraints.my = [ymax; -ymin];
​
%Determine the influence of the horizon length on the MPC scheme
param_simulation.horizon_lengths = [4, 15, 30, 50, 72, 90]; %arbitrary values of horizon length
tuning_horizon_length(ssM, param_constraints, param_objective, param_simulation, refDist);
​
%define simulation parameters
param_simulation.N = 72; %prediction horizon chosen - 1 day = 72*20min
param_simulation.T = size(refDist,2)-param_simulation.N; %simulation length in time-steps
​
%run tracking MPC with no night-setbacks and no variable cost
[xt, yt, ut, t] = trackingMPC(ssM, param_constraints, param_objective, param_simulation);
​
%display total economic cost
total_cost = 0.2*sum(ut(:));
sprintf('Total economic cost: $%d', total_cost)
​
disp('Click on Enter to continue with the Section 2.'); pause;
%% Section 2: economic MPC and soft constraints
​
%
define other objective parametersparam_objective.c = 0.2; %fixed electricity price
param_objective.S = 50*eye(ny); %economic cost weight
​
%run economic MPC with no night-setbacks and no variable cost
[xt, yt, ut, t, total_cost] = economicMPC_sc(ssM, param_constraints, param_objective, param_simulation);
​
%display total economic cost
sprintf('Total economic cost: $%d', total_cost)
​
disp('Click on Enter to continue with the Section 3.'); pause;
%% Section 3: economic, soft constraints, and variable cost
​
%
run economic MPC with variable cost, but no night-setbacks[xt, yt, ut, t, total_cost] = economicMPC_sc_vc(ssM, param_constraints, param_objective, param_simulation);
​
%display total economic cost
sprintf('Total economic cost: $%d', total_cost)
​
disp('Click on Enter to continue with the Section 4.'); pause;
%% Section 4 : Night setbacks
​
%
run economic MPC with variable cost 
andnight-setbacks[xt, yt, ut, t, total_cost] = economicMPC_sc_vc_sb(ssM, param_constraints, param_objective, param_simulation);
​
%display total economic cost
sprintf('Total economic cost: $%d', total_cost)
​
disp('Click on Enter to continue with the Section 5.'); pause;

🎉3 参考文献

[1]张冬冬,王淳,代伟,罗策恒,刘梓宁,武新章.居民区多能源管理模型与优化调度策略分析[J/OL].电力系统及其自动化学报:1-13[2023-05-27].

部分理论引用网络文献,若有侵权联系博主删除。

🌈4 Matlab代码实现

http://www.lryc.cn/news/91230.html

相关文章:

  • 【概率论】中心极限定理(二)
  • Blender UV展开流程
  • Flutter 笔记 | Flutter 核心原理(二)关键类和启动流程
  • Android:主题切换
  • terminalworks ASP.NET Core PDF 浏览器-Crack
  • Rust每日一练(Leetday0020) 最后单词的长度、螺旋矩阵II、排列序列
  • 短视频矩阵源码如何做应用编程?
  • 【运维知识进阶篇】Ansible实现一套完整LNMP架构
  • Spring Boot 自动配置一篇概览
  • 深入理解设计原则之接口隔离原则(ISP)【软件架构设计】
  • IMX6ULL裸机篇之I2C实验主控代码说明二
  • 【计算机组成原理与体系结构】数据的表示与运算
  • 如何入门编程
  • SQL中CONVERT转化日期函数的使用方法
  • SpringBoot2-核心技术(一)
  • mac host学习
  • Java之~指定String日期时间,5分钟一截取时间
  • 【chatGPT4结对编程】chatGPT4教我做图像分类
  • Different romantic
  • learn C++ NO.7——C/C++内存管理
  • SDUT数据库原理——第十章作业(参考答案)
  • My Note of Diffusion Models
  • 【P37】JMeter 仅一次控制器(Once Only Controller)
  • cleanmymac要不要下载装机?好不好用
  • DNS风险分析及防护研究(五):常见的DNS威胁与防御(中科三方)
  • 使用geoserver发布shp和tiff数据
  • 谷歌周彦祺:LLM浪潮中的女性科学家多面手丨智源大会嘉宾风采
  • Burp模块
  • sql笔记:SQL SERVER字符串填充(标量值函数创建、标量值函数调用)
  • python使用hTTP方法