Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release notes

## Version 0.1.1 (2025-12-16)

* Minor updates to `README.md` and the documentation.
* Removal of data compliance of `TransmissionMode` due to the changes from [`EnergyModelsBase` v0.9.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.9.1) and the corresponding adjustment in [`EnergyModelsGeography` v0.11.3](https://github.com/EnergyModelsX/EnergyModelsGeography.jl/releases/tag/v0.11.3).

## Version 0.1.0 (2025-03-27)

Initial version of the package:
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsCompliance"
uuid = "a12c78df-351d-47be-9a81-17a33aab13b1"
authors = ["Julian Straus <Julian.Straus@sintef.no>"]
version = "0.1.0"
version = "0.1.1"

[deps]
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ While it can be used as a first step for checking new elements, thorough tests o
The usage of the package is best illustrated through the commented [`examples`](examples).
The examples showcase how the functions from `EnergyModelsCompliance` can be utilized to identify whether your newly developed element can be incorporated in `EnergyModelsBase` or `EnergyModelsGeography` models.

> [!WARNING]
> The package is not yet registered.
> It is hence necessary to first clone the package and manually add the package to the example environment through:
>
> ```julia
> ] dev ..
> ```
> [!IMPORTANT]
> The reimplementation of the `ExtensionData` in [`EnergyModelsBase` v0.9.1](https://github.com/EnergyModelsX/EnergyModelsBase.jl/releases/tag/v0.9.1) and the corresponding adjustment in [`EnergyModelsGeography` v0.11.3](https://github.com/EnergyModelsX/EnergyModelsGeography.jl/releases/tag/v0.11.3) resulted in problems for checking the function `mode_data`.
> The check is hence deactivated while we consider how to do properly assess it in `EnergyModelsBase` and `EnergyModelsGeography`.

## Cite

Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# EnergyModelsCompliance

`EnergyModelsCompliance` is a utility package for the `EnergyModelsX` framework focusing on providing the user with functionality to check whether newly developed element descriptions are complying with the framework.
These functions are included for both [`EnergyModelsBase`](https://energymodelsx.github.io/EnergyModelsBase.jl/stable/) and [`EnergyModelsGeography`](https://energymodelsx.github.io/EnergyModelsGeography.jl/stable/)
These functions are included for both [`EnergyModelsBase`](https://energymodelsx.github.io/EnergyModelsBase.jl/stable/) and [`EnergyModelsGeography`](https://energymodelsx.github.io/EnergyModelsGeography.jl/stable/).

It should be utilized for obtaining an overview of potential problems, but **not** as substitution for rigorous testing.

Expand Down
4 changes: 0 additions & 4 deletions docs/src/manual/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@
> ] add TimeStruct
> ] add EnergyModelsCompliance
> ```

!!! note
If you receive the error that `EnergyModelsCompliance` is not yet registered, you have to add the package using the GitHub repositories through `] add https://github.com/EnergyModelsX/EnergyModelsCompliance.jl`.
Once the package is registered, this is not required.
18 changes: 16 additions & 2 deletions docs/src/manual/use.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ In this case, the model would not construct.
However, if a developer provide new methods for their developed node, it is possible to ignore the warnings.
An example is given by the function [`opex_fixed`](@extref EnergyModelsBase.opex_fixed).
This function is only called in the function [`constraints_opex_fixed`](@extref EnergyModelsBase.constraints_opex_fixed).
Hence, if you do not use the function, you can ignore the warning
Hence, if you do not use the function, you can ignore the warning.

### [Test case](@id man-use-concepts-test)

Expand All @@ -37,6 +37,20 @@ It should be used for identifying whether the developed element results in a tri
The function creates a minimum working example given an instance of the element, a simple time structure, and the `warn_log` from the function [`compliance_element`](@ref).
It then tests whether the new element is utilized.

!!! note "Tested values"
The utilization is tested by the variable `:cap_use` of the connected `Node`s and a corresponding utilization value of the new `Node` or `TransmissionMode`.
It must be above 0.1 in at least one of the time periods for all connected `Node`s.
The tests for the node itself are:
- `:cap_use` of the developed `Node` is larger than 0.1 at least once.
- `:stor_level` of the developed `Storage` is larger than 0.1 at least once.
`:stor_charge_use` an/or `stor_discharge_use` must also be above 0.1 at least once depending on whether the `Storage` node has input or output.
- `:trans_in` and `:trans_out` of the developed `TransmissionMode` is larger than 0.1 at least once.

You must adjust your test case that they are working with these test values.

This is also explained in the respective docstrings [`test_case(n::Source, 𝒯::TimeStructure, warn; co2::ResourceEmit = ResourceEmit("CO₂", 1.0))`](@ref) and [`test_case(tm::TransmissionMode, 𝒯::TimeStructure, warn; co2::ResourceEmit = ResourceEmit("CO₂", 1.0))`](@ref).
.

There are however a few important caveats when using the function for `Node`s.

1. If your node includes CO₂ capture or process emissions, you **must** specify the keyword argument `co2` with your CO₂ instance.
Expand All @@ -51,7 +65,7 @@ There are however a few important caveats when using the function for `Node`s.

!!! warning "Rigorous testing"
The developed function should only be used for identifying major problems with new elements.
It does **not** provide a rigerous test for the new element.
It does **not** provide a rigorous test for the new element.
This is especially relevant for the mathematical formulation, as we cannot include automated tests for unknown mathematical formulations.
It is hence necessary that you test your element further with changes in the input representing your specific element.

Expand Down
7 changes: 6 additions & 1 deletion ext/EMGExt/compliance_ele.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ the indivdiual test functions. The called test functions are dependent on the ch
- [`compliance_con_rate`](@ref) for [`PipeMode`](@extref EnergyModelsGeography.PipeMode), and
- [`compliance_bidirectional`](@ref).

!!! warning
[`EMC.compliance_data`](@ref) is in the current stage removed due to changes to the
handling of `ExtensionData`.

!!! note "Areas"
The following function is called:

Expand All @@ -36,7 +40,8 @@ function EMC.compliance_element(tm::TransmissionMode)
warn_opex_fixed = has_opex(tm) ? EMC.compliance_opex_fixed(tm) : false
err_in, warn_in = EMC.compliance_inputs(tm)
err_out, warn_out = EMC.compliance_outputs(tm)
warn_data = EMC.compliance_data(tm)
# warn_data = EMC.compliance_data(tm)
warn_data = false

warn_loss = compliance_loss(tm)
warn_con_rate = compliance_con_rate(tm)
Expand Down
2 changes: 1 addition & 1 deletion test/test_emb_mwe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ end
Dict(power => 1, co2 => 1), # Output from the node with output ratio
# Line above: co2 is required as output for variable definition, but the
# value does not matter
[CaptureEnergyEmissions(0.9)], # Additonal data for emissions and CO₂ capture
[CaptureEnergyEmissions(0.9)], # Additional data for emissions and CO₂ capture
)
err_log, warn_log = compliance_element(node);
𝒯 = TwoLevel(1,1,SimpleTimes(10,1))
Expand Down
14 changes: 7 additions & 7 deletions test/test_emg_access_fun.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ end
disable_logging(Error), (@test EMC.compliance_outputs(mode)[1]), disable_logging(Debug)
Base.delete_method(@which outputs(mode))

