alan-turing-institute / vehicle-grid-integration-webapp-private

Vehicle Grid Integration OpenDSS webapp - private
MIT License
0 stars 1 forks source link

How to pass numpy arrays into DSS code and make sure they all get added to the demand profile #14

Closed OscartGiles closed 2 years ago

OscartGiles commented 2 years ago

Loading profile data for the DSS Simulation

My current understanding is:

  1. There are a load of files that get loaded in the DSS code here:

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/funcsTuring.py#L966-L1021

Each of these gets put in a Bunch (a dict-like data structure)

For any of these that have more than one column, we then calculate an average profile (average each row) and put each of those into self.p. Both the unaveraged and averaged versions stay in self.p. The average version has _ appended to the name (i.e. the row averaged of self.p.crest is self.p.crest_.

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/funcsTuring.py#L1024-L1032

I think this is the part of the code I need to pass my numpy arrays to. Is that right @deakinmt @myriam-nea @LouiseABowler . Do I need to make changes anywhere else in the code base?

All this code gets run here:

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/funcsTuring.py#L172-L186

but only if this is true: if "dmnd_gen_data" in rundict.keys():. This comes from here:

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/azureOptsXmpls.py#L49-L82

We then call this method:

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/funcsTuring.py#L1135-L1307

which creates self.dmnd grabs some of the profile arrays and does some stuff with it (not sure what). self.dmnd then appears again here:

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/funcsTuring.py#L1726-L1768

I'm not quite sure whats happening here, but the result is an array with shape (917, 48) which gets passed to

https://github.com/alan-turing-institute/vehicle-grid-integration-webapp-private/blob/352511715a2f443117a77ad83d48ad20bc73bae9/vgi_api/vgi_api/azure_mockup.py#L58

which runs the simulation.

What things end up in self.p

These are all the things in self.p, which presumably should be replaced by the numpy arrays I'm creating on the API.

What I have on the API

These can either be a CSV file the user uploads, None, or one of a set of default profiles.

What I don't know is how these map to the datasets above... Or exactly what I need to change in the DSS code.

OscartGiles commented 2 years ago

mv_solar_profile

IC00 (always loaded in code)

Heat pump options

Electric Vehicle data

Smart Meter

OscartGiles commented 2 years ago

Implemented