Hi,
My problem is with the definition of variable ‘ds’ used in equations 1 & 2. Eq 1 & 2 runs for each line. And each line has ns (ns is a parameter in the fdata table) number of steps. Variable ‘ds’ should be defined for each step in each line. The way I have written variable ‘ds’ in equations, it will be overwritten of second line onwards. Could anyone help me with the definition of variable ‘ds’ in such situations? Please let me know if you need any more information.
Set
i ‘Gas network buses’ / 17 /
slack(i) ‘Source bus’ / 1, 3 /
t ‘Time period’ / t1t1 /
mn ‘Set to access fdata from excel sheet’ /Cjj,Fgmin,Fgmax,ns,nsk/;
Alias (i,j);
$call gdxxrw MultiEnergySystemData.xlsx par=fdata rng=ModifiedNGSystem!A21:G27 cDim=1 rDim=2
*=== Now import data from GDX
Parameter fdata(i,j, mn);
$gdxin MultiEnergySystemData.gdx
$load fdata
$gdxin
display fdata
$ontext
fdata is like this
i j Cjj Fgmin Fgmax ns nsk
1 2 50.6 0 3000 300 300
2 3 50.1 0 1000 100 100
3 4 45.3 0 10 100 100
2 5 45.3 0 2500 250 250
5 6 43.1 0 1200 120 120
6 7 37.5 0 600 100 100
offtext
\
\
Parameter cx(i,j), cxv(i,j);
cx(i,j)(LN(i,j,‘Limit’))= 1;
Variables ds(i,j), fg;
Equation eq1, eq2;
, eq22, eq25;
eq1(i,j)$cx(i,j)…
fg(i,j) =e= Fgmin(i,j) + sum(ns(i,j),(1/nsk(i,j))(Fgmax(i,j)-Fgmin(i,j))*ds(ns(i,j)));
eq2(i,j)$cx(i,j)…
sum(ns(i,j),sqr((1/nsk(i,j))(Fgmax(i,j)-Fgmin(i,j)))(sqr(ns(i,j))-sqr(ns(i,j)-1))*ds(ns(i,j)));