Add FlexMeasures plugins, USEF protocol, and Cariflex simulator

- flexmeasures-entsoe: ENTSO-E data plugin
- flexmeasures-weather: Weather data plugin
- USEF Flex Trading Protocol PDF (2.4MB)
- Cariflex simulator (publishes to Redis)
- Dashboard Grafana updated with correct InfluxDB queries
- All tools extracted in /tools/
This commit is contained in:
Eric F
2026-06-08 07:38:57 -04:00
parent 3fb90a8033
commit d4974e3241
72 changed files with 5185 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
from datetime import datetime
import pandas as pd
from pvlib.location import Location
def compute_irradiance(
latitude: float, longitude: float, dt: datetime, cloud_coverage: float
) -> float:
"""Compute the irradiance received on a location at a specific time.
This uses pvlib to
1) compute clear-sky irradiance as Global Horizontal Irradiance (GHI),
which includes both Direct Normal Irradiance (DNI)
and Diffuse Horizontal Irradiance (DHI).
2) adjust the GHI for cloud coverage
"""
site = Location(latitude, longitude, tz=dt.tzinfo)
solpos = site.get_solarposition(pd.DatetimeIndex([dt]))
ghi_clear = site.get_clearsky(pd.DatetimeIndex([dt]), solar_position=solpos).loc[
dt
]["ghi"]
return ghi_clear_to_ghi(ghi_clear, cloud_coverage)
def ghi_clear_to_ghi(ghi_clear: float, cloud_coverage: float) -> float:
"""Compute global horizontal irradiance (GHI) from clear-sky GHI, given a cloud coverage between 0 and 1.
References
----------
Perez, R., Moore, K., Wilcox, S., Renne, D., Zelenka, A., 2007.
Forecasting solar radiation preliminary evaluation of an
approach based upon the national forecast database. Solar Energy
81, 809812.
"""
if cloud_coverage < 0 or cloud_coverage > 1:
raise ValueError("cloud_coverage should lie in the interval [0, 1]")
return (1 - 0.87 * cloud_coverage**1.9) * ghi_clear