Package: pymfm
pymfmPython 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.ContributionClone repository via SSH (git@github.com:sogno-platform/pymfm.git) or clone repository via HTTPS (https://github.com/sogno-platform/pymfm.git)Open an issue athttps://github.com/sogno-platform/pymfm/issuesCheckout the development branch:git checkout devUpdate your local development branch:git pull origin devCreate your feature/issue branch:git checkout -b issueXY_explanationCommit your changes:git commit -m "Add feature #XY"Push to the branch:git push origin issueXY_explanationSubmit a pull request from issueXY_explanation to dev branch viahttps://github.com/sogno-platform/pymfm/pullsWait for approval or revision of the new implementations.Installationpymfm requires at least the following Python packages:matplotlib>=3.7.1scipy>=1.11.0astral>=3.2pandas>=1.5.3pyomo>=6.5.0xlsxwriter >= 3.1.2pydantic >= 1.10.9, < 2.0as well as the installation of at least one mathematical programming solver for convex and/or non-convex problems, which is supported by thePyomooptimisation modelling library.
We recommend one of the following solvers:Gurobi (gurobipy)(default)SCIP (Solving Constraint Integer Programs)To install pymfm and all its python dependencies, you can:pip install pymfmor:<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 pymfmDocumentationThe documentation for the latest pymfm release can be found in folder ./docs and onthisdocumentation page.For further information, please also visit theFEIN Aachen association website.Example Usageimportosfrompymfm.control.utils.data_inputimportInputData,open_jsonfrompymfm.control.utils.mode_logic_handlerimportmode_logic_handlerfrompymfm.control.utilsimportdata_outputdefmain():"""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 scriptfpath=os.path.dirname(os.path.abspath(__file__))# Construct the file path for the input JSON filefilepath=os.path.join(fpath,"inputs/scheduling_optimization_based.json")# Open and load the JSON data from the filedata=open_json(filepath)# Create an InputData object from the loaded datainput_data=InputData(**data)# Execute the control logic handler to process the input datamode_logic,output_df,status=mode_logic_handler(input_data)# Prepare and save control output data as JSON filesdata_output.prepare_json(mode_logic,output_df,output_directory="outputs/")# Visualize and save control output data as SVG plotsdata_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 thepymfm repository.The fileexamples/controle/scheduling_rule_based.pycan be run without installing any solver by runningpythonscheduling_rule_based.pyfrom theexamples/controlfolder.LicenseThe 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 theApache2.0 LicenseContactAmir Ahmadifar, M.Sc.aahmadifar@eonerc.rwth-aachen.deErdem Gumrukcu, M.Sc.erdem.guemruekcue@eonerc.rwth-aachen.deFlorian Oppermann, B.Sc.florian.oppermann@eonerc.rwth-aachen.deAytug Yavuzer, B.Sc.aytug.yavuzer@eonerc.rwth-aachen.deUniv.-Prof. Antonello Monti, Ph.D.post_acs@eonerc.rwth-aachen.deInstitute for Automation of Complex Power Systems (ACS)E.ON Energy Research Center (E.ON ERC)RWTH Aachen University, Germany