@@ -356,6 +356,50 @@ class EVChargerData(ComponentData):
356356 wire for phase/line 1,2 and 3 respectively.
357357 """
358358
359+ active_power_inclusion_lower_bound : float
360+ """Lower inclusion bound for EV charger power in watts.
361+
362+ This is the lower limit of the range within which power requests are allowed for the
363+ EV charger.
364+
365+ See [`frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds`][] and
366+ [`frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds`][] for more
367+ details.
368+ """
369+
370+ active_power_exclusion_lower_bound : float
371+ """Lower exclusion bound for EV charger power in watts.
372+
373+ This is the lower limit of the range within which power requests are not allowed for
374+ the EV charger.
375+
376+ See [`frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds`][] and
377+ [`frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds`][] for more
378+ details.
379+ """
380+
381+ active_power_inclusion_upper_bound : float
382+ """Upper inclusion bound for EV charger power in watts.
383+
384+ This is the upper limit of the range within which power requests are allowed for the
385+ EV charger.
386+
387+ See [`frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds`][] and
388+ [`frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds`][] for more
389+ details.
390+ """
391+
392+ active_power_exclusion_upper_bound : float
393+ """Upper exclusion bound for EV charger power in watts.
394+
395+ This is the upper limit of the range within which power requests are not allowed for
396+ the EV charger.
397+
398+ See [`frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds`][] and
399+ [`frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds`][] for more
400+ details.
401+ """
402+
359403 frequency : float
360404 """AC frequency, in Hertz (Hz)."""
361405
@@ -375,10 +419,11 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> EVChargerData:
375419 Returns:
376420 Instance of EVChargerData created from the protobuf message.
377421 """
422+ raw_power = raw .ev_charger .data .ac .power_active
378423 ev_charger_data = cls (
379424 component_id = raw .id ,
380425 timestamp = raw .ts .ToDatetime (tzinfo = timezone .utc ),
381- active_power = raw . ev_charger . data . ac . power_active .value ,
426+ active_power = raw_power .value ,
382427 current_per_phase = (
383428 raw .ev_charger .data .ac .phase_1 .current .value ,
384429 raw .ev_charger .data .ac .phase_2 .current .value ,
@@ -389,6 +434,10 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> EVChargerData:
389434 raw .ev_charger .data .ac .phase_2 .voltage .value ,
390435 raw .ev_charger .data .ac .phase_3 .voltage .value ,
391436 ),
437+ active_power_inclusion_lower_bound = raw_power .system_inclusion_bounds .lower ,
438+ active_power_exclusion_lower_bound = raw_power .system_exclusion_bounds .lower ,
439+ active_power_inclusion_upper_bound = raw_power .system_inclusion_bounds .upper ,
440+ active_power_exclusion_upper_bound = raw_power .system_exclusion_bounds .upper ,
392441 cable_state = EVChargerCableState .from_pb (raw .ev_charger .state .cable_state ),
393442 component_state = EVChargerComponentState .from_pb (
394443 raw .ev_charger .state .component_state
@@ -397,3 +446,18 @@ def from_proto(cls, raw: microgrid_pb.ComponentData) -> EVChargerData:
397446 )
398447 ev_charger_data ._set_raw (raw = raw )
399448 return ev_charger_data
449+
450+ def is_ev_connected (self ) -> bool :
451+ """Check whether an EV is connected to the charger.
452+
453+ Returns:
454+ When the charger is not in an error state, whether an EV is connected to
455+ the charger.
456+ """
457+ return self .component_state not in (
458+ EVChargerComponentState .AUTHORIZATION_REJECTED ,
459+ EVChargerComponentState .ERROR ,
460+ ) and self .cable_state in (
461+ EVChargerCableState .EV_LOCKED ,
462+ EVChargerCableState .EV_PLUGGED ,
463+ )
0 commit comments