openclimatefix / power_perceiver

Machine learning experiments using the Perceiver IO model to forecast the electricity system (starting with solar)
MIT License
7 stars 1 forks source link

Experiment with physical PV prediction using pvlib #10

Open JackKelly opened 2 years ago

JackKelly commented 2 years ago

This is the first step of the "new ML research direction" outlined in issue #7.

TODO:

Context

I'm increasingly convinced that we need to accurately model each individual PV system as accurately as possible (especially local shading and inverter clipping). For two main reasons:

JackKelly commented 2 years ago

I've made a start on this on Friday, and found a few PV systems with pretty obvious shading issues (the plot shows power on the y axis and time-of-day on the x axis for June):

image

JackKelly commented 2 years ago

Here's pvlib prediction using clearsky irradiance (and default wind speed and air temperature):

image

Implemented in: https://github.com/openclimatefix/power_perceiver/blob/0f53822646da2605e4143268d6ac1be8cb4eabca/notebooks/2022-02-28_predict_pv_using_pvlib/predict_pv_using_pvlib.ipynb

Next step: Predict using NWPs

JackKelly commented 2 years ago

Actually, NWP irradiance isn't terrible: (this is using the NWP irradiance produced by the most recent NWP model run).

image

And showing cloud cover. And with data from 10 nearby PV systems in grey:

image

JackKelly commented 2 years ago

Hmm, I think one big source of error when using pvlib is likely to be the calculation of GHI, DNI and DHI.

The issue is that the NWP doesn't provide GHI, DNI and DHI. Instead it just provides "downwards short-wave radiation flux".

The pvlib docs provide a method to compute GHI, DNI and DHI purely from NWP total cloud cover (which already makes me nervous: we know that clouds at different vertical levels affect sunlight in different ways).

If we do this, then we get something that looks quite different to the NWP DSWRF:

image

image

If we use NWP DSWRF as GHI (which I'd guess is the right thing to do?! But I'm really not sure! Especially because none of the pvlib.forecast models do this) then we get this:

image

JackKelly commented 2 years ago

9408286

JackKelly commented 2 years ago

Next steps:

JackKelly commented 2 years ago

MAE for predicting PV power with PVLib using NWP directly above the PV system (ignoring times when the sun is less than 10 degrees above the horizon):

Both these values are closer to 7% MAPE if using the complete time series (including nighttime).

JackKelly commented 2 years ago

to convert the vector line which represents the line-of-sight of the Sun through the lower 10 km of the atmosphere, I'm planning to adapt Xiaolin Wu's line drawing algorithm.

Maybe something like this:

  1. Find the integer index for the NWP "pixel" directly above the PV system.
  2. Calculate the distance of the line of sight (distance = tan(90 - azimuth) * 10 km altitude / 2 km per pixel)
  3. Use the line drawing algorithm to find the other nwp "pixels" needed. And use the anti-aliasing to compute a weighted mean. Implement the line drawing algo as a function that returns an array of points specified as x, y, intensity, in the order of the points from the start of the line. Then break the line into three segments. Compute the weighted mean of the low clouds for the first line segment, medium clouds for the middle segment, and high clouds for the last line segment
JackKelly commented 2 years ago

Give the ML model: solar azimuth, angle, and irradiance at the top of the atmosphere

JackKelly commented 2 years ago

Note to self: See the "next steps" in the ipython notebook.

JackKelly commented 2 years ago

tl:dr: Yes, tracing the clouds along the sun's path seems to help!

Experiments computing GHI, DNI and DHI using the clouds, selecting the NWP grid boxes in the Sun's path:

JackKelly commented 2 years ago

Next steps: