@@ -231,9 +231,13 @@ def calc_raw_surplus(self):
231231 ranged_surplus = surplus + self ._control_range_offset ()
232232 return ranged_surplus
233233
234- def get_control_range_state (self , feed_in_yield : int ) -> ControlRangeState :
234+ def get_control_range_state (self ) -> ControlRangeState :
235235 control_range_low = data .data .general_data .data .chargemode_config .pv_charging .control_range [0 ]
236236 control_range_high = data .data .general_data .data .chargemode_config .pv_charging .control_range [1 ]
237+ if data .data .general_data .data .chargemode_config .pv_charging .feed_in_limit :
238+ feed_in_yield = data .data .general_data .data .chargemode_config .feed_in_yield
239+ else :
240+ feed_in_yield = 0
237241 surplus = data .data .counter_all_data .get_evu_counter ().data .get .power + feed_in_yield
238242 if control_range_low > surplus :
239243 return ControlRangeState .BELOW
@@ -270,8 +274,8 @@ def calc_switch_on_power(self, chargepoint: Chargepoint) -> Tuple[float, float]:
270274 control_parameter = chargepoint .data .control_parameter
271275 pv_config = data .data .general_data .data .chargemode_config .pv_charging
272276
273- if chargepoint .data .set . charge_template . data .chargemode .pv_charging .feed_in_limit :
274- threshold = pv_config .feed_in_yield
277+ if data .data .general_data . data .chargemode_config .pv_charging .feed_in_limit :
278+ threshold = data . data . general_data . data . chargemode_config .feed_in_yield
275279 else :
276280 threshold = pv_config .switch_on_threshold * control_parameter .phases
277281 return surplus , threshold
@@ -280,8 +284,7 @@ def switch_on_threshold_reached(self, chargepoint: Chargepoint) -> None:
280284 try :
281285 message = None
282286 control_parameter = chargepoint .data .control_parameter
283- feed_in_limit = chargepoint .data .set .charge_template .data .chargemode .pv_charging .\
284- feed_in_limit
287+ feed_in_limit = data .data .general_data .data .chargemode_config .pv_charging .feed_in_limit
285288 pv_config = data .data .general_data .data .chargemode_config .pv_charging
286289 timestamp_switch_on_off = control_parameter .timestamp_switch_on_off
287290
@@ -305,7 +308,7 @@ def switch_on_threshold_reached(self, chargepoint: Chargepoint) -> None:
305308 message = self .SWITCH_ON_WAITING .format (timecheck .convert_timestamp_delta_to_time_string (
306309 timestamp_switch_on_off , pv_config .switch_on_delay ))
307310 if feed_in_limit :
308- message += "Die Einspeisegrenze wird berücksichtigt."
311+ message += " Die Einspeisegrenze wird berücksichtigt."
309312 control_parameter .state = ChargepointState .SWITCH_ON_DELAY
310313 else :
311314 # Einschaltschwelle nicht erreicht
@@ -343,8 +346,8 @@ def switch_on_timer_expired(self, chargepoint: Chargepoint) -> None:
343346 msg = self .SWITCH_ON_EXPIRED .format (pv_config .switch_on_threshold )
344347 control_parameter .state = ChargepointState .WAIT_FOR_USING_PHASES
345348
346- if chargepoint . data . set . charge_template . data . chargemode . pv_charging .feed_in_limit :
347- feed_in_yield = pv_config .feed_in_yield
349+ if pv_config .feed_in_limit :
350+ feed_in_yield = data . data . general_data . data . chargemode_config .feed_in_yield
348351 else :
349352 feed_in_yield = 0
350353 ev_template = charging_ev_data .ev_template
@@ -391,11 +394,11 @@ def switch_off_check_timer(self, chargepoint: Chargepoint) -> None:
391394 def calc_switch_off_threshold (self , chargepoint : Chargepoint ) -> float :
392395 pv_config = data .data .general_data .data .chargemode_config .pv_charging
393396 control_parameter = chargepoint .data .control_parameter
394- if chargepoint . data . set . charge_template . data . chargemode . pv_charging .feed_in_limit :
397+ if pv_config .feed_in_limit :
395398 # Der EVU-Überschuss muss ggf um die Einspeisegrenze bereinigt werden.
396399 # Wnn die Leistung nicht Einspeisegrenze + Einschaltschwelle erreicht, darf die Ladung nicht pulsieren.
397400 # Abschaltschwelle um Einschaltschwelle reduzieren.
398- threshold = (- data .data .general_data .data .chargemode_config .pv_charging . feed_in_yield
401+ threshold = (- data .data .general_data .data .chargemode_config .feed_in_yield
399402 + pv_config .switch_on_threshold * control_parameter .phases )
400403 else :
401404 threshold = pv_config .switch_off_threshold
0 commit comments