for i=1:9
elebus24=XLSX.getdata(FUHE[i])
gasbus24=XLSX.getdata(FUHE[i+9])
for m=1:2
hotbus24=XLSX.getdata(FUHE[9*m+9+i])
#####################CHP############
for j=1:5#CHP数量
if i<=3
if m==1 #||m==3
USEgas[j,:]=@expression(model,Echp_a[j,i,:]/0.35);#CHPh是CHP机组热转化效率,单位为MW
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ebus1[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_a[j,i,:]);
else USEgas[j,:]=@expression(model,Echp_s[j,i,:]/0.35);#CHPh是CHP机组热转化效率,单位为MW
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ebus1[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_s[j,i,:]);
end
line=findnext(gbus1[:,1].==EHCHP[j,1], 1);
gasbus24[line,:]=@expression(model,gasbus24[line,:]+USEgas[j,:]*100);
line=findnext(hbus1[:,1].==EHCHP[j,7], 1);
hotbus24[line,:]=@expression(model,hotbus24[line,:]-GEThot[j,:]);
elseif i>3&i<=6
if m==1#||m==3
USEgas[j,:]=@expression(model,Echp_a[j,i,:]/0.35);#CHPh是CHP机组热转化效率,单位为MW
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ehavebus2[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_a[j,i,:]);
else USEgas[j,:]=@expression(model,Echp_s[j,i,:]/0.35);
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ehavebus2[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_s[j,i,:]);
end
line=findnext(ghavebus2[:,1].==EHCHP[j,1], 1);
gasbus24[line,:]=@expression(model,gasbus24[line,:]+USEgas(j,:)*100);
line=findnext(hhavebus2[:,1]==EHCHP[j,7], 1);
hotbus24[line,:]=@expression(model,hotbus24[line,:]-GEThot[j,:];
*elseif i>6*
if m==1
USEgas[j,:]=@expression(model,Echp_a[j,i,:]/0.35);#CHPh是CHP机组热转化效率,单位为MW
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ehavebus3[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_a[j,i,:]);
else USEgas[j,:]=@expression(model,Echp_s[j,i,:]/0.35);#CHPh是CHP机组热转化效率,单位为MW
GEThot[j,:]=@expression(model,USEgas[j,:]*0.45);
line=findnext(ehavebus3[:,1].==EHCHP[j,2], 1);
elebus24[line,:]=@expression(model,elebus24[line,:]-Echp_s[j,i,:]);
end
line=findnext(ghavebus3[:,1].==EHCHP[j,1], 1);
gasbus24[line,:]=@expression(model,gasbus24[line,:]+USEgas(j,:)*100);
line=findnext(hhavebus3[:,1]==EHCHP[j,7], 1);
hotbus24[line,:]=@expression(model,hotbus24[line,:]-GEThot[j,:];
end
end
end
end
如上所示,在 elseif i>6处报错。不知是逻辑错误还是什么,请大大帮忙看一下
这两边不是有*吗,拿掉就好了吧
不是的,在源程序中已经去掉了,还是报错。我也很迷惑
错误信息是什么?
我怀疑错误信息是这个,应该用 &&
事实是你这两个地方漏了括号,你仔细看看。
elseif USEgas[j,:]=@expression(model,Echp_s[j,i,:]/0.35);