mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-07-13 05:18:12 +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>
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
# ruff: noqa: S101
|
|
|
|
import numpy as np
|
|
|
|
from akkudoktoreos.devices.devicesabc import BatteryOperationMode
|
|
from akkudoktoreos.optimization.genetic.genetic import GeneticOptimization
|
|
from akkudoktoreos.optimization.genetic.geneticsolution import GeneticSolution
|
|
|
|
|
|
def test_battery_discharge_allowed_remains_local_load_mode(config_eos):
|
|
config_eos.merge_settings_from_dict(
|
|
{"feedintariff": {"direct_marketing_enabled": True}}
|
|
)
|
|
solution = GeneticSolution.model_construct()
|
|
|
|
operation_mode, operation_mode_factor = solution._battery_operation_from_solution(
|
|
ac_charge=0.0,
|
|
dc_charge=0.0,
|
|
discharge_allowed=True,
|
|
)
|
|
|
|
assert operation_mode == BatteryOperationMode.PEAK_SHAVING
|
|
assert operation_mode_factor == 1.0
|
|
|
|
|
|
def test_battery_grid_export_signal_maps_to_grid_support_export(config_eos):
|
|
config_eos.merge_settings_from_dict(
|
|
{"feedintariff": {"direct_marketing_enabled": True}}
|
|
)
|
|
solution = GeneticSolution.model_construct()
|
|
|
|
operation_mode, operation_mode_factor = solution._battery_operation_from_solution(
|
|
ac_charge=0.0,
|
|
dc_charge=0.0,
|
|
discharge_allowed=False,
|
|
battery_grid_export_allowed=True,
|
|
)
|
|
|
|
assert operation_mode == BatteryOperationMode.GRID_SUPPORT_EXPORT
|
|
assert operation_mode_factor == 1.0
|
|
|
|
|
|
def test_decode_charge_discharge_has_separate_battery_grid_export_state():
|
|
optimization = GeneticOptimization()
|
|
optimization.bat_possible_charge_values = [1.0]
|
|
optimization.optimize_dc_charge = True
|
|
optimization.optimize_battery_grid_export = True
|
|
|
|
ac_charge, dc_charge, discharge, battery_grid_export = (
|
|
optimization.decode_charge_discharge(np.array([5]))
|
|
)
|
|
|
|
assert ac_charge.tolist() == [0.0]
|
|
assert dc_charge.tolist() == [0]
|
|
assert discharge.tolist() == [0]
|
|
assert battery_grid_export.tolist() == [1]
|