Time problems in EMS / Optimization

This commit is contained in:
Andreas 2024-10-22 08:58:07 +02:00 committed by Andreas
parent fca2338bd7
commit 8d3eb96a0b
2 changed files with 8 additions and 8 deletions

View File

@ -82,10 +82,10 @@ class EnergieManagementSystem:
akku_soc_pro_stunde[0] = self.akku.ladezustand_in_prozent() akku_soc_pro_stunde[0] = self.akku.ladezustand_in_prozent()
if self.eauto: if self.eauto:
eauto_soc_pro_stunde[0] = self.eauto.ladezustand_in_prozent() eauto_soc_pro_stunde[0] = self.eauto.ladezustand_in_prozent()
for stunde in range(start_stunde + 1, ende): for stunde in range(start_stunde , ende):
stunde_since_now = stunde - start_stunde stunde_since_now = stunde - start_stunde
# Accumulate loads and PV generation # Accumulate loads and PV generation
verbrauch = self.gesamtlast[stunde] verbrauch = self.gesamtlast[stunde]
verluste_wh_pro_stunde[stunde_since_now] = 0.0 verluste_wh_pro_stunde[stunde_since_now] = 0.0

View File

@ -219,13 +219,13 @@ class optimization_problem:
# Register separate mutation functions for each type of value: # Register separate mutation functions for each type of value:
# - Discharge state mutation (-5, 0, 1) # - Discharge state mutation (-5, 0, 1)
if self.optimize_dc_charge: if self.optimize_dc_charge:
self.toolbox.register("mutate_charge_discharge", tools.mutUniformInt, low=0, up=8, indpb=0.1) self.toolbox.register("mutate_charge_discharge", tools.mutUniformInt, low=0, up=8, indpb=0.2)
else: else:
self.toolbox.register("mutate_charge_discharge", tools.mutUniformInt, low=0, up=6, indpb=0.1) self.toolbox.register("mutate_charge_discharge", tools.mutUniformInt, low=0, up=6, indpb=0.2)
# - Float mutation for EV charging values # - Float mutation for EV charging values
self.toolbox.register("mutate_ev_charge_index", tools.mutUniformInt, low=0, up=len(possible_ev_charge_currents) - 1, indpb=0.1) self.toolbox.register("mutate_ev_charge_index", tools.mutUniformInt, low=0, up=len(possible_ev_charge_currents) - 1, indpb=0.2)
# - Start hour mutation for household devices # - Start hour mutation for household devices
self.toolbox.register("mutate_hour", tools.mutUniformInt, low=start_hour, up=23, indpb=0.1) self.toolbox.register("mutate_hour", tools.mutUniformInt, low=start_hour, up=23, indpb=0.2)
# Register custom mutation function # Register custom mutation function
self.toolbox.register("mutate", self.mutate) self.toolbox.register("mutate", self.mutate)
@ -426,7 +426,7 @@ class optimization_problem:
"evaluate", "evaluate",
lambda ind: self.evaluate(ind, ems, parameter, start_hour, worst_case), lambda ind: self.evaluate(ind, ems, parameter, start_hour, worst_case),
) )
start_solution, extra_data = self.optimize(parameter["start_solution"], ngen=ngen) start_solution, extra_data = self.optimize(parameter["start_solution"], ngen=ngen) #
# Perform final evaluation on the best solution # Perform final evaluation on the best solution
o = self.evaluate_inner(start_solution, ems, start_hour) o = self.evaluate_inner(start_solution, ems, start_hour)