Skip to content

Commit

Permalink
Handle issues with specific points.
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Nov 6, 2023
1 parent 80c2ddc commit b3a0fe1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions services/core/IEEE_2030_5/ieee_2030_5/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ def __post_init__(self):

@staticmethod
def build_from_csv(data: Dict[str, str]) -> MappedPoint:
"""Create a mapped point from a row of data.
:param data: A row of data from the point_map csv file.
:type data: Dict[str, str]
:return: A mapped point object.
:rtype: MappedPoint
"""
return MappedPoint(point_on_bus=data['Point Name'].strip(),
description=data['Description'].strip(),
multiplier=data['Multiplier'].strip(),
Expand Down Expand Up @@ -363,15 +370,21 @@ def _control_event_started(self, control: m.DERControl):
if isinstance(point_value, m.PowerFactor):
point_value = point_value.displacement * math.pow(
10, -point_value.multiplier)
else:
elif point_value.value is not None and point_value.multiplier is not None:
point_value = point_value.value * math.pow(10, -point_value.multiplier)
else:
point_value = None
elif isinstance(point_value, m.FixedVar):
...
# TODO: Deal with ref type?
point_value = point_value.value

elif isinstance(point_value, m.DERCurveLink):
# TODO Handle DERCurve Types
...
elif isinstance(point_value, bool):
point_value = 1 if point_value else 0
elif isinstance(point_value, m.PowerFactorWithExcitation):
point_value = point_value.displacement

if point_value:
_log.debug(f'Setting point: {point.point_on_bus} to {point_value}')
Expand Down

0 comments on commit b3a0fe1

Please sign in to comment.