I'm getting a few errors in my code (which is interfaced with Matlab) and I'm unable to solve them.
26 $if exists $ include matdata.gms
**** $668
1 - Can't understand this error and can't find information about it.
58 PiCalc(b,t).. Pi(b,t) =e= P(b,t) + c(b,t) - d(b,t);
**** $37,409
37 '=l=' or '=e=' or '=g=' operator expected
2 - I don't understand what the problem is here as I clearly use a '=e=' operator.
59 P_linhaCalc(l,t).. P_linha(l,t) =e= sum(b, A(l,b)*Pi(b,t));
**** $8,409
8 ')' expected
409 Unrecognizable item - skip to find a new statement
looking for a ';' or a key word to get started again
3 - Again, I don't understand the missing ')' when It's present.
Any feedback is appreciated.
Full code is bellow:
** Define the structure to connect with the matlab code
*$onempty
$include matglobs.gms
*$if exists $ include matdata.gms
set t /1*%timeSteps%/,
b /1*%bus%/,
l /1*%lines%/
;
Positive Variable d(b,t),
c(b,t)
;
Free Variable res;
parameters size(b), rate(b),lim_linhas(l), P(b,t), A(l,b),
cost, soc(b,t),
P_linha(l,t),
pen, bat(b), preco(t)
;
$if exists $ include matdata.gms
Equations
socCalc1(b,t)
socCalc2(b,t)
maxDischarge(b,t)
maxCharge(b,t)
PiCalc(b,t)
P_linhaCalc(l,t)
penCalc(l,t)
Con10(b)
Con11
Obj
;
socCalc1(b,t)$(ord(t)=1).. soc(b,t) =e= size(b)/2;
socCalc2(b,t)$(ord(t)>1).. soc(b,t) =e= soc(b,t-1) + c(b,t) - d(b,t);
maxDischarge(b,t).. d(b,t) =l= rate(b)*size(b);
maxCharge(b,t).. c(b,t) =l= rate(b)*size(b);
PiCalc(b,t).. Pi(b,t) =e= P(b,t)+c(b,t)-d(b,t);
P_linhaCalc(l,t).. P_linha(l,t) =e= sum(b, A(l,b)*Pi(b,t));
penCalc(l,t)$(P_linha(l,t) > lim_linhas(l)).. pen =e= pen - (P_linha(l,t) - lim_linhas(l))*100000;
Con10(b).. sum(t, d(b,t)*preco(t) - c(b,t)*preco(t)) =e= bat(b);
Con11.. sum(b, bat(b)) =e= cost;
Obj.. cost + pen =e= res;
Model Opt_Bat /all/;
Solve Opt_Bat using MINLP minimizing res;
$libinclude matout res.l