-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Included abstract supertype for NonDisRES * Updated version number
- Loading branch information
Showing
10 changed files
with
123 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "EnergyModelsRenewableProducers" | ||
uuid = "b007c34f-ba52-4995-ba37-fffe79fbde35" | ||
authors = ["Sigmund Eggen Holm <[email protected]>, Julian Straus <[email protected]>"] | ||
version = "0.6.1" | ||
version = "0.6.2" | ||
|
||
[deps] | ||
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,97 @@ | ||
# Test that the fields of a NonDisRES are correctly checked | ||
# - check_node(n::NonDisRES, π―, modeltype::EnergyModel) | ||
@testset "Checks" begin | ||
|
||
# Test set for the non dispatchable renewable energy source type | ||
@testset "Test NonDisRES" begin | ||
# Set the global to true to suppress the error message | ||
EMB.TEST_ENV = true | ||
|
||
# Test that the fields of a NonDisRES are correctly checked | ||
# - check_node(n::NonDisRES, π―, modeltype::EnergyModel) | ||
@testset "Checks" begin | ||
# Test that a wrong capacity is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(-2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Set the global to true to suppress the error message | ||
EMB.TEST_ENV = true | ||
# Test that a wrong fixed OPEX is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(-10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Test that a wrong capacity is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(-2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
# Test that a wrong output dictionary is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => -1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Test that a wrong fixed OPEX is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(-10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
# Test that a wrong profile is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([-0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 1.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Test that a wrong output dictionary is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => -1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Test that a wrong profile is caught by the checks. | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([-0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(2), | ||
OperationalProfile([0.9, 0.4, 1.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@test_throws AssertionError EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Set the global again to false | ||
EMB.TEST_ENV = false | ||
end | ||
# Set the global again to false | ||
EMB.TEST_ENV = false | ||
end | ||
|
||
@testset ":profile and :curtailment" begin | ||
# Creation of the initial problem with the NonDisRES node | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(25), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
@testset ":profile and :curtailment" begin | ||
# Creation of the initial problem with the NonDisRES node | ||
wind = EMRP.NonDisRES( | ||
"wind", | ||
FixedProfile(25), | ||
OperationalProfile([0.9, 0.4, 0.6, 0.8]), | ||
FixedProfile(10), | ||
FixedProfile(10), | ||
Dict(Power => 1), | ||
) | ||
case, modeltype = small_graph(source=wind, ops=SimpleTimes(4,1)) | ||
|
||
# Run the model | ||
m = EMB.run_model(case, modeltype, OPTIMIZER) | ||
# Run the model | ||
m = EMB.run_model(case, modeltype, OPTIMIZER) | ||
|
||
# Extraction of the time structure | ||
π― = case[:T] | ||
# Extraction of the time structure | ||
π― = case[:T] | ||
|
||
# Run of the general tests | ||
general_tests(m) | ||
# Run of the general tests | ||
general_tests(m) | ||
|
||
# Test that cap_use is correctly with respect to the profile. | ||
# - EMB.constraints_capacity(m, n::NonDisRES, π―::TimeStructure, modeltype::EnergyModel) | ||
@test sum( | ||
value.(m[:cap_use][wind, t]) + value.(m[:curtailment][wind, t]) β | ||
EMRP.profile(wind, t) * value.(m[:cap_inst][wind, t]) for t β π―, atol β TEST_ATOL | ||
) == length(π―) | ||
end | ||
# Test that cap_use is correctly with respect to the profile. | ||
# - EMB.constraints_capacity(m, n::NonDisRES, π―::TimeStructure, modeltype::EnergyModel) | ||
@test sum( | ||
value.(m[:cap_use][wind, t]) + value.(m[:curtailment][wind, t]) β | ||
EMRP.profile(wind, t) * value.(m[:cap_inst][wind, t]) for t β π―, atol β TEST_ATOL | ||
) == length(π―) | ||
end |
0fd950a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
0fd950a
There was a problem hiding this comment.
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/117402
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.
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: