1 Star 0 Fork 1

ubuntu11/Two_Layer_EMS

forked from yueliang3/Two_Layer_EMS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fcnCalCostonlyDegradation.m 964 Bytes
一键复制 编辑 原始数据 按行查看 历史
juchengquan 提交于 2019-03-10 11:07 . 0.9b
function priceOut = fcnCalCostonlyDegradation(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 = coeff*( abs(x(i,1)+u(i,2))^b - abs(x(i,1)^b ) );
else %0.0001*(1/u(2))^2 +
cost = coeff*( abs(u(i,2))^b );
end
else
if u(i,2)*x(i,1)>=0 % x(1) is the cumulative kWh
cost = coeff*( abs(x(i,1)+u(i,2))^b - abs(x(i,1)^b ) );
else %0.0001*(1/u(2))^2 +
cost = coeff*( abs(u(i,2))^b );
end
end
priceOut(i,1) = cost;
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ubuntu11/Two_Layer_EMS.git
git@gitee.com:ubuntu11/Two_Layer_EMS.git
ubuntu11
Two_Layer_EMS
Two_Layer_EMS
master

搜索帮助