OpenLEADR / openleadr-python

Python library for OpenADR
https://openleadr.org/docs
Apache License 2.0
133 stars 51 forks source link

Missing Duration in Metadata reports #83

Closed 00javad00 closed 2 years ago

00javad00 commented 3 years ago

According to OpenADR 2.0b Profile Specification: oadrReport:duration element communicates the amount of history that can be buffered. This element MUST be included in Metadata reports. So duration and corresponding functions shall be added to client.add_report. i.e:

def add_report(self, callback, resource_id, measurement=None,
                   data_collection_mode='incremental',
                   report_specifier_id=None, r_id=None,
                   report_name=enums.REPORT_NAME.TELEMETRY_USAGE,
                   reading_type=enums.READING_TYPE.DIRECT_READ,
                   report_type=enums.REPORT_TYPE.READING, sampling_rate=None, 
                   report_duration=timedelta(seconds=3600),data_source=None,
                   scale="none", unit=None, power_ac=True, power_hertz=50, power_voltage=230,
                   market_context=None, end_device_asset_mrid=None, report_data_source=None,
                   on_change=False):
bnystrom commented 3 years ago

I'll second the need for this. We have tested against a VTN the rejects "oadrRegisterReport" due to the fact that the duration element is missing. Looking at the templates for report, though, the logic is already in place for providing duration if it is provided. The call to add_report, however, does not take such a parameter.

Although the xsd schema does not "require" that element, the OpenADR spec does require it per conformance rule 312. Here's the text from rule 312:

VEN/VTN, EiReport Service, Metadata oadrReport Object The oadrReport:duration element communicates the amount of data that is available for reporting. For telemetry reporting this may reflect the amount of data that can be buffered by the VEN. For history and forecast reports the amount of available data is more likely bounded by off device storage. This element MUST be included in Metadata reports. Since duration is a time pa- rameter the assumption is that the implementation can store enough data at the fastest supported sampling rate (oadrSamplingRate:oadrMinPeriod) for that duration of time.

stan-janssen commented 2 years ago

You're right; this parameter should be added. I'll look into what other side-effects this has.

stan-janssen commented 2 years ago

I finally got around to adding this parameter, thanks again for reporting it.