示例#1
0
def test_cloud_cover_to_ghi_linear():
    amodel = GFS()
    ghi_clear = 1000
    offset = 25
    out = amodel.cloud_cover_to_ghi_linear(0, ghi_clear, offset=offset)
    assert_allclose(out, 1000)
    out = amodel.cloud_cover_to_ghi_linear(100, ghi_clear, offset=offset)
    assert_allclose(out, 250)
示例#2
0
def test_cloud_cover_to_ghi_linear():
    amodel = GFS()
    ghi_clear = 1000
    offset = 25
    out = amodel.cloud_cover_to_ghi_linear(0, ghi_clear, offset=offset)
    assert_allclose(out, 1000)
    out = amodel.cloud_cover_to_ghi_linear(100, ghi_clear, offset=offset)
    assert_allclose(out, 250)
def test_cloud_cover_to_ghi_linear():
    with pytest.warns(pvlibDeprecationWarning):
        amodel = GFS()
    ghi_clear = 1000
    offset = 25
    out = amodel.cloud_cover_to_ghi_linear(0, ghi_clear, offset=offset)
    assert_allclose(out, 1000)
    out = amodel.cloud_cover_to_ghi_linear(100, ghi_clear, offset=offset)
    assert_allclose(out, 250)
示例#4
0
    def _make_pv_forecast(self, forecast) -> pd.DataFrame:
        """Compile the forecast required for PV generation prediction

        Uses pvlib to generate solar irradiance predictions.

        Arguments:
            forecast {pandas.DataFrame} -- DarkSky originated forecast
        """

        # Annoyingly, the PV & wind libraries want temperature named differently
        pv_forecast = forecast.rename(columns={
            'temperature': 'air_temp',
            'windSpeed': 'wind_speed',
        })

        # Use PV lib to get insolation based on the cloud cover reported here

        model = GFS()

        # Next up, we get hourly solar irradiance using interpolated cloud cover
        # We can get this from the clearsky GHI...

        if tables in sys.modules:
            # We can use Ineichen clear sky model (uses pytables for turbidity)
            clearsky = self.pv_location.get_clearsky(pv_forecast.index)

        else:
            # We can't, so use 'Simplified Solis'
            clearsky = self.pv_location.get_clearsky(pv_forecast.index,
                                                     model='simplified_solis')

        # ... and by knowledge of where the sun is
        solpos = self.pv_location.get_solarposition(pv_forecast.index)

        ghi = model.cloud_cover_to_ghi_linear(pv_forecast['cloudCover'] * 100,
                                              clearsky['ghi'])
        dni = disc(ghi, solpos['zenith'], pv_forecast.index)['dni']
        dhi = ghi - dni * np.cos(np.radians(solpos['zenith']))

        # Whump it all together and we have our forecast!
        pv_forecast['dni'] = dni
        pv_forecast['dhi'] = dhi
        pv_forecast['ghi'] = ghi

        return pv_forecast