Skip to content
alliander-opensourcePublic

About

SUNlight-based Disaggregation using Anchored rEference profiles Library

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Sundael

Module to disaggregate generation and consumption from import (net consumption) and export (net generation) profiles, or a net load profile. Generation is based on average PV profiles, optionally per area (for instance by postal code), corrected for installation size, tilt and orientation. These are calculated based on the SunDance algorithm.

Example usage

Required data

The SunDance algorithm disaggregates solar generation from net meter data.

For a more detailed example, see the notebook examples/example_usage.ipynb.

from sundael import PVDisaggregator

pv = PVDisaggregator(pv_ratio=pv_ratio) 
result = pv.disaggregate(net_consumption, net_generation)

Visualize the results.

# Show one example of "Klant 63"
import hvplot.pandas

idx = "Klant 63"

pd.concat(
    (
        result["consumption"].loc[idx].rename("consumption"),
        result["generation"].loc[idx].rename("generation") * -1,
    ),
    axis=1

).fillna(0).hvplot(width=1200, title=idx)

profiles

Configuration

Defaults are managed through a Pydantic config object in src/sundael/config.py.

from sundael.config import PVConfig

# Start from package defaults and override only what you need.
config = PVConfig(latitude=52.1, longitude=5.1)

Use this config in the disaggregator:

from sundael import PVDisaggregator

pv = PVDisaggregator(pv_ratio=pv_ratio, config=config)
result = pv.disaggregate(netload=netload)

Getting Started

Local

To get a local copy up and running, follow these steps:

  1. Clone the repository
git clone https://github.com/Alliander/sundael
  1. Install dependencies
uv sync

Setup pre-commit

The pre-commit hook runs ruff and mypy checks before you commit to the repository. First, install pre-commit if you haven't done so already:

pip install pre-commit

Then, install the hook:

pre-commit install

The pre-commit hook ensures your code adheres to standards. If, for a certain commit, you want to skip the checks, pass a --no-verify flag to git commit.

Contributing code: style and commits

In short, we use Conventional Commits for commit messages and follow conventional Python code guidelines, including PEP8. See CONTRIBUTING.md for more details.

Testing your package locally

Run pytest:

uv run pytest

Local code quality checks

We use ruff for linting and code quality. It replaces other tools such as black, isort and flake8 (and is really fast).

Note

For Visual Studio Code you can install the ruff extension and enable linting and auto-formatting on save.

Before you publish your changes, run the code quality checks that are done in the workflow, to prevent unexpected failed runs:

uv run ruff check .
uv run mypy .

To format code with ruff:

uv run ruff format .

To automatically fix any errors:

uv run ruff check --fix .

License

This project is licensed under the Mozilla Public License, Version 2.0, see LICENSE for details.

Contributing

Please read CODE_OF_CONDUCT, CONTRIBUTING and PROJECT GOVERNANCE for details on the process for submitting pull requests to us.

Contact

Please read SUPPORT for how to get in touch with the sundael project.

About

SUNlight-based Disaggregation using Anchored rEference profiles Library

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages