Code Monkey home page Code Monkey logo

tulipaenergymodel.jl's Introduction

TulipaEnergyModel

Stable doc Dev doc Test workflow status Lint workflow Status Docs workflow Status Coverage DOI

This package provides an optimization model for the electricity market and its coupling with other energy sectors (e.g., hydrogen, heat, natural gas, etc.). The main objective is to determine the optimal investment and operation decisions for different types of assets (e.g., producers, consumers, conversions, storages, and transports).

How to Cite

If you use TulipaEnergyModel.jl in your work, please cite using the format given in CITATION.cff.

Installation

pkg> add TulipaEnergyModel

See the documentation for details on the model and the package.

Bug reports and discussions

If you think you found a bug, feel free to open an issue. Focused suggestions and requests can also be opened as issues. Before opening a pull request, please start an issue or a discussion on the topic.

If you want to ask a question unsuitable for a bug report, start a discussion here. This forum is for general discussion about the repository TulipaEnergyModel.

Contribution

If you want to contribute to the package, please read our CONTRIBUTING.md and follow the guidelines in the README.dev.md file.

License

This content is released under the Apache License 2.0 License.

tulipaenergymodel.jl's People

Contributors

abelsiqueira avatar clizbe avatar datejada avatar g-moralesespana avatar github-actions[bot] avatar gnawin avatar greg-neustroev avatar sjvrijn avatar suvayu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tulipaenergymodel.jl's Issues

Change input format to use GML

Summary

We need an input describing what flows are free, and we chose to use GML.

Basic Example

Here is an example of GML file:

graph [
	comment "This is a sample graph"
	directed 1
	id 42
	label "Hello, I am a graph"
	node [
		id 1
		label "node 1"
		thisIsASampleAttribute 42
	]
	node [
		id 2
		label "node 2"
		thisIsASampleAttribute 43
	]
	node [
		id 3
		label "node 3"
		thisIsASampleAttribute 44
	]
	edge [
		source 1
		target 2
		label "Edge from node 1 to node 2"
	]
	edge [
		source 2
		target 3
		label "Edge from node 2 to node 3"
	]
	edge [
		source 3
		target 1
		label "Edge from node 3 to node 1"
	]
]

Drawbacks

It looks like it doesn't support data to be attached to nodes and edges (@suvayu, do you know?). If that is the case, we might have to find something else.

@datejada, is there anything else apart from the profile that is attached to an edge?

Reference Issues

Workflow with ESDL

Discussed in #56

Originally posted by datejada August 22, 2023
I can foresee three data files in the model that need to be considered as inputs and outputs for the model; see Figure below.

  1. ESDL files (.esdl): These files will contain the available information that can be stored in this format. Generally speaking, it is capacities, efficiencies, investment costs, operational costs, and commission and decommissions dates.
  2. Complementary information files (.csv?): Here we have two categories
  • Extra information for assets: Information not available in the ESDL format, e.g., unit-commitment parameters.
  • Configuration parameters: setting parameters such as the years to run, type of simulation (only dispatch or with investment), etc.
  1. Profiles database (.sqllite?): This file/DB will contain a large amount of input data (e.g., availability profiles) and results (e.g., production profiles for each asset).

Maybe we need more types of files; I'm not sure. In addition, the pre-processing and post-processing can be either in Julia or Python; these steps should be able to link the information in all the data sources with the optimization model.

I hope these comments and general overview help in the discussion for next week's meeting to talk about the design of the model.

image

Add workflows to auto-label issues

Such as new issues being labeled "Todo" and issues moving to "In Progress" if someone is assigned or there is a Pull Request referencing it. And labeled "Done" when closed with a Pull request.

Complete README

README should have important at-a-glance information for potential users, and some information for people that know what they want. A possible structure is as follows:

  • Brief description for users who don't know if they are in the right place.
  • Brief description for specialized users.
  • Installation instructions.
  • 3-5 lines example and link to documentation for further explanation.
  • Directions for contributors.
  • License and link to LICENSE.

Publish the package!

Summary

We should publish the package ASAP so we can dibs the name.

Basic Example

Do it, quick!

Drawbacks

We might start seeing responses from the "community."
We have to start dealing with version releases.

Reference Issues

No response

YAML and JSON formatting

EditorConfig is configured to use 4 spaces, but YAML and JSON files were created with 2 spaces.
Since the formatting of these files is not checked - only correctness (hopefully) - these are not enforced.
However, when using an editor, especially when "format on save" is enabled, the editor tries to force 4 spaces.

We should try to find a formatter/linter for yaml and json. Either way, we should fix the behaviour with one of two options:

Option 1:

  • Configure .editorconfig to use 2 spaces for yaml and json

Option 2

  • Update all yaml and json files to use 4 spaces

Compare using NamedTuples instead of Dict for the parameters

Dicts are

D = Dict(:a => 1, :b => 2)

and NamedTuples are

N = (a = 1, b = 2)

You can access named tuples via ., like N.a.

NamedTuples are like structures without name. They don't use strings and they are immutable, so they might be more efficient.

Also, it makes more sense, since they are parameters that won't be changed within the code.

Enable Codecov

