@@ -28,7 +28,6 @@ def __init__(self, file_name=None):
2828 super ().__init__ (file_name = file_name )
2929 if self .config is None :
3030 return
31- self .interval = self .config .get (["interval" ], None , "1hour" ).lower ()
3231 self .interval_s = 3600 if self .interval == "1hour" else 900
3332 self .interval_name = "uur" if self .interval == "1hour" else "kwartier"
3433 self .steps_day = 24 if self .interval == "1hour" else 96
@@ -122,8 +121,8 @@ def calc_optimum(
122121 return
123122 if u_data <= 8 or u_prices <= 8 :
124123 logging .warning (
125- f"Er ontbreken voor een aantal uur gegevens "
126- f"(meteo en/of dynamische prijzen)\n "
124+ f"Er ontbreken voor een aantal uur meteogegevens "
125+ f"(en/of dynamische prijzen)\n "
127126 f"controleer of alle gegevens zijn opgehaald"
128127 )
129128 if self .notification_entity is not None :
@@ -234,8 +233,6 @@ def calc_optimum(
234233 uur .append (hour )
235234 tijd .append (dtime )
236235 gr = row .glob_rad
237- if self .interval == "15min" :
238- gr *= 4
239236 global_rad .append (gr )
240237 pv_total = 0
241238 if first_interval :
@@ -248,10 +245,8 @@ def calc_optimum(
248245 interval_fraction .append (1 )
249246 for s in range (solar_num ):
250247 prod = self .calc_prod_solar (
251- self .solar [s ], row .time , gr , interval_fraction [- 1 ]
248+ self .solar [s ], row .time , gr , hour_fraction [- 1 ]
252249 )
253- if self .interval == "15min" :
254- prod /= 4
255250 solar_prod [s ].append (prod )
256251 pv_total += prod
257252 pv_org_ac .append (pv_total )
@@ -268,7 +263,7 @@ def calc_optimum(
268263 self .battery_options [b ]["solar" ][s ],
269264 row .time ,
270265 gr ,
271- interval_fraction [- 1 ],
266+ hour_fraction [- 1 ],
272267 )
273268 pv_total += prod
274269 pv_org_dc .append (pv_total )
@@ -492,8 +487,6 @@ def calc_optimum(
492487 global_rad [u ],
493488 hour_fraction [u ],
494489 )
495- if self .interval == "15min" :
496- prod_dc /= 4
497490 eff = 1
498491 for ds in range (DS [b ]):
499492 if discharge_stages [b ][ds ]["power" ] / 1000 > prod_dc :
@@ -1820,8 +1813,8 @@ def calc_optimum(
18201813 max_heat_power = stages [- 1 ]["max_power" ] * stages [- 1 ]["cop" ] / 1000
18211814
18221815 # een of meer intervallen minder als boiler via wp gaat
1823- if boiler_heated_by_heatpump and boiler_start_index < U :
1824- boiler_int = est_needed_intv [U - 1 ]
1816+ if boiler_heated_by_heatpump and boiler_start < U :
1817+ boiler_int = est_needed_intv [boiler_start ] + 1
18251818 else :
18261819 boiler_int = 0
18271820 max_heat_prod = sum (
@@ -2727,17 +2720,16 @@ def calc_optimum(
27272720 + boiler_storage
27282721 )
27292722
2730- logging .info ("Calculation profit after optimize in €" )
2731- logging .info (f"Cost before optimize { old_cost_da : 7.2f} " )
2732- logging .info (f"Cost consumption { cost_consumption : 7.2f} " )
2733- logging .info (f"Profit production { profit_production : 7.2f} " )
2734- logging .info (f"Cycle cost { total_cycle_cost : 7.2f} " )
2735- logging .info (f"Battery storage { battery_storage : 7.2f} " )
2736- logging .info (f"Boiler storage { boiler_storage : 7.2f} " )
2737- logging .info (f"Total { total_cost : 7.2f} " )
2738- logging .info (f"Cost after optimize { cost .x : 7.2f} " )
2739- logging .info (
2740- f"Profit: { old_cost_da - cost .x : 7.2f} "
2723+ logging .info ("/nCalculation profit after optimize in €\n "
2724+ f"Cost before optimize { old_cost_da : 7.2f} \n "
2725+ f"Cost consumption { cost_consumption : 7.2f} \n "
2726+ f"Profit production { profit_production : 7.2f} \n "
2727+ f"Cycle cost { total_cycle_cost : 7.2f} \n "
2728+ f"Battery storage { battery_storage : 7.2f} \n "
2729+ f"Boiler storage { boiler_storage : 7.2f} \n "
2730+ f"Total { total_cost : 7.2f} \n "
2731+ f"Cost after optimize { cost .x : 7.2f} \n "
2732+ f"Profit: { old_cost_da - cost .x : 7.2f} "
27412733 )
27422734
27432735 # doorzetten van alle settings naar HA
0 commit comments