Skip to content

Commit

Permalink
Use model for cim measurement output.
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Aug 6, 2024
1 parent 7eb6240 commit eb25587
Show file tree
Hide file tree
Showing 4 changed files with 2,131 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ieee_2030_5/adapters/gridappsd_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,12 @@ def get_house_and_utility_inverters(self) -> list[HouseLookup]:
lfdi=self.tls.lfdi(ec['mRID'])
except FileNotFoundError:
lfdi = None
self._inverters.append(HouseLookup(mRID=ec['mRID'],
name=match_house.group(0),
lfdi=lfdi))
self._inverters.append(
HouseLookup(mRID=ec['mRID'], name=match_house.group(0), lfdi=lfdi))
elif match_utility := re.match(re_utility, ec['name']):
pass
# TODO: Figure out about mrid for utilities.
# for phase in ec['phases']:
# self._inverters.append(HouseLookup(mRID=ec['mRID'],
# name=match_utility.group(0) + f"_{phase}",
# lfdi=self.tls.lfdi(ec['mRID'])))
self._inverters.append(
HouseLookup(mRID=ec['mRID'], name=match_utility.group(0), lfdi=lfdi))

return self._inverters

def get_power_electronic_connections(self) -> list[cim.PowerElectronicsConnection]:
Expand Down Expand Up @@ -218,6 +214,8 @@ def get_device_configurations(self) -> list[DeviceConfiguration]:

def get_message_for_bus(self) -> dict:
import random
import ieee_2030_5.models.output as mo

msg = {}

# TODO Get from list adapter for each house.
Expand Down Expand Up @@ -247,10 +245,11 @@ def get_message_for_bus(self) -> dict:
break

if inverter:
msg[inverter.mRID] = asdict(mo.AnalogValue(mRID=inverter.mRID, timeStamp=status.readingTime, name=inverter.name, value=status.stateOfChargeStatus.value))

msg[inverter.mRID] = dict(mrid=inverter.mRID, name=inverter.name)
# msg[inverter.mRID] = dict(mrid=inverter.mRID, name=inverter.name)

msg[inverter.mRID].update(asdict(status))
# msg[inverter.mRID].update(asdict(status))


# for inv in self._inverters:
Expand Down
28 changes: 28 additions & 0 deletions ieee_2030_5/models/output/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'''
Annotated CIMantic Graphs data profile init file for Profile
Generated by CIMTool http://cimtool.org
'''
from ieee_2030_5.models.output.output_models import (
Identity, ACDCTerminal, Analog, AnalogControl, AnalogValue, BatteryState, BatteryUnit, Command,
ConductingEquipment, Discrete, DiscreteValue, GeneratingUnit,
IEEE1547AbnormalPerfomanceCategory, IEEE1547ControlSettings, IEEE1547Info,
IEEE1547IslandingCategory, IEEE1547NormalPerformanceCategory, IEEE1547Setting,
IEEE1547TripSettings, IOPoint, IdentifiedObject, Measurement, MeasurementValue,
MeasurementValueQuality, MeasurementValueSource, PhaseCode, PhotoVoltaicUnit,
PowerElectronicsConnection, PowerElectronicsConnectionPhase, PowerElectronicsUnit,
PowerSystemResource, RotatingMachine, SinglePhaseKind, SmartInverterMode, Terminal,
ReactivePower, Susceptance, Seconds, Voltage, ApparentPower, PerCent, RealEnergy, PU,
Frequency, ActivePower)

__all__ = [
Identity, ACDCTerminal, Analog, AnalogControl, AnalogValue, BatteryState, BatteryUnit, Command,
ConductingEquipment, Discrete, DiscreteValue, GeneratingUnit,
IEEE1547AbnormalPerfomanceCategory, IEEE1547ControlSettings, IEEE1547Info,
IEEE1547IslandingCategory, IEEE1547NormalPerformanceCategory, IEEE1547Setting,
IEEE1547TripSettings, IOPoint, IdentifiedObject, Measurement, MeasurementValue,
MeasurementValueQuality, MeasurementValueSource, PhaseCode, PhotoVoltaicUnit,
PowerElectronicsConnection, PowerElectronicsConnectionPhase, PowerElectronicsUnit,
PowerSystemResource, RotatingMachine, SinglePhaseKind, SmartInverterMode, Terminal,
ReactivePower, Susceptance, Seconds, Voltage, ApparentPower, PerCent, RealEnergy, PU,
Frequency, ActivePower
]
Loading

0 comments on commit eb25587

Please sign in to comment.