@@ -228,6 +228,8 @@ def calc_optimum(
228228 # prog_data = prog_data.reset_index()
229229 # make sure indexes pair with number of rows
230230 for row in prog_data .itertuples ():
231+ if math .isnan (row .da_ex ):
232+ break
231233 dtime = row .tijd
232234 hour = dtime .strftime ("%H:%M" )
233235 uur .append (hour )
@@ -2490,7 +2492,7 @@ def calc_optimum(
24902492 ) * hour_fraction [u ]
24912493 if ac_to_dc_netto > 0 :
24922494 ac_to_dc_eff = dc_from_ac_netto * 100.0 / ac_to_dc_netto
2493- elif ac_to_dc_netto < 0 :
2495+ elif dc_from_ac_netto < 0 :
24942496 ac_to_dc_eff = ac_to_dc_netto * 100.0 / dc_from_ac_netto
24952497 else :
24962498 ac_to_dc_eff = "--"
@@ -2504,7 +2506,7 @@ def calc_optimum(
25042506 ) * hour_fraction [u ]
25052507 if dc_to_bat_netto > 0 :
25062508 dc_to_bat_eff = bat_from_dc_netto * 100.0 / dc_to_bat_netto
2507- elif dc_to_bat_netto < 0 :
2509+ elif bat_from_dc_netto < 0 :
25082510 dc_to_bat_eff = dc_to_bat_netto * 100.0 / bat_from_dc_netto
25092511 else :
25102512 dc_to_bat_eff = "--"
@@ -3504,7 +3506,7 @@ def calc_optimum(
35043506 axis [0 ].set_ylabel ("kWh" )
35053507 ylim = math .ceil (max_y )
35063508 axis [0 ].set_ylim ([- ylim , ylim ])
3507- axis [0 ].set_xticks (ind , labels = uur_labels )
3509+ axis [0 ].set_xticks (ind , labels = uur_labels [: len ( ind )] )
35083510 if self .interval == "1hour" :
35093511 ticker_multi = 2
35103512 ticker_offset = 0
@@ -3612,7 +3614,7 @@ def calc_optimum(
36123614 axis [1 ].legend (loc = "best" , bbox_to_anchor = (1.05 , 1.00 ))
36133615 axis [1 ].set_ylabel ("kWh" )
36143616 axis [1 ].set_ylim ([- ylim , ylim ])
3615- axis [1 ].set_xticks (ind , labels = uur_labels )
3617+ axis [1 ].set_xticks (ind , labels = uur_labels [: len ( ind )] )
36163618 axis [1 ].xaxis .set_major_locator (
36173619 ticker .MultipleLocator (ticker_multi , offset = ticker_offset )
36183620 )
@@ -3686,7 +3688,7 @@ def calc_optimum(
36863688 # axis[gr_no].legend(loc='best', bbox_to_anchor=(1.30, 1.00))
36873689 axis [gr_no ].set_ylabel ("kWh" )
36883690 axis [gr_no ].set_ylim ([- ylim , ylim ])
3689- axis [gr_no ].set_xticks (ind , labels = uur_labels )
3691+ axis [gr_no ].set_xticks (ind , labels = uur_labels [: len ( ind )] )
36903692 axis [gr_no ].xaxis .set_major_locator (
36913693 ticker .MultipleLocator (ticker_multi , offset = ticker_offset )
36923694 )
@@ -3726,7 +3728,7 @@ def calc_optimum(
37263728 ln1 = axis [gr_no ].plot (
37273729 ind , soc_t , label = "SoC" , linestyle = line_styles [0 ], color = "olive"
37283730 )
3729- axis [gr_no ].set_xticks (ind , labels = uur_labels )
3731+ axis [gr_no ].set_xticks (ind , labels = uur_labels [: len ( ind )] )
37303732 axis [gr_no ].set_ylabel ("% SoC" )
37313733 axis [gr_no ].set_xlabel ("uren van de dag" )
37323734 axis [gr_no ].xaxis .set_major_locator (
0 commit comments