diff --git a/test.py b/test.py index b26153e..4d46555 100644 --- a/test.py +++ b/test.py @@ -22,45 +22,312 @@ import os start_hour = 8 -# prediction_hours = 24 -# date = (datetime.now().date() + timedelta(hours = prediction_hours)).strftime("%Y-%m-%d") -# date_now = datetime.now().strftime("%Y-%m-%d") -# akku_size = 30000 # Wh -# year_energy = 2000*1000 #Wh -# einspeiseverguetung_cent_pro_wh = np.full(prediction_hours, 7/(1000.0*100.0)) # € / Wh +pv_forecast= [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 46.0757222688471, + 474.780954810247, + 1049.36036517475, + 1676.86962934168, + 2037.0885036865, + 2600.03233682621, + 5307.79424852068, + 5214.54927119013, + 5392.8995394438, + 4229.09283442043, + 3568.84965239262, + 2627.95972505784, + 1618.04209206715, + 718.733713468062, + 102.060092599437, + 0, + 0, + 0, + 0, + 0, + -0.068771006309608, + 0, + 0.0275649587447597, + 0, + 53.980235336087, + 543.602674801833, + 852.52597210804, + 964.253104261402, + 1043.15079499546, + 1333.69973977172, + 6901.19158127423, + 6590.62442617817, + 6161.97317306069, + 4530.33886807194, + 3535.37982191984, + 2388.65608163334, + 1365.10812389941, + 557.452392556485, + 82.376303341511, + 0.026903650788687, + 0 + ] +temperature_forecast= [ + 18.3, + 17.8, + 16.9, + 16.2, + 15.6, + 15.1, + 14.6, + 14.2, + 14.3, + 14.8, + 15.7, + 16.7, + 17.4, + 18, + 18.6, + 19.2, + 19.1, + 18.7, + 18.5, + 17.7, + 16.2, + 14.6, + 13.6, + 13, + 12.6, + 12.2, + 11.7, + 11.6, + 11.3, + 11, + 10.7, + 10.2, + 11.4, + 14.4, + 16.4, + 18.3, + 19.5, + 20.7, + 21.9, + 22.7, + 23.1, + 23.1, + 22.8, + 21.8, + 20.2, + 19.1, + 18, + 17.4 + ] -# max_heizleistung = 1000 # 5 kW Heizleistung -# wp = Waermepumpe(max_heizleistung,prediction_hours) +strompreis_euro_pro_wh = [ + 0.00031540228, + 0.00031000228, + 0.00029390228, + 0.00028410228, + 0.00028840228, + 0.00028800228, + 0.00030930228, + 0.00031390228, + 0.00031540228, + 0.00028120228, + 0.00022820228, + 0.00022310228, + 0.00021500228, + 0.00020770228, + 0.00020670228, + 0.00021200228, + 0.00021540228, + 0.00023000228, + 0.00029530228, + 0.00032990228, + 0.00036840228, + 0.00035900228, + 0.00033140228, + 0.00031370228, + 0.00031540228, + 0.00031000228, + 0.00029390228, + 0.00028410228, + 0.00028840228, + 0.00028800228, + 0.00030930228, + 0.00031390228, + 0.00031540228, + 0.00028120228, + 0.00022820228, + 0.00022310228, + 0.00021500228, + 0.00020770228, + 0.00020670228, + 0.00021200228, + 0.00021540228, + 0.00023000228, + 0.00029530228, + 0.00032990228, + 0.00036840228, + 0.00035900228, + 0.00033140228, + 0.00031370228 + ] +gesamtlast= [ + 723.794862683391, + 743.491222629184, + 836.32034938972, + 870.858204290382, + 877.988917620097, + 857.94124236693, + 535.7468553632, + 658.119336334815, + 955.15298014833, + 2636.705125629, + 1321.53672393798, + 1488.77669263834, + 1129.61536474922, + 1261.47022563591, + 1308.42804416213, + 1740.76791896787, + 989.769241971553, + 1291.60060799951, + 1360.9198505883, + 1290.04968399465, + 989.968377880823, + 1121.41872787695, + 1250.64584231737, + 852.708926147066, + 723.492531379247, + 743.121389279149, + 835.959858325763, + 870.44547874543, + 878.758616187391, + 858.773385266073, + 535.600426631561, + 658.438388271842, + 955.420012089818, + 2636.68835629389, + 1321.54382666298, + 1489.13090434992, + 1129.80079639256, + 1262.0092664333, + 1308.72647023183, + 1741.92058921559, + 990.700392687782, + 1293.57876397944, + 1363.67698321638, + 1291.28280716443, + 990.277508651153, + 1121.16294287294, + 1250.20143586737, + 852.488808763652 + ] -# akku = PVAkku(akku_size,prediction_hours) -# discharge_array = np.full(prediction_hours,1) #np.array([1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]) # - -# laden_moeglich = np.full(prediction_hours,1) # np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0]) -# #np.full(prediction_hours,1) -# eauto = PVAkku(kapazitaet_wh=60000, hours=prediction_hours, lade_effizienz=0.95, entlade_effizienz=1.0, max_ladeleistung_w=10000 ,start_soc_prozent=10) -# eauto.set_charge_per_hour(laden_moeglich) -# min_soc_eauto = 80 -# hohe_strafe = 10.0 -#[1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1] -individual = [1, 1, # 0 - 0, 1, # 1 - 0, 0, # 2 - 0, 1, # 3 - 0, 0, # 4 - 1, 0, # 5 - 0, 1, # 6 - 0, 0, # 7 - 0, 0, # 8 - 1, 0, - 0, 0, - 1, 0, - 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1] -parameter= {'pv_soc': 92.4052, 'pv_akku_cap': 30000, 'year_energy': 4100000, 'einspeiseverguetung_euro_pro_wh': 7e-05, 'max_heizleistung': 1000, 'pv_forecast_url': 'https://api.akkudoktor.net/forecast?lat=50.8588&lon=7.3747&power=5000&azimuth=-10&tilt=7&powerInvertor=10000&horizont=20,27,22,20&power=4800&azimuth=-90&tilt=7&powerInvertor=10000&horizont=30,30,30,50&power=1400&azimuth=-40&tilt=60&powerInvertor=2000&horizont=60,30,0,30&power=1600&azimuth=5&tilt=45&powerInvertor=1400&horizont=45,25,30,60&past_days=5&cellCoEff=-0.36&inverterEfficiency=0.8&albedo=0.25&timezone=Europe%2FBerlin&hourly=relativehumidity_2m%2Cwindspeed_10m', 'eauto_min_soc': 100, 'eauto_cap': 60000, 'eauto_charge_efficiency': 0.95, 'eauto_charge_power': 5500, 'eauto_soc': 77, 'pvpowernow': 211.137503624, 'start_solution': individual, 'haushaltsgeraet_wh': 937, 'haushaltsgeraet_dauer': 0} +start_solution= [ + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] +parameter= {'pv_soc': 92.4052, 'pv_akku_cap': 30000, 'year_energy': 4100000, 'einspeiseverguetung_euro_pro_wh': 7e-05, 'max_heizleistung': 1000,"gesamtlast":gesamtlast, 'pv_forecast': pv_forecast, "temperature_forecast":temperature_forecast, "strompreis_euro_pro_wh":strompreis_euro_pro_wh, 'eauto_min_soc': 100, 'eauto_cap': 60000, 'eauto_charge_efficiency': 0.95, 'eauto_charge_power': 5500, 'eauto_soc': 77, 'pvpowernow': 211.137503624, 'start_solution': start_solution, 'haushaltsgeraet_wh': 937, 'haushaltsgeraet_dauer': 0} -opt_class = optimization_problem(prediction_hours=24, strafe=10) +opt_class = optimization_problem(prediction_hours=48, strafe=10) ergebnis = opt_class.optimierung_ems(parameter=parameter, start_hour=start_hour)