mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-12 21:08:13 +00:00
Fügt einen Direktvermarktungs-Modus (feedintariff.direct_marketing_enabled) hinzu, der den Börsenpreis als Einspeisevergütung nutzt und aktive Batterie-Entladung ins Netz (battery_grid_export_allowed) sowie DC-Charge-Bypass optimiert. - FeedInTariffEnergyCharts-Provider (Börsen-Einspeisetarif inkl. Prognose) - Inverter: DC/AC-Wirkungsgrade und Batterie-Grid-Export in process_energy - Genetik: Export-/DC-Charge-Zustände, Restwert-Bewertung des Akkus - Solution-Result: neues Feld Feed_in_tariff (verwendeter Tarif je Stunde) - Tests für neue Provider, Solution und Simulation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
73 lines
2.1 KiB
Python
73 lines
2.1 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from akkudoktoreos.core.coreabc import get_ems
|
|
from akkudoktoreos.prediction.feedintarifffixed import FeedInTariffFixed
|
|
from akkudoktoreos.utils.datetimeutil import compare_datetimes, to_datetime
|
|
|
|
DIR_TESTDATA = Path(__file__).absolute().parent.joinpath("testdata")
|
|
|
|
|
|
@pytest.fixture
|
|
def provider(config_eos):
|
|
"""Fixture to create a ElecPriceProvider instance."""
|
|
settings = {
|
|
"feedintariff": {
|
|
"provider": "FeedInTariffFixed",
|
|
"provider_settings": {
|
|
"FeedInTariffFixed": {
|
|
"feed_in_tariff_kwh": 0.078,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
config_eos.merge_settings_from_dict(settings)
|
|
assert config_eos.feedintariff.provider == "FeedInTariffFixed"
|
|
provider = FeedInTariffFixed()
|
|
assert provider.enabled()
|
|
return provider
|
|
|
|
|
|
# ------------------------------------------------
|
|
# General forecast
|
|
# ------------------------------------------------
|
|
|
|
|
|
def test_singleton_instance(provider):
|
|
"""Test that ElecPriceForecast behaves as a singleton."""
|
|
another_instance = FeedInTariffFixed()
|
|
assert provider is another_instance
|
|
|
|
|
|
def test_invalid_provider(provider, config_eos):
|
|
"""Test requesting an unsupported provider."""
|
|
settings = {
|
|
"feedintariff": {
|
|
"provider": "<invalid>",
|
|
"provider_settings": {
|
|
"FeedInTariffFixed": {
|
|
"feed_in_tariff_kwh": 0.078,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
with pytest.raises(ValueError, match="not a valid feed in tariff provider"):
|
|
config_eos.merge_settings_from_dict(settings)
|
|
|
|
|
|
def test_direct_marketing_switch(config_eos):
|
|
assert config_eos.feedintariff.direct_marketing_enabled is False
|
|
|
|
config_eos.merge_settings_from_dict(
|
|
{"feedintariff": {"direct_marketing_enabled": True}}
|
|
)
|
|
|
|
assert config_eos.feedintariff.direct_marketing_enabled is True
|
|
|
|
|
|
# ------------------------------------------------
|
|
# Fixed feed in tariv values
|
|
# ------------------------------------------------
|