%% Update swarm
[~, gbest] = min(swarm(:, 4, 1));
% diversity control
for d=1:num_of_D,
swarm_diversity(d) = 0.5*(max(swarm(:, 1, d))-min(swarm(:, 1, d)));
end
for d=1:num_of_D,
if swarm_diversity(d) < diversity_limit,
swarm_dir(d) = -1;
else
swarm_dir(d) = 1;
end
end
% Updating velocity vectors and positions
for n=1:swarm_size
for d = 1 : num_of_D,
rand1=rand;
rand2=rand;
swarm(n, 2, d) = Kappa*(swarm(n, 2, d)...
+ swarm_dir(d)*correction_factor*rand1*(swarm(n, 3, d) - swarm(n, 1, d))...
+ swarm_dir(d)*correction_factor*rand2*(swarm(gbest, 3, d) - swarm(n, 1, d)));
end
for d = 1 : 4,
swarm(n, 2, d)= min(max(-5e-2,swarm(n, 2, d)),5e-2);
if bound(n,d)==1
if ((swarm(n, 1, d) + swarm(n, 2, d))>0)&&((swarm(n, 1, d) + swarm(n, 2, d))<1)
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
bound(n,d)=0;
else
swarm(n, 1, d) = swarm(n, 1, d) - swarm(n, 2, d);
end
else
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
if (swarm(n, 1, d)<0)||(swarm(n, 1, d)>1)
bound(n,d)=1;
end
swarm(n, 1, d)= min(max(0,swarm(n, 1, d)),1);
end
end
for d = 5 : 16,
swarm(n, 2, d)= min(max(-5e-2,swarm(n, 2, d)),5e-2);
if bound(n,d)==1
if ((swarm(n, 1, d) + swarm(n, 2, d))>-1)&&((swarm(n, 1, d) + swarm(n, 2, d))<1) %Lvalues
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
bound(n,d)=0;
else
swarm(n, 1, d) = swarm(n, 1, d) - swarm(n, 2, d);
end
else
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
if (swarm(n, 1, d)<-1)||(swarm(n, 1, d)>1) %Lvalues
bound(n,d)=1;
end
swarm(n, 1, d)= min(max(-1,swarm(n, 1, d)),1); %Lvalues
end
end
for d = 17 : 20,
swarm(n, 2, d)= min(max(-5e-2,swarm(n, 2, d)),5e-2);
if bound(n,d)==1
if ((swarm(n, 1, d) + swarm(n, 2, d))>-1)&&((swarm(n, 1, d) + swarm(n, 2, d))<0) %Lvalues
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
bound(n,d)=0;
else
swarm(n, 1, d) = swarm(n, 1, d) - swarm(n, 2, d);
end
else
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
if (swarm(n, 1, d)<-1)||(swarm(n, 1, d)>0) %Lvalues
bound(n,d)=1;
end
swarm(n, 1, d)= min(max(-1,swarm(n, 1, d)),0); %Lvalues
end
end
for d = 21 : 24,
swarm(n, 2, d)= min(max(-5e-2,swarm(n, 2, d)),5e-2);
if bound(n,d)==1
if ((swarm(n, 1, d) + swarm(n, 2, d))>0)&&((swarm(n, 1, d) + swarm(n, 2, d))<1) %Lvalues
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
bound(n,d)=0;
else
swarm(n, 1, d) = swarm(n, 1, d) - swarm(n, 2, d);
end
else
swarm(n, 1, d) = swarm(n, 1, d) + swarm(n, 2, d);
if (swarm(n, 1, d)<0)||(swarm(n, 1, d)>1) %Lvalues
bound(n,d)=1;
end
swarm(n, 1, d)= min(max(0,swarm(n, 1, d)),1); %Lvalues
end
end
end
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
燃料电池(fuel cell power train)能量管理策略,采用模糊控制、粒子群优化 使得电动车能量在锂离子电池和超级电容器之间进行优化分配!!!
资源推荐
资源详情
资源评论
收起资源包目录
燃料电池能量管理策略.7z (10个子文件)
updateswarm.m 5KB
PSO4FLCdemo_run_me.m 2KB
FLC4EV_PSO_demo.slx 204KB
initial_parameters.mat 229B
Init_swarm.m 1KB
writeweights.m 423B
FLC_HESS.fis 3KB
run_sim.m 352B
visu_PSO.m 2KB
sim_demo.m 1KB
共 10 条
- 1
资源评论
- zhizhi2050302024-02-26资源很实用,对我启发很大,有很好的参考价值,内容详细。
- 邹可2023-06-04怎么能有这么好的资源!只能用感激涕零来形容TAT...
- 用生命耍帅2024-03-18实在是宝藏资源、宝藏分享者!感谢大佬~
- 2301_815099322024-01-29发现一个宝藏资源,资源有很高的参考价值,赶紧学起来~
- 2301_767764142024-03-29发现一个宝藏资源,资源有很高的参考价值,赶紧学起来~
学习不好的电气仔
- 粉丝: 1559
- 资源: 266
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功