Skip to content

Commit

Permalink
Fix on checks (#18)
Browse files Browse the repository at this point in the history
* Fixed a bug in the checks and added checks for node and data

* Added tests for checks

* Updated documentation for checks
  • Loading branch information
JulStraus authored Mar 4, 2024
1 parent 145509e commit 8df6833
Show file tree
Hide file tree
Showing 8 changed files with 980 additions and 206 deletions.
200 changes: 112 additions & 88 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,146 @@
# Release notes
=============

Unversioned
--------------------------
* Fixed a bug when running the examples from a non-cloned version of `EnergyModelsBase`.
* This was achieved through a separate Project.toml in the examples.
* Added functions `inputs`, `outputs`, and `data_nodes` for `Availability` and `outputs` for `Source` nodes.
* Allow availability to not require all resources in the the `input` and `output` field.
* Moved all files declaring structures to a separate folder for improved readability.
* Reworked the structure of the test folder.

Version 0.6.5 (2024-01-31)
--------------------------
* Updated the restrictions on the fields of individual types to be consistent.

Version 0.6.4 (2024-01-18)
--------------------------
* Minor modification to the `EmissionsData` allowing now also time dependent process emissions. This is achieved through switching to a parametric type.

Version 0.6.3 (2024-01-17)
--------------------------
* Changed name of `constraints_level` to `constraints_level_sp` when the time input is given as a `StrategicPeriod` to improve understandability.
* Add `modeltype::EnergyModel` as an argument to the methods `constraints_level_sp` (see above) and `constraints_level_aux`.

Version 0.6.2 (2024-01-17)
--------------------------
* When variables are created with the method `variables_nodes`, it will lead to an `ErrorException` when the method tries to create a variable that has already been created. This is ok, and this error should be ignored. This change specifies exactly what error should be ignored, to avoid that other types of errors are also ignored.

Version 0.6.1 (2024-01-11)
--------------------------
* Fix: add missing parenthesis in the objective function.

Version 0.6.0 (2023-12-14)
--------------------------
* Switched fields `Input` and `Output` of `Availability` nodes from `Dict{Resource, Real}` to `Array{<:Resource}`. The former is still available as a constructor, while a new constructor is introduced which requires the input only once.
* All fields in composite types are now lower case.
* Renamed `Network` to `NetworkNode`. `NetworkNode` can be considered to be replaced in a later iterations as it is not really needed.
* Added functions for extracting the fields of `Node`s, `Resource`s, and `EnergyModel`s to allow for extensions.
* Added export of functions that are frequently used in other packages.
* Moved the emissions to a `Data` type on which we can dispatch, depending on the chosen approach for capture and process emissions.
* Redesigned storage as parametric type to dispatch on the level balance. This includes as well the introduction of a new variable.
* Included potential for different durations of operational periods.
* Included representative periods. These do only affect a `Storage` node as these are the only time dependent nodes.
* Added emission prices to `OperationalModel`.

Version 0.5.2 (2023-11-06)
--------------------------
* Introduced method `create_model` that can take a `JuMP.Model` as input to simplify potential use of other type of models
* Fixed the documentation to avoid errors

Version 0.5.1 (2023-06-16)
--------------------------
* Updated the documentation based on the new format

Version 0.5.0 (2023-06-01)
--------------------------

## Version 0.6.6 (2024-03-04)

### Examples

* Fixed a bug when running the examples from a non-cloned version of `EnergyModelsBase`.
* This is achieved through a separate Project.toml in the examples folder.

### Checks

* Fixed the bug preventing the time profile checks to run.
* Included checks of the input data and for all nodes.
* Included tests for checks.

### Minor updates

* Added functions `inputs`, `outputs`, and `data_nodes` for `Availability` and `outputs` for `Source` nodes.
* Allow availability to not require all resources in the the `input` and `output` field.
* Moved all files declaring structures to a separate folder for improved readability.
* Reworked the structure of the test folder.

## Version 0.6.5 (2024-01-31)

* Updated the restrictions on the fields of individual types to be consistent.

## Version 0.6.4 (2024-01-18)

* Minor modification to the `EmissionsData` allowing now also time dependent process emissions.
* This is achieved through switching to a parametric type.

## Version 0.6.3 (2024-01-17)

* Changed name of `constraints_level` to `constraints_level_sp` when the time input is given as a `StrategicPeriod` to improve understandability.
* Add `modeltype::EnergyModel` as an argument to the methods `constraints_level_sp` (see above) and `constraints_level_aux`.

## Version 0.6.2 (2024-01-17)

* When variables are created with the method `variables_nodes`, it will lead to an `ErrorException` when the method tries to create a variable that has already been created. This is ok, and this error should be ignored. This change specifies exactly what error should be ignored, to avoid that other types of errors are also ignored.

## Version 0.6.1 (2024-01-11)

* Fix: add missing parenthesis in the objective function.

## Version 0.6.0 (2023-12-14)

* Switched fields `Input` and `Output` of `Availability` nodes from `Dict{Resource, Real}` to `Array{<:Resource}`. The former is still available as a constructor, while a new constructor is introduced which requires the input only once.
* All fields in composite types are now lower case.
* Renamed `Network` to `NetworkNode`. `NetworkNode` can be considered to be replaced in a later iterations as it is not really needed.
* Added functions for extracting the fields of `Node`s, `Resource`s, and `EnergyModel`s to allow for extensions.
* Added export of functions that are frequently used in other packages.
* Moved the emissions to a `Data` type on which we can dispatch, depending on the chosen approach for capture and process emissions.
* Redesigned storage as parametric type to dispatch on the level balance. This includes as well the introduction of a new variable.
* Included potential for different durations of operational periods.
* Included representative periods. These do only affect a `Storage` node as these are the only time dependent nodes.
* Added emission prices to `OperationalModel`.

## Version 0.5.2 (2023-11-06)

* Introduced method `create_model` that can take a `JuMP.Model` as input to simplify potential use of other type of models
* Fixed the documentation to avoid errors

## Version 0.5.1 (2023-06-16)

* Updated the documentation based on the new format

## Version 0.5.0 (2023-06-01)

### Switch to TimeStruct.jl
* Switched the time structure representation to [TimeStruct.jl](https://sintefore.github.io/TimeStruct.jl/)
* TimeStruct.jl is implemented with only the basis features that were available in TimesStructures.jl. This implies that neither operational nor strategic uncertainty is included in the model

Version 0.4.0 (2023-05-30)
--------------------------
* Switched the time structure representation to [TimeStruct.jl](https://sintefore.github.io/TimeStruct.jl/)
* TimeStruct.jl is implemented with only the basis features that were available in TimesStructures.jl. This implies that neither operational nor strategic uncertainty is included in the model

## Version 0.4.0 (2023-05-30)

### Additional input data changes
* Changed the structure in which the extra field `Data` is included in the nodes
* It is changed from `Dict{String, Data}` to `Array{Data}`

Version 0.3.3 (2023-04-26)
--------------------------
* Changed where storage variables are declared to avoid potential method ambiguity through new storage variables when using `EnergyModelsInvestments`
* Changed the structure in which the extra field `Data` is included in the nodes
* It is changed from `Dict{String, Data}` to `Array{Data}`

## Version 0.3.3 (2023-04-26)

* Changed where storage variables are declared to avoid potential method ambiguity through new storage variables when using `EnergyModelsInvestments`

## Version 0.3.2 (2023-02-07)

* Generalized the function names for identifying and sorting the individual introduced types.

## Version 0.3.1 (2023-02-03)

Version 0.3.2 (2023-02-07)
--------------------------
* Generalized the function names for identifying and sorting the individual introduced types.
* Take the examples out to the directory `examples`

Version 0.3.1 (2023-02-03)
--------------------------
* Take the examples out to the directory `examples`
## Version 0.3.0 (2023-02-02)

Version 0.3.0 (2023-02-02)
--------------------------
### Fields of reference types and new types

* Removal of all process emissions and CO₂ capture from reference types to avoid having to include them as well
in all subtypes defined later to keep the fallback option. This requires in the future to ***remove*** CO₂ as output when using CO₂ capture as it was previously the case. The original types are retained so that they can still be used
in all subtypes defined later to keep the fallback option. This requires in the future to***remove*** CO₂ as output when using CO₂ capture as it was previously the case. The original types are retained so that they can still be used
* Introduction of a type `RefStorageEmissions` to account for a storage unit that can be used for storing `ResourceEmit`

### Introduction of functions for constraints generation

* Substitution of variable and fixed OPEX calculations as well as capacity and flow constraints through functions which utilize dispatching on `node` types

### Redefinition of introduction of global data

* Removal of the type `AbstractGlobalData` and all subtypes and substitution through `EnergyModel` and the corresponding subtypes
* Addition of the field `CO2_instance` in the type `OperationalModel`
* Addition of `ModelType` to the function `create_node` to be able to use different ids for the CO₂ resource

### Additional changes

* Redefining `CO2Int` in fields of type `Resource` to `CO2_int` to be consistent with the other types
* Minor changes in constraint description that do not break previous code
* Changed the input to the function `variables_node` to simplify the generation of variables for a specific `node` type

Version 0.2.7 (2022-12-12)
--------------------------
## Version 0.2.7 (2022-12-12)

### Internal release

* Renamed packages to use common prefix
* Updated README

Version 0.2.4 (2022-09-07)
--------------------------
## Version 0.2.4 (2022-09-07)

### Feature update and changes in export

* Inclusion of time dependent profiles for surplus and deficit of sinks
* Inclusion of parameter checks for surplus and deficit of sinks
* Export of all reference nodes for easier identification of the nodes
* Changes in the test structure with improved testing of variables
* Changes in doc strings for individual functions/types

Version 0.2.3 (2021-09-07)
--------------------------
## Version 0.2.3 (2021-09-07)

### Changes in naming

* Major changes in both variable and parameter naming, check the commit message for an overview

Version 0.2.2 (2021-08-20)
--------------------------
## Version 0.2.2 (2021-08-20)

### Feature updates

* Change of Availability to abstract type and introduction of GenAvailability
as composite type to be able to use multiple dispatch on the availability nodes
* Inclusion of the entry fixed OPEX to the node composite types
Expand All @@ -129,24 +150,27 @@ Version 0.2.2 (2021-08-20)
model data

### Changes in naming

* Introduce the optimization variables stor_level and stor_max for storages, and
use these instead of cap_usage and cap_max for the constraints on Storage.
* Use the new variable cap_storage in Storage nodes for the installed storage capacity.

Version 0.2.1 (2021-04-22)
--------------------------
## Version 0.2.1 (2021-04-22)

### Feature updates

* Reduction in variables through introduction of input/output (#2)
dictionaries for all nodes that only include necessary components
* Improvement related to emissions to avoid wrong accounting when other emission carriers than CO₂ are present (#2)
* Link resources generated automatically from input (#2)

### Changes in naming

* Removal of prefix "create" before "constraints" and "variables"
* "create_module" switched to "create_node"

Version 0.2.0 (2021-04-19)
--------------------------
## Version 0.2.0 (2021-04-19)

* Inclusion of abstract type and structures for both resources and (#1)
differentiation in nodes
* Development of new functions for the given data structures to obtain (#1)
Expand All @@ -161,6 +185,6 @@ next (#1)
* Providing a test case that can be used for playing around with the simple
system (#1)

Version 0.1.0 (2021-03-19)
--------------------------
## Version 0.1.0 (2021-03-19)

* Initial (skeleton) version
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsBase"
uuid = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
authors = ["Lars Hellemo <[email protected]>, Julian Straus <[email protected]>"]
version = "0.6.5"
version = "0.6.6"

[deps]
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Expand Down
6 changes: 6 additions & 0 deletions docs/src/how-to/create-new-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ While step 1 is always required, it is possible to omit step 2 if no new variabl
It is also possible to create unregistered variables for each instance of the node.
This is however only advised if you do not need to access the value of the variables after the optimization.
!!! warning
When creating a new node type, you are free to change the field names to whatever name you desire. However, if you change the field names, there are several things to consider:
1. Certain functions are used within the core structure of the code for accessing the fields. These functions can be found in the *[Public Interface](@ref functions_fields_node)*.
2. The function [`EMB.check_node`](@ref) conducts some checks on the individual node data. If the fields and structure from the reference nodes are not present, you also have to create a new function for your node.
## Additional tips for creating new nodes
1. If the `NewNodeType` should be able to include investments, it is necessary to i) call the function [`constraints_capacity_installed`](@ref).
Expand Down
Loading

2 comments on commit 8df6833

@JulStraus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102224

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.6 -m "<description of version>" 8df6833177d0f4c8b32c1982ff4edfd7d01c12db
git push origin v0.6.6

Please sign in to comment.