mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-20 16:58:12 +00:00
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
This PR adds three native PV power forecast providers, giving operators more
cloud forecast sources to choose from via pvforecast.provider, alongside the
existing PVForecastAkkudoktor, PVForecastVrm and PVForecastImport:
PVForecastPVNode — native 15-minute forecasts from the pvnode.com
V2 API. Saved-site mode (GET /v2/forecast/{site_id}) where the operator enters their API key +
site id, or inline mode (POST /v2/forecast/inline) using the configured planes.
PVForecastForecastSolar — the free Forecast.Solar API (no key
required for the public endpoint). Multi-plane systems issue one request per plane and the
instantaneous powers are summed per timestamp.
PVForecastSolcast — the Solcast rooftop-site API (API key + resource id).
Implementation notes
All three populate the existing pvforecast_ac_power (and mirror pvforecast_dc_power)
prediction keys, so they slot into the optimizer unchanged.
Timezone handling: pvnode and Forecast.Solar return site-local wall-clock timestamps with an
IANA timezone field, which are resolved to absolute instants before resampling; Solcast returns
UTC period_end and is normalised to the period start.
Each provider follows the existing provider pattern (provider_id(), _request_forecast() with
@cache_in_file, _update_data()), is registered in pvforecast.py and prediction.py, and is
upstream-neutral.
Validation
27 unit tests (timezone resolution, null/zero handling, kW→W and period-start conversion,
azimuth conversion, multi-plane summation, request URL/auth, HTTP-error handling).
ruff check (F/D/S/bandit) and ruff format clean.
Each provider was additionally validated against its live API with a real plant, confirming
the response shapes (pvnode: 288 native 15-min slots; Forecast.Solar: instantaneous watts;
Solcast: kW estimates with period_end/PT30M).
Documentation
Provider descriptions and configuration examples added to docs/akkudoktoreos/prediction.md.
CHANGELOG.md entry under Unreleased.
Regenerated docs/_generated/configpvforecast.md and configexample.md.
Notes for reviewers
Forecast.Solar's free endpoint is rate-limited (12 req/hour) and Solcast's free tier limits daily
calls; both providers rely on the standard 1-hour cache_in_file TTL to stay within budget.
Authors:
The code is created by Christin. Only minor adaptions by Bobby.
Signed-off-by: Christin <info@bikinibottom.capital>
Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
Co-authored-by: Christin <info@bikinibottom.capital>
461 lines
16 KiB
Markdown
461 lines
16 KiB
Markdown
## PV Forecast Configuration
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast
|
|
:widths: 10 20 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Environment Variable | Type | Read-Only | Default | Description |
|
|
| ---- | -------------------- | ---- | --------- | ------- | ----------- |
|
|
| max_planes | `EOS_PVFORECAST__MAX_PLANES` | `Optional[int]` | `rw` | `0` | Maximum number of planes that can be set |
|
|
| planes | `EOS_PVFORECAST__PLANES` | `Optional[list[akkudoktoreos.prediction.pvforecast.PVForecastPlaneSetting]]` | `rw` | `None` | Plane configuration. |
|
|
| planes_azimuth | | `List[float]` | `ro` | `N/A` | Compute a list of the azimuths per active planes. |
|
|
| planes_inverter_paco | | `Any` | `ro` | `N/A` | Compute a list of the maximum power rating of the inverter per active planes. |
|
|
| planes_peakpower | | `List[float]` | `ro` | `N/A` | Compute a list of the peak power per active planes. |
|
|
| planes_tilt | | `List[float]` | `ro` | `N/A` | Compute a list of the tilts per active planes. |
|
|
| planes_userhorizon | | `Any` | `ro` | `N/A` | Compute a list of the user horizon per active planes. |
|
|
| provider | `EOS_PVFORECAST__PROVIDER` | `Optional[str]` | `rw` | `None` | PVForecast provider id of provider to be used. |
|
|
| provider_settings | `EOS_PVFORECAST__PROVIDER_SETTINGS` | `PVForecastCommonProviderSettings` | `rw` | `required` | Provider settings |
|
|
| providers | | `list[str]` | `ro` | `N/A` | Available PVForecast provider ids. |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider": "PVForecastAkkudoktor",
|
|
"provider_settings": {
|
|
"PVForecastImport": null,
|
|
"PVForecastVrm": null,
|
|
"PVForecastPVNode": null,
|
|
"PVForecastForecastSolar": null,
|
|
"PVForecastSolcast": null
|
|
},
|
|
"planes": [
|
|
{
|
|
"surface_tilt": 10.0,
|
|
"surface_azimuth": 180.0,
|
|
"userhorizon": [
|
|
10.0,
|
|
20.0,
|
|
30.0
|
|
],
|
|
"peakpower": 5.0,
|
|
"pvtechchoice": "crystSi",
|
|
"mountingplace": "free",
|
|
"loss": 14.0,
|
|
"trackingtype": 0,
|
|
"optimal_surface_tilt": false,
|
|
"optimalangles": false,
|
|
"albedo": null,
|
|
"module_model": null,
|
|
"inverter_model": null,
|
|
"inverter_paco": 6000,
|
|
"modules_per_string": 20,
|
|
"strings_per_inverter": 2
|
|
},
|
|
{
|
|
"surface_tilt": 20.0,
|
|
"surface_azimuth": 90.0,
|
|
"userhorizon": [
|
|
5.0,
|
|
15.0,
|
|
25.0
|
|
],
|
|
"peakpower": 3.5,
|
|
"pvtechchoice": "crystSi",
|
|
"mountingplace": "free",
|
|
"loss": 14.0,
|
|
"trackingtype": 1,
|
|
"optimal_surface_tilt": false,
|
|
"optimalangles": false,
|
|
"albedo": null,
|
|
"module_model": null,
|
|
"inverter_model": null,
|
|
"inverter_paco": 4000,
|
|
"modules_per_string": 20,
|
|
"strings_per_inverter": 2
|
|
}
|
|
],
|
|
"max_planes": 1
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider": "PVForecastAkkudoktor",
|
|
"provider_settings": {
|
|
"PVForecastImport": null,
|
|
"PVForecastVrm": null,
|
|
"PVForecastPVNode": null,
|
|
"PVForecastForecastSolar": null,
|
|
"PVForecastSolcast": null
|
|
},
|
|
"planes": [
|
|
{
|
|
"surface_tilt": 10.0,
|
|
"surface_azimuth": 180.0,
|
|
"userhorizon": [
|
|
10.0,
|
|
20.0,
|
|
30.0
|
|
],
|
|
"peakpower": 5.0,
|
|
"pvtechchoice": "crystSi",
|
|
"mountingplace": "free",
|
|
"loss": 14.0,
|
|
"trackingtype": 0,
|
|
"optimal_surface_tilt": false,
|
|
"optimalangles": false,
|
|
"albedo": null,
|
|
"module_model": null,
|
|
"inverter_model": null,
|
|
"inverter_paco": 6000,
|
|
"modules_per_string": 20,
|
|
"strings_per_inverter": 2
|
|
},
|
|
{
|
|
"surface_tilt": 20.0,
|
|
"surface_azimuth": 90.0,
|
|
"userhorizon": [
|
|
5.0,
|
|
15.0,
|
|
25.0
|
|
],
|
|
"peakpower": 3.5,
|
|
"pvtechchoice": "crystSi",
|
|
"mountingplace": "free",
|
|
"loss": 14.0,
|
|
"trackingtype": 1,
|
|
"optimal_surface_tilt": false,
|
|
"optimalangles": false,
|
|
"albedo": null,
|
|
"module_model": null,
|
|
"inverter_model": null,
|
|
"inverter_paco": 4000,
|
|
"modules_per_string": 20,
|
|
"strings_per_inverter": 2
|
|
}
|
|
],
|
|
"max_planes": 1,
|
|
"providers": [
|
|
"PVForecastAkkudoktor",
|
|
"PVForecastVrm",
|
|
"PVForecastPVNode",
|
|
"PVForecastForecastSolar",
|
|
"PVForecastSolcast",
|
|
"PVForecastImport"
|
|
],
|
|
"planes_peakpower": [
|
|
5.0,
|
|
3.5
|
|
],
|
|
"planes_azimuth": [
|
|
180.0,
|
|
90.0
|
|
],
|
|
"planes_tilt": [
|
|
10.0,
|
|
20.0
|
|
],
|
|
"planes_userhorizon": [
|
|
[
|
|
10.0,
|
|
20.0,
|
|
30.0
|
|
],
|
|
[
|
|
5.0,
|
|
15.0,
|
|
25.0
|
|
]
|
|
],
|
|
"planes_inverter_paco": [
|
|
6000.0,
|
|
4000.0
|
|
]
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### Common settings for the Solcast PV forecast provider
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings::PVForecastSolcast
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| api_key | `str` | `rw` | `` | Solcast API key (Bearer auth). Required. |
|
|
| site_id | `str` | `rw` | `` | Solcast rooftop site (resource) id. Required. |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastSolcast": {
|
|
"api_key": "your-solcast-key",
|
|
"site_id": "abcd-1234-efgh-5678"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### Common settings for the Forecast.Solar PV forecast provider
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings::PVForecastForecastSolar
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| api_key | `Optional[str]` | `rw` | `None` | Forecast.Solar API key. Optional — the public endpoint works without a key (lower rate limit). |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastForecastSolar": {
|
|
"api_key": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### Common settings for the pvnode.com PV forecast provider
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings::PVForecastPVNode
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| api_key | `str` | `rw` | `` | pvnode.com API key (Bearer auth). Required. |
|
|
| forecast_days | `int` | `rw` | `2` | Forecast horizon in days (1-7, capped by the pvnode plan). |
|
|
| site_id | `Optional[str]` | `rw` | `None` | pvnode.com site id of the saved plant ('Anlagen-ID'). When set, the saved (possibly calibrated) site is used. Leave empty to send the configured pvforecast.planes inline instead. |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastPVNode": {
|
|
"api_key": "pvn_live_xxxxxxxxxxxxxxxx",
|
|
"site_id": "abcd-1234",
|
|
"forecast_days": 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### Common settings for PV forecast VRM API
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings::PVForecastVrm
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| pvforecast_vrm_idsite | `int` | `rw` | `12345` | VRM-Installation-ID |
|
|
| pvforecast_vrm_token | `str` | `rw` | `your-token` | Token for Connecting VRM API |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastVrm": {
|
|
"pvforecast_vrm_token": "your-token",
|
|
"pvforecast_vrm_idsite": 12345
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### Common settings for pvforecast data import from file or JSON string
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings::PVForecastImport
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| import_file_path | `Union[str, pathlib.Path, NoneType]` | `rw` | `None` | Path to the file to import PV forecast data from. |
|
|
| import_json | `Optional[str]` | `rw` | `None` | JSON string, dictionary of PV forecast value lists. |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastImport": {
|
|
"import_file_path": null,
|
|
"import_json": "{\"pvforecast_ac_power\": [0, 8.05, 352.91]}"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### PV Forecast Provider Configuration
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::provider_settings
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| PVForecastForecastSolar | `Optional[akkudoktoreos.prediction.pvforecastforecastsolar.PVForecastForecastSolarCommonSettings]` | `rw` | `None` | PVForecastForecastSolar settings |
|
|
| PVForecastImport | `Optional[akkudoktoreos.prediction.pvforecastimport.PVForecastImportCommonSettings]` | `rw` | `None` | PVForecastImport settings |
|
|
| PVForecastPVNode | `Optional[akkudoktoreos.prediction.pvforecastpvnode.PVForecastPVNodeCommonSettings]` | `rw` | `None` | PVForecastPVNode settings |
|
|
| PVForecastSolcast | `Optional[akkudoktoreos.prediction.pvforecastsolcast.PVForecastSolcastCommonSettings]` | `rw` | `None` | PVForecastSolcast settings |
|
|
| PVForecastVrm | `Optional[akkudoktoreos.prediction.pvforecastvrm.PVForecastVrmCommonSettings]` | `rw` | `None` | PVForecastVrm settings |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"provider_settings": {
|
|
"PVForecastImport": null,
|
|
"PVForecastVrm": null,
|
|
"PVForecastPVNode": null,
|
|
"PVForecastForecastSolar": null,
|
|
"PVForecastSolcast": null
|
|
}
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|
|
|
|
### PV Forecast Plane Configuration
|
|
|
|
<!-- pyml disable line-length -->
|
|
:::{table} pvforecast::planes::list
|
|
:widths: 10 10 5 5 30
|
|
:align: left
|
|
|
|
| Name | Type | Read-Only | Default | Description |
|
|
| ---- | ---- | --------- | ------- | ----------- |
|
|
| albedo | `Optional[float]` | `rw` | `None` | Proportion of the light hitting the ground that it reflects back. |
|
|
| inverter_model | `Optional[str]` | `rw` | `None` | Model of the inverter of this plane. |
|
|
| inverter_paco | `Optional[int]` | `rw` | `None` | AC power rating of the inverter [W]. |
|
|
| loss | `Optional[float]` | `rw` | `14.0` | Sum of PV system losses in percent |
|
|
| module_model | `Optional[str]` | `rw` | `None` | Model of the PV modules of this plane. |
|
|
| modules_per_string | `Optional[int]` | `rw` | `None` | Number of the PV modules of the strings of this plane. |
|
|
| mountingplace | `Optional[str]` | `rw` | `free` | Type of mounting for PV system. Options are 'free' for free-standing and 'building' for building-integrated. |
|
|
| optimal_surface_tilt | `Optional[bool]` | `rw` | `False` | Calculate the optimum tilt angle. Ignored for two-axis tracking. |
|
|
| optimalangles | `Optional[bool]` | `rw` | `False` | Calculate the optimum tilt and azimuth angles. Ignored for two-axis tracking. |
|
|
| peakpower | `Optional[float]` | `rw` | `None` | Nominal power of PV system in kW. |
|
|
| pvtechchoice | `Optional[str]` | `rw` | `crystSi` | PV technology. One of 'crystSi', 'CIS', 'CdTe', 'Unknown'. |
|
|
| strings_per_inverter | `Optional[int]` | `rw` | `None` | Number of the strings of the inverter of this plane. |
|
|
| surface_azimuth | `Optional[float]` | `rw` | `180.0` | Orientation (azimuth angle) of the (fixed) plane. Clockwise from north (north=0, east=90, south=180, west=270). |
|
|
| surface_tilt | `Optional[float]` | `rw` | `30.0` | Tilt angle from horizontal plane. Ignored for two-axis tracking. |
|
|
| trackingtype | `Optional[int]` | `rw` | `None` | Type of suntracking. 0=fixed, 1=single horizontal axis aligned north-south, 2=two-axis tracking, 3=vertical axis tracking, 4=single horizontal axis aligned east-west, 5=single inclined axis aligned north-south. |
|
|
| userhorizon | `Optional[List[float]]` | `rw` | `None` | Elevation of horizon in degrees, at equally spaced azimuth clockwise from north. |
|
|
:::
|
|
<!-- pyml enable line-length -->
|
|
|
|
<!-- pyml disable no-emphasis-as-heading -->
|
|
**Example Input/Output**
|
|
<!-- pyml enable no-emphasis-as-heading -->
|
|
|
|
<!-- pyml disable line-length -->
|
|
```json
|
|
{
|
|
"pvforecast": {
|
|
"planes": [
|
|
{
|
|
"surface_tilt": 10.0,
|
|
"surface_azimuth": 180.0,
|
|
"userhorizon": [
|
|
10.0,
|
|
20.0,
|
|
30.0
|
|
],
|
|
"peakpower": 5.0,
|
|
"pvtechchoice": "crystSi",
|
|
"mountingplace": "free",
|
|
"loss": 14.0,
|
|
"trackingtype": 0,
|
|
"optimal_surface_tilt": false,
|
|
"optimalangles": false,
|
|
"albedo": null,
|
|
"module_model": null,
|
|
"inverter_model": null,
|
|
"inverter_paco": 6000,
|
|
"modules_per_string": 20,
|
|
"strings_per_inverter": 2
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
<!-- pyml enable line-length -->
|