Codecov integration is not complete. I believe it needs to be enabled at https://app.codecov.io by an owner.
Although I could do it, it might be interesting for someone from TNO to check it out.

Benchmark workflow does not work for PRs from forks

The Benchmark workflow is supposed to run the benchmarks and comment the resources in the PR. However, it needs permissions that can't be granted if the PR is from a fork.

The "straightforward but not simple solution" would be to change our workflow entirely and use branches in the main repo instead of forks.

@suvayu also posted the idea below:

IMO this should be a bot, and a cron job. Bot to manually trigger it in a PR, and cron that checks performance regression, say, once a week.

Originally posted by @suvayu in #50 (comment)

@suvayu, do you know how to set that up, do you know if it works without permissions?

Add "run on save" of Julia Formatter to README.dev

In VSCode (or similar) you can change your settings so that the Julia Formatter runs when you save. We should tell people to enable this in the README.dev.
This makes sure your code works in the Julia Formatter before running pre-commit, etc.

The linting is failing for the ISSUE_TEMPLATE files

Description

The linting is failing for the following files after the update in the spacing format of the YML files:

-ADDITION-REQUEST.yml
-BUG-REPORT.yml
-IMPROVEMENT-REQUEST.yml

Reproduction steps

1. Go to git bash
2. then run the command "pre-commit run -a"
3. The error message is shown in the Logs section.

Logs

prettier.................................................................Failed
- hook id: prettier
- files were modified by this hook

.github/ISSUE_TEMPLATE/ADDITION-REQUEST.yml
.github/ISSUE_TEMPLATE/BUG-REPORT.yml
.github/ISSUE_TEMPLATE/IMPROVEMENT-REQUEST.yml

OS

No response

Fix Julia file format

The Julia files don't follow the Julia Formatter definitions. One option to update them all is running the pre-commit hook and committing the changes in the files.

Add stable documentation

We need to add the stable documentation of the README, as right now there is no file linked to this, and an error will occur in the pre-commit when not fixed.

Update the issue templates

Summary

For internal use, the issue templates are too constraining.

Basic Example

Epic is an example of issue that doesn't match what we want.

Drawbacks

We don't want other people to be able to create epic issues (maybe that can be enforced?)

Reference Issues

No response

Refactor the optimise_investments function

We should have a function to create the model that directly receives the parameters, and another function that reads from the data. This will be useful for benchmarking as well.

Data structure to JuMP Model

Summary

Define the model in sets, indices, constraints, variables, etc.

  • ADD ISSUES HERE

Epics Overview
1. ESDL round trip
2. Data structure
3. Model definition
4. Output comparison

[BUG] Lint is broken because README has old badges

Description

The Badge on README is pointing to CI.yml, which does not exist anymore on main.
The fix is to remove it and add new badges for Test, Lint, and Docs.

Reproduction steps

Check the action tab.

Logs

No response

OS

No response

Associate parameters (from ESDL) with asset/flow attributes

Ensure compatibility between ESDL asset/flows attributes with the model formulation.

The strategy is to play with the map editor to understand how parameters are assigned to flows/assets in ESDL. Then, compare with formulation and see if something has to be changed either on the ESDL side or on the model side.

Compare to a model without Sets and dictionaries

Currently, the model creates dictionaries to obtain the parameter values.
For instance,

p_variable_cost   = Dict((row.a)                => row.pVarCost for row in eachrow(assets_df))

This is needed because the model is indexed by the values of the sets. For instance,

A = assets_df.a
...
@variable(model, 0 <= v_float[A,...])

Instead, we can index via the numerical index of the set:

num_assets = length(assets_df.a)
A = 1:num_assets
...
p_variable_cost = assets_df.pVarCost

However, to do this, the parameters p_demand and p_availability would need some extra attention, since they are not, technically, 1-dimensional.
If it is possible to create this version, a comparison will help decide which strategy to follow.

Add DOCUMENTER_KEY to secrets

Summary

This key is used by the TagBot and can be used by CompatHelper. It allows them to make commits, pull requests, etc., using a user's SSH key.

Basic Example

To generate use

pkg> activate --temp
pkg> add DocumenterTools
julia> using DocumenterTools
julia> DocumenterTools.genkeys(user="TulipaEnergy", repo="TulipaEnergyModel.jl")

Then follow the instructions.

Drawbacks

None.

Reference Issues

No response

Change the flow variable definition in the model

Update the formulation such that the flow variable is from asset $a$ to assets $a'$ like this: $v_{flow}(a,a',rp,k)$.
There are at least changes in the following parts:

  • Input data files
  • Parameter definitions
  • Variables definitions
  • Constraints

Map ESDL to a Julia data structure (assets data, flows data, and graph)

Go through the ESDL file and map ports to connections to create a graph in Julia.

The esdl ports link to a hash that later must be scanned to find the right connection.

Also, obtain the assets and flows data


Removed the following because this will happen before GML+CSV are created, i.e., before Julia is involved.
Possible implementation

ESDL to CSV

Convert ESDL to GML + CSV and back
(Most likely a python script on another repository.)

  • #89
  • #91
  • Handle aggregated attributes
    • e.g. variable cost can be a sum of different costs
  • #102
    • (maybe part of #91?)

See also #63 for more info/discussion.

Test cases:

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.