Skip to main content

A Python framework for microgrid flexibility management.

Project description

pymfm

Python package pymfm is a framework for microgrid flexibility management. The framework allows to develop scenario-oriented management strategies for community microgrids based on optimization and rule-based algorithms in both (near) real-time and scheduling operation modes by coordinating battery storage and photovoltaic units. Furthermore, this framework can be used to create realistic forecast profiles based on standard load and PV generation profiles. Its target users are researchers in the field of smart grid applications and the deployment of operational flexibility for renewable energy communities.

Contribution

  1. Clone repository via SSH (git@github.com:sogno-platform/pymfm.git) or clone repository via HTTPS (https://github.com/sogno-platform/pymfm.git)
  2. Open an issue at https://github.com/sogno-platform/pymfm/issues
  3. Checkout the development branch: git checkout dev
  4. Update your local development branch: git pull origin dev
  5. Create your feature/issue branch: git checkout -b issueXY_explanation
  6. Commit your changes: git commit -m "Add feature #XY"
  7. Push to the branch: git push origin issueXY_explanation
  8. Submit a pull request from issueXY_explanation to dev branch via https://github.com/sogno-platform/pymfm/pulls
  9. Wait for approval or revision of the new implementations.

Installation

pymfm requires at least the following Python packages:

  • matplotlib>=3.7.1
  • scipy>=1.11.0
  • astral>=3.2
  • pandas>=1.5.3
  • pyomo>=6.5.0
  • xlsxwriter >= 3.1.2
  • pydantic >= 1.10.9, < 2.0

as well as the installation of at least one mathematical programming solver for convex and/or non-convex problems, which is supported by the Pyomo optimisation modelling library. We recommend one of the following solvers:

To install pymfm and all its python dependencies, you can:

pip install pymfm

or:

<path_to_your_python_binary> -m pip install -e '<your_path_to_pymfm_git_folder>'

You can check if the installation has been successful by trying to import package pymfm into your Python environment. This import should be possible without any errors.

import pymfm

Documentation

The documentation for the latest pymfm release can be found in folder ./docs and on this documentation page.

For further information, please also visit the FEIN Aachen association website.

Example Usage

import os
from pymfm.control.utils.data_input import InputData, open_json
from pymfm.control.utils.mode_logic_handler import mode_logic_handler
from pymfm.control.utils import data_output


def main():
    """
    Example usage of scheduling optimization based control.

    This function reads input data from "inputs/scheduling_optimization_based.json" JSON file, 
    processes it using the `mode_logic_handler`, prepares output data, 
    saves output JSON files under "outputs/", 
    and saves visualized data through plots under "outputs/" as SVG files.

    :return: None
    """
    # Get the current directory of the script
    fpath = os.path.dirname(os.path.abspath(__file__))

    # Construct the file path for the input JSON file
    filepath = os.path.join(fpath, "inputs/scheduling_optimization_based.json")

    # Open and load the JSON data from the file
    data = open_json(filepath)

    # Create an InputData object from the loaded data
    input_data = InputData(**data)

    # Execute the control logic handler to process the input data
    mode_logic, output_df, status = mode_logic_handler(input_data)

    # Prepare and save control output data as JSON files
    data_output.prepare_json(mode_logic, output_df, output_directory="outputs/")

    # Visualize and save control output data as SVG plots
    data_output.visualize_and_save_plots(
        mode_logic, output_df, output_directory="outputs/"
    )
if __name__ == "__main__":
    main()

For an example that can be run out of the box you can download the example folder from the pymfm repository.

The file examples/controle/scheduling_rule_based.py can be run without installing any solver by running

python scheduling_rule_based.py

from the examples/control folder.

License

The pymfm package is released by the Institute for Automation of Complex Power Systems (ACS), E.ON Energy Research Center (E.ON ERC), RWTH Aachen University under the Apache2.0 License

Contact

Institute for Automation of Complex Power Systems (ACS)
E.ON Energy Research Center (E.ON ERC)
RWTH Aachen University, Germany

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

pymfm-0.5.5.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

pymfm-0.5.5-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

Details for the file pymfm-0.5.5.tar.gz.

File metadata

  • Download URL: pymfm-0.5.5.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pymfm-0.5.5.tar.gz
Algorithm Hash digest
SHA256 60c6437ff652997159bfecafd544c80484237f178ccb766eca077e8e566a355d
MD5 e0ab9b3125616e93d2c5ed97ce506432
BLAKE2b-256 569620bc6e0396bf5e1870629b9bd5b3936031aa00f07970595df5b5c1fc2c2d

See more details on using hashes here.

File details

Details for the file pymfm-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: pymfm-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 39.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for pymfm-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e0cea135bbe271679b64e1b873ac4fe6dbd4ff36c9e4b50a9234374a4c5a9511
MD5 c6c8ad8f9e4aa589a539d5871c7ba19d
BLAKE2b-256 f5409a699a10acc3a3938bca8f737e49c69abbaeb00300500ce5d827e913deb9

See more details on using hashes here.

Supported by

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