Hi,
So I’ve built this simple model, but I cant make it work because I dont know how to integrate the binary part with the non linear optimization. Im getting error 53 Endogenous $ operation not allowed, can anyone help me with this please? Thank you!!
Sets
t time periods /t1*t10/;
Parameter
cap max generation capacity /325/
sto max storage capacity /2600/
pump max pumping capacity /253/
price(T) price at period t
/t1 131.55,
t2 168.78,
t3 158.78,
t4 151.95,
t5 147.31,
t6 145.55,
t7 144.79,
t8 144.94,
t9 144.67,
t10 147.31/;
Variables
x(t) ‘pumping quantity in time period t’
y(t) ‘generation quantity in time period t’
s(t) ‘storage quantity at period in time period t’
bx(t) ‘boolean pumping in time period t’
by(t) ‘boolean generation in time period t’
cf ‘capacity factor %’
z ‘total revenue in thousands of dollars’;
Positive Variable x,y,s;
Binary Variable bx,by;
Equations
revenue “define objective function”
pumping(t) “pumping at period t”
max_pump(t) “max pumping at period t”
max_gen(t) “max gen at period t”
generation(t) “generation at period t”
storage (t) “storage at period t”
max_storage(t) “max storage at period t”
capacityfactor “capacity factor of the plant”;
storage(t)… s(t)=e=x(t-1) +s(t-1) +y(t);
revenue… z =e= sum(t,by(t)*y(t)*price(t)-bx(t)*x(t)price(t));
pumping(t)… bx(t)(by(t)=1)=e=0;
max_pump(t).. x(t)=l=pump;
max_storage(t).. s(t) =l= sto;
generation(t).. by(t)(bx(t)=1) =e=0;
max_gen(t)… y(t)=l=cap;
capacityfactor… cf =e= sum(t,y(t)/(17520cap));
y.fx(‘t1’) = 0;
Model batteries_model /all/ ;
option nlp=conopt;
option mip=cplex;
option rminlp=conopt;
option minlp=dicopt;
Solve batteries_model using minlp maximizing z;