Giter Club home page Giter Club logo

drakesiard / elecsim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexanderkell/elecsim

0.0 1.0 0.0 563.78 MB

Long term electricity market agent based model simulation used to observe the effect of policy on investment decisions

Home Page: https://elecsim.readthedocs.io

License: MIT License

Python 0.65% Jupyter Notebook 79.54% R 0.01% HTML 18.93% CSS 0.01% Dockerfile 0.01% Shell 0.02% PowerShell 0.01% JavaScript 0.87% Xonsh 0.01%

elecsim's Introduction

ElecSim

ElecSim is an agent-based model of an electricity market written in python. ElecSim can be generalised to any country, with the starting parameters set in a scenario file.

Through the manipulation of a scenario file, one can build a custom environment of electricity producers with their respective power plants, and an electricity market which matches demand with supply.

ElecSim allows practitioners to explore the effect of different policy options and starting conditions on electricity markets.

For the full papers which detail ElecSim, see publications [1] and [2].

Features

  • Generalisable to any country
  • Integration of major power plant types
  • Default parameter data included
  • Example model library

Installation

Install ElecSim through the python repository pip with the following command

pip install elecsim

Or for the latest release:

pip install -e git+https://github.com/alexanderkell/elecsim

Getting started

Once ElecSim is installed, create a python file and fill it with the following code:

from elecsim.model.world import World 

if __name__ == "__main__":
    world = World(initialization_year = 2018, log_level="warning")
    for years in range(20):
        for time_steps in range(8):
            world.step()

This code imports the World class. We use logging to display useful information of the run. This can be turned to 'warning' or changed to 'debug' for further information.

We instantiate the model to start in the year 2018. The first for loop steps the model 20 times, which is equivalent to 20 years in the model. The second for loop iterates through the 8 representative days.

Custom Scenario

Whilst elecsim comes with a fully parametrised case study of the UK in 2018, you can update the scenario data however you wish. Here we show you how to edit a scenario file for a model run.

Open the scenario file found here and make the required changes.

For a scenario of the Scottish electricity market we make the following changes:

segment_demand_diff = [17568, 21964, 23127, 24327, 25520, 26760, 27888, 28935, 29865, 30721, 31567, 32315, 33188, 34182, 35505, 37480, 39585, 42206, 45209, 52152]
# Peak demand in Scotland is 9.5 times smaller than that of the UK as a whole
segment_demand_diff = [x/9.5 for x in segment_demand_diff]
...
historical_hourly_demand = pd.read_csv('{}/data/processed/electricity_demand/uk_all_year_demand.csv'.format(ROOT_DIR))
historical_hourly_demand.demand = historical_hourly_demand.demand/9.5
...
# We read a new file containing power plants of Scotland
power_plants = pd.read_csv('/path/to/power_plants/scotland_plants.csv', dtype={'Start_date': int})

We then pass this new scenario file into the World class as shown below:

from elecsim.model.world import World 

if __name__ == "__main__":
    world = World(initialization_year = 2018, scenario_file='/path/to/scenario.py', log_level="warning")
    for years in range(20):
        for time_steps in range(8):
            world.step()

This will now run the Scottish scenario for 20 years, with 8 representative days per year.

Docker

ElecSim is hosted on docker hub, so that anybody on any machine can quickly get running.

Run the following command to pull ElecSim from docker hub

docker pull alexkell/elecsim:latest

Once you have an ElecSim container run a particular file using the following command

docker run elecsim <path/to/file>

Contributing back to ElecSim

If you run into an issue, please submit a ticket here. If possible, please follow up with a pull request.

To add a feature, submit a ticket here.

elecsim's People

Contributors

alexanderkell avatar

Watchers

James Cloos avatar

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.