Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

degradation model cleanup #443

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

degradation model cleanup #443

wants to merge 18 commits into from

Conversation

rathod-b
Copy link
Collaborator

Moving old degradation branch changes to this "cleaned up" branch

Moving old degradation branch changes to this "cleaned up" branch
rathod-b and others added 5 commits September 20, 2024 14:39
Remove "replacement" strategy test because it cannot be run using open source solvers.
this should fix failing/erroring tests
Copy link
Collaborator

@zolanaj zolanaj left a comment

Choose a reason for hiding this comment

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

Thanks for re-initiating @rathod-b!

I checked this against the conversation threads in the previous repo and everything checks out. I caught a couple things that I tried to implement directly. Assuming I didn't break anything in the tests, the changelog needs to be updated and then this is ready to merge.

src/results/electric_storage.jl Show resolved Hide resolved
@@ -7,6 +7,7 @@ function add_degradation_variables(m, p)
@variable(m, Eplus_sum[days] >= 0)
@variable(m, Eminus_sum[days] >= 0)
@variable(m, EFC[days] >= 0)
@variable(m, SOH[days])
end


Copy link
Collaborator

Choose a reason for hiding this comment

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

we should refactor constrain_degradation_variables() so that the constraints are generated in the set days instead of in a for loop

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is addressed in 8563bb3, pending tests passing

Comment on lines 1094 to -1064

# test the replacement strategy
d["ElectricStorage"]["degradation"] = Dict("maintenance_strategy" => "replacement")
m = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false))
set_optimizer_attribute(m, "mip_rel_gap", 0.01)
r = run_reopt(m, d)
@test occursin("are not supported by the solver", string(r["Messages"]["errors"])) || occursin("Unable to use IndicatorToMILPBridge", string(r["Messages"]["errors"]))
# test the replacement strategy ## Cannot test with open source solvers.
# d["ElectricStorage"]["degradation"] = Dict("maintenance_strategy" => "replacement")
# m = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false))
# set_optimizer_attribute(m, "mip_rel_gap", 0.01)
# r = run_reopt(m, d)
# @test occursin("not supported by the solver", string(r["Messages"]["errors"]))
# #optimal SOH at end of horizon is 80\% to prevent any replacement
# @test sum(value.(m[:bmth_BkWh])) ≈ 0 atol=0.1
# @test sum(value.(m[:dvSOHChangeTimesEnergy])) ≈ 68.48 atol=0.01
# # @test r["ElectricStorage"]["maintenance_cost"] ≈ 2972.66 atol=0.01
# # the maintenance_cost comes out to 3004.39 on Actions, so we test the LCC since it should match
# @test r["Financial"]["lcc"] ≈ 1.240096e7 rtol=0.01
# @test last(value.(m[:SOH])) ≈ 66.633 rtol=0.01
# @test r["ElectricStorage"]["size_kwh"] ≈ 83.29 rtol=0.01
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we just remove this test if we can't solve it with an open-source solver?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought it would be helpful to keep it here for documentation? And in case someone wants to test these locally using a different solver, they can uncomment and test?

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense to me. Maybe we add a note to that effect at the start of the commented test, that if you're modifying degradation this should be tested?

@rathod-b rathod-b marked this pull request as ready for review October 7, 2024 19:42
@zolanaj
Copy link
Collaborator

zolanaj commented Oct 7, 2024

@rathod-b I added some notes to the changelog, can you review for completeness?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants