0

I am not able to sort out the Error 148 in GAMS Studio 39.3 for my problem.

148 Dimension different - The symbol is referenced with more/less indices as declared

following is the details:

Sets
EV          'EV unit'/ev1*ev1/
Asev1       'set ev index for values of sch' /1*2/
taev        'set of arrival'/taev1*taev1/
tdev        'set of departure'/tdev1*tdev1/
t           ’time periods’ /t1*t2/
w           ’scenarios’ /w1*w2/;


SCALAR 
Pev          ’EV power traded in the Energy market’/7.8/;


PARAMETER    
Asev        'alphasch(ev) values of alphasch'
/1         0
2          1/;


PARAMETER 
weigth(w)           ’weight of scenarios’
/w1  0.05
w2   0.05/;


POSITIVE VARIABLES
As(ev,t,w)           'EV scheduling in time period t';


EQUATION
Pev1                 'power output of EV'


Pev1(t,w)..     Pev=e=sum(ev,Pev(ev,t,w)*Asev('ev,t,w'));

I am not sure where i am making mistake however i am getting Error 148. Error 148 Dimension different - The symbol is referenced with more/less **** indices as declared

Note: I got $148 error under w)*

Lutz
  • 2,197
  • 1
  • 10
  • 12
Asad
  • 5
  • 2

2 Answers2

0
Pev1(t,w)..     Pev=e=sum(ev,Pev(ev,t,w)*Asev('ev,t,w'));

First, you probably don't want the quotes at the end, which makes ev,t,w one specific element. So, you should change it to this:

Pev1(t,w)..     Pev=e=sum(ev,Pev(ev,t,w)*Asev(ev,t,w));

But still, this does not work. You defined Asev as 1-dimensional parameter with the elements 1 and 2 above. That does not fit your usage here. So, what do you actually intend? Either the definition of Asev must be wrong or your usage. Or did you actually want to use As here instead, like this?

Pev1(t,w)..     Pev=e=sum(ev,Pev(ev,t,w)*As(ev,t,w));

This would resolve the problem for the last term, but give an error before, since also the use of Pev (with 3 indices here) does not match your definition as Scalar above.

Lutz
  • 2,197
  • 1
  • 10
  • 12
0

Thanks for your feedback!

As or Asev is just the declaration.

Firstly, I removed the quotes at the end, which makes (ev,t,w)

and here it is

Pev1(t,w).. Pev=e=sum(ev,Pev(ev,t,w)*As(ev,t,w));

The problem for the last term is still existing.

I didn't get it you saying " the use of Pev (with 3 indices here) does not match your definition as Scalar above."

I think the Pev (with 3 indices here) match with the scalar above

Asad
  • 5
  • 2
  • "As or Asev is just the declaration" - Not sure, what you mean here. They are two different symbols, one is a variable, the other a parameter. - "I think the Pev (with 3 indices here) match with the scalar above" - No, it actually does not. Scalar means 0 indices, so you cannot access it with 3 indices. BTW: It would be better to write a reply like yours under the answer as comment instead of as new answer. – Lutz Nov 02 '22 at 11:51
  • That would be better, but still has just two indices, not three, right? – Lutz Nov 02 '22 at 12:30
  • I am not sure about the SCALAR and indices here, I have reviewed some other codes in GAMS and they do have more than 2 or three indices in the SCALAR. As I have already lot of other symbols, so according to my mentioned approach and problem, I use Pev for Power of electric vehicle. i also have table for EV data which contains Pev value defined as power of EV. – Asad Nov 03 '22 at 00:02
  • in my new code, I consider As only a "Parameter" – Asad Nov 03 '22 at 00:03
  • Scalar has zero dimensions by definition (see https://www.gams.com/41/docs/UG_DataEntry.html#UG_DataEntry_Scalars). Not sure about the status of your problem after the latest comment. If you still have a question after some code changes, it would probably be the best to update your initial question. – Lutz Nov 03 '22 at 08:07
  • I will get back to you shortly after revising my problem – Asad Nov 05 '22 at 05:37