mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
Small penalty when EV 100% and charge >0
This commit is contained in:
parent
83bfb1878b
commit
85395076be
@ -7,7 +7,7 @@ from deap import algorithms, base, creator, tools
|
|||||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
from akkudoktoreos.config import AppConfig
|
from akkudoktoreos.config import AppConfig
|
||||||
from akkudoktoreos.devices.battery import (
|
from akkudoktoreos.devices.battery import (
|
||||||
EAutoParameters,
|
EAutoParameters,
|
||||||
@ -344,6 +344,7 @@ class optimization_problem:
|
|||||||
ems.set_ev_charge_hours(np.array(eautocharge_hours_float))
|
ems.set_ev_charge_hours(np.array(eautocharge_hours_float))
|
||||||
else:
|
else:
|
||||||
ems.set_ev_charge_hours(np.full(self.prediction_hours, 0))
|
ems.set_ev_charge_hours(np.full(self.prediction_hours, 0))
|
||||||
|
|
||||||
return ems.simuliere(start_hour)
|
return ems.simuliere(start_hour)
|
||||||
|
|
||||||
def evaluate(
|
def evaluate(
|
||||||
@ -370,11 +371,12 @@ class optimization_problem:
|
|||||||
# 0.01 for i in range(start_hour, self.prediction_hours) if discharge_hours_bin[i] == 0.0
|
# 0.01 for i in range(start_hour, self.prediction_hours) if discharge_hours_bin[i] == 0.0
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# Penalty for not meeting the minimum SOC (State of Charge) requirement
|
# Penalty for charging EV, with battery full
|
||||||
# if parameters.eauto_min_soc_prozent - ems.eauto.ladezustand_in_prozent() <= 0.0 and self.optimize_ev:
|
len_soc = len(o["EAuto_SoC_pro_Stunde"])
|
||||||
# gesamtbilanz += sum(
|
eautocharge_hours = np.array(eautocharge_hours_index)
|
||||||
# self.strafe for ladeleistung in eautocharge_hours_index if ladeleistung != 0.0
|
relevant_indices = eautocharge_hours[-len_soc:]
|
||||||
# )
|
mask = (o["EAuto_SoC_pro_Stunde"] == 100) & (relevant_indices != 0)
|
||||||
|
gesamtbilanz += np.sum(mask) * 0.01
|
||||||
|
|
||||||
individual.extra_data = ( # type: ignore[attr-defined]
|
individual.extra_data = ( # type: ignore[attr-defined]
|
||||||
o["Gesamtbilanz_Euro"],
|
o["Gesamtbilanz_Euro"],
|
||||||
|
@ -48,7 +48,7 @@ app = FastAPI(
|
|||||||
working_dir = get_working_dir()
|
working_dir = get_working_dir()
|
||||||
# copy config to working directory. Make this a CLI option later
|
# copy config to working directory. Make this a CLI option later
|
||||||
config = load_config(working_dir, True)
|
config = load_config(working_dir, True)
|
||||||
opt_class = optimization_problem(config, verbose=False)
|
opt_class = optimization_problem(config, verbose=True)
|
||||||
server_dir = Path(__file__).parent.resolve()
|
server_dir = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user