✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
Matlab实现电动汽车充电负荷的模拟预测。该程序对1000天电动汽车的充电负荷进行模拟,可以很好的预测日电动汽车负荷。
该程序采用蒙特卡洛模拟方法,对电动私家车在工作日、非工作日的充电负荷进行模拟预测。
仿真结果包括:图1为1000天电动汽车的充电负荷,图2为电动汽车的充电负荷平均值,图3为随机选取1天的电动汽车的充电负荷,图4为程序的部分代码截图。
代码注释详细,适合于初学者,是很好的学习资料。
⛄ 部分代码
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (c) 2019-present, Mahmoud Afifi
% York University, Canada
% Email: mafifi@eecs.yorku.ca - m.3afifi@gmail.com
%
% This source code is licensed under the license found in the
% LICENSE file in the root directory of this source tree.
% All rights reserved.
%
%%
% Please cite the following work if this program is used:
% Mahmoud Afifi and Michael S. Brown. Sensor Independent Illumination
% Estimation for DNN Models. In BMVC, 2019
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
clc
clear all
close all
Matlab_ver = 'higher'; %'2018b', '2019a', or 'higher'
image_name = fullfile('imgs_w_normalization',...
'Cube+_challenge_CanonEOS550D_243.png'); %image name
%Note: be sure that the image is in the raw-RGB linear space and the
%black/saturation normalization is correctly applied to the image before
%using it.
model_name = 'trained_model_wo_NUS_Canon1DsMkIII'; %trained model name
device = 'gpu'; %cpu
in_img_sz = 150; %our network accepts 150x150 raw-RGB image
if strcmpi(Matlab_ver, '2018b') == 1 || strcmpi(Matlab_ver,'2019a') == 1
old = 1;
load(fullfile('models_old',model_name)); %load the trained model
else
old = 0;
load(fullfile('models',model_name)); %load the trained model
end
I_ = imread(image_name); %read the image
sz =size(I_);
if sz(1)~=in_img_sz || sz(2)~=in_img_sz
I = imresize(I_,[in_img_sz,in_img_sz]); %resize the image
else
I = I_;
end
%estimate the scene illuminant
if old == 1
est_ill = predict(trained_model,I,'ExecutionEnvironment',device);
else
est_ill = predict_(trained_model,I,device); %estimate the scene illuminant
end
est_ill = est_ill./norm(est_ill); %make it a unit vector
fprintf('Estimated scene illuminant = %f, %f, %f\n',...
est_ill(1),est_ill(2),est_ill(3)); %display the result
factor = 6; %scale factor to aid visualization
subplot(1,3,1); imshow(I_*factor);
title('Input raw-RGB image'); %show input raw-RGB image (scaled to aid visualization)
subplot(1,3,2); imshow(imresize(imread('mapped.png')*factor,[sz(1) sz(2)]));
title('mapped image');
subplot(1,3,3); imshow(reshape(...
reshape(im2double(I_),[],3)*diag(est_ill(2)./est_ill),sz)*factor); %apply white balance correction then show the result (scaled to aid visualization)
title('White-balanced raw-RGB image');
linkaxes
⛄ 运行结果
⛄ 参考文献
[1] 顾越,张晓冬,王强.基于MATLAB的电动汽车非车载充电机仿真建模[J].海军航空工程学院学报, 2012, 27(3):5.DOI:CNKI:SUN:HJHK.0.2012-03-025.
[2] 荣海,王印松,薛金会,等.基于MATLAB/Simulink的电动汽车非车载充电机仿真研究[C]//CNKI;WanFang.CNKI;WanFang, 2013:3.DOI:10.3969/j.issn.1671-1041.2013.06.008.