Skip to main content

A highlevel interface for the reporting API

Project description

Reporting Highlevel Interface

Build Status PyPI Package Docs

Introduction

A highlevel interface for the reporting API

Supported Platforms

The following platforms are officially supported (tested):

  • Python: 3.11
  • Operating System: Ubuntu Linux 20.04
  • Architectures: amd64, arm64

Contributing

If you want to know how to build this project and contribute to it, please check out the Contributing Guide.

Installation

# Choose the version you want to install
VERSION=0.3.0
pip install frequenz-reporting-python==$VERSION

Initialize the client

from datetime import datetime

from frequenz.client.common.metric import Metric
from frequenz.client.reporting import ReportingApiClient
from frequenz.reporting._reporting import cumulative_energy

# Change server address
SERVICE_ADDRESS = "grpc://replace-this-with-your-server-url:port"
API_KEY = open('api_key.txt').read().strip()
client = ReportingApiClient(service_address=SERVICE_ADDRESS, key=API_KEY)

Calculate cumulative energy for a single microgrid and component:

If the component does not measure Metric.AC_ACTIVE_ENERGY, set use_active_power=True to utilize Metric.AC_ACTIVE_POWER instead.

A resampling period can be set that alters how NaNs are handled, resulting in varying results. NaN values are ignored in sums, which may lead to significant data loss if many are present in the raw data. There is no universally correct method for handling NaNs, as their causes can vary.

energy_reading = await cumulative_energy(
			client=client,
                        microgrid_id=1,
                        component_id=100,
                        start_time=datetime.fromisoformat("2024-09-01T00:00:00"),
                        end_time=datetime.fromisoformat("2024-09-30T00:00:00"),
                        use_active_power=True,
                        resampling_period=timedelta(seconds=10),
    )

print(energy_reading)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frequenz_reporting_python-0.5.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frequenz_reporting_python-0.5.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file frequenz_reporting_python-0.5.0.tar.gz.

File metadata

File hashes

Hashes for frequenz_reporting_python-0.5.0.tar.gz
Algorithm Hash digest
SHA256 16a43883a97eded623ab88feaca0945486e0f55ffc132d5a4e66b176c1bbf5ec
MD5 2bf3b288fef86f2fa6d8b46a68b47ced
BLAKE2b-256 dcab583e53e11ea63838396d07f7d42d201449c260cf208d9297d3fb9cd08558

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_reporting_python-0.5.0.tar.gz:

Publisher: ci.yaml on frequenz-floss/frequenz-reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file frequenz_reporting_python-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frequenz_reporting_python-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dc721242210b4ef2143eba8ccc9d06bb349ef4da6d0706a0ef53510ee59cb82
MD5 8e333ac3d87d6402e7010c907c0f1fb6
BLAKE2b-256 24b4f6525bd5ea1f1c006a05a8476c859ac8755f0d92bdb89707ba3fcd52d65a

See more details on using hashes here.

Provenance

The following attestation bundles were made for frequenz_reporting_python-0.5.0-py3-none-any.whl:

Publisher: ci.yaml on frequenz-floss/frequenz-reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page