💥💥💞💞欢迎来到本博客❤️❤️💥💥
🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
📋📋📋本文目录如下:🎁🎁🎁
目录
💥1 概述
📚2 运行结果
2.1 算例1
2.2 算例2
2.3 算例3
🌈3 Matlab代码实现
🎉4 参考文献
💥1 概述
本研究的目的是预测压缩空气系统的电气负载曲线,这对于行业从业者和软件提供商开发更好的负载管理和前瞻调度程序的实践和工具很有价值。使用两层前馈神经网络和长短期记忆两个人工神经网络来预测空压机的电气负荷。
📚2 运行结果
2.1 算例1
2.2 算例2
2.3 算例3
部分代码:
close all
clear all
% load data
load('data/ac1Data.mat')
% assign data to variables
Load = ac1.load;
Weekday = weekday(ac1.DATE);
Minute = minute(ac1.Time);
Hour = hour(ac1.Time);
Pressure = ac1.LinePressure_bar_;
Temp1 = ac1.InletAirTempC;
Temp2 = ac1.DischargeTemperature_degC_;
% form input
exoData = [Weekday,Minute,...
Hour,Pressure,Temp1,Temp2];
% define working day index
workingDayIdx = and(Weekday >1, Weekday < 7);
% define non-working day index
nonworkingDayIdx = or(Weekday ==1,Weekday == 7);
% data pre-process/apply hampel filter
workingExoData = exoData(workingDayIdx,:);
workingLoad= hampel(Load(workingDayIdx),5,2);
nonworkingExoData = exoData(nonworkingDayIdx,:);
nonworkingLoad = hampel(Load(nonworkingDayIdx),5,2);
% define working day test set
inputTestSeries1 = num2cell(workingExoData(end-200:end,:)',1);
targetTestSeries1 = num2cell(workingLoad(end-200:end)');
% define non-working day test set
inputTestSeries2 = num2cell(nonworkingExoData(end-200:end,:)',1);
targetTestSeries2 = num2cell(nonworkingLoad(end-200:end)');
% load pre-trained networks
load('data/ac1_w_ffnn.mat') % for working days
load('data/ac1_nw_ffnn.mat') % for non-working days
netsw = removedelay(netw);
netsn = removedelay(netn);
% forecast values using pre-trained networks
[xsw,xisw,aisw,tsw] = preparets(netsw,inputTestSeries1,{},targetTestSeries1);
ys_w = netsw(xsw,xisw,aisw);
[xsn,xisn,aisn,tsn] = preparets(netsn,inputTestSeries2,{},targetTestSeries2);
ys_n = netsn(xsn,xisn,aisn);
% timeshfit forecasts back to the original positive -- see 'removedelay' documentation
yhat_w = cell2mat(ys_w(end-96:end-1));
y_w = workingLoad(end-(length(yhat_w)-1):end)';
yhat_n = cell2mat(ys_n(end-96:end-1));
y_n = nonworkingLoad(end-(length(yhat_n)-1):end)';
% calculate evaluation metrics
workingDayRMSE = sqrt(mean((y_w - yhat_w).^2)); % calculate root mean squared error for working day forcast
nonworkingDayRMSE = sqrt(mean((y_n - yhat_n).^2)); % calculate root mean squared error for non-working day forcast
RMSE = [workingDayRMSE;nonworkingDayRMSE];
workingDayMASE = mean(abs(y_w-yhat_w))/(mean(abs(y_w(2:end)-y_w(1:end-1)))); % calculate mean absolute scaled error for working day forecast
nonworkingDayMASE = mean(abs(y_n-yhat_n))/(mean(abs(y_n(2:end)-y_n(1:end-1)))); % calculate mean absolute scaled error for non-working day forecast
MASE = [workingDayMASE;nonworkingDayMASE];
mdl_w = fitlm(y_w,yhat_w);
workingDayR2 = mdl_w.Rsquared.Ordinary; % get R2 between observed and predicited for working day forecast
mdl_n = fitlm(y_n,yhat_n);
nonWorkingDayR2 = mdl_n.Rsquared.Ordinary ;% get R2 between observed and predicited for non-working day forecast
R2 = [workingDayR2;nonWorkingDayR2];
T = table (RMSE,MASE,R2,'RowNames',{'Working Days';'Non-working Days'}); % construct output table
T.Properties.DimensionNames{1} = 'Mode';
figure
subplot(2,2,1)
plot(y_w)
hold on
plot(yhat_w,'.-')
hold off
legend(["Measured" "Predicted"])
xlabel("Timestep (15-minutes)")
ylabel("Electrical Load (kW)")
title(["Forecast using FFNN";"Compressor 1 - Working Day"])
subplot(2,2,3)
stem(yhat_w - y_w)
xlabel("Timestep (15-minutes)")
ylabel("Error (kW)")
title("RMSE = " + workingDayRMSE)
subplot(2,2,2)
plot(y_n)
hold on
plot(yhat_n,'.-')
hold off
legend(["Measured" "Predicted"])
xlabel("Timestep (15-minutes)")
ylabel("Electrical Load (kW)")
title(["Forecast using FFNN";"Compressor 1 - Non-Working Day"])
subplot(2,2,4)
stem(yhat_n - y_n)
xlabel("Timestep (15-minutes)")
ylabel("Error (kW)")
title("RMSE = " + nonworkingDayRMSE)
writetable(T,'results/ac1_ffnn_metrics.csv','WriteRowNames',true)
saveas(gcf, 'results/ac1_ffnn_result.png')
🌈3 Matlab代码实现
🎉4 参考文献
部分理论来源于网络,如有侵权请联系删除。
[1]Da-Chun Wu, Babak Bahrami Asl, Ali Razban, Jie Chen (2020) Air Compressor Load Forecasting using Artificial Neural Network