Code Monkey home page Code Monkey logo

trend's Introduction

Logo of trEnD

trEnD: Model for Transition of End-users and the Distribution Power Network

Welcome to trEnD, a c++ based model of the energy transition, focusing on the end-users and the distribution network. The source codes are currently undergoing revision and being tested by real data of Norway in my phD project. Feel free to comment on any issues.

Below is the abstract version of the full documentation of this project.

Table of Contents

User Guide

Preparing the Input .csv Files

An example of the input csv files can be found here. In case the model is applied for other time periods of the same region, the format of the csv files should be kept the same. For regions where conventional thermal power plants still play a role in the power system, additional input data might be needed, and corresponding parts of the source codes might therefore have to be modified in the future.

Below is a brief summary of the input .csv files currently used in the model.

.csv Files for Power Market

The following files can be found in the folder power_market. If not specifically mentioned, the time series were extracted from ENTSO-E Transparency Platform.

  • cbt_forecast.csv stores the time series of scheduled cross border transmission flows of the modeled bidding zones and their directly connected neighbors. Since there can be two directions of transmission flow between 2 connected bidding zones, each connection contributes to 2 columns of time series.
  • control_reserve_activated.csv stores the time series of activated control reserve in the modeled bidding zones. Since the activated control reserve can be both positive and negative, each bidding zone contributes to 2 columns of time series.
  • da_price.csv stores the time series of day-ahead prices in the modeled bidding zones and their directly connected neighbors. The prices in Great Britian was extracted from Elexon Portal.
  • generation_solar_forecast.csv stores the time series of scheduled solar power generation in the modeled bidding zones and their directly connected neighbors.
  • generation_total_forecast.csv stores the time series of scheduled total generation in the modeled bidding zones and their directly connected neighbors.
  • generation_wind_offshore_forecast.csv stores the time series of scheduled offshore wind power generation in the modeled bidding zones and their directly connected neighbors.
  • generation_wind_onshore_forecast.csv stores the time series of scheduled onshore wind power generation in the modeled bidding zones and their directly connected neighbors. The data of Great Britian were extracted from Elexon Portal.
  • merit_order_curve_q_assimilated.csv stores the merit order curves of the modeled bidding zones and their directly connected neighbors. This file might not be needed in the future once merit order curves can be modeled endogeneously within.
  • solar_radiation.csv stores the time series of solar radiation data from meteorology stations in the modeled bidding zones. The data is obtained from Frost.

.csv Files for Power Network

The files can be found in the folder power_network. If not specifically mentioned, the time series were extracted from the NVE dataset.

  • DSO_Bidding_Zone.csv stores the bidding zones where original DSO areas from the NVE dataset are located.
  • cbt_constraint.csv stores the cross border transmission flow constraint between the modeled bidding zones and their directly connected neighbors. "-1" means that there are no connections between the 2 bidding zones. This dataset was inferred from cbt_forecast.csv.
  • cbt_entry_nodes.csv stores the transmission nodes where power flows from / to neighboring bidding zones injects / leaves. These transmission nodes were inferred from the transmission network graph from PyPSA-Eur.
  • hydro_plants.csv stores the information of hydroelectric power plants in the modeled bidding zones.
  • point_info.csv stores the information of spatial points considered in the model.
  • point_matrix.csv stores the geometrical relations of the spatial points in point_info.csv with a matrix. It makes finding the neighbors of a spatial point faster.
  • solar_radiation_stations.csv stores the information of the meteorology stations in the modeled bidding zones. The data is obtained from Frost.
  • transmission_edges.csv stores the information of the edges of the transmission network in the modeled bidding zones.
  • transmission_nodes.csv stores the information of the nodes of the transmission network in the modeled bidding zones.
  • wind_plants.csv stores the information of wind power plants in the modeled bidding zones.

Compiling the Source Codes

Prerequisite for Compilation

  • Boost library installed (I used version 1.78.0, but will move to 1.83.0 soon)

The library ALGLIB and Eigen are also used in the model, but they are already in the source codes or the library directory so you need not to download it in addition.

Once compilation is complete, the input csv files, source files, object files and binary file will take about 120 MB of space.

Compiler Choice and Settings

I use TDM-GCC version 9.2.0 and 10.3.0 to compile the codes on windows 11; I also tested the compilation on a Ubuntu 22.04 virtual machine in virtual box.

I use Code::Blocks version 20.03 for project management, and a codeblock project file is provided in the repository. Again it should be possible to use other IDEs for project management and code editing.

Remember to add the project's top-level directory (the directory which stores this repository) to compiler search directories when compiling. This can be done quite easily in codeblocks.

If you prefer to use the terminal (or are unable to use GUI), there is a Makefile in the repository also that should set everything up for you.

Executing the Binary File

You will be asked to type in the values for some boolean variables at the beginning of the program. These boolean variables determine which modules of the program will be run. The questions will be shown in the following order:

  • "Default procedure?": If you type 1 (yes) for this question, the simulation will be run under the default settings of the program (no estimation of spatial fields, simulation without DSO filtering bids during redispatch), and the questions below will not be asked.
  • "Estimate spatial fields?": If you type 1 (yes) for this question, the necessary spatial fields will be estimated first and stored in the Processed/spatial_field folder.
  • "Simulate operation?": If you type 1 (yes) for this question, the program will simulate the operation of the power market.
  • "DSOs filter bids?": This question only appears when you have answered "yes" to "Simulate operation?". If you type 1 (yes) for this question, the DSOs will filter submitted bids in their operation area during redispatch.
  • "Control reserve?": This question only appears when you have answered "yes" to "Simulate operation?". If you type 1 (yes) for this question, the program will simulate the activatation of tertiary control reserve after redispatch.

Output .csv Files

Workflow of the Model

Workflow of the model

Data Processing Stage

Simulation Stage

Bid Submission

Market Clearing

Redispatch

Control Reserve Activation

Settlement Stage

Documentation of Source Codes

Below is a summary of what the source codes do, categorized by the subfolders in src folder. The full documentation can be found at the github-pages of this repository.

  • agent: source codes for the operation and investment strategies of relevant agents in the model.
  • alglib: source codes from the external library ALGLIB.
  • basic: source codes for generic functions and headers.
  • power_market: source codes for the market clearing at different levels.
  • power_network: source codes for the processing of power network data.
  • spatial_field: source codes for the processing of spatial fields.
  • main.cpp: the cpp file where the main function is located.

trend's People

Contributors

tonyyentwn avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

trend's Issues

error with Eigen when running area_demand

Hello,

When running the code on Ubuntu 20.04 after compiling with g++ -g -Wall -o area_demand area_demand.cpp I got the following error:

area_demand: /usr/include/eigen3/Eigen/src/Core/Product.h:95: Eigen::Product<Lhs, Rhs, Option>::Product(const Lhs&, const Rhs&) [with _Lhs = Eigen::Matrix<double, -1, 1>; _Rhs = Eigen::Matrix<double, -1, 1>; int Option = 0; Eigen::Product<Lhs, Rhs, Option>::Lhs = Eigen::Matrix<double, -1, 1>; Eigen::Product<Lhs, Rhs, Option>::Rhs = Eigen::Matrix<double, -1, 1>]: Assertion `lhs.cols() == rhs.rows() && "invalid matrix product" && "if you wanted a coeff-wise or a dot product use the respective explicit functions"' failed.

How this could be fixed please?

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.