mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-06 08:18:51 -06:00
Properly validate solutions with price-sensitive loads
This commit is contained in:
@@ -3,11 +3,13 @@
|
|||||||
## [0.2.0] - [Unreleased]
|
## [0.2.0] - [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Sub-hourly unit commitment
|
- Sub-hourly unit commitment
|
||||||
- Added function `UnitCommitment.write(filename, solution)`
|
- Added function `UnitCommitment.write(filename, solution)`
|
||||||
- Added mathematical formulation to the documentation
|
- Added mathematical formulation to the documentation
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Renamed "Time (h)" parameter to "Time horizon (h)"
|
- Renamed "Time (h)" parameter to "Time horizon (h)"
|
||||||
- The function `UnitCommitment.build_model` now returns a plain JuMP model. The
|
- The function `UnitCommitment.build_model` now returns a plain JuMP model. The
|
||||||
struct `UnitCommitmentModel` has been completely removed. Accessing model elements can now be accomplished as follows:
|
struct `UnitCommitmentModel` has been completely removed. Accessing model elements can now be accomplished as follows:
|
||||||
@@ -21,6 +23,10 @@
|
|||||||
- All function that do not appear in the documentation have been renamed to `_something`.
|
- All function that do not appear in the documentation have been renamed to `_something`.
|
||||||
These functions are not part of the public API and may change without notice.
|
These functions are not part of the public API and may change without notice.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Properly validate solutions with price-sensitive loads.
|
||||||
|
|
||||||
## [0.1.1] - 2020-11-16
|
## [0.1.1] - 2020-11-16
|
||||||
|
|
||||||
* Fixes to MATLAB and PGLIB-UC instances
|
* Fixes to MATLAB and PGLIB-UC instances
|
||||||
|
|||||||
@@ -307,26 +307,44 @@ function _validate_reserve_and_demand(instance, solution, tol=0.01)
|
|||||||
for t in 1:instance.time
|
for t in 1:instance.time
|
||||||
load_curtail = 0
|
load_curtail = 0
|
||||||
fixed_load = sum(b.load[t] for b in instance.buses)
|
fixed_load = sum(b.load[t] for b in instance.buses)
|
||||||
production = sum(solution["Production (MW)"][g.name][t]
|
ps_load = sum(
|
||||||
for g in instance.units)
|
solution["Price-sensitive loads (MW)"][ps.name][t]
|
||||||
|
for ps in instance.price_sensitive_loads
|
||||||
|
)
|
||||||
|
production = sum(
|
||||||
|
solution["Production (MW)"][g.name][t]
|
||||||
|
for g in instance.units
|
||||||
|
)
|
||||||
if "Load curtail (MW)" in keys(solution)
|
if "Load curtail (MW)" in keys(solution)
|
||||||
load_curtail = sum(solution["Load curtail (MW)"][b.name][t]
|
load_curtail = sum(
|
||||||
for b in instance.buses)
|
solution["Load curtail (MW)"][b.name][t]
|
||||||
|
for b in instance.buses
|
||||||
|
)
|
||||||
end
|
end
|
||||||
balance = fixed_load - load_curtail - production
|
balance = fixed_load - load_curtail - production + ps_load
|
||||||
|
|
||||||
# Verify that production equals demand
|
# Verify that production equals demand
|
||||||
if abs(balance) > tol
|
if abs(balance) > tol
|
||||||
@error @sprintf("Non-zero power balance at time %d (%.2f - %.2f - %.2f != 0)",
|
@error @sprintf(
|
||||||
t, fixed_load, load_curtail, production)
|
"Non-zero power balance at time %d (%.2f + %.2f - %.2f - %.2f != 0)",
|
||||||
|
t,
|
||||||
|
fixed_load,
|
||||||
|
ps_load,
|
||||||
|
load_curtail,
|
||||||
|
production,
|
||||||
|
)
|
||||||
err_count += 1
|
err_count += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
# Verify spinning reserves
|
# Verify spinning reserves
|
||||||
reserve = sum(solution["Reserve (MW)"][g.name][t] for g in instance.units)
|
reserve = sum(solution["Reserve (MW)"][g.name][t] for g in instance.units)
|
||||||
if reserve < instance.reserves.spinning[t] - tol
|
if reserve < instance.reserves.spinning[t] - tol
|
||||||
@error @sprintf("Insufficient spinning reserves at time %d (%.2f should be %.2f)",
|
@error @sprintf(
|
||||||
t, reserve, instance.reserves.spinning[t])
|
"Insufficient spinning reserves at time %d (%.2f should be %.2f)",
|
||||||
|
t,
|
||||||
|
reserve,
|
||||||
|
instance.reserves.spinning[t],
|
||||||
|
)
|
||||||
err_count += 1
|
err_count += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user