mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-12-13 15:26:17 +00:00
Inverter Klasse hinzugefügt
Kleinere Bugs bei max_WR Leistung behoben
This commit is contained in:
@@ -99,6 +99,7 @@ class optimization_problem:
|
||||
|
||||
# Fitness-Funktion (muss Ihre EnergieManagementSystem-Logik integrieren)
|
||||
def evaluate(self,individual,ems,parameter,start_hour,worst_case):
|
||||
|
||||
try:
|
||||
o = self.evaluate_inner(individual,ems,start_hour)
|
||||
except:
|
||||
@@ -121,7 +122,7 @@ class optimization_problem:
|
||||
strafe = 0.0
|
||||
strafe = max(0,(parameter['eauto_min_soc']-ems.eauto.ladezustand_in_prozent()) * self.strafe )
|
||||
gesamtbilanz += strafe
|
||||
gesamtbilanz += o["Gesamt_Verluste"]/1000.0
|
||||
gesamtbilanz += o["Gesamt_Verluste"]/10000.0
|
||||
|
||||
return (gesamtbilanz,)
|
||||
|
||||
@@ -131,7 +132,7 @@ class optimization_problem:
|
||||
|
||||
# Genetischer Algorithmus
|
||||
def optimize(self,start_solution=None):
|
||||
population = self.toolbox.population(n=200)
|
||||
population = self.toolbox.population(n=1000)
|
||||
hof = tools.HallOfFame(1)
|
||||
|
||||
stats = tools.Statistics(lambda ind: ind.fitness.values)
|
||||
@@ -144,8 +145,8 @@ class optimization_problem:
|
||||
if start_solution is not None and start_solution != -1:
|
||||
population.insert(0, creator.Individual(start_solution))
|
||||
|
||||
#algorithms.eaMuPlusLambda(population, self.toolbox, 100, 200, cxpb=0.4, mutpb=0.5, ngen=500, stats=stats, halloffame=hof, verbose=True)
|
||||
algorithms.eaSimple(population, self.toolbox, cxpb=0.4, mutpb=0.4, ngen=100, stats=stats, halloffame=hof, verbose=True)
|
||||
#algorithms.eaMuPlusLambda(population, self.toolbox, 100, 200, cxpb=0.2, mutpb=0.2, ngen=500, stats=stats, halloffame=hof, verbose=True)
|
||||
algorithms.eaSimple(population, self.toolbox, cxpb=0.2, mutpb=0.2, ngen=200, stats=stats, halloffame=hof, verbose=True)
|
||||
|
||||
member = {"bilanz":[],"verluste":[],"nebenbedingung":[]}
|
||||
for ind in population:
|
||||
@@ -161,6 +162,7 @@ class optimization_problem:
|
||||
|
||||
def optimierung_ems(self,parameter=None, start_hour=None,worst_case=False):
|
||||
|
||||
|
||||
############
|
||||
# Parameter
|
||||
############
|
||||
@@ -256,7 +258,7 @@ class optimization_problem:
|
||||
|
||||
self.toolbox.register("evaluate", evaluate_wrapper)
|
||||
start_solution, extra_data = self.optimize(start_params)
|
||||
best_solution = start_solution
|
||||
best_solution = start_params
|
||||
o = self.evaluate_inner(best_solution, ems,start_hour)
|
||||
eauto = ems.eauto.to_dict()
|
||||
spuelstart_int = None
|
||||
@@ -269,8 +271,8 @@ class optimization_problem:
|
||||
|
||||
|
||||
|
||||
|
||||
print(o)
|
||||
print(parameter)
|
||||
print(best_solution)
|
||||
visualisiere_ergebnisse(gesamtlast, pv_forecast, specific_date_prices, o,best_solution[0::2],best_solution[1::2] , temperature_forecast, start_hour, self.prediction_hours,einspeiseverguetung_euro_pro_wh,extra_data=extra_data)
|
||||
os.system("cp visualisierungsergebnisse.pdf ~/")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user