-
Notifications
You must be signed in to change notification settings - Fork 20
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
Prevent simultaneous charge/discharge plus other minor improvements #440
base: develop
Are you sure you want to change the base?
Conversation
This reverts commit 353085f.
started failing due to expanded NSRDB data?
This reverts commit f7b6e4d.
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.
test/Project.toml
Outdated
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.
Remove this addition of Logging since it's just for debugging
@testset "Prevent simultaneous charge and discharge" begin | ||
logger = SimpleLogger() | ||
results = nothing | ||
with_logger(logger) do | ||
model = Model(optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false, "log_to_console" => false)) | ||
results = run_reopt(model, "./scenarios/simultaneous_charge_discharge.json") | ||
end | ||
@test any(.&( | ||
results["ElectricStorage"]["storage_to_load_series_kw"] .!= 0.0, | ||
( | ||
results["ElectricUtility"]["electric_to_storage_series_kw"] .+ | ||
results["PV"]["electric_to_storage_series_kw"] | ||
) .!= 0.0 | ||
) | ||
) ≈ false | ||
@test any(.&( | ||
results["Outages"]["storage_discharge_series_kw"] .!= 0.0, | ||
results["Outages"]["pv_to_storage_series_kw"] .!= 0.0 | ||
) | ||
) ≈ false | ||
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.
I really like this test!
(p.production_factor[t, tz+ts-1] + p.unavailability[t][tz+ts-1]) * p.levelization_factor[t] * m[:dvMGRatedProduction][t, s, tz, ts] | ||
(p.production_factor[t, time_step_wrap_around(tz+ts-1, time_steps_per_hour=p.s.settings.time_steps_per_hour)] + p.unavailability[t][time_step_wrap_around(tz+ts-1, time_steps_per_hour=p.s.settings.time_steps_per_hour)]) * p.levelization_factor[t] * m[:dvMGRatedProduction][t, s, tz, ts] | ||
) |
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.
So the wraparound function is required for data from the initial problem (e.g., production factors and site load) and NOT required for the microgrid state of charge because that's only using the starting time period SOC from the full-year problem and then using the (tz,ts) tuple instead of an "absolute-value" time step that could otherwise exceed 8760. Is that right?
I spot-checked a case and the m[:dvStorageEnergy"] reconciles correctly for the long-duration case in the testset - just making sure I understand.
Changed
1/p.s.settings.time_steps_per_hour
withp.hours_per_time_step
for simplicity/consistencyadd_storage_sum_constraints
toadd_storage_sum_grid_constraints
for clarityAdded
test/Project.toml
because it is used inruntests.jl
Fixed
add_hot_thermal_storage_dispatch_constraints
andadd_cold_thermal_storage_dispatch_constraints
because this loop is already done when calling these functions and storage name is passed in as argumentb
results/wind.jl