If you don't share your model please don't expect others to write code for you that works with your model out of the box!
Please find further comments below.
Actually what this line does is exactly that. It computes the number of time slices based on the number of total timeslots.PeterBe wrote: ↑5 years ago Thanks Fred for your answer,
there are still a few things that I do not understand.
why do we need a Compile-Time Variable here? You anyways specify the number of total timeslots. So the number of time slices can be computed based on this.Code: Select all
$eval tSlices ceil(card(tt)/288)
You could also enter this number manually and define
Code: Select all
set tSlice / ts1*ts31 /;
There is no mapping operator. map(tSlice,tt) is just a two dimensional set that maps time slots to time slices if the right hand side evaluates to true.PeterBe wrote: ↑5 years agoI could not find a good description of the mapping operator. What is done in the statement "(ord(tSlice)-1)*288 < ord(tt) and (ord(tSlice))*288 >= ord(tt)"?Code: Select all
map(tSlice,tt) = (ord(tSlice)-1)*288 < ord(tt) and (ord(tSlice))*288 >= ord(tt);
You could rewrite this as:
Code: Select all
map(tSlice,tt)$[(ord(tSlice)-1)*288 < ord(tt) and (ord(tSlice))*288 >= ord(tt)] = yes;
This just changes the formatting of the display statement in a way that I sometimes like better than the default (https://www.gams.com/latest/docs/UG_Dis ... layControl).PeterBe wrote: ↑5 years agoThe same question here. What does 0:0:1 mean?Code: Select all
option map:0:0:1; display map;
What is in the set you now define as t_a? Isn't that the superset of timeslots? And if so, why does the explanatory text say 'time slices'? In any case, you are defining super set tt of time slots and another set for time slices later again. That does not make sense to me. You need to understand the example first and then transfer it to your code and get the names consistent. Of course you get tons of errors if you declare parameters that are indexed with sets you did not (yet) declare.PeterBe wrote: ↑5 years ago Regarding my code I changed the name of the variable that I used before from t to t_a. This set (and all other parameters) are loaded from the file "data_5min_Jan_DayAhead_1HH.gdx."
I also load other parameters from that file and define variables.Code: Select all
Set t_a timeslices household households; $call gdxxrw data_5min_Jan_DayAhead_1HH.xlsx index=index!A1 $ife errorlevel<>0 $abort Problems running GDXXRW $GDXIN 'data_5min_Jan_DayAhead_1HH.gdx'; $LOAD t_a $LOAD household set tt 'super set of time steps' /t1*t8928/; $eval tSlices ceil(card(tt)/288) set tSlice / ts1*ts%tSlices% / t(tt) 'dynamic subset of tt' map(tSlice,tt) 'mapping of time slice to time steps' ; map(tSlice,tt) = (ord(tSlice)-1)*288 < ord(tt) and (ord(tSlice))*288 >= ord(tt); option map:0:0:1; display map; ....
If I run the model I get many error messages stating "Values for domain 1 are unknown - no checking possible" and "Set has not been initialized".Code: Select all
... Parameter demand_heating(t, household) $LOAD demand_heating demand_electrical(t, household) $LOAD demand_electrical ... temperature_level_DHWTank.lo(t, household) = minimalDHWTankTemperature; temperature_level_DHWTank.up(t, household) = maximalDHWTankTemperature; ...
My questin is whether I have to adjust the arguments for all those variables and parameters? For example shall I change "demand_electrical(t, household)" to "demand_electrical(tt, household)" or something like that?
As I said at the very beginning, if you don't share your code or at least an executable example, it makes helping you difficult!
Fred