EnergyModelsX / EnergyModelsBase.jl

MIT License
8 stars 0 forks source link

Enhanc/Potential in links #47

Closed JulStraus closed 1 week ago

JulStraus commented 2 weeks ago

This PR focuses on increasing the flexibility of Links. It incorporates several different concepts for links to allow for

  1. differing input and output resources of links as well as specifying these directly (ae10474d7c6f83c30cad1937dd39cf084dad2eda),
  2. bidirectional links and nodes (113b8f30d1af94d55162a8540e996d22014e5bb3),
  3. emissions of links (8110d8da1a3a81d5928767376fe6959a92f2ff37),
  4. OPEX of links (with both fixed and variable OPEX created at the same time) (166fe57c3066b08371095bda59b2f2c3b344bd42),
  5. capacity of links (9027a4de46b1cb3d6c2ad09044425e53def9fb38),
  6. inclusion of new variables (f8d959a71bbb7042d1c9c3c4717e4a7349d6b22a), and
  7. investments in links (7c18c7ecdfb532723890b09e20d7ea41061e2990).

All introduced changes are only valid if the user specifies explicitly for their abstract or composite type that they should include them.

I did not update the documentation with additional information regarding the extension of Links yet. In practice, it only includes the new variables and the docstrings, but not how one can create new links.

JulStraus commented 1 week ago

Looks good, this is an important step towards more unified building of models from both nodes and links.

I have thought a bit about the naming, and I currently lean towards using the same function for creating variables and constraints for nodes and links, and dispatch to different methods. Then we could get a nice top level loop that clearly communicats that we do the same for nodes and links (or where they differ), something like:

for elements ∈ (𝒩, ℒ)
     variables_opex(m, elements, 𝒯, 𝒫, modeltype)
     variables_capex(m, elements, 𝒯, modeltype)
     variables_capacity(m, elements, 𝒯, modeltype)
     variables_nodes(m, elements, 𝒯, modeltype)
end

I suggest we follow that up in a separate PR.

Generally speaking, I like the design of looping through everything. We could also split flow variables into two methods to be certain regarding the application. In theory, that should not be breaking as we do not export the functions.

There are however two things I want to stress:

All of the changes should in my opinion be a separate PR, but with the same versions increase. That way, we do not introduce a version which we directly change again.