OSeMOSYS / OSeMOSYS_GNU_MathProg

The GNU MathProg implementation of OSeMOSYS
Apache License 2.0
9 stars 14 forks source link

added check statements to perform simple parameter debugging #50

Closed vignesh1987 closed 4 years ago

vignesh1987 commented 4 years ago

I have added check statements to perform simple checks on some parameters in the OSeMOSYS data file. 1.'Capacity investment' check

  1. 'Annual Activity' check
  2. 'Total capacity' check
  3. 'Minimum Annual activity' check
  4. 'Time Slice' check
  5. 'Model period activity limit' check
vignesh1987 commented 4 years ago

Hi, I have now created test cases for the check statements except for statement 3 (Total capacity check). I am not able to find a workaround for checking Total annual max capacity>= residual capacity + Total Annual Min capacity investment for those technologies where the Total annual max capacity is not zero by default but intentionally (by mistake) entered as zero. @willu47, @tniet, @abhishek0208 : if any of you have a few minutes, would like to discuss this!

tniet commented 4 years ago

Hey @vignesh1987 - Happy to find a time to meet to discuss but the time zone differences might make that challenging.

Looking at the code, why you don't want to check when TotalAnnualMaxCap is 0 (even if it's the default)? If we adopt the -1 convention of not binding (per commit https://github.com/OSeMOSYS/OSeMOSYS_GNU_MathProg/commit/83f2d80c6bf5e07bd8f9a4ab284f309430463317) then we should be checking for zero TotalAnnualMaxCap against ResidualCap, etc.

Am I missing something?

willu47 commented 4 years ago

Tests are currently failing because your checks have found a problem in the utopia model!

$ glpsol -m src/osemosys.txt -d tests/utopia.txt 
GLPSOL: GLPK LP/MIP Solver, v4.65
Parameter(s) specified in the command line:
 -m src/osemosys.txt -d tests/utopia.txt
Reading model section from src/osemosys.txt...
1097 lines were read
Reading data section from tests/utopia.txt...
543 lines were read
Checking (line 156)...
Capacity investment check successful 
Checking (line 160)...
Annual Activity check successful 
Checking (line 164)...
Capacity check 1 successful 
Checking (line 168)...
Capacity check 2 successful 
Checking (line 172)...
Minimum Activity check successful 
Checking (line 176)...
src/osemosys.txt:176: check[1990] failed
MathProg model processing error
willu47 commented 4 years ago

Suggest something like this:

check{y in YEAR}: sum{l in TIMESLICE} YearSplit[l,y] >= 0.9999 && sum{l in TIMESLICE} YearSplit[l,y] <= 1.0001;
vignesh1987 commented 4 years ago

@willu47 : Thanks for the help and suggestions. I have

  1. Corrected the Printf statements as you suggested. Found out that there is a 100 character limit for Print statements in GNU-Mathprog.
  2. Changed the year split bounds
  3. Reverted back to the latest master version (for rest of the code)
vignesh1987 commented 4 years ago

Should I add it to other versions of the code as well? (as they have the same parameters). I mean the short and the lastest fast versions?

willu47 commented 4 years ago

Yes please!