-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
Moving old degradation branch changes to this "cleaned up" branch
Remove "replacement" strategy test because it cannot be run using open source solvers.
this should fix failing/erroring tests
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.
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.
@@ -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 | |||
|
|||
|
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.
we should refactor constrain_degradation_variables()
so that the constraints are generated in the set days
instead of in a for loop
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.
this is addressed in 8563bb3, pending tests passing
|
||
# 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 |
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.
should we just remove this test if we can't solve it with an open-source solver?
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.
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?
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.
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 I added some notes to the changelog, can you review for completeness? |
rm documentation to check failing test
…into degradation-cleanup
Moving old degradation branch changes to this "cleaned up" branch