gams-math - GAMS中集合的变量定义问题
问题描述
我的问题是方程 1 中使用的变量“ds”的定义。方程 1 对每一行运行。并且每一行都有ns(ns是一个参数)步数。应为每行中的每个步骤定义变量“ds”。定义集合 l 和 nsl。参数 'linen' 显示网络中的行号。保持每行的步数相等,即 ns=250。定义变量 ds(l,nsl)。现在方程中这个变量的使用非常重要。我为行号 'linen' 编写了 ds(fdata(i,j,'linen'),nsl)) ,为步骤号编写了 nsl 。求和运行在 nsl 上。错误 121:eq1 中的 ds(fdata(i,j,'linen'),nsl)) 中的“设置预期”。
在这种情况下,任何人都可以帮助我定义变量“ds”吗?如果您需要更多信息,请告诉我。
Set
i 'Gas network buses' / 1*7 /
slack(i) 'Source bus' / 1, 3 /
t 'Time period' / t1*t1 /
mn 'Set to access fdata from excel sheet' /Cjj,Fgmin,Fgmax, linen/
l 'number of Gas lines' /1*6/
nsl 'steps' /1*250/ ;
Alias (i,j);
$call gdxxrw MultiEnergySystemData.xlsx par=fdata rng=ModifiedNGSystem!A21:F27 cDim=1 rDim=2
*=== Now import data from GDX
Parameter fdata(i,j, mn);
$gdxin MultiEnergySystemData.gdx
$load fdata
$gdxin
display data
Parameter ns /250/;
$ontext
fdata is like this
i j Cjj Fgmin Fgmax linen
1 2 50.6 0 3000 1
2 3 50.1 0 1000 2
3 4 45.3 0 10 3
2 5 45.3 0 2500 4
5 6 43.1 0 1200 5
6 7 37.5 0 600 6
$offtext
Parameter cx(i,j), cxv(i,j);
cx(i,j)$(fdata(i,j,'Cjj'))= 1;
Variables ds(l,nsl), fg(i,j);
Equation eq1;
eq1(i,j)$cx(i,j)..
fg(i,j) =e= fdata(i,j,'Fgmin') + sum(nsl,(1/ns)*(fdata(i,j,'Fgmax')-fdata(i,j,'Fgmin'))*ds(fdata(i,j,'linen'),nsl));
解决方案
推荐阅读
- c - 如何提取字符串的前 X 个字符并将它们用于 C 中的另一个字符
- javascript - Gulp 4 不输出 console.log
- python - 您如何将语料库中的所有单词包含在 Gensim TF-IDF 中?
- c++ - 在 C++ 中输出错误数字的数组
- reactjs - 数据存储更改时组件如何更新
- postgresql - PostgreSQL 表布局和索引性能
- java - 如何在 Java 中更新控制台上的输出?(右手规则迷宫求解器)
- javascript - ApostropheCMS:当实际上有孩子时,如何在撇号页面下填充 _children 键?
- qt - QML:ListView 中的鼠标滚轮事件传播
- apache-spark - 使用 PySpark 进行动态时间分析