mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-25 06:52:23 +00:00
Awattar Price changed to more precise value; if SoC=0 discharge =1 forced. Exp Avg for siple Price Forecast
* Discharge Mask Bug, Tests updated, simple Price Forecast with linear weighting * Price Forecast with linear weighting, last value = highest weighting Discharge enforce when soc = 0 -> mask bug
This commit is contained in:
committed by
Dominique Lasserre
parent
9881fe6da1
commit
86d2173a4d
@@ -435,9 +435,34 @@ class optimization_problem(ConfigMixin, DevicesMixin, EnergyManagementSystemMixi
|
||||
discharge_hours_bin, eautocharge_hours_index, washingstart_int
|
||||
)
|
||||
|
||||
individual[:] = adjusted_individual # Aktualisiere das ursprüngliche individual
|
||||
individual[:] = adjusted_individual
|
||||
|
||||
# Berechnung weiterer Metriken
|
||||
# New check: Activate discharge when battery SoC is 0
|
||||
battery_soc_per_hour = np.array(
|
||||
o.get("akku_soc_pro_stunde", [])
|
||||
) # Example key for battery SoC
|
||||
|
||||
if battery_soc_per_hour is not None:
|
||||
if battery_soc_per_hour is None or discharge_hours_bin is None:
|
||||
raise ValueError("battery_soc_per_hour or discharge_hours_bin is None")
|
||||
min_length = min(battery_soc_per_hour.size, discharge_hours_bin.size)
|
||||
battery_soc_per_hour_tail = battery_soc_per_hour[-min_length:]
|
||||
discharge_hours_bin_tail = discharge_hours_bin[-min_length:]
|
||||
len_ac = len(self.config.optimization_ev_available_charge_rates_percent)
|
||||
|
||||
# Find hours where battery SoC is 0
|
||||
zero_soc_mask = battery_soc_per_hour_tail == 0
|
||||
discharge_hours_bin_tail[zero_soc_mask] = (
|
||||
len_ac + 2
|
||||
) # Activate discharge for these hours
|
||||
|
||||
# Merge the updated discharge_hours_bin back into the individual
|
||||
adjusted_individual = self.merge_individual(
|
||||
discharge_hours_bin, eautocharge_hours_index, washingstart_int
|
||||
)
|
||||
individual[:] = adjusted_individual
|
||||
|
||||
# More metrics
|
||||
individual.extra_data = ( # type: ignore[attr-defined]
|
||||
o["Gesamtbilanz_Euro"],
|
||||
o["Gesamt_Verluste"],
|
||||
|
Reference in New Issue
Block a user