Giter Site home page Giter Site logo

drafproject / draf Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 2.0 3.29 MB

Demand Response Analysis Framework (DRAF)

License: GNU Lesser General Public License v3.0

Python 98.67% Batchfile 0.03% Shell 0.05% Jupyter Notebook 1.24%
decarbonization decision-support demand-response flexibility-modeling optimization energy-system-modeling

draf's Introduction

draf logo


paper License: LGPL v3 python Imports: isort Code style: black

demand response analysis framework (draf) is an analysis and decision support framework for local multi-energy hubs focusing on demand response. It uses the power of (mixed integer) linear programming optimization, pandas, Plotly, Matplotlib, elmada, GSEE, Jupyter and more to help users along the energy system analysis process. The software is described and demonstrated in the open-access draf demo paper. draf runs on Windows, macOS, and Linux. A draf-version supporting time series aggregation is provided in the dev-TSA branch.

Features

draf process

  • Time series analysis tools:
    • DemandAnalyzer - Analyze energy demand profiles
    • PeakLoadAnalyzer - Analyze peak loads or run simple battery simulation
  • Easily parameterizable component templates:
    • battery energy storage (BES), battery electric vehicle (BEV), combined heat and power (CHP), heat-only boiler (HOB), heat pump (HP), power-to-heat (P2H), photovoltaic (PV), wind turbine (WT), thermal energy storage (TES), fuel cell (FC), electrolyzer (Elc), hydrogen storage (H2S), production process (PP), product storage (PS), direct air capture (DAC), and more.
    • Sensible naming conventions for parameters and variables, see section Naming conventions.
  • Parameter preparation tools:
    • TimeSeriesPrepper - For time series data
      • Electricity prices via elmada
      • Carbon emission factors via elmada
      • Standard load profiles from BDEW
      • PV profiles via GSEE (In Germany, using weather data from DWD)
    • DataBase - For scientific data such as cost or efficiency factors
  • Scenario generation tools: Easily build individual scenarios or sensitivity analyses
  • Multi-objective mathematical optimization with support of different model languages and solvers:
    • Pyomo - A free and open-source modeling language in Python that supports multiple solvers.
    • GurobiPy - The Python interface to Gurobi, the fastest MILP solver (see Mittelmann benchmark).
  • Plotting tools: Convenient plotting of heatmaps, Sankeys, tables, pareto plots, etc. using Plotly, Matplotlib, and seaborn.
    • Support of meta data such as unit, doc, src, and dims
    • Automatic unit conversion
  • Export tools:
    • CaseStudy objects including all parameters, meta data, and results can be saved to files.
    • Data can be exported to xarray format.

Quick start

  1. Install miniconda or anaconda

  2. Open a terminal in the directory where you want to place draf in.

  3. Clone draf:

    git clone https://github.com/DrafProject/draf
    cd draf
  4. Create and activate the draf conda environment (conda env create will create a conda environment based on environment.yml which will install the newest versions of the required packages including the full editable local version of draf.):

    conda env create
    conda activate draf
  5. (OPTIONAL) If the draf environment caused issues, you could install an older but more specific conda environment, e.g.:

    conda env create --file environments/environment_py39all_mac.yml --force
    conda activate draf39
  6. (OPTIONAL) To use Gurobi (fast optimization), install a valid Gurobi license (its free for academics).

  7. Open Jupyter notebook:

    jupyter notebook
  8. Check if the imports work:

    import draf
    import elmada
  9. (OPTIONAL) To use the latest electricity prices and carbon emission factors from elmada, request an ENTSO-E API key and set it to elmada:

    # You have to run this Python code only once (it writes to a permanent file):
    import elmada
    elmada.set_api_keys(entsoe="YOUR_ENTSOE_KEY")
  10. Start modeling. Have a look at the examples. Start with the minimal if you want to write your own component. Start with the PV example if you want to import existing components. For more advanced modeling look at the draf_demo_case_studies. Consider the DRAF CHEAT SHEET

Structure

A CaseStudy object can contain several Scenario instances:

draf architecture

Naming conventions

All parameter and variable names must satisfy the structure <Type>_<Component>_<Descriptor>_<Dims>. E.g. in P_EG_buy_T, P is the entity type (here: electrical power), EG the component (here: Electricity Grid), buy the descriptor and T the dimension (here: time). Dimensions are denoted with individual capital letters, so <Dims> is TE if the entity has the dimensions T and E. See conventions.py for examples of types, components, and descriptors.

Contributing

Contributions in any form are welcome! Please contact Markus Fleschutz.

Citing

If you use draf for academic work please cite the draf demo paper:

@article{Fleschutz2022,
  author = {Markus Fleschutz and Markus Bohlayer and Marco Braun and Michael D. Murphy},
  title = {Demand Response Analysis Framework ({DRAF}): An Open-Source Multi-Objective Decision Support Tool for Decarbonizing Local Multi-Energy Systems},
  publisher = {{MDPI} {AG}},
  journal = {Sustainability}
  year = {2022},
  volume = {14},
  number = {13},
  pages = {8025},
  url = {https://doi.org/10.3390/su14138025},
  doi = {10.3390/su14138025},
}

Publications using draf

License and status

Copyright (c) 2017-2024 Markus Fleschutz

License: LGPL v3

The development of draf was initiated by Markus Fleschutz in 2017 and continued in a cooperative PhD between the MeSSO Research Group of the Munster Technological University, Ireland and the Energy System Analysis Research Group of the Karlsruhe University of Applied Sciences, Germany. This project was supported by the MTU Rísam PhD Scholarship scheme and by the Federal Ministry for Economic Affairs and Climate Action (BMWK) on the basis of a decision by the German Bundestag.

Thank you Dr. Markus Bohlayer, Dr. Ing. Adrian Bürger, Andre Leippi, Dr. Ing. Marco Braun, and Dr. Michael D. Murphy for your valuable feedback.

MTU_HKA_Logo

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

draf's People

Contributors

mfleschutz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mzhuang1 im-onu

draf's Issues

component_templates - EG

Hello @mfleschutz!

I want to add the EG component and I got this error:
HTTPError: 403 Client Error: Forbidden for url: https://transparency.entsoe.eu/api?documentType=A44&in_Domain=10Y1001A1001A82H&out_Domain=10Y1001A1001A82H&securityToken=YOUR_ENTSOE_KEY&periodStart=201812312300&periodEnd=201912312300

I don´t want to show the whole error log so I leave my notebook here in case you want to take a closer look on the error.

file: Case_Study_Windschläg

https://github.com/yamidibarra/Stadt_OG/tree/yamidibarra-patch-1

As far as I understood, entsoe does not allow to read data from its website.
is this correct?

Thanks for your help!

DemandAnalyzer - analyze_demand

Hi @mfleschutz

I am using the analyze_demand method defined in the scenario class which generates the plots of violin, load curves etc. This method is linked to the DemandAnalyzer class in which the plots are generated.

I have problems when I analyze the heat demand, because the y-axis (ylabel) shows "P_el" and I would like to change the label of this axis to P_th. Is this possible? is it also posible to change the color of the violin plots?

Python 3.9 support

Gurobi was the reason why draf ran only on Python 3.7.

The newest version of Gurobi supports Python 3.9 (see here). So draf could theoretically run on Python 3.9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.