Output GDX files for vSPD

  • 144 Views
  • Last post 3 weeks ago
Kaka posted this 4 weeks ago

Hi there

On the main vSPD page it says "vSPD output is generated as a collection of GDX and CSV files". However, when I run vSPD in GAMS Studio, it appears that only CSV files are added to the Output folder. I require GDX files for more efficient analysis of the output data. Can you please indicate where the GDX output files are, or provide instructions on how they can be created?

Thanks

Order by: Standard | Newest | Votes
Phil Bishop posted this 4 weeks ago

Hi there

I assume you are referring to v5.0.2 of vSPD. Regardless, my comments below pertain to v5.0.2.

My guess is that the statement on the vSPD page that says "vSPD output is generated as a collection of GDX and CSV files" refers to an older version of vSPD, likely prior to 1 Nov 2022 (the onset of real-time pricing (RTP)). RTP resulted in the vSPD GAMS code being modified substantially. So much so that we no longer maintain backward compatibility, ie a different version of vSPD is reqiured pre and post RTP. In any event, we will modify the vSPD page and remove the comment about writing all output to GDX files.

If you look at the file called vSPDreport.gms you'll see a block of code starting at line 15 that writes output to CSV files. Each CSV file created is within a loop over the sets controlling the domain of the variables (technically parameters) being written to the CSV file. Be aware that this writing to CSV might occur within a larger loop iterating over the days/intervals the model is being solved, ie at each iterate, the CSV report writing appends the file written to in the previous iterate.

Anyway, if you want to write to GDX files instead of or in addition to the CSV files, I suggest you add a statement to write to a GDX file at the point in the vSPDreport code at which the CSV files are written. See GAMS Data eXchange (GDX).

Alternatively, you could write some new code to hoover up all the CSV files and write them to a single GDX file if that better suits your purpose. See CSVRead.

Good luck

Phil

Kaka posted this 4 weeks ago

Thanks Phil. Yes, I was referring to v5.0.2 of vSPD.

On review of vSPDreport.gms, I see there is a commented out "execute unload" statement on line 442. To create a GDX file, I simply uncommented this statement.

So you're aware, the same commented out statement exists in VSPDReport.gms for v3.0.4, so it appears the change to output CSV files only pre-dated real-time pricing.

Cheers

Phil Bishop posted this 3 weeks ago

You need to be a little thoughtful about this. The execute_unload statement at line 442 of vSPDreport.gms will dump everything (sets, parameters, variable levels, bounds, marginal values, etc) that have been declared and initialised at the time you hit line 442.

Take a look at vSPDsolve.gms - make sure you appreciate what lines 14-31 are telling you. Then scroll down to line 136 and you'll see a bunch of parameters declared that start with o_. These are the parameters used to collect up the output we think is worth reporting each time around the solve loop, ie the variable levels and constraint marginal values will get updated with each solve. It is these parameters that you want to unload by name into a GDX file at the end, ie line 442 in vSPDreport.gms.

See also line 1739 of vSPDsolve.gms to see where vSPDreport.gms is included into vSPDsolve.gms.

Phil

Kaka posted this 3 weeks ago

Thanks Phil. Is there a way to save the output parameters that start with "o_" without individually listing each parameter in the execute_unload statement on line 442 of vSPDreport.gms? I attempted using a wildcard (o_*), but that didn't work.

Cheers

Phil Bishop posted this 3 weeks ago

I don't recall. It's about 10 years since I wrote any GAMS code. You could just go with the execute_unload statement at line #442, which will write everything to the GDX file and then just ignore most of it (except the o_* parameters).