Hello Friends,
If we have the following table in GAMS:
Table X(s, b)
B1
0 10
1 20
2 30
3 40;
And another table as follows:
Table Power_Bus(PB, *)
P_bus Q_bus
PB1 0 0
PB2 100 60
PB3 90 40
PB4 120 80
PB5 60 30
PB6 60 20
PB7 200 100
PB8 200 100
PB9 60 20
PB10 60 20;
And we want to write a code that subtracts the values from the first table one by one from a specific value in the second column of the second table, how can we implement this?
I tried to implement it in GAMS but received the following error:
Dimension different - The symbol is referenced with more/less indices as declared
Code:
Sets
s /0*3/
b /B1/
PB /PB1*PB10/;
Alias (s,i);
Table X(s,b)
B1
0 10
1 20
2 30
3 40;
Table Power_Bus(PB,*)
P_bus Q_bus
PB1 0 0
PB2 100 60
PB3 90 40
PB4 120 80
PB5 60 30
PB6 60 20
PB7 200 100
PB8 200 100
PB9 60 20
PB10 60 20;
Parameters
Modified_Power_Bus(PB, *);
Modified_Power_Bus(PB,'P_bus') = Power_Bus(PB,'P_bus');
loop(s,
Modified_Power_Bus(PB(s),'P_bus') = Power_Bus(PB(s),'P_bus') - X(s,'B1');
);
Display Modified_Power_Bus;
Thank you!