1 Star 0 Fork 1

yueliang3/Two_Layer_EMS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fcnCalCostwithDegradation.m 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
juchengquan 提交于 2019-03-10 11:07 . 0.9b
function priceOut = fcnCalCostwithDegradation(mpcModel, mpcdata, varargin) %this shows the objective funciton
%UPDATE Degradation Cost
m = mpcModel.mpciter;
u = mpcModel.u;
x = mpcModel.x;
price = mpcdata.price(1:m,1);
priceOut = zeros(m,1);
A = mpcModel.battery.lifeParam(1,1);
b = mpcModel.battery.lifeParam(1,2);
coeff = mpcModel.battery.totalprice /(2*A*( mpcModel.battery.capacity ^b));
for i = 1:1:m
if u(i,1)>=0
if u(i,2)*x(i,1)>=0 % x(1) is the cumulative kWh
cost = price(i)*u(i,1) + coeff*( abs(x(i,1)+u(i,2))^b - abs(x(i,1)^b ) );
else %0.0001*(1/u(2))^2 +
cost = price(i)*u(i,1) + coeff*( abs(u(i,2))^b );
end
else
if u(i,2)*x(i,1)>=0 % x(1) is the cumulative kWh
cost = 0.8*price(i)*u(i,1) + coeff*( abs(x(i,1)+u(i,2))^b - abs(x(i,1)^b ) );
else %0.0001*(1/u(2))^2 +
cost = 0.8*price(i)*u(i,1) + coeff*( abs(u(i,2))^b );
end
end
priceOut(i,1) = cost;
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yueliang3/Two_Layer_EMS.git
git@gitee.com:yueliang3/Two_Layer_EMS.git
yueliang3
Two_Layer_EMS
Two_Layer_EMS
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385