# Test the data warning
msg = "The function `mode_data(tm)` is not working for the mode type `TestMode`.\n" *
"If you do not use the default functions `create_mode` and `investment_data` " *
"(when using `EnergyModelsInvestments`),\n" *
"you can ignore this warning."
@test_logs (:warn, msg) EMC.compliance_data(mode)
disable_logging(Warn), (@test EMC.compliance_data(mode)), disable_logging(Debug)
# # Test the data warning
# msg = "The function `mode_data(tm)` is not working for the mode type `TestMode`.\n" *
# "If you do not use the default functions `create_mode` and `investment_data` " *
# "(when using `EnergyModelsInvestments`),\n" *
# "you can ignore this warning."
# @test_logs (:warn, msg) EMC.compliance_data(mode)
# disable_logging(Warn), (@test EMC.compliance_data(mode)), disable_logging(Debug)

# Test the loss warnings
msg = "The function `loss(tm)` is not working for the mode type " *
Expand Down
4 changes: 2 additions & 2 deletions test/test_emg_element.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
@test all(err_log == (inputs=true, outputs=true, bidirectional=true))
@test all(
warn_log == (capacity=true, opex_var=true, opex_fixed=true,
inputs=false, outputs=false, loss=true, consumption_rate=false, data=true)
inputs=false, outputs=false, loss=true, consumption_rate=false, data=false)
)
EMB.outputs(tm::TestMode) = [ResourceCarrier("test", 0.0)]
EMG.loss(tm::TestMode) = FixedProfile(10)
Expand All @@ -30,7 +30,7 @@ end
@test all(err_log == (inputs=true, outputs=false, bidirectional=true))
@test all(
warn_log == (capacity=true, opex_var=true, opex_fixed=true,
inputs=false, outputs=false, loss=false, consumption_rate=false, data=true)
inputs=false, outputs=false, loss=false, consumption_rate=false, data=false)
)
Base.delete_method(@which outputs(mode))
Base.delete_method(@which loss(mode))
Expand Down
Loading