Hello,
I am formulating LP problem using JuMP for energy system
one of the constraints is the nodal electricity balance, say I have indices of node, time, and technologies
How do I make a certain expression valid for a specific index?
In the example below, what I am trying to achieve is that I only want the first sum expression to apply when index x is CHP, though it will be expanded later
using DataFrames, CSV, XLSX, UnPack, JuMP, HiGHS
@constraints model begin
Electricity_Balance[i in NODES, k in NODES, t in HOURS],
eldemand_data[i, t] + sum(Generation_Dispatch[i, x, t; x == "CHP"] / gentechdata[x; x == "CHP"].efficiency for x in GEN_TECHS) ≤
sum(Generation_Dispatch[i, x, t] for x in GEN_TECHS) + Active_Flow[i, k, t] +
sum(Storage_Dispatch[i, s, t; s == "BAT"] for s in STO_TECHS)
end
but it throws this error
LoadError: At c:\Users… : unsupported operator +
LoadError: syntax: unexpected semicolon in array expression around C:\Users…
How should I formulate it better?
Or should I define different constraints that apply to these indices?
Thank you very much in advance!