Datasets:
EridanusQ commited on
Commit ·
43c68a3
1
Parent(s): 86bf940
init
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .JuliaFormatter.toml +5 -0
- .gitattributes +17 -0
- .github/ISSUE_TEMPLATE/bug_report.md +25 -0
- .github/ISSUE_TEMPLATE/config.yml +8 -0
- .github/workflows/lint.yml +28 -0
- .github/workflows/tagbot.yml +11 -0
- .github/workflows/test.yml +35 -0
- .gitignore +49 -0
- .zenodo.json +27 -0
- CHANGELOG.md +84 -0
- LICENSE.md +25 -0
- Makefile +11 -0
- Project.toml +46 -0
- README.md +330 -0
- benchmark/Project.toml +6 -0
- benchmark/run.jl +210 -0
- benchmark/scripts/compare.py +86 -0
- benchmark/scripts/download_matpower_instances.py +191 -0
- benchmark/scripts/table.py +232 -0
- create_scuc_mps_files.jl +46 -0
- docs/Project.toml +10 -0
- docs/example/out.json +1158 -0
- docs/example/s1.json +495 -0
- docs/example/s2.json +495 -0
- docs/make.jl +43 -0
- docs/src/api.md +63 -0
- docs/src/assets/cost_curve.png +3 -0
- docs/src/assets/custom.css +36 -0
- docs/src/guides/format.md +380 -0
- docs/src/guides/instances.md +289 -0
- docs/src/guides/model.md +78 -0
- docs/src/guides/problem.md +618 -0
- docs/src/index.md +63 -0
- docs/src/tutorials/customizing.jl +125 -0
- docs/src/tutorials/decomposition.md +105 -0
- docs/src/tutorials/lmp.jl +57 -0
- docs/src/tutorials/market.jl +183 -0
- docs/src/tutorials/usage.jl +212 -0
- docs/src/tutorials/utils.jl +78 -0
- generate_dataset.jl +296 -0
- pmax-preprocessing.jl +7 -0
- src/UnitCommitment.jl +93 -0
- src/import/egret.jl +55 -0
- src/instance/migrate.jl +50 -0
- src/instance/modify.jl +242 -0
- src/instance/read.jl +580 -0
- src/instance/structs.jl +155 -0
- src/instance/subhourly.jl +271 -0
- src/lmp/aelmp.jl +212 -0
- src/lmp/conventional.jl +92 -0
.JuliaFormatter.toml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
always_for_in = true
|
| 2 |
+
always_use_return = true
|
| 3 |
+
margin = 80
|
| 4 |
+
remove_extra_newlines = true
|
| 5 |
+
short_to_long_function_def = true
|
.gitattributes
CHANGED
|
@@ -58,3 +58,20 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
case2383wp/hourly_withline/case2383wp_2017-01-02_h_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
case2383wp/hourly_noline/case2383wp_2017-01-02_h_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
case2383wp/subhourly_withline/case2383wp_2017-01-03_s_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
case2383wp/hourly_withline/case2383wp_2017-01-03_h_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
case2383wp/hourly_noline/case2383wp_2017-01-04_h_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
case2383wp/subhourly_noline/case2383wp_2017-01-03_s_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
case2383wp/subhourly_noline/case2383wp_2017-01-04_s_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
case2383wp/subhourly_noline/case2383wp_2017-01-01_s_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
case2383wp/subhourly_withline/case2383wp_2017-01-04_s_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
case2383wp/hourly_noline/case2383wp_2017-01-03_h_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
case2383wp/subhourly_noline/case2383wp_2017-01-02_s_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
case2383wp/hourly_noline/case2383wp_2017-01-01_h_noline.mps filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
case2383wp/hourly_withline/case2383wp_2017-01-04_h_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
case2383wp/hourly_withline/case2383wp_2017-01-01_h_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
case2383wp/subhourly_withline/case2383wp_2017-01-01_s_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
case2383wp/subhourly_withline/case2383wp_2017-01-02_s_withline.mps filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
*.mps filter=lfs diff=lfs merge=lfs -text
|
.github/ISSUE_TEMPLATE/bug_report.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: Bug report
|
| 3 |
+
about: Something is broken in the package
|
| 4 |
+
title: ''
|
| 5 |
+
labels: ''
|
| 6 |
+
assignees: ''
|
| 7 |
+
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
## Description
|
| 11 |
+
|
| 12 |
+
A clear and concise description of what the bug is.
|
| 13 |
+
|
| 14 |
+
## Steps to Reproduce
|
| 15 |
+
|
| 16 |
+
Please describe how can the developers reproduce the problem in their own computers. Code snippets and sample input files are specially helpful. For example:
|
| 17 |
+
|
| 18 |
+
1. Install the package
|
| 19 |
+
2. Run the code below with the attached input file...
|
| 20 |
+
3. The following error appears...
|
| 21 |
+
|
| 22 |
+
## System Information
|
| 23 |
+
- Operating System: [e.g. Ubuntu 20.04]
|
| 24 |
+
- Julia version: [e.g. 1.4]
|
| 25 |
+
- Package version: [e.g. 0.0.1]
|
.github/ISSUE_TEMPLATE/config.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: false
|
| 2 |
+
contact_links:
|
| 3 |
+
- name: Feature Request
|
| 4 |
+
url: https://github.com/ANL-CEEESA/UnitCommitment.jl/discussions/categories/feature-requests
|
| 5 |
+
about: Submit ideas for new features and small enhancements
|
| 6 |
+
- name: Help & FAQ
|
| 7 |
+
url: https://github.com/ANL-CEEESA/UnitCommitment.jl/discussions/categories/help-faq
|
| 8 |
+
about: Ask questions about the package and get help from the community
|
.github/workflows/lint.yml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: lint
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
pull_request:
|
| 5 |
+
jobs:
|
| 6 |
+
build:
|
| 7 |
+
runs-on: ubuntu-latest
|
| 8 |
+
steps:
|
| 9 |
+
- uses: julia-actions/setup-julia@latest
|
| 10 |
+
with:
|
| 11 |
+
version: '1'
|
| 12 |
+
- uses: actions/checkout@v1
|
| 13 |
+
- name: Format check
|
| 14 |
+
shell: julia --color=yes {0}
|
| 15 |
+
run: |
|
| 16 |
+
using Pkg
|
| 17 |
+
Pkg.add(PackageSpec(name="JuliaFormatter", version="0.14.4"))
|
| 18 |
+
using JuliaFormatter
|
| 19 |
+
format("src", verbose=true)
|
| 20 |
+
format("test", verbose=true)
|
| 21 |
+
format("benchmark", verbose=true)
|
| 22 |
+
out = String(read(Cmd(`git diff`)))
|
| 23 |
+
if isempty(out)
|
| 24 |
+
exit(0)
|
| 25 |
+
end
|
| 26 |
+
@error "Some files have not been formatted !!!"
|
| 27 |
+
write(stdout, out)
|
| 28 |
+
exit(1)
|
.github/workflows/tagbot.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: TagBot
|
| 2 |
+
on:
|
| 3 |
+
schedule:
|
| 4 |
+
- cron: 0 * * * *
|
| 5 |
+
jobs:
|
| 6 |
+
TagBot:
|
| 7 |
+
runs-on: ubuntu-latest
|
| 8 |
+
steps:
|
| 9 |
+
- uses: JuliaRegistries/TagBot@v1
|
| 10 |
+
with:
|
| 11 |
+
token: ${{ secrets.GITHUB_TOKEN }}
|
.github/workflows/test.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Build & Test
|
| 2 |
+
on:
|
| 3 |
+
push:
|
| 4 |
+
pull_request:
|
| 5 |
+
schedule:
|
| 6 |
+
- cron: '45 10 * * *'
|
| 7 |
+
jobs:
|
| 8 |
+
test:
|
| 9 |
+
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
|
| 10 |
+
runs-on: ${{ matrix.os }}
|
| 11 |
+
strategy:
|
| 12 |
+
matrix:
|
| 13 |
+
version: ['1.6', '1.7', '1.8', '1.9']
|
| 14 |
+
os:
|
| 15 |
+
- ubuntu-latest
|
| 16 |
+
arch:
|
| 17 |
+
- x64
|
| 18 |
+
steps:
|
| 19 |
+
- uses: actions/checkout@v2
|
| 20 |
+
- uses: julia-actions/setup-julia@v1
|
| 21 |
+
with:
|
| 22 |
+
version: ${{ matrix.version }}
|
| 23 |
+
arch: ${{ matrix.arch }}
|
| 24 |
+
- name: Run tests
|
| 25 |
+
shell: julia --color=yes --project=test {0}
|
| 26 |
+
run: |
|
| 27 |
+
using Pkg
|
| 28 |
+
Pkg.develop(path=".")
|
| 29 |
+
Pkg.update()
|
| 30 |
+
using UnitCommitmentT
|
| 31 |
+
try
|
| 32 |
+
runtests()
|
| 33 |
+
catch
|
| 34 |
+
exit(1)
|
| 35 |
+
end
|
.gitignore
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.bak
|
| 2 |
+
*.gz
|
| 3 |
+
*.ipynb
|
| 4 |
+
*.lastrun
|
| 5 |
+
*.mps
|
| 6 |
+
*.so
|
| 7 |
+
*/Manifest.toml
|
| 8 |
+
.AppleDB
|
| 9 |
+
.AppleDesktop
|
| 10 |
+
.AppleDouble
|
| 11 |
+
.DS_Store
|
| 12 |
+
.DocumentRevisions-V100
|
| 13 |
+
.LSOverride
|
| 14 |
+
.Spotlight-V100
|
| 15 |
+
.TemporaryItems
|
| 16 |
+
.Trashes
|
| 17 |
+
.VolumeIcon.icns
|
| 18 |
+
._*
|
| 19 |
+
.apdisk
|
| 20 |
+
.com.apple.timemachine.donotpresent
|
| 21 |
+
.fseventsd
|
| 22 |
+
.ipy*
|
| 23 |
+
.vscode
|
| 24 |
+
Icon
|
| 25 |
+
Manifest.toml
|
| 26 |
+
Network Trash Folder
|
| 27 |
+
TODO.md
|
| 28 |
+
Temporary Items
|
| 29 |
+
benchmark/results
|
| 30 |
+
benchmark/runs
|
| 31 |
+
benchmark/tables
|
| 32 |
+
benchmark/tmp.json
|
| 33 |
+
build
|
| 34 |
+
.julia_depot/
|
| 35 |
+
docs/_build
|
| 36 |
+
instances/**/*.json
|
| 37 |
+
instances/_source
|
| 38 |
+
local
|
| 39 |
+
notebooks
|
| 40 |
+
docs/src/tutorials/usage.md
|
| 41 |
+
docs/src/tutorials/customizing.md
|
| 42 |
+
docs/src/tutorials/market.md
|
| 43 |
+
docs/src/tutorials/lmp.md
|
| 44 |
+
*-off.md
|
| 45 |
+
dev/instance/GD_SCUC_data.json
|
| 46 |
+
dev/instance/GD_SCUC_Default.json
|
| 47 |
+
dev/instance/GD_SCUC_2025-01-03.json
|
| 48 |
+
dev/instance/GD_SCUC_2025-01-05.json
|
| 49 |
+
dev/instance/GD_SCUC_2025-01-11.json
|
.zenodo.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"creators": [
|
| 3 |
+
{
|
| 4 |
+
"orcid": "0000-0002-5022-9802",
|
| 5 |
+
"affiliation": "Argonne National Laboratory",
|
| 6 |
+
"name": "Santos Xavier, Alinson"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"affiliation": "University of Florida",
|
| 10 |
+
"name": "Kazachkov, Aleksandr M."
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"affiliation": "Technische Universität Berlin",
|
| 14 |
+
"name": "Yurdakul, Ogün"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"affiliation": "Purdue University",
|
| 18 |
+
"name": "He, Jun"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"affiliation": "Argonne National Laboratory",
|
| 22 |
+
"name": "Qiu, Feng"
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"title": "UnitCommitment.jl: A Julia/JuMP Optimization Package for Security-Constrained Unit Commitment",
|
| 26 |
+
"description": "<b>UnitCommitment.jl</b> (UC.jl) is an optimization package for the Security-Constrained Unit Commitment Problem (SCUC), a fundamental optimization problem in power systems used, for example, to clear the day-ahead electricity markets. The package provides benchmark instances for the problem and Julia/JuMP implementations of state-of-the-art mixed-integer programming formulations."
|
| 27 |
+
}
|
CHANGELOG.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file.
|
| 4 |
+
|
| 5 |
+
- The format is based on [Keep a Changelog][changelog].
|
| 6 |
+
- This project adheres to [Semantic Versioning][semver].
|
| 7 |
+
- For versions before 1.0, we follow the [Pkg.jl convention][pkjjl]
|
| 8 |
+
that `0.a.b` is compatible with `0.a.c`.
|
| 9 |
+
|
| 10 |
+
[changelog]: https://keepachangelog.com/en/1.0.0/
|
| 11 |
+
[semver]: https://semver.org/spec/v2.0.0.html
|
| 12 |
+
[pkjjl]: https://pkgdocs.julialang.org/v1/compatibility/#compat-pre-1.0
|
| 13 |
+
|
| 14 |
+
## [0.4.0] - 2024-05-21
|
| 15 |
+
### Added
|
| 16 |
+
- Add support for two-stage stochastic problems
|
| 17 |
+
- Add support for day-ahead and real-time market clearing simulation
|
| 18 |
+
- Add time decomposition methods
|
| 19 |
+
- Add scenario decomposition methods (progressive hedging)
|
| 20 |
+
- Add support for energy storage units
|
| 21 |
+
- Rewrite documentation with runnable examples
|
| 22 |
+
|
| 23 |
+
## [0.3.0] - 2022-07-18
|
| 24 |
+
### Added
|
| 25 |
+
- Add support for multiple reserve products and zonal reserves.
|
| 26 |
+
- Add flexiramp reserve products, following WanHob2016's formulation (@oyurdakul, #21).
|
| 27 |
+
- Add 365 variations for each MATPOWER instance, corresponding to each day of the year.
|
| 28 |
+
|
| 29 |
+
### Changed
|
| 30 |
+
- To support multiple/zonal reserves, the input data format has been modified as follows:
|
| 31 |
+
- In `Generators`, replace `Provides spinning reserves?` by `Reserve eligibility`
|
| 32 |
+
- In `Parameters`, remove `Reserve shortfall penalty`
|
| 33 |
+
- Revise `Reserves` section
|
| 34 |
+
- To allow new versions of UnitCommitment.jl to read old instance files, a new required field `Version` has been added to the `Parameters` section. To load v0.2 files in v0.3, please add `{"Parameters":{"Version":"0.2"}}` to the file.
|
| 35 |
+
- Benchmark test cases are now downloaded on-the-fly as needed, instead of being stored in our GitHub repository. Test cases can also be directly downloaded from: https://axavier.org/UnitCommitment.jl/
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
## [0.2.2] - 2021-07-21
|
| 39 |
+
### Fixed
|
| 40 |
+
- Fix small bug in validation scripts related to startup costs
|
| 41 |
+
- Fix duplicated startup constraints (@mtanneau, #12)
|
| 42 |
+
|
| 43 |
+
## [0.2.1] - 2021-06-02
|
| 44 |
+
### Added
|
| 45 |
+
- Add multiple ramping formulations (ArrCon2000, MorLatRam2013, DamKucRajAta2016, PanGua2016)
|
| 46 |
+
- Add multiple piecewise-linear costs formulations (Garver1962, CarArr2006, KnuOstWat2018)
|
| 47 |
+
- Allow benchmark scripts to compare multiple formulations
|
| 48 |
+
|
| 49 |
+
## [0.2.0] - 2021-05-28
|
| 50 |
+
### Added
|
| 51 |
+
- Add sub-hourly unit commitment.
|
| 52 |
+
- Add `UnitCommitment.write(filename, solution)`.
|
| 53 |
+
- Add current mathematical formulation to the documentation.
|
| 54 |
+
|
| 55 |
+
### Changed
|
| 56 |
+
- Rename "Time (h)" parameter to "Time horizon (h)".
|
| 57 |
+
- Rename `UnitCommitment.get_solution` to `UnitCommitment.solution`, for better
|
| 58 |
+
consistency with JuMP style.
|
| 59 |
+
- Add an underscore to the name of all functions that do not appear in the
|
| 60 |
+
documentation (e.g. `something` becomes `_something`) These functions are not
|
| 61 |
+
part of the public API and may change without notice, even in PATCH releases.
|
| 62 |
+
- The function `UnitCommitment.build_model` now returns a plain JuMP model. The
|
| 63 |
+
struct `UnitCommitmentModel` has been completely removed. Accessing model
|
| 64 |
+
elements can now be accomplished as follows:
|
| 65 |
+
- `model.vars.x[idx]` becomes `model[:x][idx]`
|
| 66 |
+
- `model.eqs.y[idx]` becomes `model[:eq_y][idx]`
|
| 67 |
+
- `model.expr.z[idx]` becomes `model[:expr_z][idx]`
|
| 68 |
+
- `model.obj` becomes `model[:obj]`
|
| 69 |
+
- `model.isf` becomes `model[:isf]`
|
| 70 |
+
- `model.lodf` becomes `model[:lodf]`
|
| 71 |
+
|
| 72 |
+
### Fixed
|
| 73 |
+
- Properly validate solutions with price-sensitive loads.
|
| 74 |
+
|
| 75 |
+
## [0.1.1] - 2020-11-16
|
| 76 |
+
### Added
|
| 77 |
+
- Add OR-LIB and Tejada19 instances.
|
| 78 |
+
- Improve documentation.
|
| 79 |
+
|
| 80 |
+
## Fixed
|
| 81 |
+
- Fixes to MATLAB and PGLIB-UC instances.
|
| 82 |
+
|
| 83 |
+
## [0.1.0] - 2020-11-06
|
| 84 |
+
- Initial public release.
|
LICENSE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright © 2020-2022, UChicago Argonne, LLC
|
| 2 |
+
|
| 3 |
+
All Rights Reserved
|
| 4 |
+
|
| 5 |
+
Software Name: UnitCommitment.jl
|
| 6 |
+
|
| 7 |
+
By: Argonne National Laboratory
|
| 8 |
+
|
| 9 |
+
OPEN SOURCE LICENSE
|
| 10 |
+
-------------------
|
| 11 |
+
|
| 12 |
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
| 13 |
+
|
| 14 |
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
| 15 |
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
| 16 |
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
| 17 |
+
|
| 18 |
+
********************************************************************************
|
| 19 |
+
|
| 20 |
+
DISCLAIMER
|
| 21 |
+
----------
|
| 22 |
+
|
| 23 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 24 |
+
|
| 25 |
+
********************************************************************************
|
Makefile
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
VERSION := 0.4
|
| 6 |
+
|
| 7 |
+
docs:
|
| 8 |
+
cd docs; julia --project=. -e 'include("make.jl"); make()'; cd ..
|
| 9 |
+
rsync -avP --delete-after docs/build/ ../docs/$(VERSION)/
|
| 10 |
+
|
| 11 |
+
.PHONY: docs
|
Project.toml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name = "UnitCommitment"
|
| 2 |
+
uuid = "64606440-39ea-11e9-0f29-3303a1d3d877"
|
| 3 |
+
version = "0.3.0"
|
| 4 |
+
|
| 5 |
+
[deps]
|
| 6 |
+
Cbc = "9961bab8-2fa3-5c5a-9d89-47fab24efd76"
|
| 7 |
+
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
|
| 8 |
+
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
|
| 9 |
+
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
|
| 10 |
+
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
|
| 11 |
+
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
|
| 12 |
+
GZip = "92fee26a-97fe-5a0c-ad85-20a5f3185b63"
|
| 13 |
+
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
| 14 |
+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
| 15 |
+
JSONSchema = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
|
| 16 |
+
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
| 17 |
+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
|
| 18 |
+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
|
| 19 |
+
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
|
| 20 |
+
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
|
| 21 |
+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
|
| 22 |
+
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
|
| 23 |
+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
| 24 |
+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
| 25 |
+
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
|
| 26 |
+
|
| 27 |
+
[compat]
|
| 28 |
+
Cbc = "1.3.0"
|
| 29 |
+
CodecZlib = "0.7.8"
|
| 30 |
+
DataStructures = "0.18.22"
|
| 31 |
+
Dates = "1.11.0"
|
| 32 |
+
Distributed = "1.11.0"
|
| 33 |
+
Distributions = "0.25.125"
|
| 34 |
+
GZip = "0.5.2"
|
| 35 |
+
HiGHS = "1.23.0"
|
| 36 |
+
JSON = "0.21.4"
|
| 37 |
+
JSONSchema = "1.5.0"
|
| 38 |
+
JuMP = "1.30.0"
|
| 39 |
+
LinearAlgebra = "1.12.0"
|
| 40 |
+
Logging = "1.11.0"
|
| 41 |
+
MPI = "0.20.26"
|
| 42 |
+
OffsetArrays = "1.17.0"
|
| 43 |
+
Printf = "1.11.0"
|
| 44 |
+
Random = "1.11.0"
|
| 45 |
+
SparseArrays = "1.12.0"
|
| 46 |
+
TimerOutputs = "0.5.29"
|
README.md
CHANGED
|
@@ -1,3 +1,333 @@
|
|
| 1 |
---
|
| 2 |
license: bsd-3-clause
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: bsd-3-clause
|
| 3 |
+
task_categories:
|
| 4 |
+
- other
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- mixed-integer-programming
|
| 9 |
+
- power-systems
|
| 10 |
+
- optimization
|
| 11 |
+
- unit-commitment
|
| 12 |
+
- mps
|
| 13 |
+
- benchmark
|
| 14 |
+
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# UnitCommitment Trajectory MPS Dataset
|
| 19 |
+
|
| 20 |
+
本仓库基于修改版 `UnitCommitment.jl`,从 MATPOWER 机组组合实例生成标准 `.mps` 文件,用于混合整数规划、机组组合、SCUC 模型和求解器基准测试。
|
| 21 |
+
|
| 22 |
+
代码仓库地址:[EridanusQ/UnitCommitment_Trajectory](https://huggingface.co/datasets/EridanusQ/UnitCommitment_Trajectory)
|
| 23 |
+
|
| 24 |
+
数据集仓库地址:[EridanusQ/UnitCommitment_Trajectory_Dataset](https://huggingface.co/datasets/EridanusQ/UnitCommitment_Trajectory_Dataset)
|
| 25 |
+
|
| 26 |
+
本文档面向 Linux 服务器运行。所有命令默认在仓库根目录执行,也就是包含 `Project.toml`、`generate_dataset.jl` 和 `benchmark/` 的目录。
|
| 27 |
+
|
| 28 |
+
## 1. 项目结构
|
| 29 |
+
|
| 30 |
+
```text
|
| 31 |
+
UnitCommitment_Trajectory/
|
| 32 |
+
├── README.md
|
| 33 |
+
├── Project.toml
|
| 34 |
+
├── Manifest.toml
|
| 35 |
+
├── generate_dataset.jl
|
| 36 |
+
├── create_scuc_mps_files.jl
|
| 37 |
+
├── benchmark/
|
| 38 |
+
│ └── scripts/
|
| 39 |
+
│ └── download_matpower_instances.py
|
| 40 |
+
├── docs/
|
| 41 |
+
│ └── src/guides/instances.md
|
| 42 |
+
├── instances/
|
| 43 |
+
│ └── matpower/
|
| 44 |
+
├── src/
|
| 45 |
+
└── testdata/
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
默认路径如下:
|
| 49 |
+
|
| 50 |
+
| 类型 | 默认路径 | 说明 |
|
| 51 |
+
| :--- | :--- | :--- |
|
| 52 |
+
| 输入实例 | `instances/matpower` | `.json.gz` 输入文件 |
|
| 53 |
+
| 输出数据集 | `../UnitCommitment_Trajectory_Dataset` | `.mps` 输出文件,默认在仓库上一级目录 |
|
| 54 |
+
| case 列表来源 | `docs/src/guides/instances.md` | 下载脚本会从这里解析 MATPOWER case |
|
| 55 |
+
|
| 56 |
+
## 2. Linux 环境准备
|
| 57 |
+
|
| 58 |
+
建议使用 Ubuntu 22.04/24.04、Debian 12、Rocky Linux 9 或其他常见 x86_64 Linux 服务器。
|
| 59 |
+
|
| 60 |
+
必需软件:
|
| 61 |
+
|
| 62 |
+
- Julia 1.12.x。当前 `Manifest.toml` 由 Julia 1.12.6 生成。
|
| 63 |
+
- Python 3.9+。下载脚本只使用 Python 标准库。
|
| 64 |
+
- `git`、`curl` 或 `wget`。
|
| 65 |
+
- 足够的磁盘空间。全量生成会产生数万个 `.mps` 文件,建议把输入和输出放在大容量数据盘。
|
| 66 |
+
|
| 67 |
+
安装 Julia 的一种方式:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
curl -fsSL https://install.julialang.org | sh
|
| 71 |
+
exec "$SHELL"
|
| 72 |
+
julia --version
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
如果服务器不能访问外网,也可以手动安装 Julia 1.12.x,并确保 `julia` 在 `PATH` 中。
|
| 76 |
+
|
| 77 |
+
在共享服务器上,建议显式设置 Julia depot,避免把依赖写到不合适的位置:
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
mkdir -p /data/julia_depot
|
| 81 |
+
export JULIA_DEPOT_PATH=/data/julia_depot
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
不要直接复用 Windows 机器上的 `.julia_depot`。请在 Linux 上重新实例化依赖,Julia 会下载适合 Linux 的二进制 artifacts。
|
| 85 |
+
|
| 86 |
+
## 3. 初始化 Julia 依赖
|
| 87 |
+
|
| 88 |
+
```bash
|
| 89 |
+
cd /path/to/UnitCommitment_Trajectory
|
| 90 |
+
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.precompile()'
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
如果服务器网络较慢,第一次执行可能需要较长时间。完成后可以验证包能否加载:
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
julia --project=. -e 'using UnitCommitment; println("UnitCommitment loaded")'
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## 4. 下载 MATPOWER 输入实例
|
| 100 |
+
|
| 101 |
+
先查看支持的 case:
|
| 102 |
+
|
| 103 |
+
```bash
|
| 104 |
+
python3 benchmark/scripts/download_matpower_instances.py --list-cases
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
支持的 case 包括:
|
| 108 |
+
|
| 109 |
+
```text
|
| 110 |
+
case14 case30 case57 case118 case300
|
| 111 |
+
case2383wp case2736sp case2737sop case2746wop case2746wp
|
| 112 |
+
case3012wp case3120sp case3375wp
|
| 113 |
+
case89pegase case1354pegase case2869pegase case9241pegase case13659pegase
|
| 114 |
+
case1888rte case1951rte case2848rte case2868rte
|
| 115 |
+
case6468rte case6470rte case6495rte case6515rte
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
推荐先下载一个小范围做连通性测试:
|
| 119 |
+
|
| 120 |
+
```bash
|
| 121 |
+
python3 benchmark/scripts/download_matpower_instances.py \
|
| 122 |
+
--start-date 2017-01-01 \
|
| 123 |
+
--end-date 2017-01-01 \
|
| 124 |
+
--workers 8
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
下载全量 2017 年数据:
|
| 128 |
+
|
| 129 |
+
```bash
|
| 130 |
+
python3 benchmark/scripts/download_matpower_instances.py --workers 16
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
下载脚本默认写入 `instances/matpower/<case>/<YYYY-MM-DD>.json.gz`。如果希望把输入数据放在数据盘:
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
python3 benchmark/scripts/download_matpower_instances.py \
|
| 137 |
+
--out-dir /data/uc_inputs/matpower \
|
| 138 |
+
--workers 16
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
检查下载数量:
|
| 142 |
+
|
| 143 |
+
```bash
|
| 144 |
+
find instances/matpower -name '*.json.gz' | wc -l
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
全量数据目标约为 9487 个输入实例。远端若有少数 URL 暂时失败或缺失,下载脚本会打印失败地址并返回非零状态;已经下载成功的文件会保留,重新运行同一命令会自动跳过非空文件。
|
| 148 |
+
|
| 149 |
+
## 5. 单实例冒烟测试
|
| 150 |
+
|
| 151 |
+
冒烟测试会读取 `instances/matpower/case30/2017-01-01.json.gz`,并在当前目录生成 4 个 `.mps` 文件:
|
| 152 |
+
|
| 153 |
+
```bash
|
| 154 |
+
julia --project=. create_scuc_mps_files.jl
|
| 155 |
+
ls -lh uc_*mps
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
如果你把输入数据放到了自定义目录,请先把对应文件放回默认路径,或临时创建软链接:
|
| 159 |
+
|
| 160 |
+
```bash
|
| 161 |
+
mkdir -p instances
|
| 162 |
+
ln -s /data/uc_inputs/matpower instances/matpower
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
## 6. 批量生成 MPS
|
| 166 |
+
|
| 167 |
+
`generate_dataset.jl` 会扫描输入目录下已经存在的 `.json.gz` 文件。每个输入实例生成 4 个 `.mps` 变体:
|
| 168 |
+
|
| 169 |
+
```text
|
| 170 |
+
hourly_noline 小时级 UC,不含线路约束
|
| 171 |
+
hourly_withline 小时级 SCUC,含线路约束
|
| 172 |
+
subhourly_noline 子小时级 UC,不含线路约束
|
| 173 |
+
subhourly_withline 子小时级 SCUC,含线路约束
|
| 174 |
+
```
|
| 175 |
+
|
| 176 |
+
文件命名规则:
|
| 177 |
+
|
| 178 |
+
```text
|
| 179 |
+
<case>_<date>_<resolution>_<network>.mps
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
示例:
|
| 183 |
+
|
| 184 |
+
```text
|
| 185 |
+
case30_2017-01-01_h_noline.mps
|
| 186 |
+
case30_2017-01-01_s_withline.mps
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
先做 dry run,确认输入、输出和 case 选择正确:
|
| 190 |
+
|
| 191 |
+
```bash
|
| 192 |
+
UC_DRY_RUN=1 julia --project=. generate_dataset.jl
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
只生成小 case:
|
| 196 |
+
|
| 197 |
+
```bash
|
| 198 |
+
UC_CASES=case14,case30 \
|
| 199 |
+
UC_OUTPUT_ROOT=/data/uc_mps \
|
| 200 |
+
julia --project=. generate_dataset.jl
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
使用 128 个 Julia worker 进程并行生成:
|
| 204 |
+
|
| 205 |
+
```bash
|
| 206 |
+
UC_WORKERS=128 \
|
| 207 |
+
UC_CASES=case14,case30,case57,case118 \
|
| 208 |
+
UC_OUTPUT_ROOT=/pub/data/daizhengyu \
|
| 209 |
+
julia --project=. generate_dataset.jl
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
使用自定义输入目录和输出目录:
|
| 213 |
+
|
| 214 |
+
```bash
|
| 215 |
+
UC_INPUT_ROOT=/data/uc_inputs/matpower \
|
| 216 |
+
UC_OUTPUT_ROOT=/data/uc_mps \
|
| 217 |
+
julia --project=. generate_dataset.jl
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
全量生成:
|
| 221 |
+
|
| 222 |
+
```bash
|
| 223 |
+
UC_OUTPUT_ROOT=/data/uc_mps julia --project=. generate_dataset.jl
|
| 224 |
+
```
|
| 225 |
+
|
| 226 |
+
检查输出数量:
|
| 227 |
+
|
| 228 |
+
```bash
|
| 229 |
+
find /data/uc_mps -name '*.mps' | wc -l
|
| 230 |
+
du -sh /data/uc_mps
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
## 7. 长任务在服务器后台运行
|
| 234 |
+
|
| 235 |
+
全量生成耗时较长,建议使用 `tmux` 或 `screen`,避免 SSH 断开导致任务中止。
|
| 236 |
+
|
| 237 |
+
使用 `tmux`:
|
| 238 |
+
|
| 239 |
+
```bash
|
| 240 |
+
tmux new -s uc-mps
|
| 241 |
+
cd /path/to/UnitCommitment_Trajectory
|
| 242 |
+
export JULIA_DEPOT_PATH=/data/julia_depot
|
| 243 |
+
export UC_WORKERS=128
|
| 244 |
+
export UC_OUTPUT_ROOT=/data/uc_mps
|
| 245 |
+
julia --project=. generate_dataset.jl 2>&1 | tee generate_dataset.log
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
断开会话:
|
| 249 |
+
|
| 250 |
+
```bash
|
| 251 |
+
Ctrl-b d
|
| 252 |
+
```
|
| 253 |
+
|
| 254 |
+
重新进入:
|
| 255 |
+
|
| 256 |
+
```bash
|
| 257 |
+
tmux attach -t uc-mps
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
不用 `tmux` 时,也可以用 `nohup`:
|
| 261 |
+
|
| 262 |
+
```bash
|
| 263 |
+
nohup bash -lc 'UC_WORKERS=128 UC_OUTPUT_ROOT=/data/uc_mps julia --project=. generate_dataset.jl' > generate_dataset.log 2>&1 &
|
| 264 |
+
tail -f generate_dataset.log
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
生成 `case14`、`case30`、`case57`、`case118` 并输出到 `/pub/data/daizhengyu` 的后台命令:
|
| 268 |
+
|
| 269 |
+
```bash
|
| 270 |
+
mkdir -p /pub/data/daizhengyu
|
| 271 |
+
nohup bash -lc 'JULIA_NUM_THREADS=1 UC_WORKERS=128 UC_CASES=case14,case30,case57,case118 UC_OUTPUT_ROOT=/pub/data/daizhengyu julia --project=. generate_dataset.jl' > /pub/data/daizhengyu/generate_case14_30_57_118.log 2>&1 &
|
| 272 |
+
tail -f /pub/data/daizhengyu/generate_case14_30_57_118.log
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
## 8. 可用环境变量
|
| 276 |
+
|
| 277 |
+
| 变量 | 默认值 | 作用 |
|
| 278 |
+
| :--- | :--- | :--- |
|
| 279 |
+
| `UC_INPUT_ROOT` | `instances/matpower` | 输入 `.json.gz` 根目录 |
|
| 280 |
+
| `UC_OUTPUT_ROOT` | `../UnitCommitment_Trajectory_Dataset` | 输出 `.mps` 根目录 |
|
| 281 |
+
| `UC_CASES` | 空 | 逗号分隔的 case 白名单,例如 `case14,case30` |
|
| 282 |
+
| `UC_WORKERS` | `1` | Julia worker 进程数,例如 `128` |
|
| 283 |
+
| `UC_DRY_RUN` | 空 | 设为 `1`、`true`、`yes` 或 `y` 时只打印计划,不生成文件 |
|
| 284 |
+
|
| 285 |
+
清理变量:
|
| 286 |
+
|
| 287 |
+
```bash
|
| 288 |
+
unset UC_INPUT_ROOT UC_OUTPUT_ROOT UC_CASES UC_WORKERS UC_DRY_RUN
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
## 9. 常见问题
|
| 292 |
+
|
| 293 |
+
### `julia: command not found`
|
| 294 |
+
|
| 295 |
+
Julia 没有安装,或安装后没有加入 `PATH`。重新登录 shell,或把 Julia 的 `bin` 目录加入 `PATH`。
|
| 296 |
+
|
| 297 |
+
### `Input directory does not exist: instances/matpower`
|
| 298 |
+
|
| 299 |
+
还没有下载输入数据,或当前工作目录不是仓库根目录。先运行下载脚本,或通过 `UC_INPUT_ROOT` 指向真实输入目录。
|
| 300 |
+
|
| 301 |
+
### `No cases selected under ...`
|
| 302 |
+
|
| 303 |
+
输入目录下没有 `.json.gz` 文件,或者 `UC_CASES` 写了不存在的 case。用下面命令检查:
|
| 304 |
+
|
| 305 |
+
```bash
|
| 306 |
+
find "${UC_INPUT_ROOT:-instances/matpower}" -name '*.json.gz' | head
|
| 307 |
+
```
|
| 308 |
+
|
| 309 |
+
### 下载速度慢或失败
|
| 310 |
+
|
| 311 |
+
降低并发或增加重试:
|
| 312 |
+
|
| 313 |
+
```bash
|
| 314 |
+
python3 benchmark/scripts/download_matpower_instances.py \
|
| 315 |
+
--workers 4 \
|
| 316 |
+
--timeout 120 \
|
| 317 |
+
--retries 5
|
| 318 |
+
```
|
| 319 |
+
|
| 320 |
+
已经下载成功的非空文件会自动跳过,可以重复执行同一命令。
|
| 321 |
+
|
| 322 |
+
### 磁盘空间不足
|
| 323 |
+
|
| 324 |
+
不要把全量输出写到系统盘。使用 `UC_OUTPUT_ROOT=/data/uc_mps` 指向大容量数据盘,并先用 `UC_CASES=case14,case30` 做小规模测试。
|
| 325 |
+
|
| 326 |
+
### 服务器断线后任务停止
|
| 327 |
+
|
| 328 |
+
使用 `tmux`、`screen` 或 `nohup`。长任务不要直接跑在普通 SSH 前台会话里。
|
| 329 |
+
|
| 330 |
+
## 10. 引用
|
| 331 |
+
|
| 332 |
+
原始 UnitCommitment.jl DOI:
|
| 333 |
+
[10.5281/zenodo.4269874](https://doi.org/10.5281/zenodo.4269874)
|
benchmark/Project.toml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[deps]
|
| 2 |
+
DocOpt = "968ba79b-81e4-546f-ab3a-2eecfa62a9db"
|
| 3 |
+
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
|
| 4 |
+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
| 5 |
+
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
| 6 |
+
UnitCommitment = "64606440-39ea-11e9-0f29-3303a1d3d877"
|
benchmark/run.jl
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
doc = """UnitCommitment.jl Benchmark Runner
|
| 6 |
+
|
| 7 |
+
Usage:
|
| 8 |
+
run.jl [-s ARG]... [-m ARG]... [-c ARG]... [-f ARG]... [options]
|
| 9 |
+
|
| 10 |
+
Examples:
|
| 11 |
+
|
| 12 |
+
1. Benchmark all solvers, methods and formulations:
|
| 13 |
+
|
| 14 |
+
julia run.jl
|
| 15 |
+
|
| 16 |
+
2. Benchmark formulations "default" and "ArrCon200" using Gurobi:
|
| 17 |
+
|
| 18 |
+
julia run.jl -s gurobi -f default -f ArrCon2000
|
| 19 |
+
|
| 20 |
+
3. Benchmark a few test cases, using all solvers, methods and formulations:
|
| 21 |
+
|
| 22 |
+
julia run.jl -c or-lib/20_0_1_w -c matpower/case1888rte/2017-02-01
|
| 23 |
+
|
| 24 |
+
4. Solve 4 test cases in parallel, with 2 threads available per worker:
|
| 25 |
+
|
| 26 |
+
JULIA_NUM_THREADS=2 julia --procs 4 run.jl
|
| 27 |
+
|
| 28 |
+
Options:
|
| 29 |
+
-h --help Show this screen.
|
| 30 |
+
-s --solver=ARG Mixed-integer linear solver (e.g. gurobi)
|
| 31 |
+
-c --case=ARG Unit commitment test case (e.g. or-lib/20_0_1_w)
|
| 32 |
+
-m --method=ARG Solution method (e.g. default)
|
| 33 |
+
-f --formulation=ARG Formulation (e.g. ArrCon2000)
|
| 34 |
+
--time-limit=ARG Time limit in seconds [default: 3600]
|
| 35 |
+
--gap=ARG Relative MIP gap tolerance [default: 0.001]
|
| 36 |
+
--trials=ARG Number of trials [default: 5]
|
| 37 |
+
"""
|
| 38 |
+
|
| 39 |
+
using Distributed
|
| 40 |
+
using Pkg
|
| 41 |
+
Pkg.activate(".")
|
| 42 |
+
@everywhere using Pkg
|
| 43 |
+
@everywhere Pkg.activate(".")
|
| 44 |
+
|
| 45 |
+
Pkg.instantiate() # added on 15/04/2025 to ensure DocOpt is available
|
| 46 |
+
using DocOpt
|
| 47 |
+
args = docopt(doc)
|
| 48 |
+
|
| 49 |
+
@everywhere using UnitCommitment
|
| 50 |
+
@everywhere UnitCommitment._setup_logger()
|
| 51 |
+
|
| 52 |
+
using UnitCommitment
|
| 53 |
+
using Gurobi
|
| 54 |
+
using Logging
|
| 55 |
+
using JuMP
|
| 56 |
+
|
| 57 |
+
import UnitCommitment:
|
| 58 |
+
ArrCon2000,
|
| 59 |
+
CarArr2006,
|
| 60 |
+
DamKucRajAta2016,
|
| 61 |
+
Formulation,
|
| 62 |
+
Gar1962,
|
| 63 |
+
KnuOstWat2018,
|
| 64 |
+
MorLatRam2013,
|
| 65 |
+
PanGua2016,
|
| 66 |
+
XavQiuWanThi2019
|
| 67 |
+
|
| 68 |
+
# Benchmark test cases
|
| 69 |
+
# -----------------------------------------------------------------------------
|
| 70 |
+
cases = [
|
| 71 |
+
"pglib-uc/ca/2014-09-01_reserves_0",
|
| 72 |
+
"pglib-uc/ca/2014-09-01_reserves_1",
|
| 73 |
+
"pglib-uc/ca/2015-03-01_reserves_0",
|
| 74 |
+
"pglib-uc/ca/2015-06-01_reserves_0",
|
| 75 |
+
"pglib-uc/ca/Scenario400_reserves_1",
|
| 76 |
+
"pglib-uc/ferc/2015-01-01_lw",
|
| 77 |
+
"pglib-uc/ferc/2015-05-01_lw",
|
| 78 |
+
"pglib-uc/ferc/2015-07-01_hw",
|
| 79 |
+
"pglib-uc/ferc/2015-10-01_lw",
|
| 80 |
+
"pglib-uc/ferc/2015-12-01_lw",
|
| 81 |
+
"pglib-uc/rts_gmlc/2020-04-03",
|
| 82 |
+
"pglib-uc/rts_gmlc/2020-09-20",
|
| 83 |
+
"pglib-uc/rts_gmlc/2020-10-27",
|
| 84 |
+
"pglib-uc/rts_gmlc/2020-11-25",
|
| 85 |
+
"pglib-uc/rts_gmlc/2020-12-23",
|
| 86 |
+
"or-lib/20_0_1_w",
|
| 87 |
+
"or-lib/20_0_5_w",
|
| 88 |
+
"or-lib/50_0_2_w",
|
| 89 |
+
"or-lib/75_0_2_w",
|
| 90 |
+
"or-lib/100_0_1_w",
|
| 91 |
+
"or-lib/100_0_4_w",
|
| 92 |
+
"or-lib/100_0_5_w",
|
| 93 |
+
"or-lib/200_0_3_w",
|
| 94 |
+
"or-lib/200_0_7_w",
|
| 95 |
+
"or-lib/200_0_9_w",
|
| 96 |
+
"tejada19/UC_24h_290g",
|
| 97 |
+
"tejada19/UC_24h_623g",
|
| 98 |
+
"tejada19/UC_24h_959g",
|
| 99 |
+
"tejada19/UC_24h_1577g",
|
| 100 |
+
"tejada19/UC_24h_1888g",
|
| 101 |
+
"tejada19/UC_168h_72g",
|
| 102 |
+
"tejada19/UC_168h_86g",
|
| 103 |
+
"tejada19/UC_168h_130g",
|
| 104 |
+
"tejada19/UC_168h_131g",
|
| 105 |
+
"tejada19/UC_168h_199g",
|
| 106 |
+
"matpower/case1888rte/2017-02-01",
|
| 107 |
+
"matpower/case1951rte/2017-02-01",
|
| 108 |
+
"matpower/case2848rte/2017-02-01",
|
| 109 |
+
"matpower/case3012wp/2017-02-01",
|
| 110 |
+
"matpower/case3375wp/2017-02-01",
|
| 111 |
+
"matpower/case6468rte/2017-02-01",
|
| 112 |
+
"matpower/case6515rte/2017-02-01",
|
| 113 |
+
]
|
| 114 |
+
|
| 115 |
+
# Formulations
|
| 116 |
+
# -----------------------------------------------------------------------------
|
| 117 |
+
formulations = Dict(
|
| 118 |
+
"default" => Formulation(),
|
| 119 |
+
"ArrCon2000" => Formulation(ramping = ArrCon2000.Ramping()),
|
| 120 |
+
"CarArr2006" => Formulation(pwl_costs = CarArr2006.PwlCosts()),
|
| 121 |
+
"DamKucRajAta2016" => Formulation(ramping = DamKucRajAta2016.Ramping()),
|
| 122 |
+
"Gar1962" => Formulation(pwl_costs = Gar1962.PwlCosts()),
|
| 123 |
+
"KnuOstWat2018" => Formulation(pwl_costs = KnuOstWat2018.PwlCosts()),
|
| 124 |
+
"MorLatRam2013" => Formulation(ramping = MorLatRam2013.Ramping()),
|
| 125 |
+
"PanGua2016" => Formulation(ramping = PanGua2016.Ramping()),
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
# Solution methods
|
| 129 |
+
# -----------------------------------------------------------------------------
|
| 130 |
+
const gap_limit = parse(Float64, args["--gap"])
|
| 131 |
+
const time_limit = parse(Float64, args["--time-limit"])
|
| 132 |
+
methods = Dict(
|
| 133 |
+
"default" => XavQiuWanThi2019.Method(
|
| 134 |
+
time_limit = time_limit,
|
| 135 |
+
gap_limit = gap_limit,
|
| 136 |
+
),
|
| 137 |
+
)
|
| 138 |
+
|
| 139 |
+
# MIP solvers
|
| 140 |
+
# -----------------------------------------------------------------------------
|
| 141 |
+
optimizers = Dict(
|
| 142 |
+
"gurobi" => optimizer_with_attributes(
|
| 143 |
+
Gurobi.Optimizer,
|
| 144 |
+
"Threads" => Threads.nthreads(),
|
| 145 |
+
),
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
# Parse command line arguments
|
| 149 |
+
# -----------------------------------------------------------------------------
|
| 150 |
+
if !isempty(args["--case"])
|
| 151 |
+
cases = args["--case"]
|
| 152 |
+
end
|
| 153 |
+
if !isempty(args["--formulation"])
|
| 154 |
+
formulations = filter(p -> p.first in args["--formulation"], formulations)
|
| 155 |
+
end
|
| 156 |
+
if !isempty(args["--method"])
|
| 157 |
+
methods = filter(p -> p.first in args["--method"], methods)
|
| 158 |
+
end
|
| 159 |
+
if !isempty(args["--solver"])
|
| 160 |
+
optimizers = filter(p -> p.first in args["--solver"], optimizers)
|
| 161 |
+
end
|
| 162 |
+
const ntrials = parse(Int, args["--trials"])
|
| 163 |
+
|
| 164 |
+
# Print benchmark settings
|
| 165 |
+
# -----------------------------------------------------------------------------
|
| 166 |
+
function printlist(d::Dict)
|
| 167 |
+
for key in keys(d)
|
| 168 |
+
@info " - $key"
|
| 169 |
+
end
|
| 170 |
+
end
|
| 171 |
+
|
| 172 |
+
function printlist(d::Vector)
|
| 173 |
+
for key in d
|
| 174 |
+
@info " - $key"
|
| 175 |
+
end
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
@info "Computational environment:"
|
| 179 |
+
@info " - CPU: $(Sys.cpu_info()[1].model)"
|
| 180 |
+
@info " - Logical CPU cores: $(length(Sys.cpu_info()))"
|
| 181 |
+
@info " - System memory: $(round(Sys.total_memory() / 2^30, digits=2)) GiB"
|
| 182 |
+
@info " - Available workers: $(nworkers())"
|
| 183 |
+
@info " - Available threads per worker: $(Threads.nthreads())"
|
| 184 |
+
|
| 185 |
+
@info "Parameters:"
|
| 186 |
+
@info " - Number of trials: $ntrials"
|
| 187 |
+
@info " - Time limit (s): $time_limit"
|
| 188 |
+
@info " - Relative MIP gap tolerance: $gap_limit"
|
| 189 |
+
|
| 190 |
+
@info "Solvers:"
|
| 191 |
+
printlist(optimizers)
|
| 192 |
+
|
| 193 |
+
@info "Methods:"
|
| 194 |
+
printlist(methods)
|
| 195 |
+
|
| 196 |
+
@info "Formulations:"
|
| 197 |
+
printlist(formulations)
|
| 198 |
+
|
| 199 |
+
@info "Cases:"
|
| 200 |
+
printlist(cases)
|
| 201 |
+
|
| 202 |
+
# Run benchmarks
|
| 203 |
+
# -----------------------------------------------------------------------------
|
| 204 |
+
UnitCommitment._run_benchmarks(
|
| 205 |
+
cases = cases,
|
| 206 |
+
formulations = formulations,
|
| 207 |
+
methods = methods,
|
| 208 |
+
optimizers = optimizers,
|
| 209 |
+
trials = 1:ntrials,
|
| 210 |
+
)
|
benchmark/scripts/compare.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import numpy as np
|
| 7 |
+
import seaborn as sns
|
| 8 |
+
import matplotlib
|
| 9 |
+
import matplotlib.pyplot as plt
|
| 10 |
+
import sys
|
| 11 |
+
|
| 12 |
+
matplotlib.use("Agg")
|
| 13 |
+
sns.set("talk")
|
| 14 |
+
sns.set_palette(
|
| 15 |
+
[
|
| 16 |
+
"#9b59b6",
|
| 17 |
+
"#3498db",
|
| 18 |
+
"#95a5a6",
|
| 19 |
+
"#e74c3c",
|
| 20 |
+
"#34495e",
|
| 21 |
+
"#2ecc71",
|
| 22 |
+
]
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
filename = sys.argv[1]
|
| 26 |
+
m1 = sys.argv[2]
|
| 27 |
+
m2 = sys.argv[3]
|
| 28 |
+
|
| 29 |
+
# Prepare data
|
| 30 |
+
data = pd.read_csv(filename, index_col=0)
|
| 31 |
+
b1 = (
|
| 32 |
+
data[data["Group"] == m1]
|
| 33 |
+
.groupby(["Instance", "Sample"])
|
| 34 |
+
.mean()[["Optimization time (s)"]]
|
| 35 |
+
)
|
| 36 |
+
b2 = (
|
| 37 |
+
data[data["Group"] == m2]
|
| 38 |
+
.groupby(["Instance", "Sample"])
|
| 39 |
+
.mean()[["Optimization time (s)"]]
|
| 40 |
+
)
|
| 41 |
+
b1.columns = [f"{m1} time (s)"]
|
| 42 |
+
b2.columns = [f"{m2} time (s)"]
|
| 43 |
+
merged = pd.merge(b1, b2, left_index=True, right_index=True).reset_index().dropna()
|
| 44 |
+
merged["Speedup"] = merged[f"{m1} time (s)"] / merged[f"{m2} time (s)"]
|
| 45 |
+
merged["Group"] = merged["Instance"].str.replace(r"\/.*", "", regex=True)
|
| 46 |
+
merged = merged.sort_values(by=["Instance", "Sample"], ascending=True)
|
| 47 |
+
merged = merged[(merged[f"{m1} time (s)"] > 0) & (merged[f"{m2} time (s)"] > 0)]
|
| 48 |
+
|
| 49 |
+
# Plot results
|
| 50 |
+
k1 = len(merged.groupby("Instance").mean())
|
| 51 |
+
k2 = len(merged.groupby("Group").mean())
|
| 52 |
+
k = k1 + k2
|
| 53 |
+
fig = plt.figure(
|
| 54 |
+
constrained_layout=True,
|
| 55 |
+
figsize=(15, max(5, 0.75 * k)),
|
| 56 |
+
)
|
| 57 |
+
plt.suptitle(f"{m1} vs {m2}")
|
| 58 |
+
gs1 = fig.add_gridspec(nrows=k, ncols=1)
|
| 59 |
+
ax1 = fig.add_subplot(gs1[0:k1, 0:1])
|
| 60 |
+
ax2 = fig.add_subplot(gs1[k1:, 0:1], sharex=ax1)
|
| 61 |
+
sns.barplot(
|
| 62 |
+
data=merged,
|
| 63 |
+
x="Speedup",
|
| 64 |
+
y="Instance",
|
| 65 |
+
color="tab:purple",
|
| 66 |
+
errcolor="k",
|
| 67 |
+
errwidth=1.25,
|
| 68 |
+
ax=ax1,
|
| 69 |
+
)
|
| 70 |
+
sns.barplot(
|
| 71 |
+
data=merged,
|
| 72 |
+
x="Speedup",
|
| 73 |
+
y="Group",
|
| 74 |
+
color="tab:purple",
|
| 75 |
+
errcolor="k",
|
| 76 |
+
errwidth=1.25,
|
| 77 |
+
ax=ax2,
|
| 78 |
+
)
|
| 79 |
+
ax1.axvline(1.0, linestyle="--", color="k")
|
| 80 |
+
ax2.axvline(1.0, linestyle="--", color="k")
|
| 81 |
+
|
| 82 |
+
print("Writing tables/compare.png")
|
| 83 |
+
plt.savefig("tables/compare.png", dpi=150)
|
| 84 |
+
|
| 85 |
+
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import argparse
|
| 4 |
+
import datetime as dt
|
| 5 |
+
import os
|
| 6 |
+
import re
|
| 7 |
+
import sys
|
| 8 |
+
import time
|
| 9 |
+
import urllib.error
|
| 10 |
+
import urllib.request
|
| 11 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 12 |
+
from dataclasses import dataclass
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
BASE_URL_DEFAULT = "https://axavier.org/UnitCommitment.jl/0.4/instances"
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@dataclass(frozen=True)
|
| 19 |
+
class Task:
|
| 20 |
+
case: str
|
| 21 |
+
date: dt.date
|
| 22 |
+
url: str
|
| 23 |
+
out_path: Path
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _iter_dates(start: dt.date, end: dt.date):
|
| 27 |
+
if end < start:
|
| 28 |
+
raise ValueError("end_date must be >= start_date")
|
| 29 |
+
cur = start
|
| 30 |
+
one = dt.timedelta(days=1)
|
| 31 |
+
while cur <= end:
|
| 32 |
+
yield cur
|
| 33 |
+
cur += one
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def _default_instances_md_path() -> Path:
|
| 37 |
+
here = Path(__file__).resolve()
|
| 38 |
+
project_root = here.parents[2]
|
| 39 |
+
return project_root / "docs" / "src" / "guides" / "instances.md"
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _parse_matpower_cases_from_instances_md(instances_md_path: Path) -> list[str]:
|
| 43 |
+
text = instances_md_path.read_text(encoding="utf-8")
|
| 44 |
+
pattern = re.compile(r"matpower/(case[^/\s`]+)/\d{4}-\d{2}-\d{2}")
|
| 45 |
+
cases = sorted(set(pattern.findall(text)))
|
| 46 |
+
if not cases:
|
| 47 |
+
raise RuntimeError(f"No MATPOWER cases found in {instances_md_path}")
|
| 48 |
+
return cases
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def _download_one(task: Task, timeout_s: float, retries: int, force: bool) -> tuple[str, str | None]:
|
| 52 |
+
task.out_path.parent.mkdir(parents=True, exist_ok=True)
|
| 53 |
+
|
| 54 |
+
if task.out_path.exists() and not force and task.out_path.stat().st_size > 0:
|
| 55 |
+
return ("skipped", None)
|
| 56 |
+
|
| 57 |
+
tmp_path = task.out_path.with_suffix(task.out_path.suffix + ".part")
|
| 58 |
+
req = urllib.request.Request(task.url, headers={"User-Agent": "UnitCommitment downloader"})
|
| 59 |
+
|
| 60 |
+
last_err = None
|
| 61 |
+
for attempt in range(retries + 1):
|
| 62 |
+
try:
|
| 63 |
+
with urllib.request.urlopen(req, timeout=timeout_s) as resp:
|
| 64 |
+
with open(tmp_path, "wb") as f:
|
| 65 |
+
while True:
|
| 66 |
+
chunk = resp.read(1024 * 256)
|
| 67 |
+
if not chunk:
|
| 68 |
+
break
|
| 69 |
+
f.write(chunk)
|
| 70 |
+
os.replace(tmp_path, task.out_path)
|
| 71 |
+
return ("downloaded", None)
|
| 72 |
+
except (urllib.error.URLError, urllib.error.HTTPError, TimeoutError, OSError) as e:
|
| 73 |
+
last_err = e
|
| 74 |
+
try:
|
| 75 |
+
if tmp_path.exists():
|
| 76 |
+
tmp_path.unlink()
|
| 77 |
+
except OSError:
|
| 78 |
+
pass
|
| 79 |
+
if attempt < retries:
|
| 80 |
+
time.sleep(min(10.0, 0.5 * (2**attempt)))
|
| 81 |
+
continue
|
| 82 |
+
return ("failed", f"{type(last_err).__name__}: {last_err}")
|
| 83 |
+
|
| 84 |
+
return ("failed", f"{type(last_err).__name__}: {last_err}")
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def _build_tasks(
|
| 88 |
+
base_url: str,
|
| 89 |
+
out_dir: Path,
|
| 90 |
+
cases: list[str],
|
| 91 |
+
start_date: dt.date,
|
| 92 |
+
end_date: dt.date,
|
| 93 |
+
) -> list[Task]:
|
| 94 |
+
tasks: list[Task] = []
|
| 95 |
+
for case in cases:
|
| 96 |
+
for d in _iter_dates(start_date, end_date):
|
| 97 |
+
date_str = d.isoformat()
|
| 98 |
+
url = f"{base_url}/matpower/{case}/{date_str}.json.gz"
|
| 99 |
+
out_path = out_dir / case / f"{date_str}.json.gz"
|
| 100 |
+
tasks.append(Task(case=case, date=d, url=url, out_path=out_path))
|
| 101 |
+
return tasks
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def _parse_date(s: str) -> dt.date:
|
| 105 |
+
return dt.date.fromisoformat(s)
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
def main(argv: list[str]) -> int:
|
| 109 |
+
parser = argparse.ArgumentParser()
|
| 110 |
+
parser.add_argument("--instances-md", type=Path, default=_default_instances_md_path())
|
| 111 |
+
parser.add_argument("--base-url", type=str, default=BASE_URL_DEFAULT)
|
| 112 |
+
parser.add_argument(
|
| 113 |
+
"--out-dir",
|
| 114 |
+
type=Path,
|
| 115 |
+
default=(Path(__file__).resolve().parents[2] / "instances" / "matpower"),
|
| 116 |
+
)
|
| 117 |
+
parser.add_argument("--start-date", type=_parse_date, default=dt.date(2017, 1, 1))
|
| 118 |
+
parser.add_argument("--end-date", type=_parse_date, default=dt.date(2017, 12, 31))
|
| 119 |
+
parser.add_argument("--workers", type=int, default=min(32, (os.cpu_count() or 4) * 4))
|
| 120 |
+
parser.add_argument("--timeout", type=float, default=60.0)
|
| 121 |
+
parser.add_argument("--retries", type=int, default=3)
|
| 122 |
+
parser.add_argument("--force", action="store_true")
|
| 123 |
+
parser.add_argument("--dry-run", action="store_true")
|
| 124 |
+
parser.add_argument("--list-cases", action="store_true")
|
| 125 |
+
args = parser.parse_args(argv)
|
| 126 |
+
|
| 127 |
+
instances_md_path: Path = args.instances_md
|
| 128 |
+
if not instances_md_path.exists():
|
| 129 |
+
raise FileNotFoundError(str(instances_md_path))
|
| 130 |
+
|
| 131 |
+
cases = _parse_matpower_cases_from_instances_md(instances_md_path)
|
| 132 |
+
if args.list_cases:
|
| 133 |
+
for c in cases:
|
| 134 |
+
print(c)
|
| 135 |
+
return 0
|
| 136 |
+
|
| 137 |
+
out_dir: Path = args.out_dir
|
| 138 |
+
tasks = _build_tasks(
|
| 139 |
+
base_url=args.base_url.rstrip("/"),
|
| 140 |
+
out_dir=out_dir,
|
| 141 |
+
cases=cases,
|
| 142 |
+
start_date=args.start_date,
|
| 143 |
+
end_date=args.end_date,
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
print(f"cases={len(cases)} files={len(tasks)} out_dir={out_dir}")
|
| 147 |
+
if args.dry_run:
|
| 148 |
+
for t in tasks[:10]:
|
| 149 |
+
print(f"{t.url} -> {t.out_path}")
|
| 150 |
+
if len(tasks) > 10:
|
| 151 |
+
print("...")
|
| 152 |
+
return 0
|
| 153 |
+
|
| 154 |
+
downloaded = 0
|
| 155 |
+
skipped = 0
|
| 156 |
+
failed = 0
|
| 157 |
+
total = len(tasks)
|
| 158 |
+
t0 = time.time()
|
| 159 |
+
last_print = 0.0
|
| 160 |
+
|
| 161 |
+
with ThreadPoolExecutor(max_workers=max(1, args.workers)) as ex:
|
| 162 |
+
fut_to_task = {
|
| 163 |
+
ex.submit(_download_one, t, args.timeout, args.retries, args.force): t for t in tasks
|
| 164 |
+
}
|
| 165 |
+
for i, fut in enumerate(as_completed(fut_to_task), start=1):
|
| 166 |
+
status, err = fut.result()
|
| 167 |
+
if status == "downloaded":
|
| 168 |
+
downloaded += 1
|
| 169 |
+
elif status == "skipped":
|
| 170 |
+
skipped += 1
|
| 171 |
+
else:
|
| 172 |
+
failed += 1
|
| 173 |
+
task = fut_to_task[fut]
|
| 174 |
+
sys.stderr.write(f"FAILED {task.url} -> {task.out_path} ({err})\n")
|
| 175 |
+
|
| 176 |
+
now = time.time()
|
| 177 |
+
if now - last_print >= 1.0 or i == total:
|
| 178 |
+
elapsed = max(0.001, now - t0)
|
| 179 |
+
rate = i / elapsed
|
| 180 |
+
print(
|
| 181 |
+
f"{i}/{total} downloaded={downloaded} skipped={skipped} failed={failed} rate={rate:.1f}/s"
|
| 182 |
+
)
|
| 183 |
+
last_print = now
|
| 184 |
+
|
| 185 |
+
if failed:
|
| 186 |
+
return 2
|
| 187 |
+
return 0
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
if __name__ == "__main__":
|
| 191 |
+
raise SystemExit(main(sys.argv[1:]))
|
benchmark/scripts/table.py
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import pandas as pd
|
| 7 |
+
import re
|
| 8 |
+
from tabulate import tabulate
|
| 9 |
+
from colorama import init, Fore, Back, Style
|
| 10 |
+
|
| 11 |
+
init()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def process_all_log_files():
|
| 15 |
+
pathlist = list(Path(".").glob("results/**/*.log"))
|
| 16 |
+
rows = []
|
| 17 |
+
for path in pathlist:
|
| 18 |
+
if ".ipy" in str(path):
|
| 19 |
+
continue
|
| 20 |
+
row = process(str(path))
|
| 21 |
+
rows += [row]
|
| 22 |
+
df = pd.DataFrame(rows)
|
| 23 |
+
df = df.sort_values(["Group", "Buses"])
|
| 24 |
+
df.index = range(len(df))
|
| 25 |
+
print("Writing tables/benchmark.csv")
|
| 26 |
+
df.to_csv("tables/benchmark.csv", index_label="Index")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def process(filename):
|
| 30 |
+
parts = filename.replace(".log", "").split("/")
|
| 31 |
+
group_name = parts[1]
|
| 32 |
+
instance_name = "/".join(parts[2:-1])
|
| 33 |
+
sample_name = parts[-1]
|
| 34 |
+
nodes = 0.0
|
| 35 |
+
optimize_time = 0.0
|
| 36 |
+
simplex_iterations = 0.0
|
| 37 |
+
primal_bound = None
|
| 38 |
+
dual_bound = None
|
| 39 |
+
gap = None
|
| 40 |
+
root_obj = None
|
| 41 |
+
root_iterations = 0.0
|
| 42 |
+
root_time = 0.0
|
| 43 |
+
n_rows_orig, n_rows_presolved = None, None
|
| 44 |
+
n_cols_orig, n_cols_presolved = None, None
|
| 45 |
+
n_nz_orig, n_nz_presolved = None, None
|
| 46 |
+
n_cont_vars_presolved, n_bin_vars_presolved = None, None
|
| 47 |
+
read_time, model_time, isf_time, total_time = None, None, None, None
|
| 48 |
+
cb_calls, cb_time = 0, 0.0
|
| 49 |
+
transmission_count, transmission_time, transmission_calls = 0, 0.0, 0
|
| 50 |
+
|
| 51 |
+
# m = re.search("case([0-9]*)", instance_name)
|
| 52 |
+
# n_buses = int(m.group(1))
|
| 53 |
+
n_buses = 0
|
| 54 |
+
validation_errors = 0
|
| 55 |
+
|
| 56 |
+
with open(filename) as file:
|
| 57 |
+
for line in file.readlines():
|
| 58 |
+
m = re.search(
|
| 59 |
+
r"Explored ([0-9.e+]*) nodes \(([0-9.e+]*) simplex iterations\) in ([0-9.e+]*) seconds",
|
| 60 |
+
line,
|
| 61 |
+
)
|
| 62 |
+
if m is not None:
|
| 63 |
+
nodes += int(m.group(1))
|
| 64 |
+
simplex_iterations += int(m.group(2))
|
| 65 |
+
optimize_time += float(m.group(3))
|
| 66 |
+
|
| 67 |
+
m = re.search(
|
| 68 |
+
r"Best objective ([0-9.e+]*), best bound ([0-9.e+]*), gap ([0-9.e+]*)\%",
|
| 69 |
+
line,
|
| 70 |
+
)
|
| 71 |
+
if m is not None:
|
| 72 |
+
primal_bound = float(m.group(1))
|
| 73 |
+
dual_bound = float(m.group(2))
|
| 74 |
+
gap = round(float(m.group(3)), 3)
|
| 75 |
+
|
| 76 |
+
m = re.search(
|
| 77 |
+
r"Root relaxation: objective ([0-9.e+]*), ([0-9.e+]*) iterations, ([0-9.e+]*) seconds",
|
| 78 |
+
line,
|
| 79 |
+
)
|
| 80 |
+
if m is not None:
|
| 81 |
+
root_obj = float(m.group(1))
|
| 82 |
+
root_iterations += int(m.group(2))
|
| 83 |
+
root_time += float(m.group(3))
|
| 84 |
+
|
| 85 |
+
m = re.search(
|
| 86 |
+
r"Presolved: ([0-9.e+]*) rows, ([0-9.e+]*) columns, ([0-9.e+]*) nonzeros",
|
| 87 |
+
line,
|
| 88 |
+
)
|
| 89 |
+
if m is not None:
|
| 90 |
+
n_rows_presolved = int(m.group(1))
|
| 91 |
+
n_cols_presolved = int(m.group(2))
|
| 92 |
+
n_nz_presolved = int(m.group(3))
|
| 93 |
+
|
| 94 |
+
m = re.search(
|
| 95 |
+
r"Optimize a model with ([0-9.e+]*) rows, ([0-9.e+]*) columns and ([0-9.e+]*) nonzeros",
|
| 96 |
+
line,
|
| 97 |
+
)
|
| 98 |
+
if m is not None:
|
| 99 |
+
n_rows_orig = int(m.group(1))
|
| 100 |
+
n_cols_orig = int(m.group(2))
|
| 101 |
+
n_nz_orig = int(m.group(3))
|
| 102 |
+
|
| 103 |
+
m = re.search(
|
| 104 |
+
r"Variable types: ([0-9.e+]*) continuous, ([0-9.e+]*) integer \(([0-9.e+]*) binary\)",
|
| 105 |
+
line,
|
| 106 |
+
)
|
| 107 |
+
if m is not None:
|
| 108 |
+
n_cont_vars_presolved = int(m.group(1))
|
| 109 |
+
n_bin_vars_presolved = int(m.group(3))
|
| 110 |
+
|
| 111 |
+
m = re.search(r"Read problem in ([0-9.e+]*) seconds", line)
|
| 112 |
+
if m is not None:
|
| 113 |
+
read_time = float(m.group(1))
|
| 114 |
+
|
| 115 |
+
m = re.search(r"Computed ISF in ([0-9.e+]*) seconds", line)
|
| 116 |
+
if m is not None:
|
| 117 |
+
isf_time = float(m.group(1))
|
| 118 |
+
|
| 119 |
+
m = re.search(r"Built model in ([0-9.e+]*) seconds", line)
|
| 120 |
+
if m is not None:
|
| 121 |
+
model_time = float(m.group(1))
|
| 122 |
+
|
| 123 |
+
m = re.search(r"Total time was ([0-9.e+]*) seconds", line)
|
| 124 |
+
if m is not None:
|
| 125 |
+
total_time = float(m.group(1))
|
| 126 |
+
|
| 127 |
+
m = re.search(
|
| 128 |
+
r"User-callback calls ([0-9.e+]*), time in user-callback ([0-9.e+]*) sec",
|
| 129 |
+
line,
|
| 130 |
+
)
|
| 131 |
+
if m is not None:
|
| 132 |
+
cb_calls = int(m.group(1))
|
| 133 |
+
cb_time = float(m.group(2))
|
| 134 |
+
|
| 135 |
+
m = re.search(r"Verified transmission limits in ([0-9.e+]*) sec", line)
|
| 136 |
+
if m is not None:
|
| 137 |
+
transmission_time += float(m.group(1))
|
| 138 |
+
transmission_calls += 1
|
| 139 |
+
|
| 140 |
+
m = re.search(r".*MW overflow", line)
|
| 141 |
+
if m is not None:
|
| 142 |
+
transmission_count += 1
|
| 143 |
+
|
| 144 |
+
m = re.search(r".*Found ([0-9]*) validation errors", line)
|
| 145 |
+
if m is not None:
|
| 146 |
+
validation_errors += int(m.group(1))
|
| 147 |
+
print(
|
| 148 |
+
f"{Fore.YELLOW}{Style.BRIGHT}Warning:{Style.RESET_ALL} {validation_errors:8d} "
|
| 149 |
+
f"{Style.DIM}validation errors in {Style.RESET_ALL}{group_name}/{instance_name}/{sample_name}"
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
return {
|
| 153 |
+
"Group": group_name,
|
| 154 |
+
"Instance": instance_name,
|
| 155 |
+
"Sample": sample_name,
|
| 156 |
+
"Optimization time (s)": optimize_time,
|
| 157 |
+
"Read instance time (s)": read_time,
|
| 158 |
+
"Model construction time (s)": model_time,
|
| 159 |
+
"ISF & LODF computation time (s)": isf_time,
|
| 160 |
+
"Total time (s)": total_time,
|
| 161 |
+
"User-callback time": cb_time,
|
| 162 |
+
"User-callback calls": cb_calls,
|
| 163 |
+
"Gap (%)": gap,
|
| 164 |
+
"B&B Nodes": nodes,
|
| 165 |
+
"Simplex iterations": simplex_iterations,
|
| 166 |
+
"Primal bound": primal_bound,
|
| 167 |
+
"Dual bound": dual_bound,
|
| 168 |
+
"Root relaxation iterations": root_iterations,
|
| 169 |
+
"Root relaxation time": root_time,
|
| 170 |
+
"Root relaxation value": root_obj,
|
| 171 |
+
"Rows": n_rows_orig,
|
| 172 |
+
"Cols": n_cols_orig,
|
| 173 |
+
"Nonzeros": n_nz_orig,
|
| 174 |
+
"Rows (presolved)": n_rows_presolved,
|
| 175 |
+
"Cols (presolved)": n_cols_presolved,
|
| 176 |
+
"Nonzeros (presolved)": n_nz_presolved,
|
| 177 |
+
"Bin vars (presolved)": n_bin_vars_presolved,
|
| 178 |
+
"Cont vars (presolved)": n_cont_vars_presolved,
|
| 179 |
+
"Buses": n_buses,
|
| 180 |
+
"Transmission screening constraints": transmission_count,
|
| 181 |
+
"Transmission screening time": transmission_time,
|
| 182 |
+
"Transmission screening calls": transmission_calls,
|
| 183 |
+
"Validation errors": validation_errors,
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
def generate_chart():
|
| 188 |
+
import pandas as pd
|
| 189 |
+
import matplotlib
|
| 190 |
+
import matplotlib.pyplot as plt
|
| 191 |
+
import seaborn as sns
|
| 192 |
+
|
| 193 |
+
matplotlib.use("Agg")
|
| 194 |
+
sns.set("talk")
|
| 195 |
+
sns.set_palette(
|
| 196 |
+
[
|
| 197 |
+
"#9b59b6",
|
| 198 |
+
"#3498db",
|
| 199 |
+
"#95a5a6",
|
| 200 |
+
"#e74c3c",
|
| 201 |
+
"#34495e",
|
| 202 |
+
"#2ecc71",
|
| 203 |
+
]
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
tables = []
|
| 207 |
+
files = ["tables/benchmark.csv"]
|
| 208 |
+
for f in files:
|
| 209 |
+
table = pd.read_csv(f, index_col=0)
|
| 210 |
+
table.loc[:, "Filename"] = f
|
| 211 |
+
tables += [table]
|
| 212 |
+
benchmark = pd.concat(tables, sort=True)
|
| 213 |
+
benchmark = benchmark.sort_values(by=["Group", "Instance"])
|
| 214 |
+
k1 = len(benchmark.groupby("Instance"))
|
| 215 |
+
k2 = len(benchmark.groupby("Group"))
|
| 216 |
+
plt.figure(figsize=(12, 0.25 * k1 * k2))
|
| 217 |
+
sns.barplot(
|
| 218 |
+
y="Instance",
|
| 219 |
+
x="Total time (s)",
|
| 220 |
+
hue="Group",
|
| 221 |
+
errcolor="k",
|
| 222 |
+
errwidth=1.25,
|
| 223 |
+
data=benchmark,
|
| 224 |
+
)
|
| 225 |
+
plt.tight_layout()
|
| 226 |
+
print("Writing tables/benchmark.png")
|
| 227 |
+
plt.savefig("tables/benchmark.png", dpi=150)
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
if __name__ == "__main__":
|
| 231 |
+
process_all_log_files()
|
| 232 |
+
generate_chart()
|
create_scuc_mps_files.jl
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using JuMP
|
| 2 |
+
using UnitCommitment
|
| 3 |
+
|
| 4 |
+
function generate_mps_files(; base_instance_path::String = "instances/matpower/case30/2017-01-01.json.gz")
|
| 5 |
+
instance_hourly = UnitCommitment.read(base_instance_path)
|
| 6 |
+
instance_hourly_noline = deepcopy(instance_hourly)
|
| 7 |
+
empty!(instance_hourly_noline.scenarios[1].lines)
|
| 8 |
+
|
| 9 |
+
model_hourly_noline = UnitCommitment.build_model(
|
| 10 |
+
instance = instance_hourly_noline,
|
| 11 |
+
formulation = UnitCommitment.Formulation(
|
| 12 |
+
transmission = UnitCommitment.ShiftFactorsFormulation(
|
| 13 |
+
precomputed_isf = zeros(0, 0),
|
| 14 |
+
precomputed_lodf = zeros(0, 0),
|
| 15 |
+
),
|
| 16 |
+
),
|
| 17 |
+
variable_names = true,
|
| 18 |
+
)
|
| 19 |
+
JuMP.write_to_file(model_hourly_noline, "uc_default_noline.mps")
|
| 20 |
+
|
| 21 |
+
model_hourly_withline = UnitCommitment.build_model(instance = instance_hourly, variable_names = true)
|
| 22 |
+
JuMP.write_to_file(model_hourly_withline, "uc_default_withline.mps")
|
| 23 |
+
|
| 24 |
+
instance_sub = UnitCommitment.convert_to_subhourly(instance_hourly, instance_hourly)
|
| 25 |
+
instance_sub_noline = deepcopy(instance_sub)
|
| 26 |
+
empty!(instance_sub_noline.scenarios[1].lines)
|
| 27 |
+
|
| 28 |
+
model_sub_noline = UnitCommitment.build_model(
|
| 29 |
+
instance = instance_sub_noline,
|
| 30 |
+
formulation = UnitCommitment.Formulation(
|
| 31 |
+
transmission = UnitCommitment.ShiftFactorsFormulation(
|
| 32 |
+
precomputed_isf = zeros(0, 0),
|
| 33 |
+
precomputed_lodf = zeros(0, 0),
|
| 34 |
+
),
|
| 35 |
+
),
|
| 36 |
+
variable_names = true,
|
| 37 |
+
)
|
| 38 |
+
JuMP.write_to_file(model_sub_noline, "uc_subhourly_noline.mps")
|
| 39 |
+
|
| 40 |
+
model_sub_withline = UnitCommitment.build_model(instance = instance_sub, variable_names = true)
|
| 41 |
+
JuMP.write_to_file(model_sub_withline, "uc_subhourly_withline.mps")
|
| 42 |
+
|
| 43 |
+
return nothing
|
| 44 |
+
end
|
| 45 |
+
|
| 46 |
+
generate_mps_files()
|
docs/Project.toml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[deps]
|
| 2 |
+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
|
| 3 |
+
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
|
| 4 |
+
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
|
| 5 |
+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
| 6 |
+
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
|
| 7 |
+
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
|
| 8 |
+
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
|
| 9 |
+
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
| 10 |
+
UnitCommitment = "64606440-39ea-11e9-0f29-3303a1d3d877"
|
docs/example/out.json
ADDED
|
@@ -0,0 +1,1158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 25 |
+
66.0,
|
| 26 |
+
66.0
|
| 27 |
+
],
|
| 28 |
+
"g5": [
|
| 29 |
+
89.50480000000002,
|
| 30 |
+
66.0,
|
| 31 |
+
66.0,
|
| 32 |
+
66.0
|
| 33 |
+
],
|
| 34 |
+
"g6": [
|
| 35 |
+
0.0,
|
| 36 |
+
0.0,
|
| 37 |
+
0.0,
|
| 38 |
+
0.0
|
| 39 |
+
]
|
| 40 |
+
},
|
| 41 |
+
"Thermal production cost ($)": {
|
| 42 |
+
"g1": [
|
| 43 |
+
2400.0,
|
| 44 |
+
2400.0,
|
| 45 |
+
2202.5599999999995,
|
| 46 |
+
2200.0
|
| 47 |
+
],
|
| 48 |
+
"g2": [
|
| 49 |
+
0.0,
|
| 50 |
+
0.0,
|
| 51 |
+
0.0,
|
| 52 |
+
0.0
|
| 53 |
+
],
|
| 54 |
+
"g3": [
|
| 55 |
+
2548.184117647059,
|
| 56 |
+
2770.6084767264697,
|
| 57 |
+
2369.07,
|
| 58 |
+
2195.211984
|
| 59 |
+
],
|
| 60 |
+
"g4": [
|
| 61 |
+
2369.07,
|
| 62 |
+
2369.07,
|
| 63 |
+
2369.07,
|
| 64 |
+
2369.07
|
| 65 |
+
],
|
| 66 |
+
"g5": [
|
| 67 |
+
3421.5803781176473,
|
| 68 |
+
2369.07,
|
| 69 |
+
2369.07,
|
| 70 |
+
2369.07
|
| 71 |
+
],
|
| 72 |
+
"g6": [
|
| 73 |
+
0.0,
|
| 74 |
+
0.0,
|
| 75 |
+
0.0,
|
| 76 |
+
0.0
|
| 77 |
+
]
|
| 78 |
+
},
|
| 79 |
+
"Startup cost ($)": {
|
| 80 |
+
"g1": [
|
| 81 |
+
2000.0,
|
| 82 |
+
0.0,
|
| 83 |
+
0.0,
|
| 84 |
+
0.0
|
| 85 |
+
],
|
| 86 |
+
"g2": [
|
| 87 |
+
4000.0,
|
| 88 |
+
0.0,
|
| 89 |
+
0.0,
|
| 90 |
+
0.0
|
| 91 |
+
],
|
| 92 |
+
"g3": [
|
| 93 |
+
2000.0,
|
| 94 |
+
0.0,
|
| 95 |
+
0.0,
|
| 96 |
+
0.0
|
| 97 |
+
],
|
| 98 |
+
"g4": [
|
| 99 |
+
0.0,
|
| 100 |
+
0.0,
|
| 101 |
+
0.0,
|
| 102 |
+
0.0
|
| 103 |
+
],
|
| 104 |
+
"g5": [
|
| 105 |
+
0.0,
|
| 106 |
+
0.0,
|
| 107 |
+
0.0,
|
| 108 |
+
0.0
|
| 109 |
+
],
|
| 110 |
+
"g6": [
|
| 111 |
+
0.0,
|
| 112 |
+
0.0,
|
| 113 |
+
0.0,
|
| 114 |
+
0.0
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
"Is on": {
|
| 118 |
+
"g1": [
|
| 119 |
+
1.0,
|
| 120 |
+
1.0,
|
| 121 |
+
1.0,
|
| 122 |
+
1.0
|
| 123 |
+
],
|
| 124 |
+
"g2": [
|
| 125 |
+
1.0,
|
| 126 |
+
1.0,
|
| 127 |
+
1.0,
|
| 128 |
+
1.0
|
| 129 |
+
],
|
| 130 |
+
"g3": [
|
| 131 |
+
1.0,
|
| 132 |
+
1.0,
|
| 133 |
+
1.0,
|
| 134 |
+
1.0
|
| 135 |
+
],
|
| 136 |
+
"g4": [
|
| 137 |
+
1.0,
|
| 138 |
+
1.0,
|
| 139 |
+
1.0,
|
| 140 |
+
1.0
|
| 141 |
+
],
|
| 142 |
+
"g5": [
|
| 143 |
+
1.0,
|
| 144 |
+
1.0,
|
| 145 |
+
1.0,
|
| 146 |
+
1.0
|
| 147 |
+
],
|
| 148 |
+
"g6": [
|
| 149 |
+
0.0,
|
| 150 |
+
0.0,
|
| 151 |
+
0.0,
|
| 152 |
+
0.0
|
| 153 |
+
]
|
| 154 |
+
},
|
| 155 |
+
"Switch on": {
|
| 156 |
+
"g1": [
|
| 157 |
+
1.0,
|
| 158 |
+
0.0,
|
| 159 |
+
0.0,
|
| 160 |
+
0.0
|
| 161 |
+
],
|
| 162 |
+
"g2": [
|
| 163 |
+
1.0,
|
| 164 |
+
0.0,
|
| 165 |
+
0.0,
|
| 166 |
+
0.0
|
| 167 |
+
],
|
| 168 |
+
"g3": [
|
| 169 |
+
1.0,
|
| 170 |
+
0.0,
|
| 171 |
+
0.0,
|
| 172 |
+
0.0
|
| 173 |
+
],
|
| 174 |
+
"g4": [
|
| 175 |
+
1.0,
|
| 176 |
+
0.0,
|
| 177 |
+
0.0,
|
| 178 |
+
0.0
|
| 179 |
+
],
|
| 180 |
+
"g5": [
|
| 181 |
+
1.0,
|
| 182 |
+
0.0,
|
| 183 |
+
0.0,
|
| 184 |
+
0.0
|
| 185 |
+
],
|
| 186 |
+
"g6": [
|
| 187 |
+
0.0,
|
| 188 |
+
0.0,
|
| 189 |
+
-0.0,
|
| 190 |
+
0.0
|
| 191 |
+
]
|
| 192 |
+
},
|
| 193 |
+
"Switch off": {
|
| 194 |
+
"g1": [
|
| 195 |
+
0.0,
|
| 196 |
+
0.0,
|
| 197 |
+
0.0,
|
| 198 |
+
0.0
|
| 199 |
+
],
|
| 200 |
+
"g2": [
|
| 201 |
+
0.0,
|
| 202 |
+
0.0,
|
| 203 |
+
0.0,
|
| 204 |
+
0.0
|
| 205 |
+
],
|
| 206 |
+
"g3": [
|
| 207 |
+
0.0,
|
| 208 |
+
0.0,
|
| 209 |
+
0.0,
|
| 210 |
+
0.0
|
| 211 |
+
],
|
| 212 |
+
"g4": [
|
| 213 |
+
0.0,
|
| 214 |
+
0.0,
|
| 215 |
+
0.0,
|
| 216 |
+
0.0
|
| 217 |
+
],
|
| 218 |
+
"g5": [
|
| 219 |
+
0.0,
|
| 220 |
+
0.0,
|
| 221 |
+
0.0,
|
| 222 |
+
0.0
|
| 223 |
+
],
|
| 224 |
+
"g6": [
|
| 225 |
+
0.0,
|
| 226 |
+
-0.0,
|
| 227 |
+
0.0,
|
| 228 |
+
-0.0
|
| 229 |
+
]
|
| 230 |
+
},
|
| 231 |
+
"Net injection (MW)": {
|
| 232 |
+
"b1": [
|
| 233 |
+
135.0,
|
| 234 |
+
135.0,
|
| 235 |
+
130.064,
|
| 236 |
+
130.0
|
| 237 |
+
],
|
| 238 |
+
"b2": [
|
| 239 |
+
-26.01527,
|
| 240 |
+
-24.46212,
|
| 241 |
+
-23.29725,
|
| 242 |
+
-22.90897
|
| 243 |
+
],
|
| 244 |
+
"b3": [
|
| 245 |
+
-92.93263,
|
| 246 |
+
-81.22318,
|
| 247 |
+
-85.1337,
|
| 248 |
+
-88.01854
|
| 249 |
+
],
|
| 250 |
+
"b4": [
|
| 251 |
+
-57.30552,
|
| 252 |
+
-53.88429,
|
| 253 |
+
-51.31838,
|
| 254 |
+
-50.46307
|
| 255 |
+
],
|
| 256 |
+
"b5": [
|
| 257 |
+
-9.11134,
|
| 258 |
+
-8.56738,
|
| 259 |
+
-8.15941,
|
| 260 |
+
-8.02342
|
| 261 |
+
],
|
| 262 |
+
"b6": [
|
| 263 |
+
52.57277,
|
| 264 |
+
53.37439,
|
| 265 |
+
53.97561,
|
| 266 |
+
54.17602
|
| 267 |
+
],
|
| 268 |
+
"b7": [
|
| 269 |
+
0.0,
|
| 270 |
+
0.0,
|
| 271 |
+
0.0,
|
| 272 |
+
0.0
|
| 273 |
+
],
|
| 274 |
+
"b8": [
|
| 275 |
+
89.5048,
|
| 276 |
+
66.0,
|
| 277 |
+
66.0,
|
| 278 |
+
66.0
|
| 279 |
+
],
|
| 280 |
+
"b9": [
|
| 281 |
+
-35.36638,
|
| 282 |
+
-33.25495,
|
| 283 |
+
-31.67138,
|
| 284 |
+
-31.14353
|
| 285 |
+
],
|
| 286 |
+
"b10": [
|
| 287 |
+
-10.78974,
|
| 288 |
+
-10.14558,
|
| 289 |
+
-9.66246,
|
| 290 |
+
-9.50141
|
| 291 |
+
],
|
| 292 |
+
"b11": [
|
| 293 |
+
-4.19601,
|
| 294 |
+
-3.9455,
|
| 295 |
+
-3.75762,
|
| 296 |
+
-3.69499
|
| 297 |
+
],
|
| 298 |
+
"b12": [
|
| 299 |
+
-7.31305,
|
| 300 |
+
-6.87645,
|
| 301 |
+
-6.549,
|
| 302 |
+
-6.43985
|
| 303 |
+
],
|
| 304 |
+
"b13": [
|
| 305 |
+
-16.18461,
|
| 306 |
+
-15.21837,
|
| 307 |
+
-14.49368,
|
| 308 |
+
-14.25212
|
| 309 |
+
],
|
| 310 |
+
"b14": [
|
| 311 |
+
-17.86302,
|
| 312 |
+
-16.79657,
|
| 313 |
+
-15.99673,
|
| 314 |
+
-15.73012
|
| 315 |
+
]
|
| 316 |
+
},
|
| 317 |
+
"Load curtail (MW)": {
|
| 318 |
+
"b1": [
|
| 319 |
+
0.0,
|
| 320 |
+
0.0,
|
| 321 |
+
0.0,
|
| 322 |
+
0.0
|
| 323 |
+
],
|
| 324 |
+
"b2": [
|
| 325 |
+
0.0,
|
| 326 |
+
0.0,
|
| 327 |
+
0.0,
|
| 328 |
+
0.0
|
| 329 |
+
],
|
| 330 |
+
"b3": [
|
| 331 |
+
0.0,
|
| 332 |
+
0.0,
|
| 333 |
+
0.0,
|
| 334 |
+
0.0
|
| 335 |
+
],
|
| 336 |
+
"b4": [
|
| 337 |
+
-0.0,
|
| 338 |
+
0.0,
|
| 339 |
+
0.0,
|
| 340 |
+
0.0
|
| 341 |
+
],
|
| 342 |
+
"b5": [
|
| 343 |
+
0.0,
|
| 344 |
+
0.0,
|
| 345 |
+
0.0,
|
| 346 |
+
0.0
|
| 347 |
+
],
|
| 348 |
+
"b6": [
|
| 349 |
+
0.0,
|
| 350 |
+
0.0,
|
| 351 |
+
0.0,
|
| 352 |
+
0.0
|
| 353 |
+
],
|
| 354 |
+
"b7": [
|
| 355 |
+
0.0,
|
| 356 |
+
0.0,
|
| 357 |
+
0.0,
|
| 358 |
+
0.0
|
| 359 |
+
],
|
| 360 |
+
"b8": [
|
| 361 |
+
0.0,
|
| 362 |
+
0.0,
|
| 363 |
+
0.0,
|
| 364 |
+
0.0
|
| 365 |
+
],
|
| 366 |
+
"b9": [
|
| 367 |
+
0.0,
|
| 368 |
+
0.0,
|
| 369 |
+
0.0,
|
| 370 |
+
0.0
|
| 371 |
+
],
|
| 372 |
+
"b10": [
|
| 373 |
+
0.0,
|
| 374 |
+
0.0,
|
| 375 |
+
0.0,
|
| 376 |
+
0.0
|
| 377 |
+
],
|
| 378 |
+
"b11": [
|
| 379 |
+
0.0,
|
| 380 |
+
0.0,
|
| 381 |
+
0.0,
|
| 382 |
+
0.0
|
| 383 |
+
],
|
| 384 |
+
"b12": [
|
| 385 |
+
0.0,
|
| 386 |
+
0.0,
|
| 387 |
+
0.0,
|
| 388 |
+
0.0
|
| 389 |
+
],
|
| 390 |
+
"b13": [
|
| 391 |
+
0.0,
|
| 392 |
+
0.0,
|
| 393 |
+
0.0,
|
| 394 |
+
0.0
|
| 395 |
+
],
|
| 396 |
+
"b14": [
|
| 397 |
+
0.0,
|
| 398 |
+
0.0,
|
| 399 |
+
0.0,
|
| 400 |
+
0.0
|
| 401 |
+
]
|
| 402 |
+
},
|
| 403 |
+
"Line overflow (MW)": {
|
| 404 |
+
"l1": [
|
| 405 |
+
0.0,
|
| 406 |
+
0.0,
|
| 407 |
+
0.0,
|
| 408 |
+
0.0
|
| 409 |
+
],
|
| 410 |
+
"l2": [
|
| 411 |
+
0.0,
|
| 412 |
+
0.0,
|
| 413 |
+
0.0,
|
| 414 |
+
0.0
|
| 415 |
+
],
|
| 416 |
+
"l3": [
|
| 417 |
+
0.0,
|
| 418 |
+
0.0,
|
| 419 |
+
0.0,
|
| 420 |
+
0.0
|
| 421 |
+
],
|
| 422 |
+
"l4": [
|
| 423 |
+
0.0,
|
| 424 |
+
0.0,
|
| 425 |
+
0.0,
|
| 426 |
+
0.0
|
| 427 |
+
],
|
| 428 |
+
"l5": [
|
| 429 |
+
0.0,
|
| 430 |
+
0.0,
|
| 431 |
+
0.0,
|
| 432 |
+
0.0
|
| 433 |
+
],
|
| 434 |
+
"l6": [
|
| 435 |
+
0.0,
|
| 436 |
+
0.0,
|
| 437 |
+
0.0,
|
| 438 |
+
0.0
|
| 439 |
+
],
|
| 440 |
+
"l7": [
|
| 441 |
+
0.0,
|
| 442 |
+
0.0,
|
| 443 |
+
0.0,
|
| 444 |
+
0.0
|
| 445 |
+
],
|
| 446 |
+
"l8": [
|
| 447 |
+
0.0,
|
| 448 |
+
0.0,
|
| 449 |
+
0.0,
|
| 450 |
+
0.0
|
| 451 |
+
],
|
| 452 |
+
"l9": [
|
| 453 |
+
0.0,
|
| 454 |
+
0.0,
|
| 455 |
+
0.0,
|
| 456 |
+
0.0
|
| 457 |
+
],
|
| 458 |
+
"l10": [
|
| 459 |
+
0.0,
|
| 460 |
+
0.0,
|
| 461 |
+
0.0,
|
| 462 |
+
0.0
|
| 463 |
+
],
|
| 464 |
+
"l11": [
|
| 465 |
+
0.0,
|
| 466 |
+
0.0,
|
| 467 |
+
0.0,
|
| 468 |
+
0.0
|
| 469 |
+
],
|
| 470 |
+
"l12": [
|
| 471 |
+
0.0,
|
| 472 |
+
0.0,
|
| 473 |
+
0.0,
|
| 474 |
+
0.0
|
| 475 |
+
],
|
| 476 |
+
"l13": [
|
| 477 |
+
0.0,
|
| 478 |
+
0.0,
|
| 479 |
+
0.0,
|
| 480 |
+
0.0
|
| 481 |
+
],
|
| 482 |
+
"l14": [
|
| 483 |
+
0.0,
|
| 484 |
+
0.0,
|
| 485 |
+
0.0,
|
| 486 |
+
0.0
|
| 487 |
+
],
|
| 488 |
+
"l15": [
|
| 489 |
+
0.0,
|
| 490 |
+
0.0,
|
| 491 |
+
0.0,
|
| 492 |
+
0.0
|
| 493 |
+
],
|
| 494 |
+
"l16": [
|
| 495 |
+
0.0,
|
| 496 |
+
0.0,
|
| 497 |
+
0.0,
|
| 498 |
+
0.0
|
| 499 |
+
],
|
| 500 |
+
"l17": [
|
| 501 |
+
0.0,
|
| 502 |
+
0.0,
|
| 503 |
+
0.0,
|
| 504 |
+
0.0
|
| 505 |
+
],
|
| 506 |
+
"l18": [
|
| 507 |
+
0.0,
|
| 508 |
+
0.0,
|
| 509 |
+
0.0,
|
| 510 |
+
0.0
|
| 511 |
+
],
|
| 512 |
+
"l19": [
|
| 513 |
+
0.0,
|
| 514 |
+
0.0,
|
| 515 |
+
0.0,
|
| 516 |
+
0.0
|
| 517 |
+
],
|
| 518 |
+
"l20": [
|
| 519 |
+
0.0,
|
| 520 |
+
0.0,
|
| 521 |
+
0.0,
|
| 522 |
+
0.0
|
| 523 |
+
]
|
| 524 |
+
},
|
| 525 |
+
"Price-sensitive loads (MW)": {
|
| 526 |
+
"ps1": [
|
| 527 |
+
50.0,
|
| 528 |
+
50.0,
|
| 529 |
+
50.0,
|
| 530 |
+
50.0
|
| 531 |
+
]
|
| 532 |
+
},
|
| 533 |
+
"Spinning reserve (MW)": {
|
| 534 |
+
"r1": {
|
| 535 |
+
"g2": [
|
| 536 |
+
55.5048,
|
| 537 |
+
66.0,
|
| 538 |
+
98.0,
|
| 539 |
+
66.0
|
| 540 |
+
],
|
| 541 |
+
"g3": [
|
| 542 |
+
0.0,
|
| 543 |
+
0.0,
|
| 544 |
+
0.0,
|
| 545 |
+
0.0
|
| 546 |
+
],
|
| 547 |
+
"g4": [
|
| 548 |
+
34.0,
|
| 549 |
+
0.0,
|
| 550 |
+
2.0,
|
| 551 |
+
0.0
|
| 552 |
+
],
|
| 553 |
+
"g5": [
|
| 554 |
+
10.49519999999999,
|
| 555 |
+
34.0,
|
| 556 |
+
0.0,
|
| 557 |
+
34.0
|
| 558 |
+
],
|
| 559 |
+
"g6": [
|
| 560 |
+
0.0,
|
| 561 |
+
0.0,
|
| 562 |
+
0.0,
|
| 563 |
+
0.0
|
| 564 |
+
]
|
| 565 |
+
}
|
| 566 |
+
},
|
| 567 |
+
"Spinning reserve shortfall (MW)": {
|
| 568 |
+
"r1": [
|
| 569 |
+
0.0,
|
| 570 |
+
0.0,
|
| 571 |
+
0.0,
|
| 572 |
+
0.0
|
| 573 |
+
]
|
| 574 |
+
},
|
| 575 |
+
"Up-flexiramp (MW)": {},
|
| 576 |
+
"Up-flexiramp shortfall (MW)": {},
|
| 577 |
+
"Down-flexiramp (MW)": {},
|
| 578 |
+
"Down-flexiramp shortfall (MW)": {}
|
| 579 |
+
},
|
| 580 |
+
"s2": {
|
| 581 |
+
"Thermal production (MW)": {
|
| 582 |
+
"g1": [
|
| 583 |
+
135.0,
|
| 584 |
+
135.0,
|
| 585 |
+
130.064,
|
| 586 |
+
130.0
|
| 587 |
+
],
|
| 588 |
+
"g2": [
|
| 589 |
+
0.0,
|
| 590 |
+
0.0,
|
| 591 |
+
0.0,
|
| 592 |
+
0.0
|
| 593 |
+
],
|
| 594 |
+
"g3": [
|
| 595 |
+
66.0,
|
| 596 |
+
74.96720999999998,
|
| 597 |
+
66.0,
|
| 598 |
+
66.0
|
| 599 |
+
],
|
| 600 |
+
"g4": [
|
| 601 |
+
93.50480000000002,
|
| 602 |
+
66.0,
|
| 603 |
+
66.0,
|
| 604 |
+
61.4296
|
| 605 |
+
],
|
| 606 |
+
"g5": [
|
| 607 |
+
66.0,
|
| 608 |
+
66.0,
|
| 609 |
+
66.0,
|
| 610 |
+
66.0
|
| 611 |
+
],
|
| 612 |
+
"g6": [
|
| 613 |
+
0.0,
|
| 614 |
+
0.0,
|
| 615 |
+
0.0,
|
| 616 |
+
0.0
|
| 617 |
+
]
|
| 618 |
+
},
|
| 619 |
+
"Thermal production cost ($)": {
|
| 620 |
+
"g1": [
|
| 621 |
+
2400.0,
|
| 622 |
+
2400.0,
|
| 623 |
+
2202.5599999999995,
|
| 624 |
+
2200.0
|
| 625 |
+
],
|
| 626 |
+
"g2": [
|
| 627 |
+
0.0,
|
| 628 |
+
0.0,
|
| 629 |
+
0.0,
|
| 630 |
+
0.0
|
| 631 |
+
],
|
| 632 |
+
"g3": [
|
| 633 |
+
2369.07,
|
| 634 |
+
2770.6084767264697,
|
| 635 |
+
2369.07,
|
| 636 |
+
2369.07
|
| 637 |
+
],
|
| 638 |
+
"g4": [
|
| 639 |
+
3600.6944957647065,
|
| 640 |
+
2369.07,
|
| 641 |
+
2369.07,
|
| 642 |
+
2195.2119840000005
|
| 643 |
+
],
|
| 644 |
+
"g5": [
|
| 645 |
+
2369.07,
|
| 646 |
+
2369.07,
|
| 647 |
+
2369.07,
|
| 648 |
+
2369.07
|
| 649 |
+
],
|
| 650 |
+
"g6": [
|
| 651 |
+
0.0,
|
| 652 |
+
0.0,
|
| 653 |
+
0.0,
|
| 654 |
+
0.0
|
| 655 |
+
]
|
| 656 |
+
},
|
| 657 |
+
"Startup cost ($)": {
|
| 658 |
+
"g1": [
|
| 659 |
+
2000.0,
|
| 660 |
+
0.0,
|
| 661 |
+
0.0,
|
| 662 |
+
0.0
|
| 663 |
+
],
|
| 664 |
+
"g2": [
|
| 665 |
+
4000.0,
|
| 666 |
+
0.0,
|
| 667 |
+
0.0,
|
| 668 |
+
0.0
|
| 669 |
+
],
|
| 670 |
+
"g3": [
|
| 671 |
+
2000.0,
|
| 672 |
+
0.0,
|
| 673 |
+
0.0,
|
| 674 |
+
0.0
|
| 675 |
+
],
|
| 676 |
+
"g4": [
|
| 677 |
+
0.0,
|
| 678 |
+
0.0,
|
| 679 |
+
0.0,
|
| 680 |
+
0.0
|
| 681 |
+
],
|
| 682 |
+
"g5": [
|
| 683 |
+
0.0,
|
| 684 |
+
0.0,
|
| 685 |
+
0.0,
|
| 686 |
+
0.0
|
| 687 |
+
],
|
| 688 |
+
"g6": [
|
| 689 |
+
0.0,
|
| 690 |
+
0.0,
|
| 691 |
+
0.0,
|
| 692 |
+
0.0
|
| 693 |
+
]
|
| 694 |
+
},
|
| 695 |
+
"Is on": {
|
| 696 |
+
"g1": [
|
| 697 |
+
1.0,
|
| 698 |
+
1.0,
|
| 699 |
+
1.0,
|
| 700 |
+
1.0
|
| 701 |
+
],
|
| 702 |
+
"g2": [
|
| 703 |
+
1.0,
|
| 704 |
+
1.0,
|
| 705 |
+
1.0,
|
| 706 |
+
1.0
|
| 707 |
+
],
|
| 708 |
+
"g3": [
|
| 709 |
+
1.0,
|
| 710 |
+
1.0,
|
| 711 |
+
1.0,
|
| 712 |
+
1.0
|
| 713 |
+
],
|
| 714 |
+
"g4": [
|
| 715 |
+
1.0,
|
| 716 |
+
1.0,
|
| 717 |
+
1.0,
|
| 718 |
+
1.0
|
| 719 |
+
],
|
| 720 |
+
"g5": [
|
| 721 |
+
1.0,
|
| 722 |
+
1.0,
|
| 723 |
+
1.0,
|
| 724 |
+
1.0
|
| 725 |
+
],
|
| 726 |
+
"g6": [
|
| 727 |
+
0.0,
|
| 728 |
+
0.0,
|
| 729 |
+
0.0,
|
| 730 |
+
0.0
|
| 731 |
+
]
|
| 732 |
+
},
|
| 733 |
+
"Switch on": {
|
| 734 |
+
"g1": [
|
| 735 |
+
1.0,
|
| 736 |
+
0.0,
|
| 737 |
+
0.0,
|
| 738 |
+
0.0
|
| 739 |
+
],
|
| 740 |
+
"g2": [
|
| 741 |
+
1.0,
|
| 742 |
+
0.0,
|
| 743 |
+
0.0,
|
| 744 |
+
0.0
|
| 745 |
+
],
|
| 746 |
+
"g3": [
|
| 747 |
+
1.0,
|
| 748 |
+
0.0,
|
| 749 |
+
0.0,
|
| 750 |
+
0.0
|
| 751 |
+
],
|
| 752 |
+
"g4": [
|
| 753 |
+
1.0,
|
| 754 |
+
0.0,
|
| 755 |
+
0.0,
|
| 756 |
+
0.0
|
| 757 |
+
],
|
| 758 |
+
"g5": [
|
| 759 |
+
1.0,
|
| 760 |
+
0.0,
|
| 761 |
+
0.0,
|
| 762 |
+
0.0
|
| 763 |
+
],
|
| 764 |
+
"g6": [
|
| 765 |
+
0.0,
|
| 766 |
+
0.0,
|
| 767 |
+
-0.0,
|
| 768 |
+
0.0
|
| 769 |
+
]
|
| 770 |
+
},
|
| 771 |
+
"Switch off": {
|
| 772 |
+
"g1": [
|
| 773 |
+
0.0,
|
| 774 |
+
0.0,
|
| 775 |
+
0.0,
|
| 776 |
+
0.0
|
| 777 |
+
],
|
| 778 |
+
"g2": [
|
| 779 |
+
0.0,
|
| 780 |
+
0.0,
|
| 781 |
+
0.0,
|
| 782 |
+
0.0
|
| 783 |
+
],
|
| 784 |
+
"g3": [
|
| 785 |
+
0.0,
|
| 786 |
+
0.0,
|
| 787 |
+
0.0,
|
| 788 |
+
0.0
|
| 789 |
+
],
|
| 790 |
+
"g4": [
|
| 791 |
+
0.0,
|
| 792 |
+
0.0,
|
| 793 |
+
0.0,
|
| 794 |
+
0.0
|
| 795 |
+
],
|
| 796 |
+
"g5": [
|
| 797 |
+
0.0,
|
| 798 |
+
0.0,
|
| 799 |
+
0.0,
|
| 800 |
+
0.0
|
| 801 |
+
],
|
| 802 |
+
"g6": [
|
| 803 |
+
0.0,
|
| 804 |
+
-0.0,
|
| 805 |
+
0.0,
|
| 806 |
+
-0.0
|
| 807 |
+
]
|
| 808 |
+
},
|
| 809 |
+
"Net injection (MW)": {
|
| 810 |
+
"b1": [
|
| 811 |
+
135.0,
|
| 812 |
+
135.0,
|
| 813 |
+
130.064,
|
| 814 |
+
130.0
|
| 815 |
+
],
|
| 816 |
+
"b2": [
|
| 817 |
+
-26.01527,
|
| 818 |
+
-24.46212,
|
| 819 |
+
-23.29725,
|
| 820 |
+
-22.90897
|
| 821 |
+
],
|
| 822 |
+
"b3": [
|
| 823 |
+
-96.93263,
|
| 824 |
+
-81.22318,
|
| 825 |
+
-85.1337,
|
| 826 |
+
-83.44814
|
| 827 |
+
],
|
| 828 |
+
"b4": [
|
| 829 |
+
-57.30552,
|
| 830 |
+
-53.88429,
|
| 831 |
+
-51.31838,
|
| 832 |
+
-50.46307
|
| 833 |
+
],
|
| 834 |
+
"b5": [
|
| 835 |
+
-9.11134,
|
| 836 |
+
-8.56738,
|
| 837 |
+
-8.15941,
|
| 838 |
+
-8.02342
|
| 839 |
+
],
|
| 840 |
+
"b6": [
|
| 841 |
+
80.07757,
|
| 842 |
+
53.37439,
|
| 843 |
+
53.97561,
|
| 844 |
+
49.60562
|
| 845 |
+
],
|
| 846 |
+
"b7": [
|
| 847 |
+
0.0,
|
| 848 |
+
0.0,
|
| 849 |
+
0.0,
|
| 850 |
+
0.0
|
| 851 |
+
],
|
| 852 |
+
"b8": [
|
| 853 |
+
66.0,
|
| 854 |
+
66.0,
|
| 855 |
+
66.0,
|
| 856 |
+
66.0
|
| 857 |
+
],
|
| 858 |
+
"b9": [
|
| 859 |
+
-35.36638,
|
| 860 |
+
-33.25495,
|
| 861 |
+
-31.67138,
|
| 862 |
+
-31.14353
|
| 863 |
+
],
|
| 864 |
+
"b10": [
|
| 865 |
+
-10.78974,
|
| 866 |
+
-10.14558,
|
| 867 |
+
-9.66246,
|
| 868 |
+
-9.50141
|
| 869 |
+
],
|
| 870 |
+
"b11": [
|
| 871 |
+
-4.19601,
|
| 872 |
+
-3.9455,
|
| 873 |
+
-3.75762,
|
| 874 |
+
-3.69499
|
| 875 |
+
],
|
| 876 |
+
"b12": [
|
| 877 |
+
-7.31305,
|
| 878 |
+
-6.87645,
|
| 879 |
+
-6.549,
|
| 880 |
+
-6.43985
|
| 881 |
+
],
|
| 882 |
+
"b13": [
|
| 883 |
+
-16.18461,
|
| 884 |
+
-15.21837,
|
| 885 |
+
-14.49368,
|
| 886 |
+
-14.25212
|
| 887 |
+
],
|
| 888 |
+
"b14": [
|
| 889 |
+
-17.86302,
|
| 890 |
+
-16.79657,
|
| 891 |
+
-15.99673,
|
| 892 |
+
-15.73012
|
| 893 |
+
]
|
| 894 |
+
},
|
| 895 |
+
"Load curtail (MW)": {
|
| 896 |
+
"b1": [
|
| 897 |
+
0.0,
|
| 898 |
+
0.0,
|
| 899 |
+
0.0,
|
| 900 |
+
0.0
|
| 901 |
+
],
|
| 902 |
+
"b2": [
|
| 903 |
+
0.0,
|
| 904 |
+
0.0,
|
| 905 |
+
0.0,
|
| 906 |
+
0.0
|
| 907 |
+
],
|
| 908 |
+
"b3": [
|
| 909 |
+
0.0,
|
| 910 |
+
0.0,
|
| 911 |
+
0.0,
|
| 912 |
+
0.0
|
| 913 |
+
],
|
| 914 |
+
"b4": [
|
| 915 |
+
-0.0,
|
| 916 |
+
0.0,
|
| 917 |
+
0.0,
|
| 918 |
+
0.0
|
| 919 |
+
],
|
| 920 |
+
"b5": [
|
| 921 |
+
0.0,
|
| 922 |
+
0.0,
|
| 923 |
+
0.0,
|
| 924 |
+
0.0
|
| 925 |
+
],
|
| 926 |
+
"b6": [
|
| 927 |
+
0.0,
|
| 928 |
+
0.0,
|
| 929 |
+
0.0,
|
| 930 |
+
0.0
|
| 931 |
+
],
|
| 932 |
+
"b7": [
|
| 933 |
+
0.0,
|
| 934 |
+
0.0,
|
| 935 |
+
0.0,
|
| 936 |
+
0.0
|
| 937 |
+
],
|
| 938 |
+
"b8": [
|
| 939 |
+
0.0,
|
| 940 |
+
0.0,
|
| 941 |
+
0.0,
|
| 942 |
+
0.0
|
| 943 |
+
],
|
| 944 |
+
"b9": [
|
| 945 |
+
0.0,
|
| 946 |
+
0.0,
|
| 947 |
+
0.0,
|
| 948 |
+
0.0
|
| 949 |
+
],
|
| 950 |
+
"b10": [
|
| 951 |
+
0.0,
|
| 952 |
+
0.0,
|
| 953 |
+
0.0,
|
| 954 |
+
0.0
|
| 955 |
+
],
|
| 956 |
+
"b11": [
|
| 957 |
+
0.0,
|
| 958 |
+
0.0,
|
| 959 |
+
0.0,
|
| 960 |
+
0.0
|
| 961 |
+
],
|
| 962 |
+
"b12": [
|
| 963 |
+
0.0,
|
| 964 |
+
0.0,
|
| 965 |
+
0.0,
|
| 966 |
+
0.0
|
| 967 |
+
],
|
| 968 |
+
"b13": [
|
| 969 |
+
0.0,
|
| 970 |
+
0.0,
|
| 971 |
+
0.0,
|
| 972 |
+
0.0
|
| 973 |
+
],
|
| 974 |
+
"b14": [
|
| 975 |
+
0.0,
|
| 976 |
+
0.0,
|
| 977 |
+
0.0,
|
| 978 |
+
0.0
|
| 979 |
+
]
|
| 980 |
+
},
|
| 981 |
+
"Line overflow (MW)": {
|
| 982 |
+
"l1": [
|
| 983 |
+
0.0,
|
| 984 |
+
0.0,
|
| 985 |
+
0.0,
|
| 986 |
+
0.0
|
| 987 |
+
],
|
| 988 |
+
"l2": [
|
| 989 |
+
0.0,
|
| 990 |
+
0.0,
|
| 991 |
+
0.0,
|
| 992 |
+
0.0
|
| 993 |
+
],
|
| 994 |
+
"l3": [
|
| 995 |
+
0.0,
|
| 996 |
+
0.0,
|
| 997 |
+
0.0,
|
| 998 |
+
0.0
|
| 999 |
+
],
|
| 1000 |
+
"l4": [
|
| 1001 |
+
0.0,
|
| 1002 |
+
0.0,
|
| 1003 |
+
0.0,
|
| 1004 |
+
0.0
|
| 1005 |
+
],
|
| 1006 |
+
"l5": [
|
| 1007 |
+
0.0,
|
| 1008 |
+
0.0,
|
| 1009 |
+
0.0,
|
| 1010 |
+
0.0
|
| 1011 |
+
],
|
| 1012 |
+
"l6": [
|
| 1013 |
+
0.0,
|
| 1014 |
+
0.0,
|
| 1015 |
+
0.0,
|
| 1016 |
+
0.0
|
| 1017 |
+
],
|
| 1018 |
+
"l7": [
|
| 1019 |
+
0.0,
|
| 1020 |
+
0.0,
|
| 1021 |
+
0.0,
|
| 1022 |
+
0.0
|
| 1023 |
+
],
|
| 1024 |
+
"l8": [
|
| 1025 |
+
0.0,
|
| 1026 |
+
0.0,
|
| 1027 |
+
0.0,
|
| 1028 |
+
0.0
|
| 1029 |
+
],
|
| 1030 |
+
"l9": [
|
| 1031 |
+
0.0,
|
| 1032 |
+
0.0,
|
| 1033 |
+
0.0,
|
| 1034 |
+
0.0
|
| 1035 |
+
],
|
| 1036 |
+
"l10": [
|
| 1037 |
+
0.0,
|
| 1038 |
+
0.0,
|
| 1039 |
+
0.0,
|
| 1040 |
+
0.0
|
| 1041 |
+
],
|
| 1042 |
+
"l11": [
|
| 1043 |
+
0.0,
|
| 1044 |
+
0.0,
|
| 1045 |
+
0.0,
|
| 1046 |
+
0.0
|
| 1047 |
+
],
|
| 1048 |
+
"l12": [
|
| 1049 |
+
0.0,
|
| 1050 |
+
0.0,
|
| 1051 |
+
0.0,
|
| 1052 |
+
0.0
|
| 1053 |
+
],
|
| 1054 |
+
"l13": [
|
| 1055 |
+
0.0,
|
| 1056 |
+
0.0,
|
| 1057 |
+
0.0,
|
| 1058 |
+
0.0
|
| 1059 |
+
],
|
| 1060 |
+
"l14": [
|
| 1061 |
+
0.0,
|
| 1062 |
+
0.0,
|
| 1063 |
+
0.0,
|
| 1064 |
+
0.0
|
| 1065 |
+
],
|
| 1066 |
+
"l15": [
|
| 1067 |
+
0.0,
|
| 1068 |
+
0.0,
|
| 1069 |
+
0.0,
|
| 1070 |
+
0.0
|
| 1071 |
+
],
|
| 1072 |
+
"l16": [
|
| 1073 |
+
0.0,
|
| 1074 |
+
0.0,
|
| 1075 |
+
0.0,
|
| 1076 |
+
0.0
|
| 1077 |
+
],
|
| 1078 |
+
"l17": [
|
| 1079 |
+
0.0,
|
| 1080 |
+
0.0,
|
| 1081 |
+
0.0,
|
| 1082 |
+
0.0
|
| 1083 |
+
],
|
| 1084 |
+
"l18": [
|
| 1085 |
+
0.0,
|
| 1086 |
+
0.0,
|
| 1087 |
+
0.0,
|
| 1088 |
+
0.0
|
| 1089 |
+
],
|
| 1090 |
+
"l19": [
|
| 1091 |
+
0.0,
|
| 1092 |
+
0.0,
|
| 1093 |
+
0.0,
|
| 1094 |
+
0.0
|
| 1095 |
+
],
|
| 1096 |
+
"l20": [
|
| 1097 |
+
0.0,
|
| 1098 |
+
0.0,
|
| 1099 |
+
0.0,
|
| 1100 |
+
0.0
|
| 1101 |
+
]
|
| 1102 |
+
},
|
| 1103 |
+
"Price-sensitive loads (MW)": {
|
| 1104 |
+
"ps1": [
|
| 1105 |
+
50.0,
|
| 1106 |
+
50.0,
|
| 1107 |
+
50.0,
|
| 1108 |
+
50.0
|
| 1109 |
+
]
|
| 1110 |
+
},
|
| 1111 |
+
"Spinning reserve (MW)": {
|
| 1112 |
+
"r1": {
|
| 1113 |
+
"g2": [
|
| 1114 |
+
98.0,
|
| 1115 |
+
32.0,
|
| 1116 |
+
66.0,
|
| 1117 |
+
27.4296
|
| 1118 |
+
],
|
| 1119 |
+
"g3": [
|
| 1120 |
+
0.0,
|
| 1121 |
+
0.0,
|
| 1122 |
+
0.0,
|
| 1123 |
+
0.0
|
| 1124 |
+
],
|
| 1125 |
+
"g4": [
|
| 1126 |
+
1.999999999999993,
|
| 1127 |
+
34.0,
|
| 1128 |
+
34.0,
|
| 1129 |
+
38.5704
|
| 1130 |
+
],
|
| 1131 |
+
"g5": [
|
| 1132 |
+
0.0,
|
| 1133 |
+
34.0,
|
| 1134 |
+
0.0,
|
| 1135 |
+
34.0
|
| 1136 |
+
],
|
| 1137 |
+
"g6": [
|
| 1138 |
+
0.0,
|
| 1139 |
+
0.0,
|
| 1140 |
+
0.0,
|
| 1141 |
+
0.0
|
| 1142 |
+
]
|
| 1143 |
+
}
|
| 1144 |
+
},
|
| 1145 |
+
"Spinning reserve shortfall (MW)": {
|
| 1146 |
+
"r1": [
|
| 1147 |
+
0.0,
|
| 1148 |
+
0.0,
|
| 1149 |
+
0.0,
|
| 1150 |
+
0.0
|
| 1151 |
+
]
|
| 1152 |
+
},
|
| 1153 |
+
"Up-flexiramp (MW)": {},
|
| 1154 |
+
"Up-flexiramp shortfall (MW)": {},
|
| 1155 |
+
"Down-flexiramp (MW)": {},
|
| 1156 |
+
"Down-flexiramp shortfall (MW)": {}
|
| 1157 |
+
}
|
| 1158 |
+
}
|
docs/example/s1.json
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"Parameters": {
|
| 3 |
+
"Version": "0.3",
|
| 4 |
+
"Time horizon (h)": 4
|
| 5 |
+
},
|
| 6 |
+
"Generators": {
|
| 7 |
+
"g1": {
|
| 8 |
+
"Bus": "b1",
|
| 9 |
+
"Production cost curve (MW)": [
|
| 10 |
+
100,
|
| 11 |
+
110,
|
| 12 |
+
130,
|
| 13 |
+
135
|
| 14 |
+
],
|
| 15 |
+
"Production cost curve ($)": [
|
| 16 |
+
1400,
|
| 17 |
+
1600,
|
| 18 |
+
2200,
|
| 19 |
+
2400
|
| 20 |
+
],
|
| 21 |
+
"Startup delays (h)": [
|
| 22 |
+
1,
|
| 23 |
+
2,
|
| 24 |
+
3
|
| 25 |
+
],
|
| 26 |
+
"Startup costs ($)": [
|
| 27 |
+
1000.0,
|
| 28 |
+
1500.0,
|
| 29 |
+
2000.0
|
| 30 |
+
],
|
| 31 |
+
"Initial status (h)": -100,
|
| 32 |
+
"Initial power (MW)": 0
|
| 33 |
+
},
|
| 34 |
+
"g2": {
|
| 35 |
+
"Bus": "b2",
|
| 36 |
+
"Production cost curve (MW)": [
|
| 37 |
+
0,
|
| 38 |
+
47,
|
| 39 |
+
94,
|
| 40 |
+
140
|
| 41 |
+
],
|
| 42 |
+
"Production cost curve ($)": [
|
| 43 |
+
0,
|
| 44 |
+
2256.00,
|
| 45 |
+
4733.37,
|
| 46 |
+
7395.39
|
| 47 |
+
],
|
| 48 |
+
"Startup delays (h)": [
|
| 49 |
+
1,
|
| 50 |
+
4
|
| 51 |
+
],
|
| 52 |
+
"Startup costs ($)": [
|
| 53 |
+
3000.0,
|
| 54 |
+
4000.0
|
| 55 |
+
],
|
| 56 |
+
"Ramp up limit (MW)": 98.0,
|
| 57 |
+
"Ramp down limit (MW)": 98.0,
|
| 58 |
+
"Startup limit (MW)": 98.0,
|
| 59 |
+
"Shutdown limit (MW)": 98.0,
|
| 60 |
+
"Minimum uptime (h)": 4,
|
| 61 |
+
"Minimum downtime (h)": 4,
|
| 62 |
+
"Maximum daily energy (MWh)": null,
|
| 63 |
+
"Maximum daily starts": null,
|
| 64 |
+
"Initial status (h)": -8,
|
| 65 |
+
"Initial power (MW)": 0,
|
| 66 |
+
"Reserve eligibility": [
|
| 67 |
+
"r1"
|
| 68 |
+
]
|
| 69 |
+
},
|
| 70 |
+
"g3": {
|
| 71 |
+
"Bus": "b3",
|
| 72 |
+
"Production cost curve (MW)": [
|
| 73 |
+
0,
|
| 74 |
+
33,
|
| 75 |
+
66,
|
| 76 |
+
100
|
| 77 |
+
],
|
| 78 |
+
"Production cost curve ($)": [
|
| 79 |
+
0,
|
| 80 |
+
1113.75,
|
| 81 |
+
2369.07,
|
| 82 |
+
3891.54
|
| 83 |
+
],
|
| 84 |
+
"Startup delays (h)": [
|
| 85 |
+
1,
|
| 86 |
+
4,
|
| 87 |
+
8
|
| 88 |
+
],
|
| 89 |
+
"Startup costs ($)": [
|
| 90 |
+
1000.0,
|
| 91 |
+
2000.0,
|
| 92 |
+
3000.0
|
| 93 |
+
],
|
| 94 |
+
"Ramp up limit (MW)": 70.0,
|
| 95 |
+
"Ramp down limit (MW)": 70.0,
|
| 96 |
+
"Startup limit (MW)": 70.0,
|
| 97 |
+
"Shutdown limit (MW)": 70.0,
|
| 98 |
+
"Must run?": true,
|
| 99 |
+
"Minimum uptime (h)": 1,
|
| 100 |
+
"Minimum downtime (h)": 1,
|
| 101 |
+
"Maximum daily energy (MWh)": null,
|
| 102 |
+
"Maximum daily starts": null,
|
| 103 |
+
"Initial status (h)": -6,
|
| 104 |
+
"Initial power (MW)": 0,
|
| 105 |
+
"Reserve eligibility": [
|
| 106 |
+
"r1"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
"g4": {
|
| 110 |
+
"Bus": "b6",
|
| 111 |
+
"Production cost curve (MW)": [
|
| 112 |
+
33,
|
| 113 |
+
66,
|
| 114 |
+
100
|
| 115 |
+
],
|
| 116 |
+
"Production cost curve ($)": [
|
| 117 |
+
1113.75,
|
| 118 |
+
2369.07,
|
| 119 |
+
3891.54
|
| 120 |
+
],
|
| 121 |
+
"Initial status (h)": -100,
|
| 122 |
+
"Initial power (MW)": 0,
|
| 123 |
+
"Reserve eligibility": [
|
| 124 |
+
"r1"
|
| 125 |
+
]
|
| 126 |
+
},
|
| 127 |
+
"g5": {
|
| 128 |
+
"Bus": "b8",
|
| 129 |
+
"Production cost curve (MW)": [
|
| 130 |
+
33,
|
| 131 |
+
66,
|
| 132 |
+
100
|
| 133 |
+
],
|
| 134 |
+
"Production cost curve ($)": [
|
| 135 |
+
1113.75,
|
| 136 |
+
2369.07,
|
| 137 |
+
3891.54
|
| 138 |
+
],
|
| 139 |
+
"Initial status (h)": -100,
|
| 140 |
+
"Initial power (MW)": 0,
|
| 141 |
+
"Reserve eligibility": [
|
| 142 |
+
"r1"
|
| 143 |
+
]
|
| 144 |
+
},
|
| 145 |
+
"g6": {
|
| 146 |
+
"Bus": "b8",
|
| 147 |
+
"Production cost curve (MW)": [
|
| 148 |
+
100
|
| 149 |
+
],
|
| 150 |
+
"Production cost curve ($)": [
|
| 151 |
+
10000.00
|
| 152 |
+
],
|
| 153 |
+
"Initial status (h)": -100,
|
| 154 |
+
"Initial power (MW)": 0,
|
| 155 |
+
"Reserve eligibility": [
|
| 156 |
+
"r1"
|
| 157 |
+
]
|
| 158 |
+
}
|
| 159 |
+
},
|
| 160 |
+
"Buses": {
|
| 161 |
+
"b1": {
|
| 162 |
+
"Load (MW)": 0.0
|
| 163 |
+
},
|
| 164 |
+
"b2": {
|
| 165 |
+
"Load (MW)": [
|
| 166 |
+
26.01527,
|
| 167 |
+
24.46212,
|
| 168 |
+
23.29725,
|
| 169 |
+
22.90897
|
| 170 |
+
]
|
| 171 |
+
},
|
| 172 |
+
"b3": {
|
| 173 |
+
"Load (MW)": [
|
| 174 |
+
112.93263,
|
| 175 |
+
106.19039,
|
| 176 |
+
101.1337,
|
| 177 |
+
99.44814
|
| 178 |
+
]
|
| 179 |
+
},
|
| 180 |
+
"b4": {
|
| 181 |
+
"Load (MW)": [
|
| 182 |
+
57.30552,
|
| 183 |
+
53.88429,
|
| 184 |
+
51.31838,
|
| 185 |
+
50.46307
|
| 186 |
+
]
|
| 187 |
+
},
|
| 188 |
+
"b5": {
|
| 189 |
+
"Load (MW)": [
|
| 190 |
+
9.11134,
|
| 191 |
+
8.56738,
|
| 192 |
+
8.15941,
|
| 193 |
+
8.02342
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
"b6": {
|
| 197 |
+
"Load (MW)": [
|
| 198 |
+
13.42723,
|
| 199 |
+
12.62561,
|
| 200 |
+
12.02439,
|
| 201 |
+
11.82398
|
| 202 |
+
]
|
| 203 |
+
},
|
| 204 |
+
"b7": {
|
| 205 |
+
"Load (MW)": 0.0
|
| 206 |
+
},
|
| 207 |
+
"b8": {
|
| 208 |
+
"Load (MW)": 0.0
|
| 209 |
+
},
|
| 210 |
+
"b9": {
|
| 211 |
+
"Load (MW)": [
|
| 212 |
+
35.36638,
|
| 213 |
+
33.25495,
|
| 214 |
+
31.67138,
|
| 215 |
+
31.14353
|
| 216 |
+
]
|
| 217 |
+
},
|
| 218 |
+
"b10": {
|
| 219 |
+
"Load (MW)": [
|
| 220 |
+
10.78974,
|
| 221 |
+
10.14558,
|
| 222 |
+
9.66246,
|
| 223 |
+
9.50141
|
| 224 |
+
]
|
| 225 |
+
},
|
| 226 |
+
"b11": {
|
| 227 |
+
"Load (MW)": [
|
| 228 |
+
4.19601,
|
| 229 |
+
3.9455,
|
| 230 |
+
3.75762,
|
| 231 |
+
3.69499
|
| 232 |
+
]
|
| 233 |
+
},
|
| 234 |
+
"b12": {
|
| 235 |
+
"Load (MW)": [
|
| 236 |
+
7.31305,
|
| 237 |
+
6.87645,
|
| 238 |
+
6.549,
|
| 239 |
+
6.43985
|
| 240 |
+
]
|
| 241 |
+
},
|
| 242 |
+
"b13": {
|
| 243 |
+
"Load (MW)": [
|
| 244 |
+
16.18461,
|
| 245 |
+
15.21837,
|
| 246 |
+
14.49368,
|
| 247 |
+
14.25212
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
"b14": {
|
| 251 |
+
"Load (MW)": [
|
| 252 |
+
17.86302,
|
| 253 |
+
16.79657,
|
| 254 |
+
15.99673,
|
| 255 |
+
15.73012
|
| 256 |
+
]
|
| 257 |
+
}
|
| 258 |
+
},
|
| 259 |
+
"Transmission lines": {
|
| 260 |
+
"l1": {
|
| 261 |
+
"Source bus": "b1",
|
| 262 |
+
"Target bus": "b2",
|
| 263 |
+
"Reactance (ohms)": 0.05917000000000001,
|
| 264 |
+
"Susceptance (S)": 29.496860773945063,
|
| 265 |
+
"Normal flow limit (MW)": 300.0,
|
| 266 |
+
"Emergency flow limit (MW)": 400.0,
|
| 267 |
+
"Flow limit penalty ($/MW)": 1000.0
|
| 268 |
+
},
|
| 269 |
+
"l2": {
|
| 270 |
+
"Source bus": "b1",
|
| 271 |
+
"Target bus": "b5",
|
| 272 |
+
"Reactance (ohms)": 0.22304000000000002,
|
| 273 |
+
"Susceptance (S)": 7.825184953346168
|
| 274 |
+
},
|
| 275 |
+
"l3": {
|
| 276 |
+
"Source bus": "b2",
|
| 277 |
+
"Target bus": "b3",
|
| 278 |
+
"Reactance (ohms)": 0.19797,
|
| 279 |
+
"Susceptance (S)": 8.816129979261149
|
| 280 |
+
},
|
| 281 |
+
"l4": {
|
| 282 |
+
"Source bus": "b2",
|
| 283 |
+
"Target bus": "b4",
|
| 284 |
+
"Reactance (ohms)": 0.17632,
|
| 285 |
+
"Susceptance (S)": 9.898645939169292
|
| 286 |
+
},
|
| 287 |
+
"l5": {
|
| 288 |
+
"Source bus": "b2",
|
| 289 |
+
"Target bus": "b5",
|
| 290 |
+
"Reactance (ohms)": 0.17388,
|
| 291 |
+
"Susceptance (S)": 10.037550333530765
|
| 292 |
+
},
|
| 293 |
+
"l6": {
|
| 294 |
+
"Source bus": "b3",
|
| 295 |
+
"Target bus": "b4",
|
| 296 |
+
"Reactance (ohms)": 0.17103,
|
| 297 |
+
"Susceptance (S)": 10.204813494675376
|
| 298 |
+
},
|
| 299 |
+
"l7": {
|
| 300 |
+
"Source bus": "b4",
|
| 301 |
+
"Target bus": "b5",
|
| 302 |
+
"Reactance (ohms)": 0.04211,
|
| 303 |
+
"Susceptance (S)": 41.44690695783257
|
| 304 |
+
},
|
| 305 |
+
"l8": {
|
| 306 |
+
"Source bus": "b4",
|
| 307 |
+
"Target bus": "b7",
|
| 308 |
+
"Reactance (ohms)": 0.20911999999999997,
|
| 309 |
+
"Susceptance (S)": 8.346065665619404
|
| 310 |
+
},
|
| 311 |
+
"l9": {
|
| 312 |
+
"Source bus": "b4",
|
| 313 |
+
"Target bus": "b9",
|
| 314 |
+
"Reactance (ohms)": 0.55618,
|
| 315 |
+
"Susceptance (S)": 3.1380654680037567
|
| 316 |
+
},
|
| 317 |
+
"l10": {
|
| 318 |
+
"Source bus": "b5",
|
| 319 |
+
"Target bus": "b6",
|
| 320 |
+
"Reactance (ohms)": 0.25201999999999997,
|
| 321 |
+
"Susceptance (S)": 6.92536009838239
|
| 322 |
+
},
|
| 323 |
+
"l11": {
|
| 324 |
+
"Source bus": "b6",
|
| 325 |
+
"Target bus": "b11",
|
| 326 |
+
"Reactance (ohms)": 0.1989,
|
| 327 |
+
"Susceptance (S)": 8.774908255376218
|
| 328 |
+
},
|
| 329 |
+
"l12": {
|
| 330 |
+
"Source bus": "b6",
|
| 331 |
+
"Target bus": "b12",
|
| 332 |
+
"Reactance (ohms)": 0.25581,
|
| 333 |
+
"Susceptance (S)": 6.8227561549365925
|
| 334 |
+
},
|
| 335 |
+
"l13": {
|
| 336 |
+
"Source bus": "b6",
|
| 337 |
+
"Target bus": "b13",
|
| 338 |
+
"Reactance (ohms)": 0.13027,
|
| 339 |
+
"Susceptance (S)": 13.397783465067395
|
| 340 |
+
},
|
| 341 |
+
"l14": {
|
| 342 |
+
"Source bus": "b7",
|
| 343 |
+
"Target bus": "b8",
|
| 344 |
+
"Reactance (ohms)": 0.17615,
|
| 345 |
+
"Susceptance (S)": 9.908198989465395
|
| 346 |
+
},
|
| 347 |
+
"l15": {
|
| 348 |
+
"Source bus": "b7",
|
| 349 |
+
"Target bus": "b9",
|
| 350 |
+
"Reactance (ohms)": 0.11001,
|
| 351 |
+
"Susceptance (S)": 15.865187273832648
|
| 352 |
+
},
|
| 353 |
+
"l16": {
|
| 354 |
+
"Source bus": "b9",
|
| 355 |
+
"Target bus": "b10",
|
| 356 |
+
"Reactance (ohms)": 0.0845,
|
| 357 |
+
"Susceptance (S)": 20.65478404727017
|
| 358 |
+
},
|
| 359 |
+
"l17": {
|
| 360 |
+
"Source bus": "b9",
|
| 361 |
+
"Target bus": "b14",
|
| 362 |
+
"Reactance (ohms)": 0.27038,
|
| 363 |
+
"Susceptance (S)": 6.4550974628091184
|
| 364 |
+
},
|
| 365 |
+
"l18": {
|
| 366 |
+
"Source bus": "b10",
|
| 367 |
+
"Target bus": "b11",
|
| 368 |
+
"Reactance (ohms)": 0.19207,
|
| 369 |
+
"Susceptance (S)": 9.08694357262628
|
| 370 |
+
},
|
| 371 |
+
"l19": {
|
| 372 |
+
"Source bus": "b12",
|
| 373 |
+
"Target bus": "b13",
|
| 374 |
+
"Reactance (ohms)": 0.19988,
|
| 375 |
+
"Susceptance (S)": 8.73188539120637
|
| 376 |
+
},
|
| 377 |
+
"l20": {
|
| 378 |
+
"Source bus": "b13",
|
| 379 |
+
"Target bus": "b14",
|
| 380 |
+
"Reactance (ohms)": 0.34802,
|
| 381 |
+
"Susceptance (S)": 5.0150257226433235
|
| 382 |
+
}
|
| 383 |
+
},
|
| 384 |
+
"Contingencies": {
|
| 385 |
+
"c1": {
|
| 386 |
+
"Affected lines": [
|
| 387 |
+
"l1"
|
| 388 |
+
]
|
| 389 |
+
},
|
| 390 |
+
"c2": {
|
| 391 |
+
"Affected lines": [
|
| 392 |
+
"l2"
|
| 393 |
+
]
|
| 394 |
+
},
|
| 395 |
+
"c3": {
|
| 396 |
+
"Affected lines": [
|
| 397 |
+
"l3"
|
| 398 |
+
]
|
| 399 |
+
},
|
| 400 |
+
"c4": {
|
| 401 |
+
"Affected lines": [
|
| 402 |
+
"l4"
|
| 403 |
+
]
|
| 404 |
+
},
|
| 405 |
+
"c5": {
|
| 406 |
+
"Affected lines": [
|
| 407 |
+
"l5"
|
| 408 |
+
]
|
| 409 |
+
},
|
| 410 |
+
"c6": {
|
| 411 |
+
"Affected lines": [
|
| 412 |
+
"l6"
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
"c7": {
|
| 416 |
+
"Affected lines": [
|
| 417 |
+
"l7"
|
| 418 |
+
]
|
| 419 |
+
},
|
| 420 |
+
"c8": {
|
| 421 |
+
"Affected lines": [
|
| 422 |
+
"l8"
|
| 423 |
+
]
|
| 424 |
+
},
|
| 425 |
+
"c9": {
|
| 426 |
+
"Affected lines": [
|
| 427 |
+
"l9"
|
| 428 |
+
]
|
| 429 |
+
},
|
| 430 |
+
"c10": {
|
| 431 |
+
"Affected lines": [
|
| 432 |
+
"l10"
|
| 433 |
+
]
|
| 434 |
+
},
|
| 435 |
+
"c11": {
|
| 436 |
+
"Affected lines": [
|
| 437 |
+
"l11"
|
| 438 |
+
]
|
| 439 |
+
},
|
| 440 |
+
"c12": {
|
| 441 |
+
"Affected lines": [
|
| 442 |
+
"l12"
|
| 443 |
+
]
|
| 444 |
+
},
|
| 445 |
+
"c13": {
|
| 446 |
+
"Affected lines": [
|
| 447 |
+
"l13"
|
| 448 |
+
]
|
| 449 |
+
},
|
| 450 |
+
"c15": {
|
| 451 |
+
"Affected lines": [
|
| 452 |
+
"l15"
|
| 453 |
+
]
|
| 454 |
+
},
|
| 455 |
+
"c16": {
|
| 456 |
+
"Affected lines": [
|
| 457 |
+
"l16"
|
| 458 |
+
]
|
| 459 |
+
},
|
| 460 |
+
"c17": {
|
| 461 |
+
"Affected lines": [
|
| 462 |
+
"l17"
|
| 463 |
+
]
|
| 464 |
+
},
|
| 465 |
+
"c18": {
|
| 466 |
+
"Affected lines": [
|
| 467 |
+
"l18"
|
| 468 |
+
]
|
| 469 |
+
},
|
| 470 |
+
"c19": {
|
| 471 |
+
"Affected lines": [
|
| 472 |
+
"l19"
|
| 473 |
+
]
|
| 474 |
+
},
|
| 475 |
+
"c20": {
|
| 476 |
+
"Affected lines": [
|
| 477 |
+
"l20"
|
| 478 |
+
]
|
| 479 |
+
}
|
| 480 |
+
},
|
| 481 |
+
"Price-sensitive loads": {
|
| 482 |
+
"ps1": {
|
| 483 |
+
"Bus": "b3",
|
| 484 |
+
"Revenue ($/MW)": 100.0,
|
| 485 |
+
"Demand (MW)": 50.0
|
| 486 |
+
}
|
| 487 |
+
},
|
| 488 |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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"Parameters": {
|
| 3 |
+
"Version": "0.3",
|
| 4 |
+
"Time horizon (h)": 4
|
| 5 |
+
},
|
| 6 |
+
"Generators": {
|
| 7 |
+
"g1": {
|
| 8 |
+
"Bus": "b1",
|
| 9 |
+
"Production cost curve (MW)": [
|
| 10 |
+
100,
|
| 11 |
+
110,
|
| 12 |
+
130,
|
| 13 |
+
135
|
| 14 |
+
],
|
| 15 |
+
"Production cost curve ($)": [
|
| 16 |
+
1400,
|
| 17 |
+
1600,
|
| 18 |
+
2200,
|
| 19 |
+
2400
|
| 20 |
+
],
|
| 21 |
+
"Startup delays (h)": [
|
| 22 |
+
1,
|
| 23 |
+
2,
|
| 24 |
+
3
|
| 25 |
+
],
|
| 26 |
+
"Startup costs ($)": [
|
| 27 |
+
1000.0,
|
| 28 |
+
1500.0,
|
| 29 |
+
2000.0
|
| 30 |
+
],
|
| 31 |
+
"Initial status (h)": -100,
|
| 32 |
+
"Initial power (MW)": 0
|
| 33 |
+
},
|
| 34 |
+
"g2": {
|
| 35 |
+
"Bus": "b2",
|
| 36 |
+
"Production cost curve (MW)": [
|
| 37 |
+
0,
|
| 38 |
+
47,
|
| 39 |
+
94,
|
| 40 |
+
140
|
| 41 |
+
],
|
| 42 |
+
"Production cost curve ($)": [
|
| 43 |
+
0,
|
| 44 |
+
2256.00,
|
| 45 |
+
4733.37,
|
| 46 |
+
7395.39
|
| 47 |
+
],
|
| 48 |
+
"Startup delays (h)": [
|
| 49 |
+
1,
|
| 50 |
+
4
|
| 51 |
+
],
|
| 52 |
+
"Startup costs ($)": [
|
| 53 |
+
3000.0,
|
| 54 |
+
4000.0
|
| 55 |
+
],
|
| 56 |
+
"Ramp up limit (MW)": 98.0,
|
| 57 |
+
"Ramp down limit (MW)": 98.0,
|
| 58 |
+
"Startup limit (MW)": 98.0,
|
| 59 |
+
"Shutdown limit (MW)": 98.0,
|
| 60 |
+
"Minimum uptime (h)": 4,
|
| 61 |
+
"Minimum downtime (h)": 4,
|
| 62 |
+
"Maximum daily energy (MWh)": null,
|
| 63 |
+
"Maximum daily starts": null,
|
| 64 |
+
"Initial status (h)": -8,
|
| 65 |
+
"Initial power (MW)": 0,
|
| 66 |
+
"Reserve eligibility": [
|
| 67 |
+
"r1"
|
| 68 |
+
]
|
| 69 |
+
},
|
| 70 |
+
"g3": {
|
| 71 |
+
"Bus": "b3",
|
| 72 |
+
"Production cost curve (MW)": [
|
| 73 |
+
0,
|
| 74 |
+
33,
|
| 75 |
+
66,
|
| 76 |
+
100
|
| 77 |
+
],
|
| 78 |
+
"Production cost curve ($)": [
|
| 79 |
+
0,
|
| 80 |
+
1113.75,
|
| 81 |
+
2369.07,
|
| 82 |
+
3891.54
|
| 83 |
+
],
|
| 84 |
+
"Startup delays (h)": [
|
| 85 |
+
1,
|
| 86 |
+
4,
|
| 87 |
+
8
|
| 88 |
+
],
|
| 89 |
+
"Startup costs ($)": [
|
| 90 |
+
1000.0,
|
| 91 |
+
2000.0,
|
| 92 |
+
3000.0
|
| 93 |
+
],
|
| 94 |
+
"Ramp up limit (MW)": 70.0,
|
| 95 |
+
"Ramp down limit (MW)": 70.0,
|
| 96 |
+
"Startup limit (MW)": 70.0,
|
| 97 |
+
"Shutdown limit (MW)": 70.0,
|
| 98 |
+
"Must run?": true,
|
| 99 |
+
"Minimum uptime (h)": 1,
|
| 100 |
+
"Minimum downtime (h)": 1,
|
| 101 |
+
"Maximum daily energy (MWh)": null,
|
| 102 |
+
"Maximum daily starts": null,
|
| 103 |
+
"Initial status (h)": -6,
|
| 104 |
+
"Initial power (MW)": 0,
|
| 105 |
+
"Reserve eligibility": [
|
| 106 |
+
"r1"
|
| 107 |
+
]
|
| 108 |
+
},
|
| 109 |
+
"g4": {
|
| 110 |
+
"Bus": "b6",
|
| 111 |
+
"Production cost curve (MW)": [
|
| 112 |
+
33,
|
| 113 |
+
66,
|
| 114 |
+
100
|
| 115 |
+
],
|
| 116 |
+
"Production cost curve ($)": [
|
| 117 |
+
1113.75,
|
| 118 |
+
2369.07,
|
| 119 |
+
3891.54
|
| 120 |
+
],
|
| 121 |
+
"Initial status (h)": -100,
|
| 122 |
+
"Initial power (MW)": 0,
|
| 123 |
+
"Reserve eligibility": [
|
| 124 |
+
"r1"
|
| 125 |
+
]
|
| 126 |
+
},
|
| 127 |
+
"g5": {
|
| 128 |
+
"Bus": "b8",
|
| 129 |
+
"Production cost curve (MW)": [
|
| 130 |
+
33,
|
| 131 |
+
66,
|
| 132 |
+
100
|
| 133 |
+
],
|
| 134 |
+
"Production cost curve ($)": [
|
| 135 |
+
1113.75,
|
| 136 |
+
2369.07,
|
| 137 |
+
3891.54
|
| 138 |
+
],
|
| 139 |
+
"Initial status (h)": -100,
|
| 140 |
+
"Initial power (MW)": 0,
|
| 141 |
+
"Reserve eligibility": [
|
| 142 |
+
"r1"
|
| 143 |
+
]
|
| 144 |
+
},
|
| 145 |
+
"g6": {
|
| 146 |
+
"Bus": "b8",
|
| 147 |
+
"Production cost curve (MW)": [
|
| 148 |
+
100
|
| 149 |
+
],
|
| 150 |
+
"Production cost curve ($)": [
|
| 151 |
+
10000.00
|
| 152 |
+
],
|
| 153 |
+
"Initial status (h)": -100,
|
| 154 |
+
"Initial power (MW)": 0,
|
| 155 |
+
"Reserve eligibility": [
|
| 156 |
+
"r1"
|
| 157 |
+
]
|
| 158 |
+
}
|
| 159 |
+
},
|
| 160 |
+
"Buses": {
|
| 161 |
+
"b1": {
|
| 162 |
+
"Load (MW)": 0.0
|
| 163 |
+
},
|
| 164 |
+
"b2": {
|
| 165 |
+
"Load (MW)": [
|
| 166 |
+
26.01527,
|
| 167 |
+
24.46212,
|
| 168 |
+
23.29725,
|
| 169 |
+
22.90897
|
| 170 |
+
]
|
| 171 |
+
},
|
| 172 |
+
"b3": {
|
| 173 |
+
"Load (MW)": [
|
| 174 |
+
112.93263,
|
| 175 |
+
106.19039,
|
| 176 |
+
101.1337,
|
| 177 |
+
99.44814
|
| 178 |
+
]
|
| 179 |
+
},
|
| 180 |
+
"b4": {
|
| 181 |
+
"Load (MW)": [
|
| 182 |
+
57.30552,
|
| 183 |
+
53.88429,
|
| 184 |
+
51.31838,
|
| 185 |
+
50.46307
|
| 186 |
+
]
|
| 187 |
+
},
|
| 188 |
+
"b5": {
|
| 189 |
+
"Load (MW)": [
|
| 190 |
+
9.11134,
|
| 191 |
+
8.56738,
|
| 192 |
+
8.15941,
|
| 193 |
+
8.02342
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
"b6": {
|
| 197 |
+
"Load (MW)": [
|
| 198 |
+
13.42723,
|
| 199 |
+
12.62561,
|
| 200 |
+
12.02439,
|
| 201 |
+
11.82398
|
| 202 |
+
]
|
| 203 |
+
},
|
| 204 |
+
"b7": {
|
| 205 |
+
"Load (MW)": 0.0
|
| 206 |
+
},
|
| 207 |
+
"b8": {
|
| 208 |
+
"Load (MW)": 0.0
|
| 209 |
+
},
|
| 210 |
+
"b9": {
|
| 211 |
+
"Load (MW)": [
|
| 212 |
+
35.36638,
|
| 213 |
+
33.25495,
|
| 214 |
+
31.67138,
|
| 215 |
+
31.14353
|
| 216 |
+
]
|
| 217 |
+
},
|
| 218 |
+
"b10": {
|
| 219 |
+
"Load (MW)": [
|
| 220 |
+
10.78974,
|
| 221 |
+
10.14558,
|
| 222 |
+
9.66246,
|
| 223 |
+
9.50141
|
| 224 |
+
]
|
| 225 |
+
},
|
| 226 |
+
"b11": {
|
| 227 |
+
"Load (MW)": [
|
| 228 |
+
4.19601,
|
| 229 |
+
3.9455,
|
| 230 |
+
3.75762,
|
| 231 |
+
3.69499
|
| 232 |
+
]
|
| 233 |
+
},
|
| 234 |
+
"b12": {
|
| 235 |
+
"Load (MW)": [
|
| 236 |
+
7.31305,
|
| 237 |
+
6.87645,
|
| 238 |
+
6.549,
|
| 239 |
+
6.43985
|
| 240 |
+
]
|
| 241 |
+
},
|
| 242 |
+
"b13": {
|
| 243 |
+
"Load (MW)": [
|
| 244 |
+
16.18461,
|
| 245 |
+
15.21837,
|
| 246 |
+
14.49368,
|
| 247 |
+
14.25212
|
| 248 |
+
]
|
| 249 |
+
},
|
| 250 |
+
"b14": {
|
| 251 |
+
"Load (MW)": [
|
| 252 |
+
17.86302,
|
| 253 |
+
16.79657,
|
| 254 |
+
15.99673,
|
| 255 |
+
15.73012
|
| 256 |
+
]
|
| 257 |
+
}
|
| 258 |
+
},
|
| 259 |
+
"Transmission lines": {
|
| 260 |
+
"l1": {
|
| 261 |
+
"Source bus": "b1",
|
| 262 |
+
"Target bus": "b2",
|
| 263 |
+
"Reactance (ohms)": 0.05917000000000001,
|
| 264 |
+
"Susceptance (S)": 29.496860773945063,
|
| 265 |
+
"Normal flow limit (MW)": 300.0,
|
| 266 |
+
"Emergency flow limit (MW)": 400.0,
|
| 267 |
+
"Flow limit penalty ($/MW)": 1000.0
|
| 268 |
+
},
|
| 269 |
+
"l2": {
|
| 270 |
+
"Source bus": "b1",
|
| 271 |
+
"Target bus": "b5",
|
| 272 |
+
"Reactance (ohms)": 0.22304000000000002,
|
| 273 |
+
"Susceptance (S)": 7.825184953346168
|
| 274 |
+
},
|
| 275 |
+
"l3": {
|
| 276 |
+
"Source bus": "b2",
|
| 277 |
+
"Target bus": "b3",
|
| 278 |
+
"Reactance (ohms)": 0.19797,
|
| 279 |
+
"Susceptance (S)": 8.816129979261149
|
| 280 |
+
},
|
| 281 |
+
"l4": {
|
| 282 |
+
"Source bus": "b2",
|
| 283 |
+
"Target bus": "b4",
|
| 284 |
+
"Reactance (ohms)": 0.17632,
|
| 285 |
+
"Susceptance (S)": 9.898645939169292
|
| 286 |
+
},
|
| 287 |
+
"l5": {
|
| 288 |
+
"Source bus": "b2",
|
| 289 |
+
"Target bus": "b5",
|
| 290 |
+
"Reactance (ohms)": 0.17388,
|
| 291 |
+
"Susceptance (S)": 10.037550333530765
|
| 292 |
+
},
|
| 293 |
+
"l6": {
|
| 294 |
+
"Source bus": "b3",
|
| 295 |
+
"Target bus": "b4",
|
| 296 |
+
"Reactance (ohms)": 0.17103,
|
| 297 |
+
"Susceptance (S)": 10.204813494675376
|
| 298 |
+
},
|
| 299 |
+
"l7": {
|
| 300 |
+
"Source bus": "b4",
|
| 301 |
+
"Target bus": "b5",
|
| 302 |
+
"Reactance (ohms)": 0.04211,
|
| 303 |
+
"Susceptance (S)": 41.44690695783257
|
| 304 |
+
},
|
| 305 |
+
"l8": {
|
| 306 |
+
"Source bus": "b4",
|
| 307 |
+
"Target bus": "b7",
|
| 308 |
+
"Reactance (ohms)": 0.20911999999999997,
|
| 309 |
+
"Susceptance (S)": 8.346065665619404
|
| 310 |
+
},
|
| 311 |
+
"l9": {
|
| 312 |
+
"Source bus": "b4",
|
| 313 |
+
"Target bus": "b9",
|
| 314 |
+
"Reactance (ohms)": 0.55618,
|
| 315 |
+
"Susceptance (S)": 3.1380654680037567
|
| 316 |
+
},
|
| 317 |
+
"l10": {
|
| 318 |
+
"Source bus": "b5",
|
| 319 |
+
"Target bus": "b6",
|
| 320 |
+
"Reactance (ohms)": 0.25201999999999997,
|
| 321 |
+
"Susceptance (S)": 6.92536009838239
|
| 322 |
+
},
|
| 323 |
+
"l11": {
|
| 324 |
+
"Source bus": "b6",
|
| 325 |
+
"Target bus": "b11",
|
| 326 |
+
"Reactance (ohms)": 0.1989,
|
| 327 |
+
"Susceptance (S)": 8.774908255376218
|
| 328 |
+
},
|
| 329 |
+
"l12": {
|
| 330 |
+
"Source bus": "b6",
|
| 331 |
+
"Target bus": "b12",
|
| 332 |
+
"Reactance (ohms)": 0.25581,
|
| 333 |
+
"Susceptance (S)": 6.8227561549365925
|
| 334 |
+
},
|
| 335 |
+
"l13": {
|
| 336 |
+
"Source bus": "b6",
|
| 337 |
+
"Target bus": "b13",
|
| 338 |
+
"Reactance (ohms)": 0.13027,
|
| 339 |
+
"Susceptance (S)": 13.397783465067395
|
| 340 |
+
},
|
| 341 |
+
"l14": {
|
| 342 |
+
"Source bus": "b7",
|
| 343 |
+
"Target bus": "b8",
|
| 344 |
+
"Reactance (ohms)": 0.17615,
|
| 345 |
+
"Susceptance (S)": 9.908198989465395
|
| 346 |
+
},
|
| 347 |
+
"l15": {
|
| 348 |
+
"Source bus": "b7",
|
| 349 |
+
"Target bus": "b9",
|
| 350 |
+
"Reactance (ohms)": 0.11001,
|
| 351 |
+
"Susceptance (S)": 15.865187273832648
|
| 352 |
+
},
|
| 353 |
+
"l16": {
|
| 354 |
+
"Source bus": "b9",
|
| 355 |
+
"Target bus": "b10",
|
| 356 |
+
"Reactance (ohms)": 0.0845,
|
| 357 |
+
"Susceptance (S)": 20.65478404727017
|
| 358 |
+
},
|
| 359 |
+
"l17": {
|
| 360 |
+
"Source bus": "b9",
|
| 361 |
+
"Target bus": "b14",
|
| 362 |
+
"Reactance (ohms)": 0.27038,
|
| 363 |
+
"Susceptance (S)": 6.4550974628091184
|
| 364 |
+
},
|
| 365 |
+
"l18": {
|
| 366 |
+
"Source bus": "b10",
|
| 367 |
+
"Target bus": "b11",
|
| 368 |
+
"Reactance (ohms)": 0.19207,
|
| 369 |
+
"Susceptance (S)": 9.08694357262628
|
| 370 |
+
},
|
| 371 |
+
"l19": {
|
| 372 |
+
"Source bus": "b12",
|
| 373 |
+
"Target bus": "b13",
|
| 374 |
+
"Reactance (ohms)": 0.19988,
|
| 375 |
+
"Susceptance (S)": 8.73188539120637
|
| 376 |
+
},
|
| 377 |
+
"l20": {
|
| 378 |
+
"Source bus": "b13",
|
| 379 |
+
"Target bus": "b14",
|
| 380 |
+
"Reactance (ohms)": 0.34802,
|
| 381 |
+
"Susceptance (S)": 5.0150257226433235
|
| 382 |
+
}
|
| 383 |
+
},
|
| 384 |
+
"Contingencies": {
|
| 385 |
+
"c1": {
|
| 386 |
+
"Affected lines": [
|
| 387 |
+
"l1"
|
| 388 |
+
]
|
| 389 |
+
},
|
| 390 |
+
"c2": {
|
| 391 |
+
"Affected lines": [
|
| 392 |
+
"l2"
|
| 393 |
+
]
|
| 394 |
+
},
|
| 395 |
+
"c3": {
|
| 396 |
+
"Affected lines": [
|
| 397 |
+
"l3"
|
| 398 |
+
]
|
| 399 |
+
},
|
| 400 |
+
"c4": {
|
| 401 |
+
"Affected lines": [
|
| 402 |
+
"l4"
|
| 403 |
+
]
|
| 404 |
+
},
|
| 405 |
+
"c5": {
|
| 406 |
+
"Affected lines": [
|
| 407 |
+
"l5"
|
| 408 |
+
]
|
| 409 |
+
},
|
| 410 |
+
"c6": {
|
| 411 |
+
"Affected lines": [
|
| 412 |
+
"l6"
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
"c7": {
|
| 416 |
+
"Affected lines": [
|
| 417 |
+
"l7"
|
| 418 |
+
]
|
| 419 |
+
},
|
| 420 |
+
"c8": {
|
| 421 |
+
"Affected lines": [
|
| 422 |
+
"l8"
|
| 423 |
+
]
|
| 424 |
+
},
|
| 425 |
+
"c9": {
|
| 426 |
+
"Affected lines": [
|
| 427 |
+
"l9"
|
| 428 |
+
]
|
| 429 |
+
},
|
| 430 |
+
"c10": {
|
| 431 |
+
"Affected lines": [
|
| 432 |
+
"l10"
|
| 433 |
+
]
|
| 434 |
+
},
|
| 435 |
+
"c11": {
|
| 436 |
+
"Affected lines": [
|
| 437 |
+
"l11"
|
| 438 |
+
]
|
| 439 |
+
},
|
| 440 |
+
"c12": {
|
| 441 |
+
"Affected lines": [
|
| 442 |
+
"l12"
|
| 443 |
+
]
|
| 444 |
+
},
|
| 445 |
+
"c13": {
|
| 446 |
+
"Affected lines": [
|
| 447 |
+
"l13"
|
| 448 |
+
]
|
| 449 |
+
},
|
| 450 |
+
"c15": {
|
| 451 |
+
"Affected lines": [
|
| 452 |
+
"l15"
|
| 453 |
+
]
|
| 454 |
+
},
|
| 455 |
+
"c16": {
|
| 456 |
+
"Affected lines": [
|
| 457 |
+
"l16"
|
| 458 |
+
]
|
| 459 |
+
},
|
| 460 |
+
"c17": {
|
| 461 |
+
"Affected lines": [
|
| 462 |
+
"l17"
|
| 463 |
+
]
|
| 464 |
+
},
|
| 465 |
+
"c18": {
|
| 466 |
+
"Affected lines": [
|
| 467 |
+
"l18"
|
| 468 |
+
]
|
| 469 |
+
},
|
| 470 |
+
"c19": {
|
| 471 |
+
"Affected lines": [
|
| 472 |
+
"l19"
|
| 473 |
+
]
|
| 474 |
+
},
|
| 475 |
+
"c20": {
|
| 476 |
+
"Affected lines": [
|
| 477 |
+
"l20"
|
| 478 |
+
]
|
| 479 |
+
}
|
| 480 |
+
},
|
| 481 |
+
"Price-sensitive loads": {
|
| 482 |
+
"ps1": {
|
| 483 |
+
"Bus": "b3",
|
| 484 |
+
"Revenue ($/MW)": 100.0,
|
| 485 |
+
"Demand (MW)": 50.0
|
| 486 |
+
}
|
| 487 |
+
},
|
| 488 |
+
"Reserves": {
|
| 489 |
+
"r1": {
|
| 490 |
+
"Type": "Spinning",
|
| 491 |
+
"Amount (MW)": 100.0,
|
| 492 |
+
"Shortfall penalty ($/MW)": 1000.0
|
| 493 |
+
}
|
| 494 |
+
}
|
| 495 |
+
}
|
docs/make.jl
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using Documenter
|
| 2 |
+
using UnitCommitment
|
| 3 |
+
using JuMP
|
| 4 |
+
using Literate
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
function make()
|
| 9 |
+
literate_sources = [
|
| 10 |
+
"src/tutorials/usage.jl",
|
| 11 |
+
"src/tutorials/customizing.jl",
|
| 12 |
+
"src/tutorials/lmp.jl",
|
| 13 |
+
"src/tutorials/market.jl",
|
| 14 |
+
]
|
| 15 |
+
for src in literate_sources
|
| 16 |
+
Literate.markdown(
|
| 17 |
+
src,
|
| 18 |
+
dirname(src);
|
| 19 |
+
documenter = true,
|
| 20 |
+
credit = false,
|
| 21 |
+
)
|
| 22 |
+
end
|
| 23 |
+
return makedocs(
|
| 24 |
+
sitename = "UnitCommitment.jl",
|
| 25 |
+
pages = [
|
| 26 |
+
"Home" => "index.md",
|
| 27 |
+
"Tutorials" => [
|
| 28 |
+
"tutorials/usage.md",
|
| 29 |
+
"tutorials/customizing.md",
|
| 30 |
+
"tutorials/lmp.md",
|
| 31 |
+
"tutorials/market.md",
|
| 32 |
+
"tutorials/decomposition.md",
|
| 33 |
+
],
|
| 34 |
+
"User guide" => [
|
| 35 |
+
"guides/problem.md",
|
| 36 |
+
"guides/format.md",
|
| 37 |
+
"guides/instances.md",
|
| 38 |
+
],
|
| 39 |
+
"api.md",
|
| 40 |
+
],
|
| 41 |
+
format = Documenter.HTML(assets = ["assets/custom.css"]),
|
| 42 |
+
)
|
| 43 |
+
end
|
docs/src/api.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# API Reference
|
| 2 |
+
|
| 3 |
+
## Read data, build model & optimize
|
| 4 |
+
|
| 5 |
+
```@docs
|
| 6 |
+
UnitCommitment.read
|
| 7 |
+
UnitCommitment.read_benchmark
|
| 8 |
+
UnitCommitment.build_model
|
| 9 |
+
UnitCommitment.optimize!
|
| 10 |
+
UnitCommitment.solution
|
| 11 |
+
UnitCommitment.validate
|
| 12 |
+
UnitCommitment.write
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
## Locational Marginal Prices
|
| 16 |
+
|
| 17 |
+
### Conventional LMPs
|
| 18 |
+
|
| 19 |
+
```@docs
|
| 20 |
+
UnitCommitment.compute_lmp(::JuMP.Model,::UnitCommitment.ConventionalLMP)
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
### Approximated Extended LMPs
|
| 24 |
+
|
| 25 |
+
```@docs
|
| 26 |
+
UnitCommitment.AELMP
|
| 27 |
+
UnitCommitment.compute_lmp(::JuMP.Model,::UnitCommitment.AELMP)
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Modify instance
|
| 31 |
+
|
| 32 |
+
```@docs
|
| 33 |
+
UnitCommitment.slice
|
| 34 |
+
UnitCommitment.randomize!(::UnitCommitment.UnitCommitmentInstance)
|
| 35 |
+
UnitCommitment.generate_initial_conditions!
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Formulations
|
| 39 |
+
|
| 40 |
+
```@docs
|
| 41 |
+
UnitCommitment.Formulation
|
| 42 |
+
UnitCommitment.ShiftFactorsFormulation
|
| 43 |
+
UnitCommitment.ArrCon2000
|
| 44 |
+
UnitCommitment.CarArr2006
|
| 45 |
+
UnitCommitment.DamKucRajAta2016
|
| 46 |
+
UnitCommitment.Gar1962
|
| 47 |
+
UnitCommitment.KnuOstWat2018
|
| 48 |
+
UnitCommitment.MorLatRam2013
|
| 49 |
+
UnitCommitment.PanGua2016
|
| 50 |
+
UnitCommitment.WanHob2016
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Solution Methods
|
| 54 |
+
|
| 55 |
+
```@docs
|
| 56 |
+
UnitCommitment.XavQiuWanThi2019.Method
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Randomization Methods
|
| 60 |
+
|
| 61 |
+
```@docs
|
| 62 |
+
UnitCommitment.XavQiuAhm2021.Randomization
|
| 63 |
+
```
|
docs/src/assets/cost_curve.png
ADDED
|
Git LFS Details
|
docs/src/assets/custom.css
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@media screen and (min-width: 1056px) {
|
| 2 |
+
#documenter .docs-main {
|
| 3 |
+
max-width: 50rem !important;
|
| 4 |
+
}
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
tbody, thead, pre {
|
| 9 |
+
border: 1px solid rgba(0, 0, 0, 0.25);
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
table td, th {
|
| 13 |
+
padding: 8px;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
table p {
|
| 17 |
+
margin-bottom: 0;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
table td code {
|
| 21 |
+
white-space: nowrap;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
table tr,
|
| 25 |
+
table th {
|
| 26 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
table tr:last-child {
|
| 30 |
+
border-bottom: 0;
|
| 31 |
+
}
|
| 32 |
+
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# JSON data format
|
| 2 |
+
|
| 3 |
+
An instance of the stochastic security-constrained unit commitment (SCUC) problem is composed multiple scenarios. Each scenario should be described in an individual JSON file containing the main section belows. For deterministic instances, a single scenario file, following the same format below, may also be provided. Fields that are allowed to differ among scenarios are marked as "uncertain". Fields that are allowed to be time-dependent are marked as "time series".
|
| 4 |
+
|
| 5 |
+
- [Parameters](#Parameters)
|
| 6 |
+
- [Buses](#Buses)
|
| 7 |
+
- [Generators](#Generators)
|
| 8 |
+
- [Storage units](#Storage-units)
|
| 9 |
+
- [Price-sensitive loads](#Price-sensitive-loads)
|
| 10 |
+
- [Transmission lines](#Transmission-lines)
|
| 11 |
+
- [Reserves](#Reserves)
|
| 12 |
+
- [Contingencies](#Contingencies)
|
| 13 |
+
|
| 14 |
+
Each section is described in detail below. See [case118/2017-01-01.json.gz](https://axavier.org/UnitCommitment.jl/0.4/instances/matpower/case118/2017-01-01.json.gz) for a complete example.
|
| 15 |
+
|
| 16 |
+
### Parameters
|
| 17 |
+
|
| 18 |
+
This section describes system-wide parameters, such as power balance penalty, and optimization parameters, such as the length of the planning horizon and the time.
|
| 19 |
+
|
| 20 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 21 |
+
| :----------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | :----------: | :--------: |
|
| 22 |
+
| `Version` | Version of UnitCommitment.jl this file was written for. Required to ensure that the file remains readable in future versions of the package. If you are following this page to construct the file, this field should equal `0.4`. | Required | No | No |
|
| 23 |
+
| `Time horizon (min)` or `Time horizon (h)` | Length of the planning horizon (in minutes or hours). Either `Time horizon (min)` or `Time horizon (h)` is required, but not both. | Required | No | No |
|
| 24 |
+
| `Time step (min)` | Length of each time step (in minutes). Must be a divisor of 60 (e.g. 60, 30, 20, 15, etc). | `60` | No | No |
|
| 25 |
+
| `Power balance penalty ($/MW)` | Penalty for system-wide shortage or surplus in production (in $/MW). This is charged per time step. For example, if there is a shortage of 1 MW for three time steps, three times this amount will be charged. | `1000.0` | No | Yes |
|
| 26 |
+
| `Scenario name` | Name of the scenario. | `"s1"` | No | --- |
|
| 27 |
+
| `Scenario weight` | Weight of the scenario. The scenario weight can be any positive real number, that is, it does not have to be between zero and one. The package normalizes the weights to ensure that the probability of all scenarios sum up to one. | 1.0 | No | --- |
|
| 28 |
+
|
| 29 |
+
#### Example
|
| 30 |
+
|
| 31 |
+
```json
|
| 32 |
+
{
|
| 33 |
+
"Parameters": {
|
| 34 |
+
"Version": "0.4",
|
| 35 |
+
"Time horizon (h)": 4,
|
| 36 |
+
"Power balance penalty ($/MW)": 1000.0,
|
| 37 |
+
"Scenario name": "s1",
|
| 38 |
+
"Scenario weight": 0.5
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
### Buses
|
| 44 |
+
|
| 45 |
+
This section describes the characteristics of each bus in the system.
|
| 46 |
+
|
| 47 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 48 |
+
| :---------- | :--------------------------------------- | -------- | :----------: | :--------: |
|
| 49 |
+
| `Load (MW)` | Fixed load connected to the bus (in MW). | Required | Yes | Yes |
|
| 50 |
+
|
| 51 |
+
#### Example
|
| 52 |
+
|
| 53 |
+
```json
|
| 54 |
+
{
|
| 55 |
+
"Buses": {
|
| 56 |
+
"b1": {
|
| 57 |
+
"Load (MW)": 0.0
|
| 58 |
+
},
|
| 59 |
+
"b2": {
|
| 60 |
+
"Load (MW)": [26.01527, 24.46212, 23.29725, 22.90897]
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
### Generators
|
| 67 |
+
|
| 68 |
+
This section describes all generators in the system. Two types of units can be specified:
|
| 69 |
+
|
| 70 |
+
- **Thermal units:** Units that produce power by converting heat into electrical energy, such as coal and oil power plants. These units use a more complex model, with binary decision variables, and various constraints to enforce ramp rates and minimum up/down time.
|
| 71 |
+
- **Profiled units:** Simplified model for units that do not require the constraints mentioned above, only a maximum and minimum power output for each time period. Typically used for renewables and hydro.
|
| 72 |
+
|
| 73 |
+
#### Thermal Units
|
| 74 |
+
|
| 75 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 76 |
+
| :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | :----------: | :--------: |
|
| 77 |
+
| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes |
|
| 78 |
+
| `Type` | Type of the generator (string). For thermal generators, this must be `Thermal`. | Required | No | No |
|
| 79 |
+
| `Production cost curve (MW)` and `Production cost curve ($)` | Parameters describing the piecewise-linear production costs. See below for more details. | Required | Yes | Yes |
|
| 80 |
+
| `Startup costs ($)` and `Startup delays (h)` | Parameters describing how much it costs to start the generator after it has been shut down for a certain amount of time. If `Startup costs ($)` and `Startup delays (h)` are set to `[300.0, 400.0]` and `[1, 4]`, for example, and the generator is shut down at time `00:00` (h:min), then it costs \$300 to start up the generator at any time between `01:00` and `03:59`, and \$400 to start the generator at time `04:00` or any time after that. The number of startup cost points is unlimited, and may be different for each generator. Startup delays must be strictly increasing and the first entry must equal `Minimum downtime (h)`. | `[0.0]` and `[1]` | No | Yes |
|
| 81 |
+
| `Minimum uptime (h)` | Minimum amount of time the generator must stay operational after starting up (in hours). For example, if the generator starts up at time `00:00` (h:min) and `Minimum uptime (h)` is set to 4, then the generator can only shut down at time `04:00`. | `1` | No | Yes |
|
| 82 |
+
| `Minimum downtime (h)` | Minimum amount of time the generator must stay offline after shutting down (in hours). For example, if the generator shuts down at time `00:00` (h:min) and `Minimum downtime (h)` is set to 4, then the generator can only start producing power again at time `04:00`. | `1` | No | Yes |
|
| 83 |
+
| `Ramp up limit (MW)` | Maximum increase in production from one time step to the next (in MW). For example, if the generator is producing 100 MW at time step 1 and if this parameter is set to 40 MW, then the generator will produce at most 140 MW at time step 2. | `+inf` | No | Yes |
|
| 84 |
+
| `Ramp down limit (MW)` | Maximum decrease in production from one time step to the next (in MW). For example, if the generator is producing 100 MW at time step 1 and this parameter is set to 40 MW, then the generator will produce at least 60 MW at time step 2. | `+inf` | No | Yes |
|
| 85 |
+
| `Startup limit (MW)` | Maximum amount of power a generator can produce immediately after starting up (in MW). For example, if `Startup limit (MW)` is set to 100 MW and the unit is off at time step 1, then it may produce at most 100 MW at time step 2. | `+inf` | No | Yes |
|
| 86 |
+
| `Shutdown limit (MW)` | Maximum amount of power a generator can produce immediately before shutting down (in MW). Specifically, the generator can only shut down at time step `t+1` if its production at time step `t` is below this limit. | `+inf` | No | Yes |
|
| 87 |
+
| `Initial status (h)` | If set to a positive number, indicates the amount of time (in hours) the generator has been on at the beginning of the simulation, and if set to a negative number, the amount of time the generator has been off. For example, if `Initial status (h)` is `-2`, this means that the generator was off since `-02:00` (h:min). The simulation starts at time `00:00`. If `Initial status (h)` is `3`, this means that the generator was on since `-03:00`. A value of zero is not acceptable. | Required | No | No |
|
| 88 |
+
| `Initial power (MW)` | Amount of power the generator at time step `-1`, immediately before the planning horizon starts. | Required | No | No |
|
| 89 |
+
| `Must run?` | If `true`, the generator should be committed, even if that is not economical (Boolean). | `false` | Yes | Yes |
|
| 90 |
+
| `Reserve eligibility` | List of reserve products this generator is eligibe to provide. By default, the generator is not eligible to provide any reserves. | `[]` | No | Yes |
|
| 91 |
+
| `Commitment status` | List of commitment status over the time horizon. At time `t`, if `true`, the generator must be commited at that time period; if `false`, the generator must not be commited at that time period. If `null` at time `t`, the generator's commitment status is then decided by the model. By default, the status is a list of `null` values. | `null` | Yes | Yes |
|
| 92 |
+
|
| 93 |
+
#### Profiled Units
|
| 94 |
+
|
| 95 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 96 |
+
| :------------------- | :-------------------------------------------------------------------------------- | :------: | :----------: | :--------: |
|
| 97 |
+
| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes |
|
| 98 |
+
| `Type` | Type of the generator (string). For profiled generators, this must be `Profiled`. | Required | No | No |
|
| 99 |
+
| `Cost ($/MW)` | Cost incurred for serving each MW of power by this generator. | Required | Yes | Yes |
|
| 100 |
+
| `Minimum power (MW)` | Minimum amount of power this generator may supply. | `0.0` | Yes | Yes |
|
| 101 |
+
| `Maximum power (MW)` | Maximum amount of power this generator may supply. | Required | Yes | Yes |
|
| 102 |
+
|
| 103 |
+
#### Production costs and limits
|
| 104 |
+
|
| 105 |
+
Production costs are represented as piecewise-linear curves. Figure 1 shows an example cost curve with three segments, where it costs \$1400, \$1600, \$2200 and \$2400 to generate, respectively, 100, 110, 130 and 135 MW of power. To model this generator, `Production cost curve (MW)` should be set to `[100, 110, 130, 135]`, and `Production cost curve ($)` should be set to `[1400, 1600, 2200, 2400]`.
|
| 106 |
+
Note that this curve also specifies the production limits. Specifically, the first point identifies the minimum power output when the unit is operational, while the last point identifies the maximum power output.
|
| 107 |
+
|
| 108 |
+
```@raw html
|
| 109 |
+
<center>
|
| 110 |
+
<img src="../assets/cost_curve.png" style="max-width: 500px"/>
|
| 111 |
+
<div><b>Figure 1.</b> Piecewise-linear production cost curve.</div>
|
| 112 |
+
<br/>
|
| 113 |
+
</center>
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
#### Additional remarks:
|
| 117 |
+
|
| 118 |
+
- For time-dependent production limits or time-dependent production costs, the usage of nested arrays is allowed. For example, if `Production cost curve (MW)` is set to `[5.0, [10.0, 12.0, 15.0, 20.0]]`, then the unit may generate at most 10, 12, 15 and 20 MW of power during time steps 1, 2, 3 and 4, respectively. The minimum output for all time periods is fixed to at 5 MW.
|
| 119 |
+
- There is no limit to the number of piecewise-linear segments, and different generators may have a different number of segments.
|
| 120 |
+
- If `Production cost curve (MW)` and `Production cost curve ($)` both contain a single element, then the generator must produce exactly that amount of power when operational. To specify that the generator may produce any amount of power up to a certain limit `P`, the parameter `Production cost curve (MW)` should be set to `[0, P]`.
|
| 121 |
+
- Production cost curves must be convex.
|
| 122 |
+
|
| 123 |
+
#### Example
|
| 124 |
+
|
| 125 |
+
```json
|
| 126 |
+
{
|
| 127 |
+
"Generators": {
|
| 128 |
+
"gen1": {
|
| 129 |
+
"Bus": "b1",
|
| 130 |
+
"Type": "Thermal",
|
| 131 |
+
"Production cost curve (MW)": [100.0, 110.0, 130.0, 135.0],
|
| 132 |
+
"Production cost curve ($)": [1400.0, 1600.0, 2200.0, 2400.0],
|
| 133 |
+
"Startup costs ($)": [300.0, 400.0],
|
| 134 |
+
"Startup delays (h)": [1, 4],
|
| 135 |
+
"Ramp up limit (MW)": 232.68,
|
| 136 |
+
"Ramp down limit (MW)": 232.68,
|
| 137 |
+
"Startup limit (MW)": 232.68,
|
| 138 |
+
"Shutdown limit (MW)": 232.68,
|
| 139 |
+
"Minimum downtime (h)": 4,
|
| 140 |
+
"Minimum uptime (h)": 4,
|
| 141 |
+
"Initial status (h)": 12,
|
| 142 |
+
"Initial power (MW)": 115,
|
| 143 |
+
"Must run?": false,
|
| 144 |
+
"Reserve eligibility": ["r1"]
|
| 145 |
+
},
|
| 146 |
+
"gen2": {
|
| 147 |
+
"Bus": "b5",
|
| 148 |
+
"Type": "Thermal",
|
| 149 |
+
"Production cost curve (MW)": [0.0, [10.0, 8.0, 0.0, 3.0]],
|
| 150 |
+
"Production cost curve ($)": [0.0, 0.0],
|
| 151 |
+
"Initial status (h)": -100,
|
| 152 |
+
"Initial power (MW)": 0,
|
| 153 |
+
"Reserve eligibility": ["r1", "r2"],
|
| 154 |
+
"Commitment status": [true, false, null, true]
|
| 155 |
+
},
|
| 156 |
+
"gen3": {
|
| 157 |
+
"Bus": "b6",
|
| 158 |
+
"Type": "Profiled",
|
| 159 |
+
"Minimum power (MW)": 10.0,
|
| 160 |
+
"Maximum power (MW)": 120.0,
|
| 161 |
+
"Cost ($/MW)": 100.0
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
### Storage units
|
| 168 |
+
|
| 169 |
+
This section describes energy storage units in the system which charge and discharge power. The storage units consume power while charging, and generate power while discharging.
|
| 170 |
+
|
| 171 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 172 |
+
| :-------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------: | :----------: | :--------: |
|
| 173 |
+
| `Bus` | Bus where the storage unit is located. Multiple storage units may be placed at the same bus. | Required | No | Yes |
|
| 174 |
+
| `Minimum level (MWh)` | Minimum of energy level this storage unit may contain. | `0.0` | Yes | Yes |
|
| 175 |
+
| `Maximum level (MWh)` | Maximum of energy level this storage unit may contain. | Required | Yes | Yes |
|
| 176 |
+
| `Allow simultaneous charging and discharging` | If `false`, the storage unit is not allowed to charge and discharge at the same time (Boolean). | `true` | Yes | Yes |
|
| 177 |
+
| `Charge cost ($/MW)` | Cost incurred for charging each MW of power into this storage unit. | Required | Yes | Yes |
|
| 178 |
+
| `Discharge cost ($/MW)` | Cost incurred for discharging each MW of power from this storage unit. | Required | Yes | Yes |
|
| 179 |
+
| `Charge efficiency` | Efficiency rate to charge power into this storage unit. This value must be greater than or equal to `0.0`, and less than or equal to `1.0`. | `1.0` | Yes | Yes |
|
| 180 |
+
| `Discharge efficiency` | Efficiency rate to discharge power from this storage unit. This value must be greater than or equal to `0.0`, and less than or equal to `1.0`. | `1.0` | Yes | Yes |
|
| 181 |
+
| `Loss factor` | The energy dissipation rate of this storage unit. This value must be greater than or equal to `0.0`, and less than or equal to `1.0`. | `0.0` | Yes | Yes |
|
| 182 |
+
| `Minimum charge rate (MW)` | Minimum amount of power rate this storage unit may charge. | `0.0` | Yes | Yes |
|
| 183 |
+
| `Maximum charge rate (MW)` | Maximum amount of power rate this storage unit may charge. | Required | Yes | Yes |
|
| 184 |
+
| `Minimum discharge rate (MW)` | Minimum amount of power rate this storage unit may discharge. | `0.0` | Yes | Yes |
|
| 185 |
+
| `Maximum discharge rate (MW)` | Maximum amount of power rate this storage unit may discharge. | Required | Yes | Yes |
|
| 186 |
+
| `Initial level (MWh)` | Amount of energy this storage unit at time step `-1`, immediately before the planning horizon starts. | `0.0` | No | Yes |
|
| 187 |
+
| `Last period minimum level (MWh)` | Minimum of energy level this storage unit may contain in the last time step. By default, this value is the same as the last value of `Minimum level (MWh)`. | `Minimum level (MWh)` | No | Yes |
|
| 188 |
+
| `Last period maximum level (MWh)` | Maximum of energy level this storage unit may contain in the last time step. By default, this value is the same as the last value of `Maximum level (MWh)`. | `Maximum level (MWh)` | No | Yes |
|
| 189 |
+
|
| 190 |
+
#### Example
|
| 191 |
+
|
| 192 |
+
```json
|
| 193 |
+
{
|
| 194 |
+
"Storage units": {
|
| 195 |
+
"su1": {
|
| 196 |
+
"Bus": "b2",
|
| 197 |
+
"Maximum level (MWh)": 100.0,
|
| 198 |
+
"Charge cost ($/MW)": 2.0,
|
| 199 |
+
"Discharge cost ($/MW)": 2.5,
|
| 200 |
+
"Maximum charge rate (MW)": 10.0,
|
| 201 |
+
"Maximum discharge rate (MW)": 8.0
|
| 202 |
+
},
|
| 203 |
+
"su2": {
|
| 204 |
+
"Bus": "b2",
|
| 205 |
+
"Minimum level (MWh)": 10.0,
|
| 206 |
+
"Maximum level (MWh)": 100.0,
|
| 207 |
+
"Allow simultaneous charging and discharging": false,
|
| 208 |
+
"Charge cost ($/MW)": 3.0,
|
| 209 |
+
"Discharge cost ($/MW)": 3.5,
|
| 210 |
+
"Charge efficiency": 0.8,
|
| 211 |
+
"Discharge efficiency": 0.85,
|
| 212 |
+
"Loss factor": 0.01,
|
| 213 |
+
"Minimum charge rate (MW)": 5.0,
|
| 214 |
+
"Maximum charge rate (MW)": 10.0,
|
| 215 |
+
"Minimum discharge rate (MW)": 2.0,
|
| 216 |
+
"Maximum discharge rate (MW)": 10.0,
|
| 217 |
+
"Initial level (MWh)": 70.0,
|
| 218 |
+
"Last period minimum level (MWh)": 80.0,
|
| 219 |
+
"Last period maximum level (MWh)": 85.0
|
| 220 |
+
},
|
| 221 |
+
"su3": {
|
| 222 |
+
"Bus": "b9",
|
| 223 |
+
"Minimum level (MWh)": [10.0, 11.0, 12.0, 13.0],
|
| 224 |
+
"Maximum level (MWh)": [100.0, 110.0, 120.0, 130.0],
|
| 225 |
+
"Allow simultaneous charging and discharging": [false, false, true, true],
|
| 226 |
+
"Charge cost ($/MW)": [2.0, 2.1, 2.2, 2.3],
|
| 227 |
+
"Discharge cost ($/MW)": [1.0, 1.1, 1.2, 1.3],
|
| 228 |
+
"Charge efficiency": [0.8, 0.81, 0.82, 0.82],
|
| 229 |
+
"Discharge efficiency": [0.85, 0.86, 0.87, 0.88],
|
| 230 |
+
"Loss factor": [0.01, 0.01, 0.02, 0.02],
|
| 231 |
+
"Minimum charge rate (MW)": [5.0, 5.1, 5.2, 5.3],
|
| 232 |
+
"Maximum charge rate (MW)": [10.0, 10.1, 10.2, 10.3],
|
| 233 |
+
"Minimum discharge rate (MW)": [4.0, 4.1, 4.2, 4.3],
|
| 234 |
+
"Maximum discharge rate (MW)": [8.0, 8.1, 8.2, 8.3],
|
| 235 |
+
"Initial level (MWh)": 20.0,
|
| 236 |
+
"Last period minimum level (MWh)": 21.0,
|
| 237 |
+
"Last period maximum level (MWh)": 22.0
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
}
|
| 241 |
+
```
|
| 242 |
+
|
| 243 |
+
### Price-sensitive loads
|
| 244 |
+
|
| 245 |
+
This section describes components in the system which may increase or reduce their energy consumption according to the energy prices. Fixed loads (as described in the `buses` section) are always served, regardless of the price, unless there is significant congestion in the system or insufficient production capacity. Price-sensitive loads, on the other hand, are only served if it is economical to do so.
|
| 246 |
+
|
| 247 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 248 |
+
| :--------------- | :------------------------------------------------------------------------------------------- | :------: | :----------: | :--------: |
|
| 249 |
+
| `Bus` | Bus where the load is located. Multiple price-sensitive loads may be placed at the same bus. | Required | No | Yes |
|
| 250 |
+
| `Revenue ($/MW)` | Revenue obtained for serving each MW of power to this load. | Required | Yes | Yes |
|
| 251 |
+
| `Demand (MW)` | Maximum amount of power required by this load. Any amount lower than this may be served. | Required | Yes | Yes |
|
| 252 |
+
|
| 253 |
+
#### Example
|
| 254 |
+
|
| 255 |
+
```json
|
| 256 |
+
{
|
| 257 |
+
"Price-sensitive loads": {
|
| 258 |
+
"p1": {
|
| 259 |
+
"Bus": "b3",
|
| 260 |
+
"Revenue ($/MW)": 23.0,
|
| 261 |
+
"Demand (MW)": 50.0
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
### Transmission lines
|
| 268 |
+
|
| 269 |
+
This section describes the characteristics of transmission system, such as its topology and the susceptance of each transmission line.
|
| 270 |
+
|
| 271 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 272 |
+
| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | :----------: | :--------: |
|
| 273 |
+
| `Source bus` | Identifier of the bus where the transmission line originates. | Required | No | Yes |
|
| 274 |
+
| `Target bus` | Identifier of the bus where the transmission line reaches. | Required | No | Yes |
|
| 275 |
+
| `Susceptance (S)` | Susceptance of the transmission line (in siemens). | Required | No | Yes |
|
| 276 |
+
| `Normal flow limit (MW)` | Maximum amount of power (in MW) allowed to flow through the line when the system is in its regular, fully-operational state. | `+inf` | Yes | Yes |
|
| 277 |
+
| `Emergency flow limit (MW)` | Maximum amount of power (in MW) allowed to flow through the line when the system is in degraded state (for example, after the failure of another transmission line). | `+inf` | Y | Yes |
|
| 278 |
+
| `Flow limit penalty ($/MW)` | Penalty for violating the flow limits of the transmission line (in $/MW). This is charged per time step. For example, if there is a thermal violation of 1 MW for three time steps, then three times this amount will be charged. | `5000.0` | Yes | Yes |
|
| 279 |
+
|
| 280 |
+
#### Example
|
| 281 |
+
|
| 282 |
+
```json
|
| 283 |
+
{
|
| 284 |
+
"Transmission lines": {
|
| 285 |
+
"l1": {
|
| 286 |
+
"Source bus": "b1",
|
| 287 |
+
"Target bus": "b2",
|
| 288 |
+
"Susceptance (S)": 29.49686,
|
| 289 |
+
"Normal flow limit (MW)": 15000.0,
|
| 290 |
+
"Emergency flow limit (MW)": 20000.0,
|
| 291 |
+
"Flow limit penalty ($/MW)": 5000.0
|
| 292 |
+
}
|
| 293 |
+
}
|
| 294 |
+
}
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
### Reserves
|
| 298 |
+
|
| 299 |
+
This section describes the hourly amount of reserves required.
|
| 300 |
+
|
| 301 |
+
| Key | Description | Default | Time series? | Uncertain? |
|
| 302 |
+
| :------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | :----------: | :--------: |
|
| 303 |
+
| `Type` | Type of reserve product. Must be either "spinning" or "flexiramp". | Required | No | No |
|
| 304 |
+
| `Amount (MW)` | Amount of reserves required. | Required | Yes | Yes |
|
| 305 |
+
| `Shortfall penalty ($/MW)` | Penalty for shortage in meeting the reserve requirements (in $/MW). This is charged per time step. Negative value implies reserve constraints must always be satisfied. | `-1` | Yes | Yes |
|
| 306 |
+
|
| 307 |
+
#### Example 1
|
| 308 |
+
|
| 309 |
+
```json
|
| 310 |
+
{
|
| 311 |
+
"Reserves": {
|
| 312 |
+
"r1": {
|
| 313 |
+
"Type": "spinning",
|
| 314 |
+
"Amount (MW)": [57.30552, 53.88429, 51.31838, 50.46307],
|
| 315 |
+
"Shortfall penalty ($/MW)": 5.0
|
| 316 |
+
},
|
| 317 |
+
"r2": {
|
| 318 |
+
"Type": "flexiramp",
|
| 319 |
+
"Amount (MW)": [20.31042, 23.65273, 27.41784, 25.34057]
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
```
|
| 324 |
+
|
| 325 |
+
### Contingencies
|
| 326 |
+
|
| 327 |
+
This section describes credible contingency scenarios in the optimization, such as the loss of a transmission line or generator.
|
| 328 |
+
|
| 329 |
+
| Key | Description | Default | Uncertain? |
|
| 330 |
+
| :-------------------- | :------------------------------------------------------------------------------------------------ | :-----: | :--------: |
|
| 331 |
+
| `Affected generators` | List of generators affected by this contingency. May be omitted if no generators are affected. | `[]` | Yes |
|
| 332 |
+
| `Affected lines` | List of transmission lines affected by this contingency. May be omitted if no lines are affected. | `[]` | Yes |
|
| 333 |
+
|
| 334 |
+
#### Example
|
| 335 |
+
|
| 336 |
+
```json
|
| 337 |
+
{
|
| 338 |
+
"Contingencies": {
|
| 339 |
+
"c1": {
|
| 340 |
+
"Affected lines": ["l1", "l2", "l3"],
|
| 341 |
+
"Affected generators": ["g1"]
|
| 342 |
+
},
|
| 343 |
+
"c2": {
|
| 344 |
+
"Affected lines": ["l4"]
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
}
|
| 348 |
+
```
|
| 349 |
+
|
| 350 |
+
### Additional remarks
|
| 351 |
+
|
| 352 |
+
#### Time series parameters
|
| 353 |
+
|
| 354 |
+
Many numerical properties in the JSON file can be specified either as a single floating point number if they are time-independent, or as an array containing exactly `T` elements, if they are time-dependent, where `T` is the number of time steps in the planning horizon. For example, both formats below are valid when `T=3`:
|
| 355 |
+
|
| 356 |
+
```json
|
| 357 |
+
{
|
| 358 |
+
"Load (MW)": 800.0,
|
| 359 |
+
"Load (MW)": [800.0, 850.0, 730.0]
|
| 360 |
+
}
|
| 361 |
+
```
|
| 362 |
+
|
| 363 |
+
The value `T` depends on both `Time horizon (h)` and `Time step (min)`, as the table below illustrates.
|
| 364 |
+
|
| 365 |
+
| Time horizon (h) | Time step (min) | T |
|
| 366 |
+
| :--------------: | :-------------: | :-: |
|
| 367 |
+
| 24 | 60 | 24 |
|
| 368 |
+
| 24 | 15 | 96 |
|
| 369 |
+
| 24 | 5 | 288 |
|
| 370 |
+
| 36 | 60 | 36 |
|
| 371 |
+
| 36 | 15 | 144 |
|
| 372 |
+
| 36 | 5 | 432 |
|
| 373 |
+
|
| 374 |
+
## Current limitations
|
| 375 |
+
|
| 376 |
+
- Network topology must remain the same for all time periods.
|
| 377 |
+
- Only N-1 transmission contingencies are supported. Generator contingencies are not currently supported.
|
| 378 |
+
- Time-varying minimum production amounts are not currently compatible with ramp/startup/shutdown limits.
|
| 379 |
+
- Flexible ramping products can only be acquired under the `WanHob2016` formulation, which does not support spinning reserves.
|
| 380 |
+
- The set of generators must be the same in all scenarios.
|
docs/src/guides/instances.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Benchmark instances
|
| 2 |
+
|
| 3 |
+
UnitCommitment.jl provides a large collection of benchmark instances collected from the literature and converted to a [common data format](../guides/format.md). In some cases, as indicated below, the original instances have been extended, with realistic parameters, using data-driven methods. If you use these instances in your research, we request that you cite UnitCommitment.jl, as well as the original sources, as listed below. Benchmark instances can be loaded with `UnitCommitment.read_benchmark(name)`, as explained in the [tutorials](../tutorials/usage.md). Instance files can also be [directly downloaded from our website](https://axavier.org/UnitCommitment.jl/0.4/instances/).
|
| 4 |
+
|
| 5 |
+
!!! warning
|
| 6 |
+
|
| 7 |
+
The instances included in UC.jl are still under development and may change in the future. If you use these instances in your research, for reproducibility, you should specify what version of UC.jl they came from.
|
| 8 |
+
|
| 9 |
+
## MATPOWER
|
| 10 |
+
|
| 11 |
+
[MATPOWER](https://github.com/MATPOWER/matpower) is an open-source package for solving power flow problems in MATLAB and Octave. It contains a number of power flow test cases, which have been widely used in the power systems literature.
|
| 12 |
+
|
| 13 |
+
Because most MATPOWER test cases were originally designed for power flow studies, they lack a number of important unit commitment parameters, such as time-varying loads, production cost curves, ramp limits, reserves and initial conditions. The test cases included in UnitCommitment.jl are extended versions of the original MATPOWER test cases, modified as following:
|
| 14 |
+
|
| 15 |
+
- **Production cost** curves were generated using a data-driven approach, based on publicly available data. More specifically, machine learning models were trained to predict typical production cost curves, for each day of the year, based on a generator's maximum and minimum power output.
|
| 16 |
+
|
| 17 |
+
- **Load profiles** were generated using a similar data-driven approach.
|
| 18 |
+
|
| 19 |
+
- **Ramp-up, ramp-down, startup and shutdown rates** were set to a fixed proportion of the generator's maximum output.
|
| 20 |
+
|
| 21 |
+
- **Minimum reserves** were set to a fixed proportion of the total demand.
|
| 22 |
+
|
| 23 |
+
- **Contingencies** were set to include all N-1 transmission line contingencies that do not generate islands or isolated buses. More specifically, there is one contingency for each transmission line, as long as that transmission line is not a bridge in the network graph.
|
| 24 |
+
|
| 25 |
+
For each MATPOWER test case, UC.jl provides 365 variations (`2017-01-01` to `2017-12-31`) corresponding different days of the year.
|
| 26 |
+
|
| 27 |
+
### MATPOWER/UW-PSTCA
|
| 28 |
+
|
| 29 |
+
A variety of smaller IEEE test cases, [compiled by University of Washington](http://labs.ece.uw.edu/pstca/), corresponding mostly to small portions of the American Electric Power System in the 1960s.
|
| 30 |
+
|
| 31 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 32 |
+
| ----------------------------- | ----- | ---------- | ----- | ------------- | -------------- |
|
| 33 |
+
| `matpower/case14/2017-01-01` | 14 | 5 | 20 | 19 | [MTPWR, PSTCA] |
|
| 34 |
+
| `matpower/case30/2017-01-01` | 30 | 6 | 41 | 38 | [MTPWR, PSTCA] |
|
| 35 |
+
| `matpower/case57/2017-01-01` | 57 | 7 | 80 | 79 | [MTPWR, PSTCA] |
|
| 36 |
+
| `matpower/case118/2017-01-01` | 118 | 54 | 186 | 177 | [MTPWR, PSTCA] |
|
| 37 |
+
| `matpower/case300/2017-01-01` | 300 | 69 | 411 | 320 | [MTPWR, PSTCA] |
|
| 38 |
+
|
| 39 |
+
### MATPOWER/Polish
|
| 40 |
+
|
| 41 |
+
Test cases based on the Polish 400, 220 and 110 kV networks, originally provided by **Roman Korab** (Politechnika Śląska) and corrected by the MATPOWER team.
|
| 42 |
+
|
| 43 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 44 |
+
| --------------------------------- | ----- | ---------- | ----- | ------------- | ---------- |
|
| 45 |
+
| `matpower/case2383wp/2017-01-01` | 2383 | 323 | 2896 | 2240 | [MTPWR] |
|
| 46 |
+
| `matpower/case2736sp/2017-01-01` | 2736 | 289 | 3504 | 3159 | [MTPWR] |
|
| 47 |
+
| `matpower/case2737sop/2017-01-01` | 2737 | 267 | 3506 | 3161 | [MTPWR] |
|
| 48 |
+
| `matpower/case2746wop/2017-01-01` | 2746 | 443 | 3514 | 3155 | [MTPWR] |
|
| 49 |
+
| `matpower/case2746wp/2017-01-01` | 2746 | 457 | 3514 | 3156 | [MTPWR] |
|
| 50 |
+
| `matpower/case3012wp/2017-01-01` | 3012 | 496 | 3572 | 2854 | [MTPWR] |
|
| 51 |
+
| `matpower/case3120sp/2017-01-01` | 3120 | 483 | 3693 | 2950 | [MTPWR] |
|
| 52 |
+
| `matpower/case3375wp/2017-01-01` | 3374 | 590 | 4161 | 3245 | [MTPWR] |
|
| 53 |
+
|
| 54 |
+
### MATPOWER/PEGASE
|
| 55 |
+
|
| 56 |
+
Test cases from the [Pan European Grid Advanced Simulation and State Estimation (PEGASE) project](https://cordis.europa.eu/project/id/211407), describing part of the European high voltage transmission network.
|
| 57 |
+
|
| 58 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 59 |
+
| ------------------------------------- | ----- | ---------- | ----- | ------------- | --------------------------- |
|
| 60 |
+
| `matpower/case89pegase/2017-01-01` | 89 | 12 | 210 | 192 | [JoFlMa16, FlPaCa13, MTPWR] |
|
| 61 |
+
| `matpower/case1354pegase/2017-01-01` | 1354 | 260 | 1991 | 1288 | [JoFlMa16, FlPaCa13, MTPWR] |
|
| 62 |
+
| `matpower/case2869pegase/2017-01-01` | 2869 | 510 | 4582 | 3579 | [JoFlMa16, FlPaCa13, MTPWR] |
|
| 63 |
+
| `matpower/case9241pegase/2017-01-01` | 9241 | 1445 | 16049 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] |
|
| 64 |
+
| `matpower/case13659pegase/2017-01-01` | 13659 | 4092 | 20467 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] |
|
| 65 |
+
|
| 66 |
+
### MATPOWER/RTE
|
| 67 |
+
|
| 68 |
+
Test cases from the R&D Division at [Reseau de Transport d'Electricite](https://www.rte-france.com) representing the size and complexity of the French very high voltage transmission network.
|
| 69 |
+
|
| 70 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 71 |
+
| --------------------------------- | ----- | ---------- | ----- | ------------- | ----------------- |
|
| 72 |
+
| `matpower/case1888rte/2017-01-01` | 1888 | 296 | 2531 | 1484 | [MTPWR, JoFlMa16] |
|
| 73 |
+
| `matpower/case1951rte/2017-01-01` | 1951 | 390 | 2596 | 1497 | [MTPWR, JoFlMa16] |
|
| 74 |
+
| `matpower/case2848rte/2017-01-01` | 2848 | 544 | 3776 | 2242 | [MTPWR, JoFlMa16] |
|
| 75 |
+
| `matpower/case2868rte/2017-01-01` | 2868 | 596 | 3808 | 2260 | [MTPWR, JoFlMa16] |
|
| 76 |
+
| `matpower/case6468rte/2017-01-01` | 6468 | 1262 | 9000 | 6094 | [MTPWR, JoFlMa16] |
|
| 77 |
+
| `matpower/case6470rte/2017-01-01` | 6470 | 1306 | 9005 | 6085 | [MTPWR, JoFlMa16] |
|
| 78 |
+
| `matpower/case6495rte/2017-01-01` | 6495 | 1352 | 9019 | 6060 | [MTPWR, JoFlMa16] |
|
| 79 |
+
| `matpower/case6515rte/2017-01-01` | 6515 | 1368 | 9037 | 6063 | [MTPWR, JoFlMa16] |
|
| 80 |
+
|
| 81 |
+
## PGLIB-UC Instances
|
| 82 |
+
|
| 83 |
+
[PGLIB-UC](https://github.com/power-grid-lib/pglib-uc) is a benchmark library curated and maintained by the [IEEE PES Task Force on Benchmarks for Validation of Emerging Power System Algorithms](https://power-grid-lib.github.io/). These test cases have been used in [KnOsWa20].
|
| 84 |
+
|
| 85 |
+
### PGLIB-UC/California
|
| 86 |
+
|
| 87 |
+
Test cases based on publicly available data from the California ISO. For more details, see [PGLIB-UC case file overview](https://github.com/power-grid-lib/pglib-uc).
|
| 88 |
+
|
| 89 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 90 |
+
| ------------------------------------ | ----- | ---------- | ----- | ------------- | ---------- |
|
| 91 |
+
| `pglib-uc/ca/2014-09-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 92 |
+
| `pglib-uc/ca/2014-09-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 93 |
+
| `pglib-uc/ca/2014-09-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 94 |
+
| `pglib-uc/ca/2014-09-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 95 |
+
| `pglib-uc/ca/2014-12-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 96 |
+
| `pglib-uc/ca/2014-12-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 97 |
+
| `pglib-uc/ca/2014-12-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 98 |
+
| `pglib-uc/ca/2014-12-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 99 |
+
| `pglib-uc/ca/2015-03-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 100 |
+
| `pglib-uc/ca/2015-03-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 101 |
+
| `pglib-uc/ca/2015-03-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 102 |
+
| `pglib-uc/ca/2015-03-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 103 |
+
| `pglib-uc/ca/2015-06-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 104 |
+
| `pglib-uc/ca/2015-06-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 105 |
+
| `pglib-uc/ca/2015-06-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 106 |
+
| `pglib-uc/ca/2015-06-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] |
|
| 107 |
+
| `pglib-uc/ca/Scenario400_reserves_0` | 1 | 611 | 0 | 0 | [KnOsWa20] |
|
| 108 |
+
| `pglib-uc/ca/Scenario400_reserves_1` | 1 | 611 | 0 | 0 | [KnOsWa20] |
|
| 109 |
+
| `pglib-uc/ca/Scenario400_reserves_3` | 1 | 611 | 0 | 0 | [KnOsWa20] |
|
| 110 |
+
| `pglib-uc/ca/Scenario400_reserves_5` | 1 | 611 | 0 | 0 | [KnOsWa20] |
|
| 111 |
+
|
| 112 |
+
### PGLIB-UC/FERC
|
| 113 |
+
|
| 114 |
+
Test cases based on a publicly available [unit commitment test case produced by the Federal Energy Regulatory Commission](https://www.ferc.gov/industries-data/electric/power-sales-and-markets/increasing-efficiency-through-improved-software-1). For more details, see [PGLIB-UC case file overview](https://github.com/power-grid-lib/pglib-uc).
|
| 115 |
+
|
| 116 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 117 |
+
| ----------------------------- | ----- | ---------- | ----- | ------------- | -------------------- |
|
| 118 |
+
| `pglib-uc/ferc/2015-01-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 119 |
+
| `pglib-uc/ferc/2015-01-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 120 |
+
| `pglib-uc/ferc/2015-02-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 121 |
+
| `pglib-uc/ferc/2015-02-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 122 |
+
| `pglib-uc/ferc/2015-03-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 123 |
+
| `pglib-uc/ferc/2015-03-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 124 |
+
| `pglib-uc/ferc/2015-04-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 125 |
+
| `pglib-uc/ferc/2015-04-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 126 |
+
| `pglib-uc/ferc/2015-05-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 127 |
+
| `pglib-uc/ferc/2015-05-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 128 |
+
| `pglib-uc/ferc/2015-06-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 129 |
+
| `pglib-uc/ferc/2015-06-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 130 |
+
| `pglib-uc/ferc/2015-07-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 131 |
+
| `pglib-uc/ferc/2015-07-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 132 |
+
| `pglib-uc/ferc/2015-08-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 133 |
+
| `pglib-uc/ferc/2015-08-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 134 |
+
| `pglib-uc/ferc/2015-09-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 135 |
+
| `pglib-uc/ferc/2015-09-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 136 |
+
| `pglib-uc/ferc/2015-10-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 137 |
+
| `pglib-uc/ferc/2015-10-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 138 |
+
| `pglib-uc/ferc/2015-11-02_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 139 |
+
| `pglib-uc/ferc/2015-11-02_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 140 |
+
| `pglib-uc/ferc/2015-12-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 141 |
+
| `pglib-uc/ferc/2015-12-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] |
|
| 142 |
+
|
| 143 |
+
### PGLIB-UC/RTS-GMLC
|
| 144 |
+
|
| 145 |
+
[RTS-GMLC](https://github.com/GridMod/RTS-GMLC) is an updated version of the RTS-96 test system produced by the United States Department of Energy's [Grid Modernization Laboratory Consortium](https://gmlc.doe.gov/). The PGLIB-UC/RTS-GMLC instances are modified versions of the original RTS-GMLC instances, with modified ramp-rates and without a transmission network. For more details, see [PGLIB-UC case file overview](https://github.com/power-grid-lib/pglib-uc).
|
| 146 |
+
|
| 147 |
+
| Name | Buses | Generators | Lines | Contingencies | References |
|
| 148 |
+
| ------------------------------ | ----- | ---------- | ----- | ------------- | ---------- |
|
| 149 |
+
| `pglib-uc/rts_gmlc/2020-01-27` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 150 |
+
| `pglib-uc/rts_gmlc/2020-02-09` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 151 |
+
| `pglib-uc/rts_gmlc/2020-03-05` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 152 |
+
| `pglib-uc/rts_gmlc/2020-04-03` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 153 |
+
| `pglib-uc/rts_gmlc/2020-05-05` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 154 |
+
| `pglib-uc/rts_gmlc/2020-06-09` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 155 |
+
| `pglib-uc/rts_gmlc/2020-07-06` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 156 |
+
| `pglib-uc/rts_gmlc/2020-08-12` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 157 |
+
| `pglib-uc/rts_gmlc/2020-09-20` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 158 |
+
| `pglib-uc/rts_gmlc/2020-10-27` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 159 |
+
| `pglib-uc/rts_gmlc/2020-11-25` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 160 |
+
| `pglib-uc/rts_gmlc/2020-12-23` | 1 | 154 | 0 | 0 | [BaBlEh19] |
|
| 161 |
+
|
| 162 |
+
## OR-LIB/UC
|
| 163 |
+
|
| 164 |
+
[OR-LIB](http://people.brunel.ac.uk/~mastjjb/jeb/info.html) is a collection of test data sets for a variety of operations research problems, including unit commitment. The UC instances in OR-LIB are synthetic instances generated by a [random problem generator](http://groups.di.unipi.it/optimize/Data/UC.html) developed by the [Operations Research Group at University of Pisa](http://groups.di.unipi.it/optimize/). These test cases have been used in [FrGe06] and many other publications.
|
| 165 |
+
|
| 166 |
+
| Name | Hours | Buses | Generators | Lines | Contingencies | References |
|
| 167 |
+
| ------------------- | ----- | ----- | ---------- | ----- | ------------- | --------------- |
|
| 168 |
+
| `or-lib/10_0_1_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] |
|
| 169 |
+
| `or-lib/10_0_2_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] |
|
| 170 |
+
| `or-lib/10_0_3_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] |
|
| 171 |
+
| `or-lib/10_0_4_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] |
|
| 172 |
+
| `or-lib/10_0_5_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] |
|
| 173 |
+
| `or-lib/20_0_1_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] |
|
| 174 |
+
| `or-lib/20_0_2_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] |
|
| 175 |
+
| `or-lib/20_0_3_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] |
|
| 176 |
+
| `or-lib/20_0_4_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] |
|
| 177 |
+
| `or-lib/20_0_5_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] |
|
| 178 |
+
| `or-lib/50_0_1_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] |
|
| 179 |
+
| `or-lib/50_0_2_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] |
|
| 180 |
+
| `or-lib/50_0_3_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] |
|
| 181 |
+
| `or-lib/50_0_4_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] |
|
| 182 |
+
| `or-lib/50_0_5_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] |
|
| 183 |
+
| `or-lib/75_0_1_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] |
|
| 184 |
+
| `or-lib/75_0_2_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] |
|
| 185 |
+
| `or-lib/75_0_3_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] |
|
| 186 |
+
| `or-lib/75_0_4_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] |
|
| 187 |
+
| `or-lib/75_0_5_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] |
|
| 188 |
+
| `or-lib/100_0_1_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] |
|
| 189 |
+
| `or-lib/100_0_2_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] |
|
| 190 |
+
| `or-lib/100_0_3_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] |
|
| 191 |
+
| `or-lib/100_0_4_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] |
|
| 192 |
+
| `or-lib/100_0_5_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] |
|
| 193 |
+
| `or-lib/150_0_1_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] |
|
| 194 |
+
| `or-lib/150_0_2_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] |
|
| 195 |
+
| `or-lib/150_0_3_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] |
|
| 196 |
+
| `or-lib/150_0_4_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] |
|
| 197 |
+
| `or-lib/150_0_5_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] |
|
| 198 |
+
| `or-lib/200_0_10_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 199 |
+
| `or-lib/200_0_11_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 200 |
+
| `or-lib/200_0_12_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 201 |
+
| `or-lib/200_0_1_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 202 |
+
| `or-lib/200_0_2_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 203 |
+
| `or-lib/200_0_3_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 204 |
+
| `or-lib/200_0_4_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 205 |
+
| `or-lib/200_0_5_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 206 |
+
| `or-lib/200_0_6_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 207 |
+
| `or-lib/200_0_7_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 208 |
+
| `or-lib/200_0_8_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 209 |
+
| `or-lib/200_0_9_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] |
|
| 210 |
+
|
| 211 |
+
## Tejada19
|
| 212 |
+
|
| 213 |
+
Test cases used in [TeLuSa19]. These instances are similar to OR-LIB/UC, in the sense that they use the same random problem generator, but are much larger.
|
| 214 |
+
|
| 215 |
+
| Name | Hours | Buses | Generators | Lines | Contingencies | References |
|
| 216 |
+
| ----------------------- | ----- | ----- | ---------- | ----- | ------------- | ---------- |
|
| 217 |
+
| `tejada19/UC_24h_214g` | 24 | 1 | 214 | 0 | 0 | [TeLuSa19] |
|
| 218 |
+
| `tejada19/UC_24h_250g` | 24 | 1 | 250 | 0 | 0 | [TeLuSa19] |
|
| 219 |
+
| `tejada19/UC_24h_290g` | 24 | 1 | 290 | 0 | 0 | [TeLuSa19] |
|
| 220 |
+
| `tejada19/UC_24h_480g` | 24 | 1 | 480 | 0 | 0 | [TeLuSa19] |
|
| 221 |
+
| `tejada19/UC_24h_505g` | 24 | 1 | 505 | 0 | 0 | [TeLuSa19] |
|
| 222 |
+
| `tejada19/UC_24h_623g` | 24 | 1 | 623 | 0 | 0 | [TeLuSa19] |
|
| 223 |
+
| `tejada19/UC_24h_647g` | 24 | 1 | 647 | 0 | 0 | [TeLuSa19] |
|
| 224 |
+
| `tejada19/UC_24h_836g` | 24 | 1 | 836 | 0 | 0 | [TeLuSa19] |
|
| 225 |
+
| `tejada19/UC_24h_850g` | 24 | 1 | 850 | 0 | 0 | [TeLuSa19] |
|
| 226 |
+
| `tejada19/UC_24h_918g` | 24 | 1 | 918 | 0 | 0 | [TeLuSa19] |
|
| 227 |
+
| `tejada19/UC_24h_931g` | 24 | 1 | 931 | 0 | 0 | [TeLuSa19] |
|
| 228 |
+
| `tejada19/UC_24h_940g` | 24 | 1 | 940 | 0 | 0 | [TeLuSa19] |
|
| 229 |
+
| `tejada19/UC_24h_957g` | 24 | 1 | 957 | 0 | 0 | [TeLuSa19] |
|
| 230 |
+
| `tejada19/UC_24h_959g` | 24 | 1 | 959 | 0 | 0 | [TeLuSa19] |
|
| 231 |
+
| `tejada19/UC_24h_1069g` | 24 | 1 | 1069 | 0 | 0 | [TeLuSa19] |
|
| 232 |
+
| `tejada19/UC_24h_1130g` | 24 | 1 | 1130 | 0 | 0 | [TeLuSa19] |
|
| 233 |
+
| `tejada19/UC_24h_1376g` | 24 | 1 | 1376 | 0 | 0 | [TeLuSa19] |
|
| 234 |
+
| `tejada19/UC_24h_1393g` | 24 | 1 | 1393 | 0 | 0 | [TeLuSa19] |
|
| 235 |
+
| `tejada19/UC_24h_1577g` | 24 | 1 | 1577 | 0 | 0 | [TeLuSa19] |
|
| 236 |
+
| `tejada19/UC_24h_1615g` | 24 | 1 | 1615 | 0 | 0 | [TeLuSa19] |
|
| 237 |
+
| `tejada19/UC_24h_1632g` | 24 | 1 | 1632 | 0 | 0 | [TeLuSa19] |
|
| 238 |
+
| `tejada19/UC_24h_1768g` | 24 | 1 | 1768 | 0 | 0 | [TeLuSa19] |
|
| 239 |
+
| `tejada19/UC_24h_1804g` | 24 | 1 | 1804 | 0 | 0 | [TeLuSa19] |
|
| 240 |
+
| `tejada19/UC_24h_1820g` | 24 | 1 | 1820 | 0 | 0 | [TeLuSa19] |
|
| 241 |
+
| `tejada19/UC_24h_1823g` | 24 | 1 | 1823 | 0 | 0 | [TeLuSa19] |
|
| 242 |
+
| `tejada19/UC_24h_1888g` | 24 | 1 | 1888 | 0 | 0 | [TeLuSa19] |
|
| 243 |
+
| `tejada19/UC_168h_36g` | 168 | 1 | 36 | 0 | 0 | [TeLuSa19] |
|
| 244 |
+
| `tejada19/UC_168h_38g` | 168 | 1 | 38 | 0 | 0 | [TeLuSa19] |
|
| 245 |
+
| `tejada19/UC_168h_40g` | 168 | 1 | 40 | 0 | 0 | [TeLuSa19] |
|
| 246 |
+
| `tejada19/UC_168h_53g` | 168 | 1 | 53 | 0 | 0 | [TeLuSa19] |
|
| 247 |
+
| `tejada19/UC_168h_58g` | 168 | 1 | 58 | 0 | 0 | [TeLuSa19] |
|
| 248 |
+
| `tejada19/UC_168h_59g` | 168 | 1 | 59 | 0 | 0 | [TeLuSa19] |
|
| 249 |
+
| `tejada19/UC_168h_72g` | 168 | 1 | 72 | 0 | 0 | [TeLuSa19] |
|
| 250 |
+
| `tejada19/UC_168h_84g` | 168 | 1 | 84 | 0 | 0 | [TeLuSa19] |
|
| 251 |
+
| `tejada19/UC_168h_86g` | 168 | 1 | 86 | 0 | 0 | [TeLuSa19] |
|
| 252 |
+
| `tejada19/UC_168h_88g` | 168 | 1 | 88 | 0 | 0 | [TeLuSa19] |
|
| 253 |
+
| `tejada19/UC_168h_93g` | 168 | 1 | 93 | 0 | 0 | [TeLuSa19] |
|
| 254 |
+
| `tejada19/UC_168h_105g` | 168 | 1 | 105 | 0 | 0 | [TeLuSa19] |
|
| 255 |
+
| `tejada19/UC_168h_110g` | 168 | 1 | 110 | 0 | 0 | [TeLuSa19] |
|
| 256 |
+
| `tejada19/UC_168h_125g` | 168 | 1 | 125 | 0 | 0 | [TeLuSa19] |
|
| 257 |
+
| `tejada19/UC_168h_130g` | 168 | 1 | 130 | 0 | 0 | [TeLuSa19] |
|
| 258 |
+
| `tejada19/UC_168h_131g` | 168 | 1 | 131 | 0 | 0 | [TeLuSa19] |
|
| 259 |
+
| `tejada19/UC_168h_140g` | 168 | 1 | 140 | 0 | 0 | [TeLuSa19] |
|
| 260 |
+
| `tejada19/UC_168h_165g` | 168 | 1 | 165 | 0 | 0 | [TeLuSa19] |
|
| 261 |
+
| `tejada19/UC_168h_175g` | 168 | 1 | 175 | 0 | 0 | [TeLuSa19] |
|
| 262 |
+
| `tejada19/UC_168h_179g` | 168 | 1 | 179 | 0 | 0 | [TeLuSa19] |
|
| 263 |
+
| `tejada19/UC_168h_188g` | 168 | 1 | 188 | 0 | 0 | [TeLuSa19] |
|
| 264 |
+
| `tejada19/UC_168h_192g` | 168 | 1 | 192 | 0 | 0 | [TeLuSa19] |
|
| 265 |
+
| `tejada19/UC_168h_199g` | 168 | 1 | 199 | 0 | 0 | [TeLuSa19] |
|
| 266 |
+
|
| 267 |
+
## References
|
| 268 |
+
|
| 269 |
+
- [UCJL] **Alinson S. Xavier, Aleksandr M. Kazachkov, Ogün Yurdakul, Feng Qiu.** "UnitCommitment.jl: A Julia/JuMP Optimization Package for Security-Constrained Unit Commitment (Version 0.3)". Zenodo (2022). [DOI: 10.5281/zenodo.4269874](https://doi.org/10.5281/zenodo.4269874)
|
| 270 |
+
|
| 271 |
+
- [KnOsWa20] **Bernard Knueven, James Ostrowski and Jean-Paul Watson.** "On Mixed-Integer Programming Formulations for the Unit Commitment Problem". INFORMS Journal on Computing (2020). [DOI: 10.1287/ijoc.2019.0944](https://doi.org/10.1287/ijoc.2019.0944)
|
| 272 |
+
|
| 273 |
+
- [KrHiOn12] **Eric Krall, Michael Higgins and Richard P. O’Neill.** "RTO unit commitment test system." Federal Energy Regulatory Commission. Available at: <https://www.ferc.gov/industries-data/electric/power-sales-and-markets/increasing-efficiency-through-improved-software-1> (Accessed: Nov 14, 2020)
|
| 274 |
+
|
| 275 |
+
- [BaBlEh19] **Clayton Barrows, Aaron Bloom, Ali Ehlen, Jussi Ikaheimo, Jennie Jorgenson, Dheepak Krishnamurthy, Jessica Lau et al.** "The IEEE Reliability Test System: A Proposed 2019 Update." IEEE Transactions on Power Systems (2019). [DOI: 10.1109/TPWRS.2019.2925557](https://doi.org/10.1109/TPWRS.2019.2925557)
|
| 276 |
+
|
| 277 |
+
- [JoFlMa16] **C. Josz, S. Fliscounakis, J. Maeght, and P. Panciatici.** "AC Power Flow Data in MATPOWER and QCQP Format: iTesla, RTE Snapshots, and PEGASE". [ArXiv (2016)](https://arxiv.org/abs/1603.01533).
|
| 278 |
+
|
| 279 |
+
- [FlPaCa13] **S. Fliscounakis, P. Panciatici, F. Capitanescu, and L. Wehenkel.** "Contingency ranking with respect to overloads in very large power systems taking into account uncertainty, preventive and corrective actions", Power Systems, IEEE Trans. on, (28)4:4909-4917, 2013. [DOI: 10.1109/TPWRS.2013.2251015](https://doi.org/10.1109/TPWRS.2013.2251015)
|
| 280 |
+
|
| 281 |
+
- [MTPWR] **D. Zimmerman, C. E. Murillo-Sandnchez and R. J. Thomas.** "Matpower: Steady-state operations, planning, and analysis tools forpower systems research and education", IEEE Transactions on PowerSystems, vol. 26, no. 1, pp. 12 –19, Feb. 2011. [DOI: 10.1109/TPWRS.2010.2051168](https://doi.org/10.1109/TPWRS.2010.2051168)
|
| 282 |
+
|
| 283 |
+
- [PSTCA] **University of Washington, Dept. of Electrical Engineering.** "Power Systems Test Case Archive". Available at: <http://www.ee.washington.edu/research/pstca/> (Accessed: Nov 14, 2020)
|
| 284 |
+
|
| 285 |
+
- [ORLIB] **J.E.Beasley.** "OR-Library: distributing test problems by electronic mail", Journal of the Operational Research Society 41(11) (1990). [DOI: 10.2307/2582903](https://doi.org/10.2307/2582903)
|
| 286 |
+
|
| 287 |
+
- [FrGe06] **A. Frangioni, C. Gentile.** "Solving nonlinear single-unit commitment problems with ramping constraints" Operations Research 54(4), p. 767 - 775, 2006. [DOI: 10.1287/opre.1060.0309](https://doi.org/10.1287/opre.1060.0309)
|
| 288 |
+
|
| 289 |
+
- [TeLuSa19] **D. A. Tejada-Arango, S. Lumbreras, P. Sanchez-Martin and A. Ramos.** "Which Unit-Commitment Formulation is Best? A Systematic Comparison," in IEEE Transactions on Power Systems. [DOI: 10.1109/TPWRS.2019.2962024](https://ieeexplore.ieee.org/document/8941313/).
|
docs/src/guides/model.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
JuMP Model
|
| 2 |
+
==========
|
| 3 |
+
|
| 4 |
+
In this page, we describe the JuMP optimization model produced by the function `build_model`. A detailed understanding of this model is not necessary if you are just interested in using the package to solve some standard unit commitment cases, but it may be useful, for example, if you need to solve a slightly different problem, with additional variables and constraints. The notation in this page generally follows [KnOsWa20].
|
| 5 |
+
|
| 6 |
+
Decision variables
|
| 7 |
+
------------------
|
| 8 |
+
|
| 9 |
+
UC.jl models the security-constrained unit commitment problem as a two-stage stochastic program. In this approach, some of the decision variables are *first-stage decisions*, which are taken before the uncertainty is realized and must therefore be the same across all scenarios, while the remaining variables are *second-stage decisions*, which can attain a different values in each scenario. In the current version of the package, all binary variables (which model commitment decisions of thermal units) are first-stage decisions and all continuous variables are second-stage decisions.
|
| 10 |
+
|
| 11 |
+
!!! note
|
| 12 |
+
|
| 13 |
+
UC.jl treats deterministic SCUC instances as a special case of the stochastic problem in which there is only one scenario, named `"s1"` by default. To access second-stage decisions, therefore, you must provide this scenario name as the value for `sn`. For example, `model[:prod_above]["s1", g, t]`.
|
| 14 |
+
|
| 15 |
+
### Generators
|
| 16 |
+
|
| 17 |
+
In this section, we describe the decision variables associated with the generators, which include both thermal units (e.g., natural gas-fired power plant) and profiled units (e.g., wind turbine).
|
| 18 |
+
|
| 19 |
+
#### Thermal Units
|
| 20 |
+
|
| 21 |
+
Name | Description | Unit | Stage
|
| 22 |
+
:-----|:-------------|:------: | :------:
|
| 23 |
+
`is_on[g,t]` | True if generator `g` is on at time `t`. | Binary | 1
|
| 24 |
+
`switch_on[g,t]` | True is generator `g` switches on at time `t`. | Binary| 1
|
| 25 |
+
`switch_off[g,t]` | True if generator `g` switches off at time `t`. | Binary| 1
|
| 26 |
+
`startup[g,t,s]` | True if generator `g` switches on at time `t` incurring start-up costs from start-up category `s`. | Binary| 1
|
| 27 |
+
`prod_above[sn,g,t]` | Amount of power produced by generator `g` above its minimum power output at time `t` in scenario `sn`. For example, if the minimum power of generator `g` is 100 MW and `g` is producing 115 MW of power at time `t` in scenario `sn`, then `prod_above[sn,g,t]` equals `15.0`. | MW | 2
|
| 28 |
+
`segprod[sn,g,t,k]` | Amount of power from piecewise linear segment `k` produced by generator `g` at time `t` in scenario `sn`. For example, if cost curve for generator `g` is defined by the points `(100, 1400)`, `(110, 1600)`, `(130, 2200)` and `(135, 2400)`, and if the generator is producing 115 MW of power at time `t` in scenario `sn`, then `segprod[sn,g,t,:]` equals `[10.0, 5.0, 0.0]`.| MW | 2
|
| 29 |
+
`reserve[sn,r,g,t]` | Amount of reserve `r` provided by unit `g` at time `t` in scenario `sn`. | MW | 2
|
| 30 |
+
|
| 31 |
+
!!! warning
|
| 32 |
+
|
| 33 |
+
The first-stage decision variables of the JuMP model are `is_on[g,t]`, `switch_on[g,t]`, `switch_off[g,t]`, and `startup[g,t,s]`. As such, the dictionaries corresponding to these variables do not include the scenario index in their keys. In contrast, all other variables of the created JuMP model are allowed to obtain a different value in each scenario and are thus modeled as second-stage decision variables. Accordingly, the dictionaries of all second-stage decision variables have the scenario index in their keys. This is true even if the model is created to solve the deterministic SCUC, in which case the default scenario index `s1` is included in the dictionary key.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
#### Profiled Units
|
| 37 |
+
|
| 38 |
+
Name | Description | Unit | Stage
|
| 39 |
+
:-----|:-------------|:------: | :------:
|
| 40 |
+
`prod_profiled[s,t]` | Amount of power produced by profiled unit `g` at time `t`. | MW | 2
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
### Buses
|
| 44 |
+
|
| 45 |
+
Name | Description | Unit | Stage
|
| 46 |
+
:-----|:-------------|:------:| :------:
|
| 47 |
+
`net_injection[sn,b,t]` | Net injection at bus `b` at time `t` in scenario `sn`. | MW | 2
|
| 48 |
+
`curtail[sn,b,t]` | Amount of load curtailed at bus `b` at time `t` in scenario `sn`. | MW | 2
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
### Price-sensitive loads
|
| 52 |
+
|
| 53 |
+
Name | Description | Unit | Stage
|
| 54 |
+
:-----|:-------------|:------:| :------:
|
| 55 |
+
`loads[sn,s,t]` | Amount of power served to price-sensitive load `s` at time `t` in scenario `sn`. | MW | 2
|
| 56 |
+
|
| 57 |
+
### Transmission lines
|
| 58 |
+
|
| 59 |
+
Name | Description | Unit | Stage
|
| 60 |
+
:-----|:-------------|:------:| :------:
|
| 61 |
+
`flow[sn,l,t]` | Power flow on line `l` at time `t` in scenario `sn`. | MW | 2
|
| 62 |
+
`overflow[sn,l,t]` | Amount of flow above the limit for line `l` at time `t` in scenario `sn`. | MW | 2
|
| 63 |
+
|
| 64 |
+
!!! warning
|
| 65 |
+
|
| 66 |
+
Since transmission and N-1 security constraints are enforced in a lazy way, most of the `flow[l,t]` variables are never added to the model. Accessing `model[:flow][sn,l,t]` without first checking that the variable exists will likely generate an error.
|
| 67 |
+
|
| 68 |
+
Objective function
|
| 69 |
+
------------------
|
| 70 |
+
|
| 71 |
+
TODO
|
| 72 |
+
|
| 73 |
+
Constraints
|
| 74 |
+
-----------
|
| 75 |
+
|
| 76 |
+
TODO
|
| 77 |
+
|
| 78 |
+
|
docs/src/guides/problem.md
ADDED
|
@@ -0,0 +1,618 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Problem definition
|
| 2 |
+
|
| 3 |
+
The **Security-Constrained Unit Commitment Problem** (SCUC) is formulated in
|
| 4 |
+
UC.jl as a two-stage stochastic mixed-integer linear optimization problem that
|
| 5 |
+
aims to find the minimum-cost schedule for electricity generation while
|
| 6 |
+
satisfying various physical, operational and economic constraints. In its most
|
| 7 |
+
basic form, the problem is composed by:
|
| 8 |
+
|
| 9 |
+
- A set of generators, which produce power, at a given cost;
|
| 10 |
+
- A set of loads, which consume power;
|
| 11 |
+
- A transmission network, which delivers power from generators to the loads.
|
| 12 |
+
|
| 13 |
+
In addition to the basic components above, SCUC also include a wide variety of
|
| 14 |
+
additional components, such as _energy storage devices_, _reserves_ and _network
|
| 15 |
+
interfaces_, to name a few. On this page, we present a complete definition of
|
| 16 |
+
the problem, as modeled in UC.jl. Please note that different sources in the
|
| 17 |
+
literature may have significantly different definitions and assumptions.
|
| 18 |
+
|
| 19 |
+
!!! note
|
| 20 |
+
|
| 21 |
+
UC.jl treats deterministic SCUC instances as a special case of the stochastic problem in which there is only one scenario, named `"s1"` by default. To access second-stage decisions, therefore, you must provide this scenario name as the value for `s`. For example, `model[:prod_above]["s1", g, t]`.
|
| 22 |
+
|
| 23 |
+
!!! warning
|
| 24 |
+
|
| 25 |
+
The problem definition presented in this page is mathematically equivalent to the one solved by UC.jl. However, some constraints (ramping, piecewise-linear costs and start-up costs) have been simplified in this page for clarity. The set of constraints actually enforced by UC.jl better describes the convex hull of the problem and leads to better computational performance, but it is much more complex to describe. For further details, we refer to the package's source code and associated references.
|
| 26 |
+
|
| 27 |
+
## 1. General modeling assumptions
|
| 28 |
+
|
| 29 |
+
- **Time discretization:** SCUC is a multi-period problem, with decisions
|
| 30 |
+
typically covering a 24-hour or 36-hour time window. UC.jl assumes that this
|
| 31 |
+
time window is discretized into time steps of fixed length. The number of time
|
| 32 |
+
steps, as well as the duration of each time step, are configurable. In the
|
| 33 |
+
equations below, the set of time steps is denoted by $T=\{1,2,\ldots,|T|\}$.
|
| 34 |
+
|
| 35 |
+
- **Decision under uncertainty:** SCUC is a two-stage stochastic problem. In the
|
| 36 |
+
first stage, we must decide the _commitment status_ of all thermal generators.
|
| 37 |
+
In the second stage, we determine the remaining decision variables, such power
|
| 38 |
+
output of all generators, the operation of energy storage devices and load
|
| 39 |
+
shedding. Stochasticity is modeled through a discrete number of scenarios
|
| 40 |
+
$s \in S$, each with given probability $p(S)$. The goal is to minimize the
|
| 41 |
+
minimum expected cost.
|
| 42 |
+
|
| 43 |
+
## 2. Thermal generators
|
| 44 |
+
|
| 45 |
+
A _thermal generator_ is a power generation unit that converts thermal energy,
|
| 46 |
+
typically from the combustion of coal, natural gas or oil, into electrical
|
| 47 |
+
energy. Scheduling thermal generators is particularly complex due to their
|
| 48 |
+
operational characteristics, including minimum up and down times, ramping rates,
|
| 49 |
+
and start-up and shutdown limits.
|
| 50 |
+
|
| 51 |
+
### Important concepts
|
| 52 |
+
|
| 53 |
+
- **Commitment, power output and startup costs:** Thermal generators can either
|
| 54 |
+
be online (on) or offline (off). When a thermal generator is on, it can
|
| 55 |
+
produce between a minimum and a maximum amount of power; when it is off, it
|
| 56 |
+
cannot produce any power. Switching a generator on incurs a startup cost,
|
| 57 |
+
which depends on how long the unit has been offline. More precisely, each
|
| 58 |
+
thermal generator $g$ has a number $K^{start}_g$ of startup categories (e.g.,
|
| 59 |
+
cold, warm and hot). Each category $k$ has a corresponding startup cost
|
| 60 |
+
$Z^{\text{start}}_{gk}$, and is available only if the unit has spent at most
|
| 61 |
+
$M^{\text{delay}}_{gk}$ time steps offline.
|
| 62 |
+
|
| 63 |
+
- **Piecewise-linear production cost curve:** Besides startup costs, thermal
|
| 64 |
+
generators also incur production costs based on their power output. The
|
| 65 |
+
relationship between production cost and power output is not a linear, but a
|
| 66 |
+
convex curve, which is simplified using a piecewise-linear approximation. For
|
| 67 |
+
this purpose, each thermal generator $g$ has a number $K^{\text{cost}}_g$ of
|
| 68 |
+
piecewise-linear segments and its power output $y^{\text{prod-above}}_{gts}$
|
| 69 |
+
are broken down into
|
| 70 |
+
$\sum_{k=1}^{K^{\text{cost}}_g} y^{\text{seg-prod}}_{gtks}$, so that
|
| 71 |
+
production costs can be more easily calculated.
|
| 72 |
+
|
| 73 |
+
- **Ramping, minimum up/down:** Due to physical and operational limits, such as
|
| 74 |
+
thermal inertia and mechanical stress, thermal generators cannot vary their
|
| 75 |
+
power output too dramatically from one time period to the next. Similarly,
|
| 76 |
+
thermal generators cannot switch on and off too frequently; after switching on
|
| 77 |
+
or off, units must remain at that state for a minimum specified number of time
|
| 78 |
+
steps.
|
| 79 |
+
|
| 80 |
+
- **Startup and shutdown limit:** A thermal generator cannot shut off if its
|
| 81 |
+
output power level in the immediately preceding time step is very high (above
|
| 82 |
+
a specified value); the unit must first ramp down, over potentially multiple
|
| 83 |
+
time steps, and only then shut off. Similarly, the unit cannot produce a very
|
| 84 |
+
large amount of power (above a specified limit) immediately after starting up;
|
| 85 |
+
it must ramp up over potentially multiple time steps.
|
| 86 |
+
|
| 87 |
+
- **Initial status:** The optimization process finds optimal commitment status
|
| 88 |
+
and power output level for all thermal generators starting at time period 1.
|
| 89 |
+
Many constraints, however, require knowledge of previous time periods (0, -1,
|
| 90 |
+
-2, ...) which are not part of the optimization model. For this reason, part
|
| 91 |
+
of the input data is the initial power output $M^{\text{init-power}}_{g}$ of
|
| 92 |
+
unit $g$ (that is, the output at time 0) and the initial status
|
| 93 |
+
$M^{\text{init-status}}_{g}$ of unit g (how many time steps has it been
|
| 94 |
+
online/offline at time time 0). If $M^{\text{init-status}}_{g}$ is positive,
|
| 95 |
+
its magnitude indicates how many time periods has the unit been online; and if
|
| 96 |
+
negative, how has it been offline.
|
| 97 |
+
|
| 98 |
+
- **Must-run:** Due to various factors, including reliability considerations,
|
| 99 |
+
some units must remain operational regardless of whether it is economical for
|
| 100 |
+
them to do so. Must-run constraints are used to enforce such requirements.
|
| 101 |
+
|
| 102 |
+
### Sets and constants
|
| 103 |
+
|
| 104 |
+
| Symbol | Unit | Description |
|
| 105 |
+
| :------------------------------ | :----- | :----------------------------------------------------------------------------------------- |
|
| 106 |
+
| $K^{cost}_g$ | | Number of piecewise linear segments in the production cost curve. |
|
| 107 |
+
| $K^{start}_g$ | | Number of startup categories (e.g. cold, warm, hot). |
|
| 108 |
+
| $M^{\text{delay}}_{gk}$ | | Delay for startup category $k$. |
|
| 109 |
+
| $M^{\text{init-power}}_{g}$ | MW | Initial power output of unit $g$. |
|
| 110 |
+
| $M^{\text{init-status}}_{g}$ | | Initial status of unit $g$. |
|
| 111 |
+
| $M^{\text{min-up}}_{g}$ | | Minimum amount of time $g$ must stay on after switching on. |
|
| 112 |
+
| $M^{\text{must-run}}_{gt}$ | Binary | One if unit $g$ must be on at time $t$. |
|
| 113 |
+
| $M^{\text{pmax}}_{gt}$ | MW | Maximum power output at time $t$. |
|
| 114 |
+
| $M^{\text{pmin}}_{gt}$ | MW | Minimum power output at time $t$. |
|
| 115 |
+
| $M^{\text{ramp-down}}_{g}$ | MW | Ramp down limit. |
|
| 116 |
+
| $M^{\text{ramp-up}}_{g}$ | MW | Ramp up limit. |
|
| 117 |
+
| $M^{\text{seg-pmax}}_{gtks}$ | MW | Maximum power output for piecewise-linear segment $k$ at time $t$ and scenario $s$. |
|
| 118 |
+
| $M^{\text{shutdown-limit}}_{g}$ | MW | Maximum power unit $g$ produces immediately before shutting down |
|
| 119 |
+
| $M^{\text{startup-limit}}_{g}$ | MW | Maximum power unit $g$ produces immediately after starting up |
|
| 120 |
+
| $R_g$ | | Set of spinning reserves that may be served by $g$. |
|
| 121 |
+
| $Z^{\text{pmin}}_{gt}$ | \$ | Cost to keep $g$ operational at time $t$ generating at minimum power. |
|
| 122 |
+
| $Z^{\text{pvar}}_{gtks}$ | \$/MW | Cost for unit $g$ to produce 1 MW of power under piecewise-linear segment $k$ at time $t$. |
|
| 123 |
+
| $Z^{\text{start}}_{gk}$ | \$ | Cost to start unit $g$ at startup category $k$. |
|
| 124 |
+
| $G^\text{therm}$ | | Set of thermal generators. |
|
| 125 |
+
|
| 126 |
+
### Decision variables
|
| 127 |
+
|
| 128 |
+
| Symbol | JuMP name | Description | Unit | Stage |
|
| 129 |
+
| :---------------------------- | :------------------ | :-------------------------------------------------------------------------------------------- | :----- | :---- |
|
| 130 |
+
| $x^{\text{is-on}}_{gt}$ | `is_on[g,t]` | One if generator $g$ is on at time $t$. | Binary | 1 |
|
| 131 |
+
| $x^{\text{switch-on}}_{gt}$ | `switch_on[g,t]` | One if generator $g$ switches on at time $t$. | Binary | 1 |
|
| 132 |
+
| $x^{\text{switch-off}}_{gt}$ | `switch_off[g,t]` | One if generator $g$ switches off at time $t$. | Binary | 1 |
|
| 133 |
+
| $x^{\text{start}}_{gtk}$ | `startup[g,t,s]` | One if generator $g$ starts up at time $t$ under startup category $k$. | Binary | 1 |
|
| 134 |
+
| $y^{\text{prod-above}}_{gts}$ | `prod_above[s,g,t]` | Amount of power produced by $g$ at time $t$ in scenario $s$ above the minimum power. | MW | 2 |
|
| 135 |
+
| $y^{\text{seg-prod}}_{gtks}$ | `segprod[s,g,t,k]` | Amount of power produced by $g$ at time $t$ in piecewise-linear segment $k$ and scenario $s$. | MW | 2 |
|
| 136 |
+
| $y^{\text{res}}_{grts}$ | `reserve[s,r,g,t]` | Amount of spinning reserve $r$ supplied by $g$ at time $t$ in scenario $s$. | MW | 2 |
|
| 137 |
+
|
| 138 |
+
### Objective function terms
|
| 139 |
+
|
| 140 |
+
- Production costs:
|
| 141 |
+
|
| 142 |
+
```math
|
| 143 |
+
\sum_{g \in G^\text{therm}} \sum_{t \in T} x^{\text{is-on}}_{gt} Z^{\text{pmin}}_{gt}
|
| 144 |
+
+ \sum_{s \in S} p(s) \left[
|
| 145 |
+
\sum_{g \in G^\text{therm}} \sum_{t \in T} \sum_{k=1}^{K^{cost}_g}
|
| 146 |
+
y^{\text{seg-prod}}_{gtks} Z^{\text{pvar}}_{gtks}
|
| 147 |
+
\right]
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
- Start-up costs:
|
| 151 |
+
|
| 152 |
+
```math
|
| 153 |
+
\sum_{g \in G} \sum_{t \in T} \sum_{k=1}^{K^{start}_g} x^{\text{start}}_{gtk} Z^{\text{start}}_{gk}
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
### Constraints
|
| 157 |
+
|
| 158 |
+
- Some units must remain on, even if it is not economical for them to do so:
|
| 159 |
+
|
| 160 |
+
```math
|
| 161 |
+
x^{\text{is-on}}_{gt} \geq M^{\text{must-run}}_{gt}
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
- After switching on, unit must remain on for some amount of time
|
| 165 |
+
(`eq_min_uptime[g,t]`):
|
| 166 |
+
|
| 167 |
+
```math
|
| 168 |
+
\sum_{i=max(1,t-M^{\text{min-up}}_{g}+1)}^t x^{\text{switch-on}}_{gi} \leq x^{\text{is-on}}_{gt}
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
- Same as above, but covering the initial time steps (`eq_min_uptime[g,0]`):
|
| 172 |
+
|
| 173 |
+
```math
|
| 174 |
+
\sum_{i=1}^{min(T,M^{\text{min-up}}_{g}-M^{\text{init-status}}_{g})} x^{\text{switch-off}}_{gi} = 0 \; \text{ if } \; M^{\text{init-status}}_{g} > 0
|
| 175 |
+
```
|
| 176 |
+
|
| 177 |
+
- After switching off, unit must remain offline for some amount of time
|
| 178 |
+
(`eq_min_downtime[g,t]`):
|
| 179 |
+
|
| 180 |
+
```math
|
| 181 |
+
\sum_{i=max(1,t-M^{\text{min-down}}_{g}+1)}^t x^{\text{switch-off}}_{gi} \leq 1 - x^{\text{is-on}}_{gt}
|
| 182 |
+
```
|
| 183 |
+
|
| 184 |
+
- Same as above, but covering the initial time steps (`eq_min_downtime[g,0]`):
|
| 185 |
+
|
| 186 |
+
```math
|
| 187 |
+
\sum_{i=1}^{min(T,M^{\text{min-down}}_{g}+M^{\text{init-status}}_{g})} x^{\text{switch-on}}_{gi} = 0 \; \text{ if } \; M^{\text{init-status}}_{g} < 0
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
- If the unit switches on, it must choose exactly one startup category
|
| 191 |
+
(`eq_startup_choose[g,t]`):
|
| 192 |
+
|
| 193 |
+
```math
|
| 194 |
+
x^{\text{switch-on}}_{gt} = \sum_{k=1}^{K^{start}_g} x^{\text{start}}_{gtk}
|
| 195 |
+
```
|
| 196 |
+
|
| 197 |
+
- If unit has not switched off in the last "delay" time periods, then startup
|
| 198 |
+
category is forbidden (`eq_startup_restrict[g,t,s]`). The last startup
|
| 199 |
+
category is always allowed. In the equation below, $L^{\text{start}}_{gtk}=1$
|
| 200 |
+
if category should be allowed based on initial status.
|
| 201 |
+
|
| 202 |
+
```math
|
| 203 |
+
x^{\text{start}}_{gtk} \leq L^{\text{start}}_{gtk} + \sum_{i=min\left(1,t - M^{\text{delay}}_{g,k+1} + 1\right)}^{t - M^{\text{delay}}_{kg}} x^{\text{switch-off}}_{gi}
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
- Link the binary variables together (`eq_binary_link[g,t]`):
|
| 207 |
+
|
| 208 |
+
```math
|
| 209 |
+
\begin{align*}
|
| 210 |
+
& x^{\text{is-on}}_{gt} - x^{\text{is-on}}_{g,t-1} = x^{\text{switch-on}}_{gt} - x^{\text{switch-off}}_{gt} & \forall t > 1 \\
|
| 211 |
+
\end{align*}
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
- Cannot switch on and off at the same time (`eq_switch_on_off[g,t]`):
|
| 215 |
+
|
| 216 |
+
```math
|
| 217 |
+
x^{\text{switch-on}}_{gt} + x^{\text{switch-off}}_{gt} \leq 1
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
- If the unit is off, it cannot produce power or provide reserves. If it is on,
|
| 221 |
+
it must to so within the specified production limits (`eq_prod_limit[s,g,t]`):
|
| 222 |
+
|
| 223 |
+
```math
|
| 224 |
+
y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq
|
| 225 |
+
(M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt}
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
- Break down the "production above" variable into smaller "segment production"
|
| 229 |
+
variables, to simplify the objective function (`eq_prod_above_def[s,g,t]`):
|
| 230 |
+
|
| 231 |
+
```math
|
| 232 |
+
y^{\text{prod-above}}_{gts} = \sum_{k=1}^{K^{cost}_g} y^{\text{seg-prod}}_{gtks}
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
- Impose upper limit on segment production variables
|
| 236 |
+
(`eq_segprod_limit[s,g,t,k]`):
|
| 237 |
+
|
| 238 |
+
```math
|
| 239 |
+
0 \leq y^{\text{seg-prod}}_{gtks} \leq M^{\text{seg-pmax}}_{gtks}
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
- Unit cannot increase its production too quickly (`eq_ramp_up[s,g,t]`):
|
| 243 |
+
|
| 244 |
+
```math
|
| 245 |
+
y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq
|
| 246 |
+
y^{\text{prod-above}}_{g,t-1,s} + M^{\text{ramp-up}}_{g}
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
- Same as above, for initial time (`eq_ramp_up[s,g,1]`):
|
| 250 |
+
|
| 251 |
+
```math
|
| 252 |
+
y^{\text{prod-above}}_{g,1,s} + \sum_{r \in R_g} y^{\text{res}}_{gr,1,s} \leq
|
| 253 |
+
\left(M^{\text{init-power}}_{g} - M^{\text{pmin}}_{gt}\right) + M^{\text{ramp-up}}_{g}
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
- Unit cannot decrease its production too quickly (`eq_ramp_down[s,g,t]`):
|
| 257 |
+
|
| 258 |
+
```math
|
| 259 |
+
y^{\text{prod-above}}_{gts} \geq
|
| 260 |
+
y^{\text{prod-above}}_{g,t-1,s} - M^{\text{ramp-down}}_{g}
|
| 261 |
+
```
|
| 262 |
+
|
| 263 |
+
- Same as above, for initial time (`eq_ramp_down[s,g,1]`):
|
| 264 |
+
|
| 265 |
+
```math
|
| 266 |
+
y^{\text{prod-above}}_{g,1,s} \geq
|
| 267 |
+
\left(M^{\text{init-power}}_{g} - M^{\text{pmin}}_{gt}\right) - M^{\text{ramp-down}}_{g}
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
- Unit cannot produce excessive amount of power immediately after starting up
|
| 271 |
+
(`eq_startup_limit[s,g,t]`):
|
| 272 |
+
|
| 273 |
+
```math
|
| 274 |
+
y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq
|
| 275 |
+
(M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt} -
|
| 276 |
+
max\left\{0,M^{\text{pmax}}_{gt} - M^{\text{startup-limit}}_{g}\right\}
|
| 277 |
+
x^{\text{switch-on}}_{gt}
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
- Unit cannot shutoff it it's producing too much power
|
| 281 |
+
(`eq_shutdown_limit[s,g,t]`):
|
| 282 |
+
|
| 283 |
+
```math
|
| 284 |
+
y^{\text{prod-above}}_{gts} \leq
|
| 285 |
+
(M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt} -
|
| 286 |
+
max\left\{0,M^{\text{pmax}}_{gt} - M^{\text{shutdown-limit}}_{g}\right\}
|
| 287 |
+
x^{\text{switch-off}}_{g,t+1}
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
## 3. Profiled generators
|
| 291 |
+
|
| 292 |
+
A _profiled generator_ is a simplified generator model that can be used to
|
| 293 |
+
represent renewable energy resources, including wind, solar and hydro. Unlike
|
| 294 |
+
thermal generators, which can be either on or off, profiled generators do not
|
| 295 |
+
have status variables; the only optimization decision is on their power output
|
| 296 |
+
level, which must remain between minimum and maximum time-varying amounts.
|
| 297 |
+
Production cost curves for profiled generators are linear, making them again
|
| 298 |
+
much simpler than thermal units.
|
| 299 |
+
|
| 300 |
+
### Constants
|
| 301 |
+
|
| 302 |
+
| Symbol | Unit | Description |
|
| 303 |
+
| :---------------------- | :---- | :------------------------------------------------- |
|
| 304 |
+
| $M^{\text{pmax}}_{sgt}$ | MW | Maximum power output at time $t$ and scenario $s$. |
|
| 305 |
+
| $M^{\text{pmin}}_{sgt}$ | MW | Minimum power output at time $t$ and scenario $s$. |
|
| 306 |
+
| $Z^{\text{pvar}}_{sgt}$ | \$/MW | Generation cost at time $t$ and scenario $s$. |
|
| 307 |
+
|
| 308 |
+
### Decision variables
|
| 309 |
+
|
| 310 |
+
| Symbol | JuMP name | Unit | Description | Stage |
|
| 311 |
+
| :-------------------- | :--------------------- | :--- | :------------------------------------------------------------ | :---- |
|
| 312 |
+
| $y^\text{prod}_{sgt}$ | `prod_profiled[s,g,t]` | MW | Amount of power produced by $g$ in time $t$ and scenario $s$. | 2 |
|
| 313 |
+
|
| 314 |
+
### Objective function terms
|
| 315 |
+
|
| 316 |
+
- Production cost:
|
| 317 |
+
|
| 318 |
+
```math
|
| 319 |
+
\sum_{s \in S} p(s) \left[
|
| 320 |
+
\sum_{t \in T} y^\text{prod}_{sgt} Z^{\text{pvar}}_{sgt}
|
| 321 |
+
\right]
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
### Constraints
|
| 325 |
+
|
| 326 |
+
- Variable bounds:
|
| 327 |
+
|
| 328 |
+
```math
|
| 329 |
+
M^{\text{pmin}}_{sgt} \leq y^\text{prod}_{sgt} \leq M^{\text{pmax}}_{sgt}
|
| 330 |
+
```
|
| 331 |
+
|
| 332 |
+
## 4. Conventional loads
|
| 333 |
+
|
| 334 |
+
Loads represent the demand for electrical power by consumers and devices
|
| 335 |
+
connected to the system. This section describes _conventional_ (or inelastic)
|
| 336 |
+
loads, which are not sensitive to changes in electricity prices, and must always
|
| 337 |
+
be served. Each bus in the transmission network has exactly one load; multiple
|
| 338 |
+
loads in the same bus can be modelled by aggregating them. If there is not
|
| 339 |
+
enough production or transmission capacity to serve all loads, some load can be
|
| 340 |
+
curtailed, at a penalty.
|
| 341 |
+
|
| 342 |
+
### Constants
|
| 343 |
+
|
| 344 |
+
| Symbol | Unit | Description |
|
| 345 |
+
| :---------------------- | :---- | :--------------------------------------------------------- |
|
| 346 |
+
| $M^\text{load}_{sbt}$ | MW | Conventional load on bus $b$ at time $s$ and scenario $s$. |
|
| 347 |
+
| $Z^\text{curtail}_{st}$ | \$/MW | Load curtailment penalty at time $t$ in scenario $s$. |
|
| 348 |
+
|
| 349 |
+
### Decision variables
|
| 350 |
+
|
| 351 |
+
| Symbol | JuMP name | Unit | Description | Stage |
|
| 352 |
+
| :----------------------- | :--------------- | :--- | :--------------------------------------------------------------- | :---- |
|
| 353 |
+
| $y^\text{curtail}_{sbt}$ | `curtail[s,b,t]` | MW | Amount of load curtailed at bus $b$ in time $t$ and scenario $s$ | 2 |
|
| 354 |
+
|
| 355 |
+
### Objective function terms
|
| 356 |
+
|
| 357 |
+
- Load curtailment penalty:
|
| 358 |
+
|
| 359 |
+
```math
|
| 360 |
+
\sum_{s \in S} p(s) \left[
|
| 361 |
+
\sum_{b \in B} \sum_{t \in T} y^\text{curtail}_{sbt} Z^\text{curtail}_{ts}
|
| 362 |
+
\right]
|
| 363 |
+
```
|
| 364 |
+
|
| 365 |
+
### Constraints
|
| 366 |
+
|
| 367 |
+
- Variable bounds:
|
| 368 |
+
|
| 369 |
+
```math
|
| 370 |
+
0 \leq y^\text{curtail}_{sbt} \leq M^\text{load}_{bts}
|
| 371 |
+
```
|
| 372 |
+
|
| 373 |
+
## 5. Price-sensitive loads
|
| 374 |
+
|
| 375 |
+
_Price-sensitive loads_ refer to components in the system which may increase or
|
| 376 |
+
reduce their power consumption according to energy prices. Unlike conventional
|
| 377 |
+
loads, described above, price-sensitive loads are only served if it is
|
| 378 |
+
economical to do so. More specifically, there are no constraints forcing these
|
| 379 |
+
loads to be served; instead, there is a term in the objective function rewarding
|
| 380 |
+
each MW served. Unlike conventional loads, there may be multiple price-sensitive
|
| 381 |
+
loads per bus.
|
| 382 |
+
|
| 383 |
+
!!! note
|
| 384 |
+
|
| 385 |
+
Some unit commitment models allow price-sensitive loads to have a piecewise-linear convex revenue curves, similar to thermal generators. This can be achieved in UC.jl by adding multiple price-sensitive loads to the bus, one for each piecewise-linear segment.
|
| 386 |
+
|
| 387 |
+
### Sets and constants
|
| 388 |
+
|
| 389 |
+
| Symbol | Unit | Description |
|
| 390 |
+
| :--------------------------- | :---- | :--------------------------------------------------------------- |
|
| 391 |
+
| $M^\text{psl-demand}_{spt}$ | MW | Demand of price-sensitive load $p$ at time $t$ and scenario $s$. |
|
| 392 |
+
| $Z^\text{psl-revenue}_{spt}$ | \$/MW | Revenue from serving load $p$ at $t$ in scenario $s$. |
|
| 393 |
+
| $\text{PSL}$ | | Set of price-sensitive loads. |
|
| 394 |
+
|
| 395 |
+
### Decision variables
|
| 396 |
+
|
| 397 |
+
| Symbol | JuMP name | Unit | Description | Stage |
|
| 398 |
+
| :------------------- | :------------- | :--- | :------------------------------------------------ | :---- |
|
| 399 |
+
| $y^\text{psl}_{spt}$ | `loads[s,p,t]` | MW | Amount served to $p$ in time $t$ and scenario $s$ | 2 |
|
| 400 |
+
|
| 401 |
+
### Objective function terms
|
| 402 |
+
|
| 403 |
+
- Revenue from serving price-sensitive loads:
|
| 404 |
+
|
| 405 |
+
```math
|
| 406 |
+
- \sum_{s \in S} p(s) \left[
|
| 407 |
+
\sum_{p \in \text{PSL}} \sum_{t \in T} y^\text{psl}_{spt} Z^\text{psl-revenue}_{spt}
|
| 408 |
+
\right]
|
| 409 |
+
```
|
| 410 |
+
|
| 411 |
+
### Constraints
|
| 412 |
+
|
| 413 |
+
- Variable bounds:
|
| 414 |
+
|
| 415 |
+
```math
|
| 416 |
+
0 \leq y^\text{psl}_{spt} \leq M^\text{psl-demand}_{spt}
|
| 417 |
+
```
|
| 418 |
+
|
| 419 |
+
## 6. Energy storage
|
| 420 |
+
|
| 421 |
+
_Energy storage_ units are able to store energy during periods of low demand,
|
| 422 |
+
then release energy back to the grid during periods of high demand. These
|
| 423 |
+
devices include _batteries_, _pumped hydroelectric storage_, _compressed air
|
| 424 |
+
energy storage_ and _flywheels_. They are becoming increasingly important in the
|
| 425 |
+
modern power grid, and can help to enhance grid reliability, efficiency and
|
| 426 |
+
integration of renewable energy resources.
|
| 427 |
+
|
| 428 |
+
### Concepts
|
| 429 |
+
|
| 430 |
+
- **Min/max energy level and charge rate:** Energy storage units can only store
|
| 431 |
+
a limited amount of energy (in MWh). To maintain the operational safety and
|
| 432 |
+
longevity of these devices, a minimum energy level may also be imposed. The
|
| 433 |
+
rate (in MW) at which these units can charge and discharge is also limited,
|
| 434 |
+
due to chemical, physical and operational considerations.
|
| 435 |
+
|
| 436 |
+
- **Operational costs:** Charging and discharging energy storage units may incur
|
| 437 |
+
a cost/revenue. We assume that this cost/revenue is linear on the
|
| 438 |
+
charge/discharte rate ($/MW).
|
| 439 |
+
|
| 440 |
+
- **Efficiency:** Charging an energy storage unit for one hour with an input of
|
| 441 |
+
1 MW might not result in an increase of the energy level in the device by
|
| 442 |
+
exactly 1 MWh, due to various inneficiencies in the charging process,
|
| 443 |
+
including coversion losses and heat generation. For similar reasons,
|
| 444 |
+
discharging a storage unit for one hour at 1 MW might reduce the energy level
|
| 445 |
+
by more than 1 MWh. Furthermore, even when the unit is not charging or
|
| 446 |
+
discharging, some energy level may be gradually lost over time, due to
|
| 447 |
+
unwanted chemical reactions, thermal effects of mechanical losses.
|
| 448 |
+
|
| 449 |
+
- **Myopic effect:** Because the optimization process considers a fixed time
|
| 450 |
+
window, there is an inherent bias towards exploiting energy storage units to
|
| 451 |
+
their maximum within the window, completely ignoring their operation just
|
| 452 |
+
beyond this horizon. For instance, without further constraints, the
|
| 453 |
+
optimization algorithm will often ensure that all storage units are fully
|
| 454 |
+
discharged at the end of the last time step, which may not be desirable. To
|
| 455 |
+
mitigate this myopic effect, a minimum and maximum energy level may be imposed
|
| 456 |
+
at the last time step.
|
| 457 |
+
|
| 458 |
+
- **Simultaneous charging and discharging:** Depending on charge and discharge
|
| 459 |
+
costs/revenue, it may make sense mathematically to simultaneously charge and
|
| 460 |
+
discharge the storage unit, thus keeping its energy level unchanged while
|
| 461 |
+
potentially collecting revenue. Additional binary variables and constraints
|
| 462 |
+
are required to prevent this incorrect model behavior.
|
| 463 |
+
|
| 464 |
+
### Sets and constants
|
| 465 |
+
|
| 466 |
+
| Symbol | Unit | Description |
|
| 467 |
+
| :------------------------------------ | :---- | :---------------------------------------------------------------------------------------------------- |
|
| 468 |
+
| $\text{SU}$ | | Set of storage units |
|
| 469 |
+
| $Z^\text{charge}_{sut}$ | \$/MW | Linear charge cost/revenue for unit $u$ at time $t$ in scenario $s$. |
|
| 470 |
+
| $Z^\text{discharge}_{sut}$ | \$/MW | Linear discharge cost/revenue for unit $u$ at time $t$ in scenario $s$. |
|
| 471 |
+
| $M^\text{discharge-max}_{sut}$ | \$/MW | Maximum discharge rate for unit $u$ at time $t$ in scenario $s$. |
|
| 472 |
+
| $M^\text{discharge-min}_{sut}$ | \$/MW | Minimum discharge rate for unit $u$ at time $t$ in scenario $s$. |
|
| 473 |
+
| $M^\text{charge-max}_{sut}$ | \$/MW | Maximum charge rate for unit $u$ at time $t$ in scenario $s$. |
|
| 474 |
+
| $M^\text{charge-min}_{sut}$ | \$/MW | Minimum charge rate for unit $u$ at time $t$ in scenario $s$. |
|
| 475 |
+
| $M^\text{max-end-level}_{su}$ | MWh | Maximum storage level of unit $u$ at the last time step in scenario $s$ |
|
| 476 |
+
| $M^\text{min-end-level}_{su}$ | MWh | Minimum storage level of unit $u$ at the last time step in scenario $s$ |
|
| 477 |
+
| $\gamma^\text{loss}_{s,u,t}$ | | Self-discharge factor. |
|
| 478 |
+
| $\gamma^\text{charge-eff}_{s,u,t}$ | | Charging efficiency factor. |
|
| 479 |
+
| $\gamma^\text{discharge-eff}_{s,u,t}$ | | Discharging efficiency factor. |
|
| 480 |
+
| $\gamma^\text{time-step}$ | | Length of a time step, in hours. Should be 1.0 for hourly time steps, 0.5 for 30-min half steps, etc. |
|
| 481 |
+
|
| 482 |
+
### Decision variables
|
| 483 |
+
|
| 484 |
+
| Symbol | JuMP name | Unit | Description | Stage |
|
| 485 |
+
| :------------------------------ | :---------------------- | :----- | :----------------------------------------------------------- | :---- |
|
| 486 |
+
| $y^\text{level}_{sut}$ | `storage_level[s,u,t]` | MWh | Storage level of unit $u$ at time $t$ in scenario $s$. | 2 |
|
| 487 |
+
| $y^\text{charge}_{sut}$ | `charge_rate[s,u,t]` | MW | Charge rate of unit $u$ at time $t$ in scenario $s$. | 2 |
|
| 488 |
+
| $y^\text{discharge}_{sut}$ | `discharge_rate[s,u,t]` | MW | Discharge rate of unit $u$ at time $t$ in scenario $s$. | 2 |
|
| 489 |
+
| $x^\text{is-charging}_{sut}$ | `is_charging[s,u,t]` | Binary | True if unit $u$ is charging at time $t$ in scenario $s$. | 2 |
|
| 490 |
+
| $x^\text{is-discharging}_{sut}$ | `is_discharging[s,u,t]` | Binary | True if unit $u$ is discharging at time $t$ in scenario $s$. | 2 |
|
| 491 |
+
|
| 492 |
+
### Objective function terms
|
| 493 |
+
|
| 494 |
+
- Charge and discharge cost/revenue:
|
| 495 |
+
|
| 496 |
+
```math
|
| 497 |
+
\sum_{s \in S} p(s) \left[
|
| 498 |
+
\sum_{u \in \text{SU}} \sum_{t \in T} \left(
|
| 499 |
+
y^\text{charge}_{sut} Z^\text{charge}_{sut} +
|
| 500 |
+
y^\text{discharge}_{sut} Z^\text{discharge}_{sut}
|
| 501 |
+
\right)
|
| 502 |
+
\right]
|
| 503 |
+
```
|
| 504 |
+
|
| 505 |
+
### Constraints
|
| 506 |
+
|
| 507 |
+
- Prevent simultaneous charge and discharge
|
| 508 |
+
(`eq_simultaneous_charge_and_discharge[s,u,t]`):
|
| 509 |
+
|
| 510 |
+
```math
|
| 511 |
+
x^\text{is-charging}_{sut} + x^\text{is-discharging}_{sut} \leq 1
|
| 512 |
+
```
|
| 513 |
+
|
| 514 |
+
- Limit charge/discharge rate (`eq_min_charge_rate[s,u,t]`,
|
| 515 |
+
`eq_max_charge_rate[s,u,t]`, `eq_min_discharge_rate[s,u,t]` and
|
| 516 |
+
`eq_max_discharge_rate[s,u,t]`):
|
| 517 |
+
|
| 518 |
+
```math
|
| 519 |
+
\begin{align*}
|
| 520 |
+
y^\text{charge}_{sut} \leq x^\text{is-charging}_{sut} M^\text{charge-max}_{sut} \\
|
| 521 |
+
y^\text{charge}_{sut} \geq x^\text{is-charging}_{sut} M^\text{charge-min}_{sut} \\
|
| 522 |
+
y^\text{discharge}_{sut} \leq x^\text{is-discharging}_{sut} M^\text{discharge-max}_{sut} \\
|
| 523 |
+
y^\text{discharge}_{sut} \geq x^\text{is-discharging}_{sut} M^\text{discharge-min}_{sut} \\
|
| 524 |
+
\end{align*}
|
| 525 |
+
```
|
| 526 |
+
|
| 527 |
+
- Calculate current storage level (`eq_storage_transition[s,u,t]`):
|
| 528 |
+
|
| 529 |
+
```math
|
| 530 |
+
y^\text{level}_{sut} =
|
| 531 |
+
(1 - \gamma^\text{loss}_{s,u,t}) y^\text{level}_{su,t-1} +
|
| 532 |
+
\gamma^\text{time-step} \gamma^\text{charge-eff}_{s,u,t} y^\text{charge}_{sut} -
|
| 533 |
+
\frac{\gamma^\text{time-step}}{\gamma^\text{discharge-eff}_{s,u,t}} y^\text{charge}_{sut}
|
| 534 |
+
```
|
| 535 |
+
|
| 536 |
+
- Enforce storage level at last time step (`eq_ending_level[s,u]`):
|
| 537 |
+
|
| 538 |
+
```math
|
| 539 |
+
M^\text{min-end-level}_{su} \leq y^\text{level}_{sut} \leq M^\text{max-end-level}_{su}
|
| 540 |
+
```
|
| 541 |
+
|
| 542 |
+
## 7. Buses and transmission lines
|
| 543 |
+
|
| 544 |
+
So far, we have described generators, which produce power, loads, which consume
|
| 545 |
+
power, and storage units, which store energy for later use. Another important
|
| 546 |
+
element is the transmission network, which delivers the power produced by the
|
| 547 |
+
generators to the loads and storage units. Mathematically, the network is
|
| 548 |
+
represented as a graph $(B,L)$ where $B$ is the set of **buses** and $L$ is the
|
| 549 |
+
set of **transmission lines**. Each generator, load and storage unit is located
|
| 550 |
+
at a bus. The **net injection** at the bus is the sum of all power injected
|
| 551 |
+
minus withdrawn at the bus. To balance production and consumption, we must
|
| 552 |
+
enforce that the sum of all net injections over the entire network equal to
|
| 553 |
+
zero.
|
| 554 |
+
|
| 555 |
+
Besides the net balance equations, we must also enforce flow limits on the
|
| 556 |
+
transmission lines. Unlike flows in other optimization problems, power flows are
|
| 557 |
+
directly determined by net injections and transmission line parameters, and must
|
| 558 |
+
follow physical laws. UC.jl uses the DC linearization of AC power flow
|
| 559 |
+
equations. Under this linearization, the flow $f_l$ in transmission line $l$ is
|
| 560 |
+
given by $\sum_{b \in B} \delta_{bl} n_b$, where $\delta_{bl}$ is a constant
|
| 561 |
+
known as _injection shift factor_ (also commonly called _power transfer
|
| 562 |
+
distribution factor_), computed from the line parameters, and $n_b$ is the net
|
| 563 |
+
injection at bus $b$.
|
| 564 |
+
|
| 565 |
+
!!! warning
|
| 566 |
+
|
| 567 |
+
To improve computational performance, power flow variables and constraints are generated on-the-fly, during `UnitCommitment.optimize!`; they are **not** added by `UnitCommitment.build_model`.
|
| 568 |
+
|
| 569 |
+
### Sets and constants
|
| 570 |
+
|
| 571 |
+
| Symbol | Unit | Description |
|
| 572 |
+
| :------------------------ | :---- | :---------------------------------------------------------- |
|
| 573 |
+
| $M^\text{limit}_{slt}$ | MW | Flow limit for line $l$ at time $t$ and scenario $s$. |
|
| 574 |
+
| $Z^\text{overflow}_{slt}$ | \$/MW | Overflow penalty for line $l$ at time $t$ and scenario $s$. |
|
| 575 |
+
| $L$ | | Set of transmission lines. |
|
| 576 |
+
| $B$ | | Set of buses. |
|
| 577 |
+
|
| 578 |
+
### Decision variables
|
| 579 |
+
|
| 580 |
+
| Symbol | JuMP name | Unit | Description | Stage |
|
| 581 |
+
| :------------------------ | :--------------------- | :--- | :-------------------------------------------------------------------- | :---- |
|
| 582 |
+
| $y^\text{flow}_{slt}$ | _(added on-the-fly)_ | MW | Flow in line $l$ at time $t$ and scenario $s$. | 2 |
|
| 583 |
+
| $y^\text{inj}_{sbt}$ | `net_injection[s,b,t]` | MW | Total net injection at bus $b$, time $t$ and scenario $s$. | 2 |
|
| 584 |
+
| $y^\text{overflow}_{slt}$ | `overflow[s,l,t]` | MW | Amount of flow above limit for line $l$ at time $t$ and scenario $s$. | 2 |
|
| 585 |
+
|
| 586 |
+
### Objective function terms
|
| 587 |
+
|
| 588 |
+
- Penalty for exceeding line limits:
|
| 589 |
+
|
| 590 |
+
```math
|
| 591 |
+
\sum_{s \in S} p(s) \left[
|
| 592 |
+
\sum_{l \in L} \sum_{t \in T} y^\text{overflow}_{slt} Z^\text{overflow}_{slt}
|
| 593 |
+
\right]
|
| 594 |
+
```
|
| 595 |
+
|
| 596 |
+
### Constraints
|
| 597 |
+
|
| 598 |
+
- Power produced equal power consumed (`eq_power_balance[s,t]`):
|
| 599 |
+
|
| 600 |
+
```math
|
| 601 |
+
\sum_{b \in B} \sum_{t \in T} y^\text{inj}_{sbt} = 0
|
| 602 |
+
```
|
| 603 |
+
|
| 604 |
+
- Definition of flow (_enforced on-the-fly_):
|
| 605 |
+
|
| 606 |
+
```math
|
| 607 |
+
y^\text{flow}_{slt} = \sum_{b \in B} \delta_{sbl} y^\text{inj}_{sbt}
|
| 608 |
+
```
|
| 609 |
+
|
| 610 |
+
- Flow limits (_enforced on-the-fly_):
|
| 611 |
+
|
| 612 |
+
```math
|
| 613 |
+
\begin{align*}
|
| 614 |
+
y^\text{flow}_{slt} & \leq M^\text{limit}_{slt} + y^\text{overflow}_{slt} \\
|
| 615 |
+
-y^\text{flow}_{slt} & \leq M^\text{limit}_{slt} + y^\text{overflow}_{slt}
|
| 616 |
+
\end{align*}
|
| 617 |
+
```
|
| 618 |
+
|
docs/src/index.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl
|
| 2 |
+
|
| 3 |
+
**UnitCommitment.jl** (UC.jl) is an optimization package for the Security-Constrained Unit Commitment Problem (SCUC), a fundamental optimization problem in power systems used, for example, to clear the electricity markets. Both deterministic and two-stage stochastic versions of the problem are supported. The package provides benchmark instances for the problem, a flexible and well-documented data format for the problem, as well as Julia/JuMP implementations of state-of-the-art mixed-integer programming formulations and solution methods.
|
| 4 |
+
|
| 5 |
+
## Package Components
|
| 6 |
+
|
| 7 |
+
- **Data Format:** The package proposes an extensible and fully-documented JSON-based data specification format for SCUC, developed in collaboration with Independent System Operators (ISOs), which describes the most important aspects of the problem. The format supports all the most common thermal generator characteristics (including ramping, piecewise-linear production cost curves and time-dependent startup costs), as well as profiled generators, reserves, price-sensitive loads, battery storage, transmission, and contingencies.
|
| 8 |
+
- **Benchmark Instances:** The package provides a diverse collection of large-scale benchmark instances collected from the literature, converted into a common data format, and extended using data-driven methods to make them more challenging and realistic.
|
| 9 |
+
- **Model Implementation**: The package provides a Julia/JuMP implementations of state-of-the-art formulations and solution methods for the deterministic and stochastic SCUC, including multiple ramping formulations ([ArrCon2000](https://doi.org/10.1109/59.871739), [MorLatRam2013](https://doi.org/10.1109/TPWRS.2013.2251373), [DamKucRajAta2016](https://doi.org/10.1007/s10107-015-0919-9), [PanGua2016](https://doi.org/10.1287/opre.2016.1520)), piecewise-linear costs formulations ([Gar1962](https://doi.org/10.1109/AIEEPAS.1962.4501405), [CarArr2006](https://doi.org/10.1109/TPWRS.2006.876672), [KnuOstWat2018](https://doi.org/10.1109/TPWRS.2017.2783850)), contingency screening methods ([XavQiuWanThi2019](https://doi.org/10.1109/TPWRS.2019.2892620)) and decomposition methods. Our goal is to keep these implementations up-to-date as new methods are proposed in the literature.
|
| 10 |
+
- **Benchmark Tools:** The package provides automated benchmark scripts to accurately evaluate the performance impact of proposed code changes.
|
| 11 |
+
|
| 12 |
+
## Authors
|
| 13 |
+
|
| 14 |
+
- **Alinson S. Xavier** (Argonne National Laboratory)
|
| 15 |
+
- **Aleksandr M. Kazachkov** (University of Florida)
|
| 16 |
+
- **Ogün Yurdakul** (Technische Universität Berlin)
|
| 17 |
+
- **Jun He** (Purdue University)
|
| 18 |
+
- **Feng Qiu** (Argonne National Laboratory)
|
| 19 |
+
|
| 20 |
+
## Acknowledgments
|
| 21 |
+
|
| 22 |
+
- We would like to thank **Yonghong Chen** (Midcontinent Independent System Operator), **Feng Pan** (Pacific Northwest National Laboratory) for valuable feedback on early versions of this package.
|
| 23 |
+
|
| 24 |
+
- Based upon work supported by **Laboratory Directed Research and Development** (LDRD) funding from Argonne National Laboratory, provided by the Director, Office of Science, of the U.S. Department of Energy under Contract No. DE-AC02-06CH11357
|
| 25 |
+
|
| 26 |
+
- Based upon work supported by the **U.S. Department of Energy Advanced Grid Modeling Program** under Grant DE-OE0000875.
|
| 27 |
+
|
| 28 |
+
## Citing
|
| 29 |
+
|
| 30 |
+
If you use UnitCommitment.jl in your research (instances, models or algorithms), we kindly request that you cite the package as follows:
|
| 31 |
+
|
| 32 |
+
- **Alinson S. Xavier, Aleksandr M. Kazachkov, Ogün Yurdakul, Jun He, Feng Qiu**, "UnitCommitment.jl: A Julia/JuMP Optimization Package for Security-Constrained Unit Commitment (Version 0.4)". Zenodo (2024). [DOI: 10.5281/zenodo.4269874](https://doi.org/10.5281/zenodo.4269874).
|
| 33 |
+
|
| 34 |
+
If you use the instances, we additionally request that you cite the original sources, as described in the [instances page](guides/instances.md).
|
| 35 |
+
|
| 36 |
+
## License
|
| 37 |
+
|
| 38 |
+
```text
|
| 39 |
+
UnitCommitment.jl: A Julia/JuMP Optimization Package for Security-Constrained Unit Commitment
|
| 40 |
+
Copyright © 2020-2024, UChicago Argonne, LLC. All Rights Reserved.
|
| 41 |
+
|
| 42 |
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
| 43 |
+
provided that the following conditions are met:
|
| 44 |
+
|
| 45 |
+
1. Redistributions of source code must retain the above copyright notice, this list of
|
| 46 |
+
conditions and the following disclaimer.
|
| 47 |
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of
|
| 48 |
+
conditions and the following disclaimer in the documentation and/or other materials provided
|
| 49 |
+
with the distribution.
|
| 50 |
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to
|
| 51 |
+
endorse or promote products derived from this software without specific prior written
|
| 52 |
+
permission.
|
| 53 |
+
|
| 54 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
| 55 |
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
| 56 |
+
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
| 57 |
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
| 58 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 59 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 60 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
| 61 |
+
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 62 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 63 |
+
```
|
docs/src/tutorials/customizing.jl
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# # Model customization
|
| 2 |
+
|
| 3 |
+
# In the previous tutorial, we used UnitCommitment.jl to solve benchmark and user-provided instances using a default mathematical formulation for the problem. In this tutorial, we will explore how to customize this formulation.
|
| 4 |
+
|
| 5 |
+
# !!! warning
|
| 6 |
+
|
| 7 |
+
# This tutorial is not required for using UnitCommitment.jl, unless you plan to make changes to the problem formulation. In this page, we assume familiarity with the JuMP modeling language. Please see [JuMP's official documentation](https://jump.dev/JuMP.jl/stable/) for resources on getting started with JuMP.
|
| 8 |
+
|
| 9 |
+
# ## Selecting modeling components
|
| 10 |
+
|
| 11 |
+
# By default, `UnitCommitment.build_model` uses a formulation that combines modeling components from different publications, and that has been carefully tested, using our own benchmark scripts, to provide good performance across a wide variety of instances. This default formulation is expected to change over time, as new methods are proposed in the literature.
|
| 12 |
+
|
| 13 |
+
# You can, however, construct your own formulation, based on the modeling components that you choose, as shown in the next example.
|
| 14 |
+
|
| 15 |
+
# We start by importing the necessary packages and reading a benchmark instance:
|
| 16 |
+
|
| 17 |
+
using HiGHS
|
| 18 |
+
using JuMP
|
| 19 |
+
using UnitCommitment
|
| 20 |
+
|
| 21 |
+
instance = UnitCommitment.read_benchmark("matpower/case14/2017-01-01");
|
| 22 |
+
|
| 23 |
+
# Next, instead of calling `UnitCommitment.build_model` with default arguments, we can provide a `UnitCommitment.Formulation` object, which describes what modeling components to use, and how should they be configured. For a complete list of modeling components available in UnitCommitment.jl, see the [API docs](../api.md).
|
| 24 |
+
|
| 25 |
+
# In the example below, we switch to piecewise-linear cost modeling as defined in [KnuOstWat2018](https://doi.org/10.1109/TPWRS.2017.2783850), as well as ramping and startup costs formulation as defined in [MorLatRam2013](https://doi.org/10.1109/TPWRS.2013.2251373). In addition, we specify custom cutoffs for the shift factors formulation.
|
| 26 |
+
|
| 27 |
+
model = UnitCommitment.build_model(
|
| 28 |
+
instance = instance,
|
| 29 |
+
optimizer = HiGHS.Optimizer,
|
| 30 |
+
formulation = UnitCommitment.Formulation(
|
| 31 |
+
pwl_costs = UnitCommitment.KnuOstWat2018.PwlCosts(),
|
| 32 |
+
ramping = UnitCommitment.MorLatRam2013.Ramping(),
|
| 33 |
+
startup_costs = UnitCommitment.MorLatRam2013.StartupCosts(),
|
| 34 |
+
transmission = UnitCommitment.ShiftFactorsFormulation(
|
| 35 |
+
isf_cutoff = 0.008,
|
| 36 |
+
lodf_cutoff = 0.003,
|
| 37 |
+
),
|
| 38 |
+
power_trajectories = ArrCon2004.PowerTrajectories(),
|
| 39 |
+
),
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
# ## Accessing decision variables
|
| 43 |
+
|
| 44 |
+
# In the previous tutorial, we saw how to access the optimal solution through `UnitCommitment.solution`. While this approach works well for basic usage, it is also possible to get a direct reference to the JuMP decision variables and query their values, as the next example illustrates.
|
| 45 |
+
|
| 46 |
+
# First, we load a benchmark instance and solve it, as before.
|
| 47 |
+
|
| 48 |
+
instance = UnitCommitment.read_benchmark("matpower/case14/2017-01-01");
|
| 49 |
+
model =
|
| 50 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 51 |
+
UnitCommitment.optimize!(model)
|
| 52 |
+
|
| 53 |
+
# At this point, it is possible to obtain a reference to the decision variables by calling `model[:varname][index]`. For example, `model[:is_on]["g1",1]` returns a direct reference to the JuMP variable indicating whether generator named "g1" is on at time 1. For a complete list of decision variables available, and how are they indexed, see the [problem definition](../guides/problem.md).
|
| 54 |
+
|
| 55 |
+
@show JuMP.value(model[:is_on]["g1", 1])
|
| 56 |
+
|
| 57 |
+
# To access second-stage decisions, it is necessary to specify the scenario name. UnitCommitment.jl models deterministic instances as a particular case in which there is a single scenario named "s1", so we need to use this key.
|
| 58 |
+
|
| 59 |
+
@show JuMP.value(model[:prod_above]["s1", "g1", 1])
|
| 60 |
+
|
| 61 |
+
# ## Modifying variables and constraints
|
| 62 |
+
|
| 63 |
+
# When testing variations of the unit commitment problem, it is often necessary to modify the objective function, variables and constraints of the formulation. UnitCommitment.jl makes this process relatively easy. The first step is to construct the standard model using `UnitCommitment.build_model`:
|
| 64 |
+
|
| 65 |
+
instance = UnitCommitment.read_benchmark("matpower/case14/2017-01-01");
|
| 66 |
+
model =
|
| 67 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 68 |
+
|
| 69 |
+
# Now, before calling `UnitCommitment.optimize`, we can make any desired changes to the formulation. In the previous section, we saw how to obtain a direct reference to the decision variables. It is possible to modify them by using standard JuMP methods. For example, to fix the commitment status of a particular generator, we can use `JuMP.fix`:
|
| 70 |
+
|
| 71 |
+
JuMP.fix(model[:is_on]["g1", 1], 1.0, force = true)
|
| 72 |
+
|
| 73 |
+
# To modify the cost coefficient of a particular variable, we can use `JuMP.set_objective_coefficient`:
|
| 74 |
+
|
| 75 |
+
JuMP.set_objective_coefficient(model, model[:switch_on]["g1", 1], 1000.0)
|
| 76 |
+
|
| 77 |
+
# It is also possible to make changes to the set of constraints. For example, we can add a custom constraint, using the `JuMP.@constraint` macro:
|
| 78 |
+
|
| 79 |
+
@constraint(model, model[:is_on]["g3", 1] + model[:is_on]["g4", 1] <= 1,);
|
| 80 |
+
|
| 81 |
+
# We can also remove an existing model constraint using `JuMP.delete`. See the [problem definition](../guides/problem.md) for a list of constraint names and indices.
|
| 82 |
+
|
| 83 |
+
JuMP.delete(model, model[:eq_min_uptime]["g1", 1])
|
| 84 |
+
|
| 85 |
+
# After we are done with all changes, we can call `UnitCommitment.optimize` and extract the optimal solution:
|
| 86 |
+
|
| 87 |
+
UnitCommitment.optimize!(model)
|
| 88 |
+
@show UnitCommitment.solution(model)
|
| 89 |
+
|
| 90 |
+
# ## Modeling new grid components
|
| 91 |
+
|
| 92 |
+
# In this section we demonstrate how to add a new grid component to a particular bus in the network. This is useful, for example, when developing formulations for a new type of generator, energy storage, or any other grid device. We start by reading the instance data and buliding a standard model:
|
| 93 |
+
|
| 94 |
+
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
| 95 |
+
model =
|
| 96 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 97 |
+
|
| 98 |
+
# Next, we create decision variables for the new grid component. In this example, we assume that the new component can inject up to 10 MW of power at each time step, so we create new continuous variables $0 \leq x_t \leq 10$.
|
| 99 |
+
|
| 100 |
+
T = instance.time
|
| 101 |
+
@variable(model, x[1:T], lower_bound = 0.0, upper_bound = 10.0);
|
| 102 |
+
|
| 103 |
+
# Next, we add the production costs to the objective function. In this example, we assume a generation cost of \$5/MW:
|
| 104 |
+
|
| 105 |
+
for t in 1:T
|
| 106 |
+
set_objective_coefficient(model, x[t], 5.0)
|
| 107 |
+
end
|
| 108 |
+
|
| 109 |
+
# We then attach the new component to bus `b1` by modifying the net injection constraint (`eq_net_injection`):
|
| 110 |
+
|
| 111 |
+
for t in 1:T
|
| 112 |
+
set_normalized_coefficient(
|
| 113 |
+
model[:eq_net_injection]["s1", "b1", t],
|
| 114 |
+
x[t],
|
| 115 |
+
1.0,
|
| 116 |
+
)
|
| 117 |
+
end
|
| 118 |
+
|
| 119 |
+
# Next, we solve the model:
|
| 120 |
+
|
| 121 |
+
UnitCommitment.optimize!(model)
|
| 122 |
+
|
| 123 |
+
# We then finally extract the optimal value of the $x$ variables:
|
| 124 |
+
|
| 125 |
+
@show value.(x)
|
docs/src/tutorials/decomposition.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Decomposition methods
|
| 2 |
+
|
| 3 |
+
## 1. Time decomposition for production cost modeling
|
| 4 |
+
|
| 5 |
+
Solving unit commitment instances that have long time horizons (for example, year-long 8760-hour instances in production cost modeling) requires a substantial amount of computational power. To address this issue, UC.jl offers a time decomposition method, which breaks the instance down into multiple overlapping subproblems, solves them sequentially, then reassembles the solution.
|
| 6 |
+
|
| 7 |
+
When solving a unit commitment instance with a dense time slot structure, computational complexity can become a significant challenge. For instance, if the instance contains hourly data for an entire year (8760 hours), solving such a model can require a substantial amount of computational power. To address this issue, UC.jl provides a time_decomposition method within the `optimize!` function. This method decomposes the problem into multiple sub-problems, solving them sequentially.
|
| 8 |
+
|
| 9 |
+
The `optimize!` function takes 5 parameters: a unit commitment instance, a `TimeDecomposition` method, an optimizer, and two optional functions `after_build` and `after_optimize`. It returns a solution dictionary. The `TimeDecomposition` method itself requires four arguments: `time_window`, `time_increment`, `inner_method` (optional), and `formulation` (optional). These arguments define the time window for each sub-problem, the time increment to move to the next sub-problem, the method used to solve each sub-problem, and the formulation employed, respectively. The two functions, namely `after_build` and `after_optimize`, are invoked subsequent to the construction and optimization of each sub-model, respectively. It is imperative that the `after_build` function requires its two arguments to be consistently mapped to `model` and `instance`, while the `after_optimize` function necessitates its three arguments to be consistently mapped to `solution`, `model`, and `instance`.
|
| 10 |
+
|
| 11 |
+
The code snippet below illustrates an example of solving an instance by decomposing the model into multiple 36-hour sub-problems using the `XavQiuWanThi2019` method. Each sub-problem advances 24 hours at a time. The first sub-problem covers time steps 1 to 36, the second covers time steps 25 to 60, the third covers time steps 49 to 84, and so on. The initial power levels and statuses of the second and subsequent sub-problems are set based on the results of the first 24 hours from each of their immediate prior sub-problems. In essence, this approach addresses the complexity of solving a large problem by tackling it in 24-hour intervals, while incorporating an additional 12-hour buffer to mitigate the closing window effect for each sub-problem. Furthermore, the `after_build` function imposes the restriction that `g3` and `g4` cannot be activated simultaneously during the initial time slot of each sub-problem. On the other hand, the `after_optimize` function is invoked to calculate the conventional Locational Marginal Prices (LMPs) for each sub-problem, and subsequently appends the computed values to the `lmps` vector.
|
| 12 |
+
|
| 13 |
+
> **Warning**
|
| 14 |
+
> Specifying `TimeDecomposition` as the value of the `inner_method` field of another `TimeDecomposition` causes errors when calling the `optimize!` function due to the different argument structures between the two `optimize!` functions.
|
| 15 |
+
|
| 16 |
+
```julia
|
| 17 |
+
using UnitCommitment, JuMP, Cbc, HiGHS
|
| 18 |
+
|
| 19 |
+
import UnitCommitment:
|
| 20 |
+
TimeDecomposition,
|
| 21 |
+
ConventionalLMP,
|
| 22 |
+
XavQiuWanThi2019,
|
| 23 |
+
Formulation
|
| 24 |
+
|
| 25 |
+
# specifying the after_build and after_optimize functions
|
| 26 |
+
function after_build(model, instance)
|
| 27 |
+
@constraint(
|
| 28 |
+
model,
|
| 29 |
+
model[:is_on]["g3", 1] + model[:is_on]["g4", 1] <= 1,
|
| 30 |
+
)
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
lmps = []
|
| 34 |
+
function after_optimize(solution, model, instance)
|
| 35 |
+
lmp = UnitCommitment.compute_lmp(
|
| 36 |
+
model,
|
| 37 |
+
ConventionalLMP(),
|
| 38 |
+
optimizer = HiGHS.Optimizer,
|
| 39 |
+
)
|
| 40 |
+
return push!(lmps, lmp)
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
# assume the instance is given as a 120h problem
|
| 44 |
+
instance = UnitCommitment.read("instance.json")
|
| 45 |
+
|
| 46 |
+
solution = UnitCommitment.optimize!(
|
| 47 |
+
instance,
|
| 48 |
+
TimeDecomposition(
|
| 49 |
+
time_window = 36, # solve 36h problems
|
| 50 |
+
time_increment = 24, # advance by 24h each time
|
| 51 |
+
inner_method = XavQiuWanThi2019.Method(),
|
| 52 |
+
formulation = Formulation(),
|
| 53 |
+
),
|
| 54 |
+
optimizer = Cbc.Optimizer,
|
| 55 |
+
after_build = after_build,
|
| 56 |
+
after_optimize = after_optimize,
|
| 57 |
+
)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## 2. Scenario decomposition with Progressive Hedging for stochstic UC
|
| 61 |
+
|
| 62 |
+
By default, UC.jl uses the Extensive Form (EF) when solving stochastic instances. This approach involves constructing a single JuMP model that contains data and decision variables for all scenarios. Although EF has optimality guarantees and performs well with small test cases, it can become computationally intractable for large instances or substantial number of scenarios.
|
| 63 |
+
|
| 64 |
+
Progressive Hedging (PH) is an alternative (heuristic) solution method provided by UC.jl in which the problem is decomposed into smaller scenario-based subproblems, which are then solved in parallel in separate Julia processes, potentially across multiple machines. Quadratic penalty terms are used to enforce convergence of first-stage decision variables. The method is closely related to the Alternative Direction Method of Multipliers (ADMM) and can handle larger instances, although it is not guaranteed to converge to the optimal solution. Our implementation of PH relies on Message Passing Interface (MPI) for communication. We refer to [MPI.jl Documentation](https://github.com/JuliaParallel/MPI.jl) for more details on installing MPI.
|
| 65 |
+
|
| 66 |
+
The following example shows how to solve SCUC instances using progressive hedging. The script should be saved in a file, say `ph.jl`, and executed using `mpiexec -n <num-scenarios> julia ph.jl`.
|
| 67 |
+
|
| 68 |
+
```julia
|
| 69 |
+
using HiGHS
|
| 70 |
+
using MPI
|
| 71 |
+
using UnitCommitment
|
| 72 |
+
using Glob
|
| 73 |
+
|
| 74 |
+
# 1. Initialize MPI
|
| 75 |
+
MPI.Init()
|
| 76 |
+
|
| 77 |
+
# 2. Configure progressive hedging method
|
| 78 |
+
ph = UnitCommitment.ProgressiveHedging()
|
| 79 |
+
|
| 80 |
+
# 3. Read problem instance
|
| 81 |
+
instance = UnitCommitment.read(["example/s1.json", "example/s2.json"], ph)
|
| 82 |
+
|
| 83 |
+
# 4. Build JuMP model
|
| 84 |
+
model = UnitCommitment.build_model(
|
| 85 |
+
instance = instance,
|
| 86 |
+
optimizer = HiGHS.Optimizer,
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
# 5. Run the decentralized optimization algorithm
|
| 90 |
+
UnitCommitment.optimize!(model, ph)
|
| 91 |
+
|
| 92 |
+
# 6. Fetch the solution
|
| 93 |
+
solution = UnitCommitment.solution(model, ph)
|
| 94 |
+
|
| 95 |
+
# 7. Close MPI
|
| 96 |
+
MPI.Finalize()
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
When using PH, the model can be customized as usual, with different formulations or additional user-provided constraints. Note that `read`, in this case, takes `ph` as an argument. This allows each Julia process to read only the instance files that are relevant to it. Similarly, the `solution` function gathers the optimal solution of each processes and returns a combined dictionary.
|
| 100 |
+
|
| 101 |
+
Each process solves a sub-problem with $\frac{s}{p}$ scenarios, where $s$ is the total number of scenarios and $p$ is the number of MPI processes. For instance, if we have 15 scenario files and 5 processes, then each process will solve a JuMP model that contains data for 3 scenarios. If the total number of scenarios is not divisible by the number of processes, then an error will be thrown.
|
| 102 |
+
|
| 103 |
+
!!! warning
|
| 104 |
+
|
| 105 |
+
Currently, PH can handle only equiprobable scenarios. Further, `solution(model, ph)` can only handle cases where only one scenario is modeled in each process.
|
docs/src/tutorials/lmp.jl
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# # Locational Marginal Prices
|
| 2 |
+
|
| 3 |
+
# Locational Marginal Prices (LMPs) refer to the cost of supplying electricity at specific locations of the network. LMPs are crucial for the operation of electricity markets and have many other applications, such as indicating what areas of the network may require additional generation or transmission capacity. UnitCommitment.jl implements two methods for calculating LMPS: Conventional LMPs and Approximated Extended LMPs (AELMPs). In this tutorial, we introduce each method and illustrate their usage.
|
| 4 |
+
|
| 5 |
+
# ### Conventional LMPs
|
| 6 |
+
|
| 7 |
+
# Conventional LMPs work by (1) solving the original SCUC problem, (2) fixing all binary variables to their optimal values, and (3) re-solving the resulting linear programming model. In this approach, the LMPs are defined as the values of the dual variables associated with the net injection constraints.
|
| 8 |
+
|
| 9 |
+
# The first step to use this method is to load and optimize an instance, as explained in previous tutorials:
|
| 10 |
+
|
| 11 |
+
using UnitCommitment
|
| 12 |
+
using HiGHS
|
| 13 |
+
|
| 14 |
+
instance = UnitCommitment.read_benchmark("matpower/case14/2017-01-01")
|
| 15 |
+
model =
|
| 16 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer)
|
| 17 |
+
UnitCommitment.optimize!(model)
|
| 18 |
+
|
| 19 |
+
# Next, we call `UnitCommitment.compute_lmp`, as shown below. The function accepts three arguments -- a solved SCUC model, the LMP method, and a linear optimizer -- and it returns a dictionary mapping `(scenario_name, bus_name, time)` to the marginal price.
|
| 20 |
+
|
| 21 |
+
lmp = UnitCommitment.compute_lmp(
|
| 22 |
+
model,
|
| 23 |
+
UnitCommitment.ConventionalLMP(),
|
| 24 |
+
optimizer = HiGHS.Optimizer,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
# For example, the following code queries the LMP of bus `b1` in scenario `s1` at time 1:
|
| 28 |
+
|
| 29 |
+
@show lmp["s1", "b1", 1]
|
| 30 |
+
|
| 31 |
+
# ### Approximate Extended LMPs
|
| 32 |
+
|
| 33 |
+
# Approximate Extended LMPs (AELMPs) are an alternative method to calculate locational marginal prices which attemps to minimize uplift payments. The method internally works by modifying the instance data in three ways: (1) it sets the minimum power output of each generator to zero, (2) it averages the start-up cost over the offer blocks for each generator, and (3) it relaxes all integrality constraints. To compute AELMPs, as shown in the example below, we call `compute_lmp` and provide `UnitCommitment.AELMP()` as the second argument.
|
| 34 |
+
|
| 35 |
+
# This method has two configurable parameters: `allow_offline_participation` and `consider_startup_costs`. If `allow_offline_participation = true`, then offline generators are allowed to participate in the pricing. If instead `allow_offline_participation = false`, offline generators are not allowed and therefore are excluded from the system. A solved UC model is optional if offline participation is allowed, but is required if not allowed. The method forces offline participation to be allowed if the UC model supplied by the user is not solved. For the second field, If `consider_startup_costs = true`, then start-up costs are integrated and averaged over each unit production; otherwise the production costs stay the same. By default, both fields are set to `true`.
|
| 36 |
+
|
| 37 |
+
# !!! warning
|
| 38 |
+
|
| 39 |
+
# This method is still under active research, and has several limitations. The implementation provided in the package is based on MISO Phase I only. It only supports fast start resources. More specifically, the minimum up/down time of all generators must be 1, the initial power of all generators must be 0, and the initial status of all generators must be negative. The method does not support time-varying start-up costs, and only currently works for deterministic instances. If offline participation is not allowed, AELMPs treats an asset to be offline if it is never on throughout all time periods.
|
| 40 |
+
|
| 41 |
+
instance = UnitCommitment.read_benchmark("test/aelmp_simple")
|
| 42 |
+
|
| 43 |
+
model =
|
| 44 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer)
|
| 45 |
+
|
| 46 |
+
UnitCommitment.optimize!(model)
|
| 47 |
+
|
| 48 |
+
lmp = UnitCommitment.compute_lmp(
|
| 49 |
+
model,
|
| 50 |
+
UnitCommitment.AELMP(
|
| 51 |
+
allow_offline_participation = false,
|
| 52 |
+
consider_startup_costs = true,
|
| 53 |
+
),
|
| 54 |
+
optimizer = HiGHS.Optimizer,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
@show lmp["s1", "B1", 1]
|
docs/src/tutorials/market.jl
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# # Market Clearing
|
| 2 |
+
|
| 3 |
+
# In North America, electricity markets are structured around two primary types of markets: the day-ahead (DA) market and the real-time (RT) market. The DA market schedules electricity generation and consumption for the next day, based on forecasts and bids from electricity suppliers and consumers. The RT market, on the other hand, operates continuously throughout the day, addressing the discrepancies between the DA schedule and actual demand, typically every five minutes. UnitCommitment.jl is able to simulate the DA and RT market clearing process. Specifically, the package provides the function `UnitCommitment.solve_market` which performs the following steps:
|
| 4 |
+
|
| 5 |
+
# 1. Solve the DA market problem.
|
| 6 |
+
# 2. Extract commitment status of all generators.
|
| 7 |
+
# 3. Solve a sequence of RT market problems, fixing the commitment status of each generator to the corresponding optimal solution of the DA problem.
|
| 8 |
+
|
| 9 |
+
# To use this function, we need to prepare an instance file corresponding to the DA market problem and multiple instance files corresponding to the RT market problems. The number of required files depends on the time granularity and window. For example, suppose that the DA problem is solved at hourly granularity and has 24 time periods, whereas the RT problems are solved at 5-minute granularity and have a single time period. Then we would need to prepare one files for the DA problem and 288 files $\left(24 \times \frac{60}{5}\right)$ for the RT market problems.
|
| 10 |
+
|
| 11 |
+
# ## A small example
|
| 12 |
+
|
| 13 |
+
# For simplicity, in this tutorial we illustate the usage of `UnitCommitment.solve_market` with a very small example, in which the DA problem has only two time periods. We start by creating the DA instance file:
|
| 14 |
+
|
| 15 |
+
da_contents = """
|
| 16 |
+
{
|
| 17 |
+
"Parameters": {
|
| 18 |
+
"Version": "0.4",
|
| 19 |
+
"Time horizon (h)": 2
|
| 20 |
+
},
|
| 21 |
+
"Buses": {
|
| 22 |
+
"b1": {
|
| 23 |
+
"Load (MW)": [200, 400]
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"Generators": {
|
| 27 |
+
"g1": {
|
| 28 |
+
"Bus": "b1",
|
| 29 |
+
"Type": "Thermal",
|
| 30 |
+
"Production cost curve (MW)": [0, 200],
|
| 31 |
+
"Production cost curve (\$)": [0, 1000],
|
| 32 |
+
"Initial status (h)": -24,
|
| 33 |
+
"Initial power (MW)": 0
|
| 34 |
+
},
|
| 35 |
+
"g2": {
|
| 36 |
+
"Bus": "b1",
|
| 37 |
+
"Type": "Thermal",
|
| 38 |
+
"Production cost curve (MW)": [0, 300],
|
| 39 |
+
"Production cost curve (\$)": [0, 3000],
|
| 40 |
+
"Initial status (h)": -24,
|
| 41 |
+
"Initial power (MW)": 0
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
""";
|
| 46 |
+
|
| 47 |
+
open("da.json", "w") do file
|
| 48 |
+
return write(file, da_contents)
|
| 49 |
+
end;
|
| 50 |
+
|
| 51 |
+
# Next, we create eight single-period RT market problems, each one with a 15-minute time granularity:
|
| 52 |
+
|
| 53 |
+
for i in 1:8
|
| 54 |
+
rt_contents = """
|
| 55 |
+
{
|
| 56 |
+
"Parameters": {
|
| 57 |
+
"Version": "0.4",
|
| 58 |
+
"Time horizon (min)": 15,
|
| 59 |
+
"Time step (min)": 15
|
| 60 |
+
},
|
| 61 |
+
"Buses": {
|
| 62 |
+
"b1": {
|
| 63 |
+
"Load (MW)": [$(150 + 50 * i)]
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"Generators": {
|
| 67 |
+
"g1": {
|
| 68 |
+
"Bus": "b1",
|
| 69 |
+
"Type": "Thermal",
|
| 70 |
+
"Production cost curve (MW)": [0, 200],
|
| 71 |
+
"Production cost curve (\$)": [0, 1000],
|
| 72 |
+
"Initial status (h)": -24,
|
| 73 |
+
"Initial power (MW)": 0
|
| 74 |
+
},
|
| 75 |
+
"g2": {
|
| 76 |
+
"Bus": "b1",
|
| 77 |
+
"Type": "Thermal",
|
| 78 |
+
"Production cost curve (MW)": [0, 300],
|
| 79 |
+
"Production cost curve (\$)": [0, 3000],
|
| 80 |
+
"Initial status (h)": -24,
|
| 81 |
+
"Initial power (MW)": 0
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
"""
|
| 86 |
+
open("rt_$i.json", "w") do file
|
| 87 |
+
return write(file, rt_contents)
|
| 88 |
+
end
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
# Finally, we call `UnitCommitment.solve_market`, providing as arguments (1) the path to the DA problem; (2) a list of paths to the RT problems; (3) the mixed-integer linear optimizer.
|
| 92 |
+
|
| 93 |
+
using UnitCommitment
|
| 94 |
+
using HiGHS
|
| 95 |
+
|
| 96 |
+
solution = UnitCommitment.solve_market(
|
| 97 |
+
"da.json",
|
| 98 |
+
[
|
| 99 |
+
"rt_1.json",
|
| 100 |
+
"rt_2.json",
|
| 101 |
+
"rt_3.json",
|
| 102 |
+
"rt_4.json",
|
| 103 |
+
"rt_5.json",
|
| 104 |
+
"rt_6.json",
|
| 105 |
+
"rt_7.json",
|
| 106 |
+
"rt_8.json",
|
| 107 |
+
],
|
| 108 |
+
optimizer = HiGHS.Optimizer,
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
# To retrieve the day-ahead market solution, we can query `solution["DA"]`:
|
| 112 |
+
|
| 113 |
+
@show solution["DA"]
|
| 114 |
+
|
| 115 |
+
# To query each real-time market solution, we can query `solution["RT"][i]`. Note that LMPs are automativally calculated.
|
| 116 |
+
|
| 117 |
+
@show solution["RT"][1]
|
| 118 |
+
|
| 119 |
+
# ## Customizing the model and LMPs
|
| 120 |
+
|
| 121 |
+
# When using the `solve_market` function it is still possible to customize the problem formulation and the LMP calculation method. In the next example, we use a custom formulation and explicitly specify the LMP method through the `settings` keyword argument:
|
| 122 |
+
|
| 123 |
+
UnitCommitment.solve_market(
|
| 124 |
+
"da.json",
|
| 125 |
+
[
|
| 126 |
+
"rt_1.json",
|
| 127 |
+
"rt_2.json",
|
| 128 |
+
"rt_3.json",
|
| 129 |
+
"rt_4.json",
|
| 130 |
+
"rt_5.json",
|
| 131 |
+
"rt_6.json",
|
| 132 |
+
"rt_7.json",
|
| 133 |
+
"rt_8.json",
|
| 134 |
+
],
|
| 135 |
+
settings = UnitCommitment.MarketSettings(
|
| 136 |
+
lmp_method = UnitCommitment.ConventionalLMP(),
|
| 137 |
+
formulation = UnitCommitment.Formulation(
|
| 138 |
+
pwl_costs = UnitCommitment.KnuOstWat2018.PwlCosts(),
|
| 139 |
+
ramping = UnitCommitment.MorLatRam2013.Ramping(),
|
| 140 |
+
startup_costs = UnitCommitment.MorLatRam2013.StartupCosts(),
|
| 141 |
+
transmission = UnitCommitment.ShiftFactorsFormulation(
|
| 142 |
+
isf_cutoff = 0.008,
|
| 143 |
+
lodf_cutoff = 0.003,
|
| 144 |
+
),
|
| 145 |
+
),
|
| 146 |
+
),
|
| 147 |
+
optimizer = HiGHS.Optimizer,
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
# It is also possible to add custom variables and constraints to either the DA or RT market problems, through the usage of `after_build_da` and `after_build_rt` callback functions. Similarly, the `after_optimize_da` and `after_optimize_rt` can be used to directly analyze the JuMP models, after they have been optimized:
|
| 151 |
+
|
| 152 |
+
using JuMP
|
| 153 |
+
|
| 154 |
+
function after_build_da(model, instance)
|
| 155 |
+
@constraint(model, model[:is_on]["g1", 1] <= model[:is_on]["g2", 1])
|
| 156 |
+
end
|
| 157 |
+
|
| 158 |
+
function after_optimize_da(solution, model, instance)
|
| 159 |
+
@show value(model[:is_on]["g1", 1])
|
| 160 |
+
end
|
| 161 |
+
|
| 162 |
+
UnitCommitment.solve_market(
|
| 163 |
+
"da.json",
|
| 164 |
+
[
|
| 165 |
+
"rt_1.json",
|
| 166 |
+
"rt_2.json",
|
| 167 |
+
"rt_3.json",
|
| 168 |
+
"rt_4.json",
|
| 169 |
+
"rt_5.json",
|
| 170 |
+
"rt_6.json",
|
| 171 |
+
"rt_7.json",
|
| 172 |
+
"rt_8.json",
|
| 173 |
+
],
|
| 174 |
+
after_build_da = after_build_da,
|
| 175 |
+
after_optimize_da = after_optimize_da,
|
| 176 |
+
optimizer = HiGHS.Optimizer,
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
# ## Additional considerations
|
| 180 |
+
|
| 181 |
+
# - UC.jl supports two-stage stochastic DA market problems. In this case, we need one file for each DA market scenario. All RT market problems must be deterministic.
|
| 182 |
+
# - UC.jl also supports multi-period RT market problems. Assume, for example, that the DA market problem is an hourly problem with 24 time periods, whereas the RT market problem uses 5-minute granularity with 4 time periods. UC.jl assumes that the first RT file covers period `0:00` to `0:20`, the second covers `0:05` to `0:25` and so on. We therefore still need 288 RT market files. To avoid going beyond the 24-hour period covered by the DA market solution, however, the last few RT market problems must have only 3, 2, and 1 time periods, covering `23:45` to `24:00`, `23:50` to `24:00` and `23:55` to `24:00`, respectively.
|
| 183 |
+
# - Some MILP solvers (such as Cbc) have issues handling linear programming problems, which are required for the RT market. In this case, a separate linear programming solver can be provided to `solve_market` using the `lp_optimizer` argument. For example, `solve_market(da_file, rt_files, optimizer=Cbc.Optimizer, lp_optimizer=Clp.Optimizer)`.
|
docs/src/tutorials/usage.jl
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# # Getting started
|
| 2 |
+
|
| 3 |
+
# ## Installing the package
|
| 4 |
+
|
| 5 |
+
# UnitCommitment.jl was tested and developed with [Julia 1.10](https://julialang.org/). To install Julia, please follow the [installation guide on the official Julia website](https://julialang.org/downloads/). To install UnitCommitment.jl, run the Julia interpreter, type `]` to open the package manager, then type:
|
| 6 |
+
|
| 7 |
+
# ```text
|
| 8 |
+
# pkg> add UnitCommitment@0.4
|
| 9 |
+
# ```
|
| 10 |
+
|
| 11 |
+
# To solve the optimization models, a mixed-integer linear programming (MILP) solver is also required. Please see the [JuMP installation guide](https://jump.dev/JuMP.jl/stable/installation/) for more instructions on installing a solver. Typical open-source choices are [HiGHS](https://github.com/jump-dev/HiGHS.jl), [Cbc](https://github.com/JuliaOpt/Cbc.jl) and [GLPK](https://github.com/JuliaOpt/GLPK.jl). In the instructions below, HiGHS will be used, but any other MILP solver should also be compatible.
|
| 12 |
+
|
| 13 |
+
# ## Solving a benchmark instance
|
| 14 |
+
|
| 15 |
+
# We start this tutorial by illustrating how to use UnitCommitment.jl to solve one of the provided benchmark instances. The package contains a large number of deterministic benchmark instances collected from the literature and converted into a common data format, which can be used to evaluate the performance of different solution methods. See [Instances](../guides/instances.md) for more details. The first step is to import `UnitCommitment` and HiGHS.
|
| 16 |
+
|
| 17 |
+
using HiGHS
|
| 18 |
+
using UnitCommitment
|
| 19 |
+
|
| 20 |
+
# Next, we use the function `UnitCommitment.read_benchmark` to read the instance.
|
| 21 |
+
|
| 22 |
+
instance = UnitCommitment.read_benchmark("matpower/case14/2017-01-01");
|
| 23 |
+
|
| 24 |
+
# Now that we have the instance loaded in memory, we build the JuMP optimization model using `UnitCommitment.build_model`:
|
| 25 |
+
|
| 26 |
+
model = UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 27 |
+
|
| 28 |
+
# Next, we run the optimization process, with `UnitCommitment.optimize!`:
|
| 29 |
+
|
| 30 |
+
UnitCommitment.optimize!(model)
|
| 31 |
+
|
| 32 |
+
# Finally, we extract the optimal solution from the model:
|
| 33 |
+
|
| 34 |
+
solution = UnitCommitment.solution(model)
|
| 35 |
+
|
| 36 |
+
# We can then explore the solution using Julia:
|
| 37 |
+
|
| 38 |
+
@show solution["Thermal production (MW)"]["g1"]
|
| 39 |
+
|
| 40 |
+
# Or export the entire solution to a JSON file:
|
| 41 |
+
|
| 42 |
+
UnitCommitment.write("solution.json", solution)
|
| 43 |
+
|
| 44 |
+
# ## Solving a custom deterministic instance
|
| 45 |
+
|
| 46 |
+
# In the previous example, we solved a benchmark instance provided by the package. To solve a custom instance, the first step is to create an input file describing the list of elements (generators, loads and transmission lines) in the network. See [Data Format](../guides/format.md) for a complete description of the data format UC.jl expects.
|
| 47 |
+
# To keep this tutorial self-contained, we will create the input JSON file using Julia; however, this step can also be done with a simple text editor.
|
| 48 |
+
# First, we define the contents of the file:
|
| 49 |
+
|
| 50 |
+
json_contents = """
|
| 51 |
+
{
|
| 52 |
+
"Parameters": {
|
| 53 |
+
"Version": "0.4",
|
| 54 |
+
"Time horizon (h)": 4
|
| 55 |
+
},
|
| 56 |
+
"Buses": {
|
| 57 |
+
"b1": {
|
| 58 |
+
"Load (MW)": [100, 150, 200, 250]
|
| 59 |
+
}
|
| 60 |
+
},
|
| 61 |
+
"Generators": {
|
| 62 |
+
"g1": {
|
| 63 |
+
"Bus": "b1",
|
| 64 |
+
"Type": "Thermal",
|
| 65 |
+
"Production cost curve (MW)": [0, 200],
|
| 66 |
+
"Production cost curve (\$)": [0, 1000],
|
| 67 |
+
"Initial status (h)": -24,
|
| 68 |
+
"Initial power (MW)": 0
|
| 69 |
+
},
|
| 70 |
+
"g2": {
|
| 71 |
+
"Bus": "b1",
|
| 72 |
+
"Type": "Thermal",
|
| 73 |
+
"Production cost curve (MW)": [0, 300],
|
| 74 |
+
"Production cost curve (\$)": [0, 3000],
|
| 75 |
+
"Initial status (h)": -24,
|
| 76 |
+
"Initial power (MW)": 0
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
""";
|
| 81 |
+
|
| 82 |
+
# Next, we write it to `example.json`.
|
| 83 |
+
|
| 84 |
+
open("example.json", "w") do file
|
| 85 |
+
return write(file, json_contents)
|
| 86 |
+
end;
|
| 87 |
+
|
| 88 |
+
# Now that we have the input file, we can proceed as before, but using `UnitCommitment.read` instead of `UnitCommitment.read_benchmark`:
|
| 89 |
+
|
| 90 |
+
instance = UnitCommitment.read("example.json");
|
| 91 |
+
model =
|
| 92 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 93 |
+
UnitCommitment.optimize!(model)
|
| 94 |
+
|
| 95 |
+
# Finally, we extract and display the solution:
|
| 96 |
+
|
| 97 |
+
solution = UnitCommitment.solution(model)
|
| 98 |
+
|
| 99 |
+
#
|
| 100 |
+
|
| 101 |
+
@show solution["Thermal production (MW)"]["g1"]
|
| 102 |
+
|
| 103 |
+
#
|
| 104 |
+
|
| 105 |
+
@show solution["Thermal production (MW)"]["g2"]
|
| 106 |
+
|
| 107 |
+
# ## Solving a custom stochastic instance
|
| 108 |
+
|
| 109 |
+
# In addition to deterministic test cases, UnitCommitment.jl can also solve two-stage stochastic instances of the problem. In this section, we demonstrate the most simple form, which builds a single (extensive form) model containing information for all scenarios. See [Decomposition](../tutorials/decomposition.md) for more advanced methods.
|
| 110 |
+
|
| 111 |
+
# First, we need to create one JSON input file for each scenario. Parameters that are allowed to change across scenarios are marked as "uncertain" in the [JSON data format](../guides/format.md) page. It is also possible to specify the name and weight of each scenario, as shown below.
|
| 112 |
+
|
| 113 |
+
# We start by creating `example_s1.json`, the first scenario file:
|
| 114 |
+
|
| 115 |
+
json_contents_s1 = """
|
| 116 |
+
{
|
| 117 |
+
"Parameters": {
|
| 118 |
+
"Version": "0.4",
|
| 119 |
+
"Time horizon (h)": 4,
|
| 120 |
+
"Scenario name": "s1",
|
| 121 |
+
"Scenario weight": 3.0
|
| 122 |
+
},
|
| 123 |
+
"Buses": {
|
| 124 |
+
"b1": {
|
| 125 |
+
"Load (MW)": [100, 150, 200, 250]
|
| 126 |
+
}
|
| 127 |
+
},
|
| 128 |
+
"Generators": {
|
| 129 |
+
"g1": {
|
| 130 |
+
"Bus": "b1",
|
| 131 |
+
"Type": "Thermal",
|
| 132 |
+
"Production cost curve (MW)": [0, 200],
|
| 133 |
+
"Production cost curve (\$)": [0, 1000],
|
| 134 |
+
"Initial status (h)": -24,
|
| 135 |
+
"Initial power (MW)": 0
|
| 136 |
+
},
|
| 137 |
+
"g2": {
|
| 138 |
+
"Bus": "b1",
|
| 139 |
+
"Type": "Thermal",
|
| 140 |
+
"Production cost curve (MW)": [0, 300],
|
| 141 |
+
"Production cost curve (\$)": [0, 3000],
|
| 142 |
+
"Initial status (h)": -24,
|
| 143 |
+
"Initial power (MW)": 0
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
"""
|
| 148 |
+
open("example_s1.json", "w") do file
|
| 149 |
+
return write(file, json_contents_s1)
|
| 150 |
+
end;
|
| 151 |
+
|
| 152 |
+
# Next, we create `example_s2.json`, the second scenario file:
|
| 153 |
+
|
| 154 |
+
json_contents_s2 = """
|
| 155 |
+
{
|
| 156 |
+
"Parameters": {
|
| 157 |
+
"Version": "0.4",
|
| 158 |
+
"Time horizon (h)": 4,
|
| 159 |
+
"Scenario name": "s2",
|
| 160 |
+
"Scenario weight": 1.0
|
| 161 |
+
},
|
| 162 |
+
"Buses": {
|
| 163 |
+
"b1": {
|
| 164 |
+
"Load (MW)": [200, 300, 400, 500]
|
| 165 |
+
}
|
| 166 |
+
},
|
| 167 |
+
"Generators": {
|
| 168 |
+
"g1": {
|
| 169 |
+
"Bus": "b1",
|
| 170 |
+
"Type": "Thermal",
|
| 171 |
+
"Production cost curve (MW)": [0, 200],
|
| 172 |
+
"Production cost curve (\$)": [0, 1000],
|
| 173 |
+
"Initial status (h)": -24,
|
| 174 |
+
"Initial power (MW)": 0
|
| 175 |
+
},
|
| 176 |
+
"g2": {
|
| 177 |
+
"Bus": "b1",
|
| 178 |
+
"Type": "Thermal",
|
| 179 |
+
"Production cost curve (MW)": [0, 300],
|
| 180 |
+
"Production cost curve (\$)": [0, 3000],
|
| 181 |
+
"Initial status (h)": -24,
|
| 182 |
+
"Initial power (MW)": 0
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
}
|
| 186 |
+
""";
|
| 187 |
+
open("example_s2.json", "w") do file
|
| 188 |
+
return write(file, json_contents_s2)
|
| 189 |
+
end;
|
| 190 |
+
|
| 191 |
+
# Now that we have our two scenario files, we can read them using `UnitCommitment.read`. Note that, instead of a single file, we now provide a list.
|
| 192 |
+
|
| 193 |
+
instance = UnitCommitment.read(["example_s1.json", "example_s2.json"])
|
| 194 |
+
|
| 195 |
+
# If we have a large number of scenario files, the [Glob](https://github.com/vtjnash/Glob.jl) package can also be used to avoid having to list them individually:
|
| 196 |
+
|
| 197 |
+
using Glob
|
| 198 |
+
instance = UnitCommitment.read(glob("example_s*.json"))
|
| 199 |
+
|
| 200 |
+
# Finally, we build the model and optimize as before:
|
| 201 |
+
|
| 202 |
+
model =
|
| 203 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer);
|
| 204 |
+
UnitCommitment.optimize!(model)
|
| 205 |
+
|
| 206 |
+
# The solution to stochastic instances follows a slightly different format, as shown below:
|
| 207 |
+
|
| 208 |
+
solution = UnitCommitment.solution(model)
|
| 209 |
+
|
| 210 |
+
# The solution for each scenario can be accessed through `solution[scenario_name]`. For conveniance, this includes both first- and second-stage optimal decisions:
|
| 211 |
+
|
| 212 |
+
solution["s1"]
|
docs/src/tutorials/utils.jl
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# ## Generating initial conditions
|
| 3 |
+
|
| 4 |
+
# When creating random unit commitment instances for benchmark purposes, it is often hard to compute, in advance, sensible initial conditions for all thermal generators.
|
| 5 |
+
|
| 6 |
+
# Setting initial conditions naively (for example, making all generators initially off and producing no power) can easily cause the instance to become infeasible due to excessive ramping.
|
| 7 |
+
|
| 8 |
+
# Initial conditions can also make it hard to modify existing instances. For example, increasing the system load without carefully modifying the initial conditions may make the problem infeasible or unrealistically challenging to solve.
|
| 9 |
+
|
| 10 |
+
# To help with this issue, UC.jl provides a utility function which can generate feasible initial conditions by solving a single-period optimization problem. To illustrate its usage, we first generate a JSON file without initial conditions:
|
| 11 |
+
|
| 12 |
+
json_contents = """
|
| 13 |
+
{
|
| 14 |
+
"Parameters": {
|
| 15 |
+
"Version": "0.4",
|
| 16 |
+
"Time horizon (h)": 4
|
| 17 |
+
},
|
| 18 |
+
"Buses": {
|
| 19 |
+
"b1": {
|
| 20 |
+
"Load (MW)": [100, 150, 200, 250]
|
| 21 |
+
}
|
| 22 |
+
},
|
| 23 |
+
"Generators": {
|
| 24 |
+
"g1": {
|
| 25 |
+
"Bus": "b1",
|
| 26 |
+
"Type": "Thermal",
|
| 27 |
+
"Production cost curve (MW)": [0, 200],
|
| 28 |
+
"Production cost curve (\$)": [0, 1000]
|
| 29 |
+
},
|
| 30 |
+
"g2": {
|
| 31 |
+
"Bus": "b1",
|
| 32 |
+
"Type": "Thermal",
|
| 33 |
+
"Production cost curve (MW)": [0, 300],
|
| 34 |
+
"Production cost curve (\$)": [0, 3000]
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
""";
|
| 39 |
+
open("example_initial.json", "w") do file
|
| 40 |
+
return write(file, json_contents)
|
| 41 |
+
end;
|
| 42 |
+
|
| 43 |
+
# Next, we read the instance and generate the initial conditions (in-place):
|
| 44 |
+
|
| 45 |
+
instance = UnitCommitment.read("example_initial.json")
|
| 46 |
+
UnitCommitment.generate_initial_conditions!(instance, HiGHS.Optimizer)
|
| 47 |
+
|
| 48 |
+
# Finally, we optimize the resulting problem:
|
| 49 |
+
|
| 50 |
+
model =
|
| 51 |
+
UnitCommitment.build_model(instance = instance, optimizer = HiGHS.Optimizer)
|
| 52 |
+
UnitCommitment.optimize!(model)
|
| 53 |
+
|
| 54 |
+
# !!! warning
|
| 55 |
+
|
| 56 |
+
# The function `generate_initial_conditions!` may return different initial conditions after each call, even if the same instance and the same optimizer is provided. The particular algorithm may also change in a future version of UC.jl. For these reasons, it is recommended that you generate initial conditions exactly once for each instance and store them for later use.
|
| 57 |
+
|
| 58 |
+
# ## 6. Verifying solutions
|
| 59 |
+
|
| 60 |
+
# When developing new formulations, it is very easy to introduce subtle errors in the model that result in incorrect solutions. To help avoiding this, UC.jl includes a utility function that verifies if a given solution is feasible, and, if not, prints all the validation errors it found. The implementation of this function is completely independent from the implementation of the optimization model, and therefore can be used to validate it.
|
| 61 |
+
|
| 62 |
+
# ```jldoctest; output = false
|
| 63 |
+
# using JSON
|
| 64 |
+
# using UnitCommitment
|
| 65 |
+
|
| 66 |
+
# # Read instance
|
| 67 |
+
# instance = UnitCommitment.read("example/s1.json")
|
| 68 |
+
|
| 69 |
+
# # Read solution (potentially produced by other packages)
|
| 70 |
+
# solution = JSON.parsefile("example/out.json")
|
| 71 |
+
|
| 72 |
+
# # Validate solution and print validation errors
|
| 73 |
+
# UnitCommitment.validate(instance, solution)
|
| 74 |
+
|
| 75 |
+
# # output
|
| 76 |
+
|
| 77 |
+
# true
|
| 78 |
+
# ```
|
generate_dataset.jl
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using Distributed
|
| 2 |
+
using JuMP
|
| 3 |
+
using UnitCommitment
|
| 4 |
+
|
| 5 |
+
const DEFAULT_INPUT_ROOT = "instances/matpower"
|
| 6 |
+
const DEFAULT_OUTPUT_ROOT = "../UnitCommitment_Trajectory_Dataset"
|
| 7 |
+
const VARIANTS = ("hourly_noline", "hourly_withline", "subhourly_noline", "subhourly_withline")
|
| 8 |
+
|
| 9 |
+
function _build_noline_formulation()
|
| 10 |
+
return UnitCommitment.Formulation(
|
| 11 |
+
transmission = UnitCommitment.ShiftFactorsFormulation(
|
| 12 |
+
precomputed_isf = zeros(0, 0),
|
| 13 |
+
precomputed_lodf = zeros(0, 0),
|
| 14 |
+
),
|
| 15 |
+
)
|
| 16 |
+
end
|
| 17 |
+
|
| 18 |
+
function _write_mps(model::JuMP.Model, path::String)
|
| 19 |
+
mkpath(dirname(path))
|
| 20 |
+
JuMP.write_to_file(model, path)
|
| 21 |
+
return nothing
|
| 22 |
+
end
|
| 23 |
+
|
| 24 |
+
function _list_json_gz(case_dir::String)
|
| 25 |
+
files = filter(f -> endswith(f, ".json.gz"), readdir(case_dir))
|
| 26 |
+
sort!(files)
|
| 27 |
+
return files
|
| 28 |
+
end
|
| 29 |
+
|
| 30 |
+
function discover_matpower_cases(input_root::String = DEFAULT_INPUT_ROOT)
|
| 31 |
+
isdir(input_root) || error("Input directory does not exist: $input_root")
|
| 32 |
+
|
| 33 |
+
case_dirs = filter(d -> isdir(joinpath(input_root, d)), readdir(input_root))
|
| 34 |
+
sort!(case_dirs)
|
| 35 |
+
|
| 36 |
+
return [
|
| 37 |
+
(case_name, joinpath(input_root, case_name))
|
| 38 |
+
for case_name in case_dirs
|
| 39 |
+
if !isempty(_list_json_gz(joinpath(input_root, case_name)))
|
| 40 |
+
]
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
function _parse_case_filter()
|
| 44 |
+
raw = strip(get(ENV, "UC_CASES", ""))
|
| 45 |
+
isempty(raw) && return nothing
|
| 46 |
+
return Set(strip.(split(raw, ",")))
|
| 47 |
+
end
|
| 48 |
+
|
| 49 |
+
function _is_truthy_env(name::String)
|
| 50 |
+
value = lowercase(strip(get(ENV, name, "")))
|
| 51 |
+
return value in ("1", "true", "yes", "y")
|
| 52 |
+
end
|
| 53 |
+
|
| 54 |
+
function _parse_positive_int_env(name::String, default::Int)
|
| 55 |
+
raw = strip(get(ENV, name, ""))
|
| 56 |
+
isempty(raw) && return default
|
| 57 |
+
|
| 58 |
+
value = tryparse(Int, raw)
|
| 59 |
+
if value === nothing || value < 1
|
| 60 |
+
error("$name must be a positive integer, got: $raw")
|
| 61 |
+
end
|
| 62 |
+
return value
|
| 63 |
+
end
|
| 64 |
+
|
| 65 |
+
function _default_worker_count()
|
| 66 |
+
return nprocs() > 1 ? length(workers()) : 1
|
| 67 |
+
end
|
| 68 |
+
|
| 69 |
+
function _requested_worker_count()
|
| 70 |
+
return _parse_positive_int_env("UC_WORKERS", _default_worker_count())
|
| 71 |
+
end
|
| 72 |
+
|
| 73 |
+
function _selected_cases(input_root::String)
|
| 74 |
+
cases = discover_matpower_cases(input_root)
|
| 75 |
+
selected = _parse_case_filter()
|
| 76 |
+
selected === nothing && return cases
|
| 77 |
+
return filter(case -> case[1] in selected, cases)
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
function _ensure_worker_count!(requested_workers::Int)
|
| 81 |
+
requested_workers <= 1 && return Int[]
|
| 82 |
+
|
| 83 |
+
existing_workers = nprocs() > 1 ? workers() : Int[]
|
| 84 |
+
extra_workers = requested_workers - length(existing_workers)
|
| 85 |
+
|
| 86 |
+
if extra_workers > 0
|
| 87 |
+
project_file = Base.active_project()
|
| 88 |
+
if project_file === nothing
|
| 89 |
+
addprocs(extra_workers)
|
| 90 |
+
else
|
| 91 |
+
addprocs(extra_workers; exeflags = `--project=$(dirname(project_file))`)
|
| 92 |
+
end
|
| 93 |
+
end
|
| 94 |
+
|
| 95 |
+
return workers()[1:requested_workers]
|
| 96 |
+
end
|
| 97 |
+
|
| 98 |
+
function _load_script_on_workers!(worker_ids::Vector{Int})
|
| 99 |
+
isempty(worker_ids) && return nothing
|
| 100 |
+
|
| 101 |
+
script_path = abspath(@__FILE__)
|
| 102 |
+
@sync for pid in worker_ids
|
| 103 |
+
@async remotecall_wait(pid, script_path) do path
|
| 104 |
+
include(path)
|
| 105 |
+
return nothing
|
| 106 |
+
end
|
| 107 |
+
end
|
| 108 |
+
|
| 109 |
+
return nothing
|
| 110 |
+
end
|
| 111 |
+
|
| 112 |
+
function _generate_one_instance!(
|
| 113 |
+
case_name::AbstractString,
|
| 114 |
+
date_tag::AbstractString,
|
| 115 |
+
src_path::AbstractString,
|
| 116 |
+
output_root::AbstractString,
|
| 117 |
+
noline_formulation,
|
| 118 |
+
)
|
| 119 |
+
inst_hourly = UnitCommitment.read(src_path)
|
| 120 |
+
inst_hourly_noline = deepcopy(inst_hourly)
|
| 121 |
+
empty!(inst_hourly_noline.scenarios[1].lines)
|
| 122 |
+
|
| 123 |
+
model_hourly_noline = UnitCommitment.build_model(
|
| 124 |
+
instance = inst_hourly_noline,
|
| 125 |
+
formulation = noline_formulation,
|
| 126 |
+
variable_names = true,
|
| 127 |
+
)
|
| 128 |
+
_write_mps(
|
| 129 |
+
model_hourly_noline,
|
| 130 |
+
joinpath(output_root, case_name, "hourly_noline", "$(case_name)_$(date_tag)_h_noline.mps"),
|
| 131 |
+
)
|
| 132 |
+
|
| 133 |
+
model_hourly_withline = UnitCommitment.build_model(
|
| 134 |
+
instance = inst_hourly,
|
| 135 |
+
variable_names = true,
|
| 136 |
+
)
|
| 137 |
+
_write_mps(
|
| 138 |
+
model_hourly_withline,
|
| 139 |
+
joinpath(output_root, case_name, "hourly_withline", "$(case_name)_$(date_tag)_h_withline.mps"),
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
inst_sub = UnitCommitment.convert_to_subhourly(inst_hourly, inst_hourly)
|
| 143 |
+
inst_sub_noline = deepcopy(inst_sub)
|
| 144 |
+
empty!(inst_sub_noline.scenarios[1].lines)
|
| 145 |
+
|
| 146 |
+
model_sub_noline = UnitCommitment.build_model(
|
| 147 |
+
instance = inst_sub_noline,
|
| 148 |
+
formulation = noline_formulation,
|
| 149 |
+
variable_names = true,
|
| 150 |
+
)
|
| 151 |
+
_write_mps(
|
| 152 |
+
model_sub_noline,
|
| 153 |
+
joinpath(output_root, case_name, "subhourly_noline", "$(case_name)_$(date_tag)_s_noline.mps"),
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
model_sub_withline = UnitCommitment.build_model(
|
| 157 |
+
instance = inst_sub,
|
| 158 |
+
variable_names = true,
|
| 159 |
+
)
|
| 160 |
+
_write_mps(
|
| 161 |
+
model_sub_withline,
|
| 162 |
+
joinpath(output_root, case_name, "subhourly_withline", "$(case_name)_$(date_tag)_s_withline.mps"),
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
return nothing
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
function _build_generation_tasks(cases, output_root::AbstractString)
|
| 169 |
+
tasks = NamedTuple[]
|
| 170 |
+
case_count = length(cases)
|
| 171 |
+
|
| 172 |
+
for (case_index, (case_name, case_dir)) in enumerate(cases)
|
| 173 |
+
files = _list_json_gz(case_dir)
|
| 174 |
+
instance_count = length(files)
|
| 175 |
+
|
| 176 |
+
for (instance_index, file_name) in enumerate(files)
|
| 177 |
+
date_tag = split(file_name, ".")[1]
|
| 178 |
+
src_path = joinpath(case_dir, file_name)
|
| 179 |
+
push!(
|
| 180 |
+
tasks,
|
| 181 |
+
(;
|
| 182 |
+
case_index,
|
| 183 |
+
case_count,
|
| 184 |
+
case_name,
|
| 185 |
+
instance_index,
|
| 186 |
+
instance_count,
|
| 187 |
+
date_tag,
|
| 188 |
+
src_path,
|
| 189 |
+
output_root,
|
| 190 |
+
),
|
| 191 |
+
)
|
| 192 |
+
end
|
| 193 |
+
end
|
| 194 |
+
|
| 195 |
+
return tasks
|
| 196 |
+
end
|
| 197 |
+
|
| 198 |
+
function _prepare_output_dirs!(cases, output_root::AbstractString)
|
| 199 |
+
for (case_name, _) in cases
|
| 200 |
+
for variant in VARIANTS
|
| 201 |
+
mkpath(joinpath(output_root, case_name, variant))
|
| 202 |
+
end
|
| 203 |
+
end
|
| 204 |
+
return nothing
|
| 205 |
+
end
|
| 206 |
+
|
| 207 |
+
function _print_case_plan(cases)
|
| 208 |
+
for (case_index, (case_name, case_dir)) in enumerate(cases)
|
| 209 |
+
println("[$case_index/$(length(cases))] $case_name ($(_list_json_gz(case_dir) |> length) instances)")
|
| 210 |
+
end
|
| 211 |
+
return nothing
|
| 212 |
+
end
|
| 213 |
+
|
| 214 |
+
function _print_task_done(task, pid::Int)
|
| 215 |
+
println(
|
| 216 |
+
" [$(task.case_index)/$(task.case_count) $(task.case_name)] " *
|
| 217 |
+
"$(task.instance_index)/$(task.instance_count) $(task.date_tag) pid=$pid",
|
| 218 |
+
)
|
| 219 |
+
flush(stdout)
|
| 220 |
+
return nothing
|
| 221 |
+
end
|
| 222 |
+
|
| 223 |
+
function _generate_task!(task)
|
| 224 |
+
noline_formulation = _build_noline_formulation()
|
| 225 |
+
|
| 226 |
+
_generate_one_instance!(
|
| 227 |
+
task.case_name,
|
| 228 |
+
task.date_tag,
|
| 229 |
+
task.src_path,
|
| 230 |
+
task.output_root,
|
| 231 |
+
noline_formulation,
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
GC.gc()
|
| 235 |
+
_print_task_done(task, myid())
|
| 236 |
+
return nothing
|
| 237 |
+
end
|
| 238 |
+
|
| 239 |
+
function _generate_parallel!(tasks, worker_ids::Vector{Int})
|
| 240 |
+
pool = CachingPool(worker_ids)
|
| 241 |
+
pmap(_generate_task!, pool, tasks; batch_size = 1)
|
| 242 |
+
return nothing
|
| 243 |
+
end
|
| 244 |
+
|
| 245 |
+
function generate_dataset(;
|
| 246 |
+
input_root::String = get(ENV, "UC_INPUT_ROOT", DEFAULT_INPUT_ROOT),
|
| 247 |
+
output_root::String = get(ENV, "UC_OUTPUT_ROOT", DEFAULT_OUTPUT_ROOT),
|
| 248 |
+
)
|
| 249 |
+
cases = _selected_cases(input_root)
|
| 250 |
+
isempty(cases) && error("No cases selected under $input_root. Check UC_CASES or the input directory.")
|
| 251 |
+
|
| 252 |
+
mkpath(output_root)
|
| 253 |
+
requested_workers = _requested_worker_count()
|
| 254 |
+
|
| 255 |
+
total_instances = sum(length(_list_json_gz(case_dir)) for (_, case_dir) in cases)
|
| 256 |
+
println("Input root: $input_root")
|
| 257 |
+
println("Output root: $output_root")
|
| 258 |
+
println("Cases: $(length(cases))")
|
| 259 |
+
println("Instances: $total_instances")
|
| 260 |
+
println("Variants: $(length(VARIANTS))")
|
| 261 |
+
println("MPS files: $(total_instances * length(VARIANTS))")
|
| 262 |
+
println("Workers: $requested_workers")
|
| 263 |
+
|
| 264 |
+
if _is_truthy_env("UC_DRY_RUN")
|
| 265 |
+
println("\nDry run only. Set UC_DRY_RUN=0 or remove it to generate MPS files.")
|
| 266 |
+
for (case_name, case_dir) in cases
|
| 267 |
+
println(" $case_name: $(length(_list_json_gz(case_dir))) instances")
|
| 268 |
+
end
|
| 269 |
+
return nothing
|
| 270 |
+
end
|
| 271 |
+
|
| 272 |
+
_prepare_output_dirs!(cases, output_root)
|
| 273 |
+
tasks = _build_generation_tasks(cases, output_root)
|
| 274 |
+
|
| 275 |
+
println()
|
| 276 |
+
_print_case_plan(cases)
|
| 277 |
+
println()
|
| 278 |
+
|
| 279 |
+
if requested_workers <= 1
|
| 280 |
+
for task in tasks
|
| 281 |
+
_generate_task!(task)
|
| 282 |
+
end
|
| 283 |
+
else
|
| 284 |
+
worker_ids = _ensure_worker_count!(requested_workers)
|
| 285 |
+
_load_script_on_workers!(worker_ids)
|
| 286 |
+
println("Parallel worker pids: $(join(worker_ids, ", "))")
|
| 287 |
+
_generate_parallel!(tasks, worker_ids)
|
| 288 |
+
end
|
| 289 |
+
|
| 290 |
+
println("\nDone. output_root=$output_root")
|
| 291 |
+
return nothing
|
| 292 |
+
end
|
| 293 |
+
|
| 294 |
+
if myid() == 1 && abspath(PROGRAM_FILE) == @__FILE__
|
| 295 |
+
generate_dataset()
|
| 296 |
+
end
|
pmax-preprocessing.jl
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
using UnitCommitment
|
| 2 |
+
|
| 3 |
+
add_trajectory_curves(args...; kwargs...) =
|
| 4 |
+
UnitCommitment.add_trajectory_curves_to_source_data(args...; kwargs...)
|
| 5 |
+
|
| 6 |
+
modify_min_uptime(args...; kwargs...) =
|
| 7 |
+
UnitCommitment.modify_min_uptime_in_source_data(args...; kwargs...)
|
src/UnitCommitment.jl
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
module UnitCommitment
|
| 6 |
+
|
| 7 |
+
using Base: String
|
| 8 |
+
|
| 9 |
+
include("instance/structs.jl")
|
| 10 |
+
include("model/formulations/base/structs.jl")
|
| 11 |
+
include("solution/structs.jl")
|
| 12 |
+
include("lmp/structs.jl")
|
| 13 |
+
include("market/structs.jl")
|
| 14 |
+
|
| 15 |
+
include("model/formulations/ArrCon2000/structs.jl")
|
| 16 |
+
include("model/formulations/CarArr2006/structs.jl")
|
| 17 |
+
include("model/formulations/DamKucRajAta2016/structs.jl")
|
| 18 |
+
include("model/formulations/Gar1962/structs.jl")
|
| 19 |
+
include("model/formulations/KnuOstWat2018/structs.jl")
|
| 20 |
+
include("model/formulations/MorLatRam2013/structs.jl")
|
| 21 |
+
include("model/formulations/PanGua2016/structs.jl")
|
| 22 |
+
include("solution/methods/XavQiuWanThi2019/structs.jl")
|
| 23 |
+
include("solution/methods/ProgressiveHedging/structs.jl")
|
| 24 |
+
include("model/formulations/WanHob2016/structs.jl")
|
| 25 |
+
include("solution/methods/TimeDecomposition/structs.jl")
|
| 26 |
+
include("model/formulations/ArrCon2004/structs.jl")
|
| 27 |
+
|
| 28 |
+
include("import/egret.jl")
|
| 29 |
+
include("instance/read.jl")
|
| 30 |
+
include("instance/migrate.jl")
|
| 31 |
+
include("instance/modify.jl")
|
| 32 |
+
include("instance/subhourly.jl")
|
| 33 |
+
include("model/build.jl")
|
| 34 |
+
include("model/formulations/ArrCon2000/ramp.jl")
|
| 35 |
+
include("model/formulations/base/bus.jl")
|
| 36 |
+
include("model/formulations/base/line.jl")
|
| 37 |
+
include("model/formulations/base/psload.jl")
|
| 38 |
+
include("model/formulations/base/sensitivity.jl")
|
| 39 |
+
include("model/formulations/base/system.jl")
|
| 40 |
+
include("model/formulations/base/unit.jl")
|
| 41 |
+
include("model/formulations/base/punit.jl")
|
| 42 |
+
include("model/formulations/base/storage.jl")
|
| 43 |
+
include("model/formulations/CarArr2006/pwlcosts.jl")
|
| 44 |
+
include("model/formulations/DamKucRajAta2016/ramp.jl")
|
| 45 |
+
include("model/formulations/Gar1962/pwlcosts.jl")
|
| 46 |
+
include("model/formulations/Gar1962/status.jl")
|
| 47 |
+
include("model/formulations/Gar1962/prod.jl")
|
| 48 |
+
include("model/formulations/KnuOstWat2018/pwlcosts.jl")
|
| 49 |
+
include("model/formulations/MorLatRam2013/ramp.jl")
|
| 50 |
+
include("model/formulations/MorLatRam2013/scosts.jl")
|
| 51 |
+
include("model/formulations/PanGua2016/ramp.jl")
|
| 52 |
+
include("model/formulations/WanHob2016/ramp.jl")
|
| 53 |
+
include("model/formulations/ArrCon2004/powertrajectories.jl")
|
| 54 |
+
include("model/jumpext.jl")
|
| 55 |
+
include("solution/fix.jl")
|
| 56 |
+
include("solution/methods/XavQiuWanThi2019/enforce.jl")
|
| 57 |
+
include("solution/methods/XavQiuWanThi2019/filter.jl")
|
| 58 |
+
include("solution/methods/XavQiuWanThi2019/find.jl")
|
| 59 |
+
include("solution/methods/XavQiuWanThi2019/optimize.jl")
|
| 60 |
+
include("solution/methods/TimeDecomposition/optimize.jl")
|
| 61 |
+
include("solution/methods/ProgressiveHedging/optimize.jl")
|
| 62 |
+
include("solution/methods/ProgressiveHedging/read.jl")
|
| 63 |
+
include("solution/methods/ProgressiveHedging/solution.jl")
|
| 64 |
+
include("solution/optimize.jl")
|
| 65 |
+
include("solution/solution.jl")
|
| 66 |
+
include("solution/warmstart.jl")
|
| 67 |
+
include("solution/write.jl")
|
| 68 |
+
include("transform/initcond.jl")
|
| 69 |
+
include("transform/slice.jl")
|
| 70 |
+
include("transform/subhourly.jl")
|
| 71 |
+
include("transform/power_trajectories.jl")
|
| 72 |
+
include("transform/randomize/XavQiuAhm2021.jl")
|
| 73 |
+
include("utils/log.jl")
|
| 74 |
+
include("utils/benchmark.jl")
|
| 75 |
+
include("validation/repair.jl")
|
| 76 |
+
include("validation/validate.jl")
|
| 77 |
+
include("lmp/conventional.jl")
|
| 78 |
+
include("lmp/aelmp.jl")
|
| 79 |
+
include("market/market.jl")
|
| 80 |
+
|
| 81 |
+
const xxx2005 = ArrCon2004
|
| 82 |
+
|
| 83 |
+
using .Modify: add_trajectory_curves_to_source_data, modify_min_uptime_in_source_data
|
| 84 |
+
export add_trajectory_curves_to_source_data, modify_min_uptime_in_source_data
|
| 85 |
+
|
| 86 |
+
export convert_to_subhourly
|
| 87 |
+
|
| 88 |
+
# Provide the file-path based conversion API from `src/instance/subhourly.jl`,
|
| 89 |
+
# without importing/overwriting the existing instance-object methods.
|
| 90 |
+
convert_to_subhourly(instance_path::AbstractString, next_day_path::AbstractString) =
|
| 91 |
+
Subhourly.convert_to_subhourly(instance_path, next_day_path)
|
| 92 |
+
|
| 93 |
+
end
|
src/import/egret.jl
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
using DataStructures, JSON, GZip
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
read_egret_solution(path::String)::OrderedDict
|
| 10 |
+
|
| 11 |
+
Read a JSON solution file produced by EGRET and transforms it into a
|
| 12 |
+
dictionary having the same structure as the one produced by
|
| 13 |
+
UnitCommitment.solution(model).
|
| 14 |
+
"""
|
| 15 |
+
function read_egret_solution(path::String)::OrderedDict
|
| 16 |
+
egret = _read_json(path)
|
| 17 |
+
T = length(egret["system"]["time_keys"])
|
| 18 |
+
|
| 19 |
+
solution = OrderedDict()
|
| 20 |
+
is_on = solution["Is on"] = OrderedDict()
|
| 21 |
+
production = solution["Thermal production (MW)"] = OrderedDict()
|
| 22 |
+
reserve = solution["Reserve (MW)"] = OrderedDict()
|
| 23 |
+
production_cost = solution["Thermal production cost (\$)"] = OrderedDict()
|
| 24 |
+
startup_cost = solution["Startup cost (\$)"] = OrderedDict()
|
| 25 |
+
|
| 26 |
+
for (gen_name, gen_dict) in egret["elements"]["generator"]
|
| 27 |
+
if endswith(gen_name, "_T") || endswith(gen_name, "_R")
|
| 28 |
+
gen_name = gen_name[1:end-2]
|
| 29 |
+
end
|
| 30 |
+
if "commitment" in keys(gen_dict)
|
| 31 |
+
is_on[gen_name] = gen_dict["commitment"]["values"]
|
| 32 |
+
else
|
| 33 |
+
is_on[gen_name] = ones(T)
|
| 34 |
+
end
|
| 35 |
+
production[gen_name] = gen_dict["pg"]["values"]
|
| 36 |
+
if "rg" in keys(gen_dict)
|
| 37 |
+
reserve[gen_name] = gen_dict["rg"]["values"]
|
| 38 |
+
else
|
| 39 |
+
reserve[gen_name] = zeros(T)
|
| 40 |
+
end
|
| 41 |
+
startup_cost[gen_name] = zeros(T)
|
| 42 |
+
production_cost[gen_name] = zeros(T)
|
| 43 |
+
if "commitment_cost" in keys(gen_dict)
|
| 44 |
+
for t in 1:T
|
| 45 |
+
x = gen_dict["commitment"]["values"][t]
|
| 46 |
+
commitment_cost = gen_dict["commitment_cost"]["values"][t]
|
| 47 |
+
prod_above_cost = gen_dict["production_cost"]["values"][t]
|
| 48 |
+
prod_base_cost = gen_dict["p_cost"]["values"][1][2] * x
|
| 49 |
+
startup_cost[gen_name][t] = commitment_cost - prod_base_cost
|
| 50 |
+
production_cost[gen_name][t] = prod_above_cost + prod_base_cost
|
| 51 |
+
end
|
| 52 |
+
end
|
| 53 |
+
end
|
| 54 |
+
return solution
|
| 55 |
+
end
|
src/instance/migrate.jl
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
using DataStructures
|
| 6 |
+
using JSON
|
| 7 |
+
|
| 8 |
+
function _migrate(json)
|
| 9 |
+
version = json["Parameters"]["Version"]
|
| 10 |
+
if version === nothing
|
| 11 |
+
error(
|
| 12 |
+
"The provided input file cannot be loaded because it does not " *
|
| 13 |
+
"specify what version of UnitCommitment.jl it was written for. " *
|
| 14 |
+
"Please modify the \"Parameters\" section of the file and include " *
|
| 15 |
+
"a \"Version\" entry. For example: {\"Parameters\":{\"Version\":\"0.3\"}}",
|
| 16 |
+
)
|
| 17 |
+
end
|
| 18 |
+
version = VersionNumber(version)
|
| 19 |
+
version >= v"0.3" || _migrate_to_v03(json)
|
| 20 |
+
version >= v"0.4" || _migrate_to_v04(json)
|
| 21 |
+
return
|
| 22 |
+
end
|
| 23 |
+
|
| 24 |
+
function _migrate_to_v03(json)
|
| 25 |
+
# Migrate reserves
|
| 26 |
+
if json["Reserves"] !== nothing &&
|
| 27 |
+
json["Reserves"]["Spinning (MW)"] !== nothing
|
| 28 |
+
amount = json["Reserves"]["Spinning (MW)"]
|
| 29 |
+
json["Reserves"] = DefaultOrderedDict(nothing)
|
| 30 |
+
json["Reserves"]["r1"] = DefaultOrderedDict(nothing)
|
| 31 |
+
json["Reserves"]["r1"]["Type"] = "spinning"
|
| 32 |
+
json["Reserves"]["r1"]["Amount (MW)"] = amount
|
| 33 |
+
for (gen_name, gen) in json["Generators"]
|
| 34 |
+
if gen["Provides spinning reserves?"] == true
|
| 35 |
+
gen["Reserve eligibility"] = ["r1"]
|
| 36 |
+
end
|
| 37 |
+
end
|
| 38 |
+
end
|
| 39 |
+
end
|
| 40 |
+
|
| 41 |
+
function _migrate_to_v04(json)
|
| 42 |
+
# Migrate thermal units
|
| 43 |
+
if json["Generators"] !== nothing
|
| 44 |
+
for (gen_name, gen) in json["Generators"]
|
| 45 |
+
if gen["Type"] === nothing
|
| 46 |
+
gen["Type"] = "Thermal"
|
| 47 |
+
end
|
| 48 |
+
end
|
| 49 |
+
end
|
| 50 |
+
end
|
src/instance/modify.jl
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module Modify
|
| 2 |
+
|
| 3 |
+
using JSON
|
| 4 |
+
using CodecZlib
|
| 5 |
+
|
| 6 |
+
export add_trajectory_curves_to_source_data, modify_min_uptime_in_source_data
|
| 7 |
+
|
| 8 |
+
function read_json_maybe_gz(path::String)
|
| 9 |
+
open(path) do io
|
| 10 |
+
if endswith(path, ".gz")
|
| 11 |
+
decompressor = GzipDecompressorStream(io)
|
| 12 |
+
return JSON.parse(decompressor)
|
| 13 |
+
end
|
| 14 |
+
return JSON.parse(io)
|
| 15 |
+
end
|
| 16 |
+
end
|
| 17 |
+
|
| 18 |
+
function write_json_pretty(path::String, json_data)
|
| 19 |
+
open(path, "w") do f
|
| 20 |
+
JSON.print(f, json_data, 4)
|
| 21 |
+
end
|
| 22 |
+
end
|
| 23 |
+
|
| 24 |
+
normalize_top_ratio(top_pct::Float64) = clamp(top_pct <= 1.0 ? top_pct : (top_pct / 100.0), 0.0, 1.0)
|
| 25 |
+
|
| 26 |
+
function get_eligible_thermal_units(generators)::Vector{String}
|
| 27 |
+
return filter(
|
| 28 |
+
u -> haskey(generators[u], "Minimum uptime (h)") &&
|
| 29 |
+
haskey(generators[u], "Production cost curve (MW)"),
|
| 30 |
+
collect(keys(generators)),
|
| 31 |
+
)
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
function build_unit_metric_dicts(generators, unit_names::Vector{String})
|
| 35 |
+
uptime_dict = Dict{String, Float64}()
|
| 36 |
+
pmax_dict = Dict{String, Float64}()
|
| 37 |
+
pmin_dict = Dict{String, Float64}()
|
| 38 |
+
|
| 39 |
+
for u in unit_names
|
| 40 |
+
curve_mw = generators[u]["Production cost curve (MW)"]
|
| 41 |
+
uptime_dict[u] = Float64(get(generators[u], "Minimum uptime (h)", 0.0))
|
| 42 |
+
pmin_dict[u] = Float64(curve_mw[1])
|
| 43 |
+
pmax_dict[u] = Float64(curve_mw[end])
|
| 44 |
+
end
|
| 45 |
+
return uptime_dict, pmax_dict, pmin_dict
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
function sort_by_uptime_then_pmax(unit_names::Vector{String}, uptime_dict, pmax_dict)
|
| 49 |
+
return sort(copy(unit_names), by = u -> (uptime_dict[u], pmax_dict[u]), rev = true)
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
function sort_by_pmax_then_uptime(unit_names::Vector{String}, uptime_dict, pmax_dict)
|
| 53 |
+
return sort(copy(unit_names), by = u -> (pmax_dict[u], uptime_dict[u]), rev = true)
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
function top_set(sorted_units::Vector{String}, ratio::Float64)
|
| 57 |
+
n_total = length(sorted_units)
|
| 58 |
+
n_total == 0 && return Set{String}()
|
| 59 |
+
n_top = max(1, ceil(Int, n_total * ratio))
|
| 60 |
+
return Set(sorted_units[1:n_top])
|
| 61 |
+
end
|
| 62 |
+
|
| 63 |
+
function build_four_categories(unit_order::Vector{String}, uptime_sorted::Vector{String}, pmax_sorted::Vector{String})
|
| 64 |
+
top_uptime_10 = top_set(uptime_sorted, 0.10)
|
| 65 |
+
top_uptime_20 = top_set(uptime_sorted, 0.20)
|
| 66 |
+
top_uptime_50 = top_set(uptime_sorted, 0.50)
|
| 67 |
+
|
| 68 |
+
top_pmax_10 = top_set(pmax_sorted, 0.10)
|
| 69 |
+
top_pmax_20 = top_set(pmax_sorted, 0.20)
|
| 70 |
+
top_pmax_50 = top_set(pmax_sorted, 0.50)
|
| 71 |
+
|
| 72 |
+
cat1_set = intersect(top_uptime_10, top_pmax_10)
|
| 73 |
+
cat2_set = setdiff(intersect(top_uptime_20, top_pmax_20), cat1_set)
|
| 74 |
+
cat3_set = setdiff(intersect(top_uptime_50, top_pmax_50), union(cat1_set, cat2_set))
|
| 75 |
+
cat4_set = setdiff(Set(unit_order), union(cat1_set, cat2_set, cat3_set))
|
| 76 |
+
|
| 77 |
+
category1 = [u for u in unit_order if u in cat1_set]
|
| 78 |
+
category2 = [u for u in unit_order if u in cat2_set]
|
| 79 |
+
category3 = [u for u in unit_order if u in cat3_set]
|
| 80 |
+
category4 = [u for u in unit_order if u in cat4_set]
|
| 81 |
+
|
| 82 |
+
return category1, category2, category3, category4
|
| 83 |
+
end
|
| 84 |
+
|
| 85 |
+
function add_trajectory_curves_to_source_data(
|
| 86 |
+
json_path::String;
|
| 87 |
+
top_pct::Float64 = 10.0,
|
| 88 |
+
output_path::String = replace(json_path, ".json" => "-part1.json"),
|
| 89 |
+
)
|
| 90 |
+
json_data = read_json_maybe_gz(json_path)
|
| 91 |
+
|
| 92 |
+
generators = json_data["Generators"]
|
| 93 |
+
thermal_names = get_eligible_thermal_units(generators)
|
| 94 |
+
n_total = length(thermal_names)
|
| 95 |
+
|
| 96 |
+
n_total == 0 && begin
|
| 97 |
+
println("── Part 1: 未发现可处理机组,直接写出原始数据 ──")
|
| 98 |
+
write_json_pretty(output_path, json_data)
|
| 99 |
+
return output_path
|
| 100 |
+
end
|
| 101 |
+
|
| 102 |
+
uptime_dict, pmax_dict, pmin_dict = build_unit_metric_dicts(generators, thermal_names)
|
| 103 |
+
|
| 104 |
+
top_ratio = normalize_top_ratio(top_pct)
|
| 105 |
+
top_count = min(n_total, max(1, ceil(Int, n_total * top_ratio)))
|
| 106 |
+
threshold = 10.0
|
| 107 |
+
|
| 108 |
+
println("── Part 1: 筛选与约束添加 ──")
|
| 109 |
+
println(" 热机组总数: $n_total")
|
| 110 |
+
println(" Top X% 参数: $top_pct (Top 数量: $top_count)")
|
| 111 |
+
println(" Pmax 下界阈值 (Threshold): $threshold")
|
| 112 |
+
|
| 113 |
+
uptime_sorted = sort_by_uptime_then_pmax(thermal_names, uptime_dict, pmax_dict)
|
| 114 |
+
pmax_sorted = sort_by_pmax_then_uptime(thermal_names, uptime_dict, pmax_dict)
|
| 115 |
+
|
| 116 |
+
top_uptime_set = Set(uptime_sorted[1:top_count])
|
| 117 |
+
top_pmax_set = Set(pmax_sorted[1:top_count])
|
| 118 |
+
|
| 119 |
+
qualified_units = String[]
|
| 120 |
+
disqualified_units = String[]
|
| 121 |
+
|
| 122 |
+
for u in uptime_sorted
|
| 123 |
+
if (u in top_uptime_set) && (u in top_pmax_set) && (pmax_dict[u] > threshold)
|
| 124 |
+
push!(qualified_units, u)
|
| 125 |
+
else
|
| 126 |
+
push!(disqualified_units, u)
|
| 127 |
+
end
|
| 128 |
+
end
|
| 129 |
+
|
| 130 |
+
reordered_units = vcat(qualified_units, disqualified_units)
|
| 131 |
+
|
| 132 |
+
println("\n── 选中并添加轨迹的机组名单 (交集且 Pmax > $threshold) ──")
|
| 133 |
+
for u in qualified_units
|
| 134 |
+
uptime = uptime_dict[u]
|
| 135 |
+
pmax = pmax_dict[u]
|
| 136 |
+
pmin = pmin_dict[u]
|
| 137 |
+
|
| 138 |
+
generators[u]["Startup curve (MW)"] = [pmin / 2.0, pmin]
|
| 139 |
+
generators[u]["Shutdown curve (MW)"] = [pmin, pmin / 2.0]
|
| 140 |
+
|
| 141 |
+
println(" [写入轨迹] $(rpad(u,10)) Uptime=$uptime Pmax=$(round(pmax, digits=2)) Pmin=$(round(pmin, digits=2))")
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
println("\n── 未满足筛选条件的机组 (展示前几位) ──")
|
| 145 |
+
for u in disqualified_units[1:min(5, length(disqualified_units))]
|
| 146 |
+
uptime = uptime_dict[u]
|
| 147 |
+
pmax = pmax_dict[u]
|
| 148 |
+
in_top_uptime = u in top_uptime_set
|
| 149 |
+
in_top_pmax = u in top_pmax_set
|
| 150 |
+
println(" [未入选] $(rpad(u,10)) Uptime=$uptime Pmax=$(round(pmax, digits=2)) TopUptime=$in_top_uptime TopPmax=$in_top_pmax")
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
json_data["_sorted_thermal_units"] = reordered_units
|
| 154 |
+
|
| 155 |
+
write_json_pretty(output_path, json_data)
|
| 156 |
+
println("\nPart 1 完成 → 输出保存至: $output_path")
|
| 157 |
+
|
| 158 |
+
return output_path
|
| 159 |
+
end
|
| 160 |
+
|
| 161 |
+
function modify_min_uptime_in_source_data(
|
| 162 |
+
json_v1_path::String;
|
| 163 |
+
output_path::String = replace(json_v1_path, "-part1.json" => "-part2.json"),
|
| 164 |
+
)
|
| 165 |
+
json_data = read_json_maybe_gz(json_v1_path)
|
| 166 |
+
generators = json_data["Generators"]
|
| 167 |
+
|
| 168 |
+
sorted_units = get_eligible_thermal_units(generators)
|
| 169 |
+
n_total = length(sorted_units)
|
| 170 |
+
|
| 171 |
+
n_total == 0 && begin
|
| 172 |
+
println("── Part 2: 未发现可处理机组,直接写出原始数据 ──")
|
| 173 |
+
if haskey(json_data, "_sorted_thermal_units")
|
| 174 |
+
delete!(json_data, "_sorted_thermal_units")
|
| 175 |
+
end
|
| 176 |
+
write_json_pretty(output_path, json_data)
|
| 177 |
+
return output_path
|
| 178 |
+
end
|
| 179 |
+
|
| 180 |
+
uptime_dict, pmax_dict, _ = build_unit_metric_dicts(generators, sorted_units)
|
| 181 |
+
uptime_sorted = sort_by_uptime_then_pmax(sorted_units, uptime_dict, pmax_dict)
|
| 182 |
+
pmax_sorted = sort_by_pmax_then_uptime(sorted_units, uptime_dict, pmax_dict)
|
| 183 |
+
|
| 184 |
+
category1, category2, category3, category4 =
|
| 185 |
+
build_four_categories(uptime_sorted, uptime_sorted, pmax_sorted)
|
| 186 |
+
|
| 187 |
+
println("\n── Part 2: Uptime / Downtime 分类修改 ──")
|
| 188 |
+
println(" 机组总数: $n_total")
|
| 189 |
+
println(" Category 1 (top10%∩top10%): $(length(category1))")
|
| 190 |
+
println(" Category 2 (top20%∩top20% \\ cat1): $(length(category2))")
|
| 191 |
+
println(" Category 3 (top50%∩top50% \\ cat1,2): $(length(category3))")
|
| 192 |
+
println(" Category 4 (remaining): $(length(category4))")
|
| 193 |
+
|
| 194 |
+
modified_cat1 = String[]
|
| 195 |
+
modified_cat2 = String[]
|
| 196 |
+
modified_cat3 = String[]
|
| 197 |
+
|
| 198 |
+
function apply_uptime_downtime_multipliers!(u::String, up_mult::Int, down_mult::Int, tag::String)
|
| 199 |
+
old_up = get(generators[u], "Minimum uptime (h)", nothing)
|
| 200 |
+
old_down = get(generators[u], "Minimum downtime (h)", nothing)
|
| 201 |
+
|
| 202 |
+
if old_up !== nothing
|
| 203 |
+
generators[u]["Minimum uptime (h)"] = old_up * up_mult
|
| 204 |
+
end
|
| 205 |
+
if old_down !== nothing
|
| 206 |
+
generators[u]["Minimum downtime (h)"] = old_down * down_mult
|
| 207 |
+
end
|
| 208 |
+
|
| 209 |
+
println("[$tag] $u uptime: $old_up → $(get(generators[u], "Minimum uptime (h)", old_up)) downtime: $old_down → $(get(generators[u], "Minimum downtime (h)", old_down))")
|
| 210 |
+
end
|
| 211 |
+
|
| 212 |
+
for u in category1
|
| 213 |
+
apply_uptime_downtime_multipliers!(u, 4, 3, "Category 1")
|
| 214 |
+
push!(modified_cat1, u)
|
| 215 |
+
end
|
| 216 |
+
|
| 217 |
+
for u in category2
|
| 218 |
+
apply_uptime_downtime_multipliers!(u, 3, 2, "Category 2")
|
| 219 |
+
push!(modified_cat2, u)
|
| 220 |
+
end
|
| 221 |
+
|
| 222 |
+
for u in category3
|
| 223 |
+
apply_uptime_downtime_multipliers!(u, 2, 2, "Category 3")
|
| 224 |
+
push!(modified_cat3, u)
|
| 225 |
+
end
|
| 226 |
+
|
| 227 |
+
if haskey(json_data, "_sorted_thermal_units")
|
| 228 |
+
delete!(json_data, "_sorted_thermal_units")
|
| 229 |
+
end
|
| 230 |
+
|
| 231 |
+
write_json_pretty(output_path, json_data)
|
| 232 |
+
|
| 233 |
+
println("\nPart 2 完成 → 输出保存至: $output_path")
|
| 234 |
+
println(" Category 1 已修改 (uptime×4, downtime×3): $(length(modified_cat1)) 个")
|
| 235 |
+
println(" Category 2 已修改 (uptime×3, downtime×2): $(length(modified_cat2)) 个")
|
| 236 |
+
println(" Category 3 已修改 (uptime×2, downtime×2): $(length(modified_cat3)) 个")
|
| 237 |
+
println(" Category 4 未修改: $(length(category4)) 个")
|
| 238 |
+
|
| 239 |
+
return output_path
|
| 240 |
+
end
|
| 241 |
+
|
| 242 |
+
end
|
src/instance/read.jl
ADDED
|
@@ -0,0 +1,580 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
# Import required Julia packages for file operations, data structures, and JSON parsing
|
| 6 |
+
using Printf # For formatted string printing
|
| 7 |
+
using JSON # For parsing JSON files
|
| 8 |
+
using DataStructures # For OrderedDict and other data structures
|
| 9 |
+
using GZip # For reading gzipped files
|
| 10 |
+
import Base: getindex, time # Import specific functions from Base module
|
| 11 |
+
|
| 12 |
+
# Define constant URL for downloading benchmark instances
|
| 13 |
+
const INSTANCES_URL = "https://axavier.org/UnitCommitment.jl/0.4/instances"
|
| 14 |
+
|
| 15 |
+
"""
|
| 16 |
+
read_benchmark(name::AbstractString)::UnitCommitmentInstance
|
| 17 |
+
|
| 18 |
+
Read one of the benchmark instances included in the package. See
|
| 19 |
+
[Instances](guides/instances.md) for the entire list of benchmark instances available.
|
| 20 |
+
|
| 21 |
+
# Example
|
| 22 |
+
```julia
|
| 23 |
+
instance = UnitCommitment.read_benchmark("matpower/case3375wp/2017-02-01")
|
| 24 |
+
```
|
| 25 |
+
"""
|
| 26 |
+
function read_benchmark(
|
| 27 |
+
name::AbstractString;
|
| 28 |
+
quiet::Bool = false,
|
| 29 |
+
)::UnitCommitmentInstance
|
| 30 |
+
# Get the directory where this file is located
|
| 31 |
+
basedir = dirname(@__FILE__)
|
| 32 |
+
# Construct the local file path for the benchmark instance
|
| 33 |
+
filename = "$basedir/../../instances/$name.json.gz"
|
| 34 |
+
# Construct the URL for downloading the benchmark instance
|
| 35 |
+
url = "$INSTANCES_URL/$name.json.gz"
|
| 36 |
+
|
| 37 |
+
# Check if the file doesn't exist locally
|
| 38 |
+
if !isfile(filename)
|
| 39 |
+
# If not quiet mode, print download message
|
| 40 |
+
if !quiet
|
| 41 |
+
@info "Downloading: $(url)"
|
| 42 |
+
end
|
| 43 |
+
# Download the file from the URL
|
| 44 |
+
dpath = download(url)
|
| 45 |
+
# Create the directory path if it doesn't exist
|
| 46 |
+
mkpath(dirname(filename))
|
| 47 |
+
# Copy the downloaded file to the local filename
|
| 48 |
+
cp(dpath, filename)
|
| 49 |
+
# Read the JSON content from the file
|
| 50 |
+
json = _read_json(filename)
|
| 51 |
+
# If the JSON contains a SOURCE field and not in quiet mode, display citation info
|
| 52 |
+
if "SOURCE" in keys(json) && !quiet
|
| 53 |
+
@info "If you use this instance in your research, please cite:\n\n$(json["SOURCE"])\n"
|
| 54 |
+
end
|
| 55 |
+
end
|
| 56 |
+
# Return the parsed UnitCommitmentInstance
|
| 57 |
+
return UnitCommitment.read(filename)
|
| 58 |
+
end
|
| 59 |
+
|
| 60 |
+
"""
|
| 61 |
+
Helper function to repair scenario names and normalize probabilities
|
| 62 |
+
"""
|
| 63 |
+
function _repair_scenario_names_and_probabilities!(
|
| 64 |
+
scenarios::Vector{UnitCommitmentScenario},
|
| 65 |
+
path::Vector{String},
|
| 66 |
+
)::Nothing
|
| 67 |
+
# Calculate the total weight/probability of all scenarios
|
| 68 |
+
total_weight = sum([sc.probability for sc in scenarios])
|
| 69 |
+
|
| 70 |
+
# Iterate through each scenario and its corresponding file path
|
| 71 |
+
for (sc_path, sc) in zip(path, scenarios)
|
| 72 |
+
# If scenario name is empty, extract name from the file path
|
| 73 |
+
sc.name !== "" ||
|
| 74 |
+
(sc.name = first(split(last(split(sc_path, "/")), ".")))
|
| 75 |
+
# Normalize the probability by dividing by total weight
|
| 76 |
+
sc.probability = (sc.probability / total_weight)
|
| 77 |
+
end
|
| 78 |
+
return
|
| 79 |
+
end
|
| 80 |
+
|
| 81 |
+
"""
|
| 82 |
+
read(path::AbstractString)::UnitCommitmentInstance
|
| 83 |
+
|
| 84 |
+
Read a deterministic test case from the given file. The file may be gzipped.
|
| 85 |
+
|
| 86 |
+
# Example
|
| 87 |
+
|
| 88 |
+
```julia
|
| 89 |
+
instance = UnitCommitment.read("s1.json.gz")
|
| 90 |
+
```
|
| 91 |
+
"""
|
| 92 |
+
function read(path::String)::UnitCommitmentInstance
|
| 93 |
+
# Initialize empty vector for scenarios
|
| 94 |
+
scenarios = Vector{UnitCommitmentScenario}()
|
| 95 |
+
# Read the single scenario from the file
|
| 96 |
+
scenario = _read_scenario(path)
|
| 97 |
+
# Set the scenario name to "s1" for deterministic case
|
| 98 |
+
scenario.name = "s1"
|
| 99 |
+
# Set probability to 1.0 since it's deterministic
|
| 100 |
+
scenario.probability = 1.0
|
| 101 |
+
# Create scenarios vector with the single scenario
|
| 102 |
+
scenarios = [scenario]
|
| 103 |
+
# Create and return the UnitCommitmentInstance with time from scenario
|
| 104 |
+
instance =
|
| 105 |
+
UnitCommitmentInstance(time = scenario.time, scenarios = scenarios)
|
| 106 |
+
return instance
|
| 107 |
+
end
|
| 108 |
+
|
| 109 |
+
"""
|
| 110 |
+
read(path::Vector{String})::UnitCommitmentInstance
|
| 111 |
+
|
| 112 |
+
Read a stochastic unit commitment instance from the given files. Each file
|
| 113 |
+
describes a scenario. The files may be gzipped.
|
| 114 |
+
|
| 115 |
+
# Example
|
| 116 |
+
|
| 117 |
+
```julia
|
| 118 |
+
instance = UnitCommitment.read(["s1.json.gz", "s2.json.gz"])
|
| 119 |
+
```
|
| 120 |
+
"""
|
| 121 |
+
function read(paths::Vector{String})::UnitCommitmentInstance
|
| 122 |
+
# Initialize empty vector for scenarios
|
| 123 |
+
scenarios = UnitCommitmentScenario[]
|
| 124 |
+
# Read each scenario from the provided file paths
|
| 125 |
+
for p in paths
|
| 126 |
+
push!(scenarios, _read_scenario(p))
|
| 127 |
+
end
|
| 128 |
+
# Repair scenario names and normalize probabilities
|
| 129 |
+
_repair_scenario_names_and_probabilities!(scenarios, paths)
|
| 130 |
+
# Create and return the UnitCommitmentInstance with time from first scenario
|
| 131 |
+
instance =
|
| 132 |
+
UnitCommitmentInstance(time = scenarios[1].time, scenarios = scenarios)
|
| 133 |
+
return instance
|
| 134 |
+
end
|
| 135 |
+
|
| 136 |
+
"""
|
| 137 |
+
Helper function to read a single scenario from a file path
|
| 138 |
+
"""
|
| 139 |
+
function _read_scenario(path::String)::UnitCommitmentScenario
|
| 140 |
+
# Check if file is gzipped and read accordingly
|
| 141 |
+
if endswith(path, ".gz")
|
| 142 |
+
scenario = _read(gzopen(path))
|
| 143 |
+
elseif endswith(path, ".json")
|
| 144 |
+
scenario = _read(open(path))
|
| 145 |
+
else
|
| 146 |
+
error("Unsupported input format")
|
| 147 |
+
end
|
| 148 |
+
return scenario
|
| 149 |
+
end
|
| 150 |
+
|
| 151 |
+
"""
|
| 152 |
+
Helper function to read scenario from an IO stream
|
| 153 |
+
"""
|
| 154 |
+
function _read(file::IO)::UnitCommitmentScenario
|
| 155 |
+
# Parse JSON from file using DefaultOrderedDict and convert to scenario
|
| 156 |
+
return _from_json(
|
| 157 |
+
JSON.parse(file, dicttype = () -> DefaultOrderedDict(nothing)),
|
| 158 |
+
)
|
| 159 |
+
end
|
| 160 |
+
|
| 161 |
+
"""
|
| 162 |
+
Helper function to read JSON from a file path (handles both .json and .gz files)
|
| 163 |
+
"""
|
| 164 |
+
function _read_json(path::String)::OrderedDict
|
| 165 |
+
# Open file based on extension (gzipped or plain JSON)
|
| 166 |
+
if endswith(path, ".gz")
|
| 167 |
+
file = GZip.gzopen(path)
|
| 168 |
+
else
|
| 169 |
+
file = open(path)
|
| 170 |
+
end
|
| 171 |
+
# Parse JSON and return as OrderedDict
|
| 172 |
+
return JSON.parse(file, dicttype = () -> DefaultOrderedDict(nothing))
|
| 173 |
+
end
|
| 174 |
+
|
| 175 |
+
"""
|
| 176 |
+
Main function to convert JSON data to UnitCommitmentScenario
|
| 177 |
+
"""
|
| 178 |
+
function _from_json(json; repair = true)::UnitCommitmentScenario
|
| 179 |
+
# Migrate JSON data to current format if needed
|
| 180 |
+
_migrate(json)
|
| 181 |
+
|
| 182 |
+
# Initialize empty arrays for all component types
|
| 183 |
+
thermal_units = ThermalUnit[]
|
| 184 |
+
buses = Bus[]
|
| 185 |
+
contingencies = Contingency[]
|
| 186 |
+
lines = TransmissionLine[]
|
| 187 |
+
loads = PriceSensitiveLoad[]
|
| 188 |
+
reserves = Reserve[]
|
| 189 |
+
profiled_units = ProfiledUnit[]
|
| 190 |
+
storage_units = StorageUnit[]
|
| 191 |
+
|
| 192 |
+
# Helper function to handle scalar values with defaults
|
| 193 |
+
function scalar(x; default = nothing)
|
| 194 |
+
x !== nothing || return default
|
| 195 |
+
return x
|
| 196 |
+
end
|
| 197 |
+
|
| 198 |
+
# Parse time horizon from JSON parameters
|
| 199 |
+
time_horizon = json["Parameters"]["Time horizon (min)"]
|
| 200 |
+
if time_horizon === nothing
|
| 201 |
+
# Try alternative time horizon formats
|
| 202 |
+
time_horizon = json["Parameters"]["Time (h)"]
|
| 203 |
+
if time_horizon === nothing
|
| 204 |
+
time_horizon = json["Parameters"]["Time horizon (h)"]
|
| 205 |
+
end
|
| 206 |
+
# Convert hours to minutes if found
|
| 207 |
+
if time_horizon !== nothing
|
| 208 |
+
time_horizon *= 60
|
| 209 |
+
end
|
| 210 |
+
end
|
| 211 |
+
# Validate that time horizon is present and is an integer
|
| 212 |
+
time_horizon !== nothing || error("Missing parameter: Time horizon (min)")
|
| 213 |
+
isinteger(time_horizon) ||
|
| 214 |
+
error("Time horizon must be an integer in minutes")
|
| 215 |
+
time_horizon = Int(time_horizon)
|
| 216 |
+
|
| 217 |
+
# Parse time step with default of 60 minutes
|
| 218 |
+
time_step = scalar(json["Parameters"]["Time step (min)"], default = 60)
|
| 219 |
+
# Validate that time step divides 60 evenly
|
| 220 |
+
(60 % time_step == 0) ||
|
| 221 |
+
error("Time step $time_step is not a divisor of 60")
|
| 222 |
+
# Validate that time step divides time horizon evenly
|
| 223 |
+
(time_horizon % time_step == 0) || error(
|
| 224 |
+
"Time step $time_step is not a divisor of time horizon $time_horizon",
|
| 225 |
+
)
|
| 226 |
+
# Calculate time multiplier and number of time periods
|
| 227 |
+
time_multiplier = 60 ÷ time_step
|
| 228 |
+
T = time_horizon ÷ time_step
|
| 229 |
+
|
| 230 |
+
# Parse scenario probability and name with defaults
|
| 231 |
+
probability = json["Parameters"]["Scenario weight"]
|
| 232 |
+
probability !== nothing || (probability = 1)
|
| 233 |
+
scenario_name = json["Parameters"]["Scenario name"]
|
| 234 |
+
scenario_name !== nothing || (scenario_name = "")
|
| 235 |
+
|
| 236 |
+
# Initialize dictionaries for mapping names to objects
|
| 237 |
+
name_to_bus = Dict{String,Bus}()
|
| 238 |
+
name_to_line = Dict{String,TransmissionLine}()
|
| 239 |
+
name_to_unit = Dict{String,ThermalUnit}()
|
| 240 |
+
name_to_reserve = Dict{String,Reserve}()
|
| 241 |
+
|
| 242 |
+
# Helper function to convert scalar values to time series
|
| 243 |
+
function timeseries(x; default = nothing)
|
| 244 |
+
x !== nothing || return default
|
| 245 |
+
x isa Array || return [x for t in 1:T]
|
| 246 |
+
return x
|
| 247 |
+
end
|
| 248 |
+
|
| 249 |
+
# Read power balance penalty parameter with default values
|
| 250 |
+
power_balance_penalty = timeseries(
|
| 251 |
+
json["Parameters"]["Power balance penalty (\$/MW)"],
|
| 252 |
+
default = [1000.0 for t in 1:T],
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
# Read bus data from JSON
|
| 256 |
+
for (bus_name, dict) in json["Buses"]
|
| 257 |
+
# Create Bus object with all its components
|
| 258 |
+
bus = Bus(
|
| 259 |
+
bus_name,
|
| 260 |
+
length(buses), # Bus index
|
| 261 |
+
timeseries(dict["Load (MW)"]), # Load time series
|
| 262 |
+
ThermalUnit[], # Empty thermal units list
|
| 263 |
+
PriceSensitiveLoad[], # Empty loads list
|
| 264 |
+
ProfiledUnit[], # Empty profiled units list
|
| 265 |
+
StorageUnit[], # Empty storage units list
|
| 266 |
+
)
|
| 267 |
+
# Store bus in name mapping and add to buses list
|
| 268 |
+
name_to_bus[bus_name] = bus
|
| 269 |
+
push!(buses, bus)
|
| 270 |
+
end
|
| 271 |
+
|
| 272 |
+
# Read reserves data if present in JSON
|
| 273 |
+
if "Reserves" in keys(json)
|
| 274 |
+
for (reserve_name, dict) in json["Reserves"]
|
| 275 |
+
r = Reserve(
|
| 276 |
+
name = reserve_name,
|
| 277 |
+
type = lowercase(dict["Type"]),
|
| 278 |
+
amount = timeseries(dict["Amount (MW)"]),
|
| 279 |
+
thermal_units = [],
|
| 280 |
+
shortfall_penalty = scalar(
|
| 281 |
+
dict["Shortfall penalty (\$/MW)"],
|
| 282 |
+
default = -1,
|
| 283 |
+
),
|
| 284 |
+
)
|
| 285 |
+
name_to_reserve[reserve_name] = r
|
| 286 |
+
push!(reserves, r)
|
| 287 |
+
end
|
| 288 |
+
end
|
| 289 |
+
|
| 290 |
+
# Read units
|
| 291 |
+
for (unit_name, dict) in json["Generators"]
|
| 292 |
+
# Read and validate unit type
|
| 293 |
+
unit_type = scalar(dict["Type"], default = nothing)
|
| 294 |
+
unit_type !== nothing || error("unit $unit_name has no type specified")
|
| 295 |
+
bus = name_to_bus[dict["Bus"]]
|
| 296 |
+
|
| 297 |
+
if lowercase(unit_type) === "thermal"
|
| 298 |
+
# Read production cost curve data
|
| 299 |
+
K = length(dict["Production cost curve (MW)"]) # Number of cost curve segments
|
| 300 |
+
# Create matrix of power levels for each time period and segment
|
| 301 |
+
curve_mw = hcat(
|
| 302 |
+
[
|
| 303 |
+
timeseries(dict["Production cost curve (MW)"][k]) for
|
| 304 |
+
k in 1:K
|
| 305 |
+
]...,
|
| 306 |
+
)
|
| 307 |
+
# Create matrix of costs for each time period and segment
|
| 308 |
+
curve_cost = hcat(
|
| 309 |
+
[
|
| 310 |
+
timeseries(dict["Production cost curve (\$)"][k]) for
|
| 311 |
+
k in 1:K
|
| 312 |
+
]...,
|
| 313 |
+
)
|
| 314 |
+
# Extract minimum and maximum power levels from cost curve
|
| 315 |
+
min_power = curve_mw[:, 1] # First column = minimum power
|
| 316 |
+
max_power = curve_mw[:, K] # Last column = maximum power
|
| 317 |
+
min_power_cost = curve_cost[:, 1] # Cost at minimum power
|
| 318 |
+
# Create cost segments for piecewise linear cost approximation
|
| 319 |
+
segments = CostSegment[]
|
| 320 |
+
for k in 2:K
|
| 321 |
+
# Calculate power increment for this segment
|
| 322 |
+
amount = curve_mw[:, k] - curve_mw[:, k-1]
|
| 323 |
+
# Calculate marginal cost for this segment
|
| 324 |
+
cost = (curve_cost[:, k] - curve_cost[:, k-1]) ./ amount
|
| 325 |
+
replace!(cost, NaN => 0.0) # Handle division by zero
|
| 326 |
+
push!(segments, CostSegment(amount, cost))
|
| 327 |
+
end
|
| 328 |
+
|
| 329 |
+
# Read startup costs and delays
|
| 330 |
+
startup_delays = scalar(dict["Startup delays (h)"], default = [1]) # Hours required for startup
|
| 331 |
+
startup_costs = scalar(dict["Startup costs (\$)"], default = [0.0]) # Cost for each startup category
|
| 332 |
+
startup_categories = StartupCategory[]
|
| 333 |
+
# Create startup categories based on delays and costs
|
| 334 |
+
for k in 1:length(startup_delays)
|
| 335 |
+
push!(
|
| 336 |
+
startup_categories,
|
| 337 |
+
StartupCategory(
|
| 338 |
+
startup_delays[k] .* time_multiplier, # Convert hours to time periods
|
| 339 |
+
startup_costs[k], # Cost for this startup category
|
| 340 |
+
),
|
| 341 |
+
)
|
| 342 |
+
end
|
| 343 |
+
|
| 344 |
+
# Read reserve eligibility for this unit
|
| 345 |
+
unit_reserves = Reserve[]
|
| 346 |
+
if "Reserve eligibility" in keys(dict)
|
| 347 |
+
# Map reserve names to Reserve objects
|
| 348 |
+
unit_reserves =
|
| 349 |
+
[name_to_reserve[n] for n in dict["Reserve eligibility"]]
|
| 350 |
+
end
|
| 351 |
+
|
| 352 |
+
# Read and validate initial conditions for the unit
|
| 353 |
+
initial_power =
|
| 354 |
+
scalar(dict["Initial power (MW)"], default = nothing) # Power output at start
|
| 355 |
+
initial_status =
|
| 356 |
+
scalar(dict["Initial status (h)"], default = nothing) # Hours online/offline at start
|
| 357 |
+
# Validate that both initial power and status are provided together
|
| 358 |
+
if initial_power === nothing
|
| 359 |
+
initial_status === nothing || error(
|
| 360 |
+
"unit $unit_name has initial status but no initial power",
|
| 361 |
+
)
|
| 362 |
+
else
|
| 363 |
+
initial_status !== nothing || error(
|
| 364 |
+
"unit $unit_name has initial power but no initial status",
|
| 365 |
+
)
|
| 366 |
+
initial_status != 0 ||
|
| 367 |
+
error("unit $unit_name has invalid initial status")
|
| 368 |
+
# Validate that offline units have zero power
|
| 369 |
+
if initial_status < 0 && initial_power > 1e-3
|
| 370 |
+
error("unit $unit_name has invalid initial power")
|
| 371 |
+
end
|
| 372 |
+
initial_status *= time_multiplier # Convert hours to time periods
|
| 373 |
+
end
|
| 374 |
+
|
| 375 |
+
# Read commitment status for each time period
|
| 376 |
+
commitment_status = scalar(
|
| 377 |
+
dict["Commitment status"],
|
| 378 |
+
default = Vector{Union{Bool,Nothing}}(nothing, T), # Default: no commitment constraints
|
| 379 |
+
)
|
| 380 |
+
|
| 381 |
+
# Create ThermalUnit object with all parsed parameters
|
| 382 |
+
unit = ThermalUnit(
|
| 383 |
+
unit_name, # Unit identifier
|
| 384 |
+
bus, # Bus where unit is located
|
| 385 |
+
max_power, # Maximum power output
|
| 386 |
+
min_power, # Minimum power output
|
| 387 |
+
timeseries(dict["Must run?"], default = [false for t in 1:T]), # Must-run constraints
|
| 388 |
+
min_power_cost, # Cost at minimum power
|
| 389 |
+
segments, # Piecewise linear cost segments
|
| 390 |
+
scalar(dict["Minimum uptime (h)"], default = 1) *
|
| 391 |
+
time_multiplier, # Minimum time online (in periods)
|
| 392 |
+
scalar(dict["Minimum downtime (h)"], default = 1) *
|
| 393 |
+
time_multiplier, # Minimum time offline (in periods)
|
| 394 |
+
scalar(dict["Ramp up limit (MW)"], default = 1e6), # Maximum ramp up rate
|
| 395 |
+
scalar(dict["Ramp down limit (MW)"], default = 1e6), # Maximum ramp down rate
|
| 396 |
+
scalar(dict["Startup limit (MW)"], default = 1e6), # Maximum startup rate
|
| 397 |
+
scalar(dict["Shutdown limit (MW)"], default = 1e6), # Maximum shutdown rate
|
| 398 |
+
initial_status, # Initial online/offline status
|
| 399 |
+
initial_power, # Initial power output
|
| 400 |
+
startup_categories, # Startup cost categories
|
| 401 |
+
unit_reserves, # Eligible reserves
|
| 402 |
+
commitment_status, # Commitment constraints
|
| 403 |
+
timeseries(dict["Startup curve (MW)"], default = Float64[]),
|
| 404 |
+
timeseries(dict["Shutdown curve (MW)"], default = Float64[]),
|
| 405 |
+
)
|
| 406 |
+
# Add unit to its bus and update reserve associations
|
| 407 |
+
push!(bus.thermal_units, unit)
|
| 408 |
+
for r in unit_reserves
|
| 409 |
+
push!(r.thermal_units, unit)
|
| 410 |
+
end
|
| 411 |
+
# Store unit in name mapping and add to thermal units list
|
| 412 |
+
name_to_unit[unit_name] = unit
|
| 413 |
+
push!(thermal_units, unit)
|
| 414 |
+
elseif lowercase(unit_type) === "profiled"
|
| 415 |
+
# Handle profiled units (e.g., renewable energy sources)
|
| 416 |
+
bus = name_to_bus[dict["Bus"]]
|
| 417 |
+
pu = ProfiledUnit(
|
| 418 |
+
unit_name, # Unit identifier
|
| 419 |
+
bus, # Bus where unit is located
|
| 420 |
+
timeseries(scalar(dict["Minimum power (MW)"], default = 0.0)), # Minimum power output
|
| 421 |
+
timeseries(dict["Maximum power (MW)"]), # Maximum power output
|
| 422 |
+
timeseries(dict["Cost (\$/MW)"]), # Marginal cost
|
| 423 |
+
)
|
| 424 |
+
# Add profiled unit to its bus and to the global list
|
| 425 |
+
push!(bus.profiled_units, pu)
|
| 426 |
+
push!(profiled_units, pu)
|
| 427 |
+
else
|
| 428 |
+
error("unit $unit_name has an invalid type")
|
| 429 |
+
end
|
| 430 |
+
end
|
| 431 |
+
|
| 432 |
+
# Read transmission lines data
|
| 433 |
+
if "Transmission lines" in keys(json)
|
| 434 |
+
for (line_name, dict) in json["Transmission lines"]
|
| 435 |
+
# Create TransmissionLine object with all parameters
|
| 436 |
+
line = TransmissionLine(
|
| 437 |
+
line_name, # Line identifier
|
| 438 |
+
length(lines) + 1, # Line index
|
| 439 |
+
name_to_bus[dict["Source bus"]], # Source bus
|
| 440 |
+
name_to_bus[dict["Target bus"]], # Target bus
|
| 441 |
+
scalar(dict["Susceptance (S)"]), # Electrical susceptance
|
| 442 |
+
timeseries(
|
| 443 |
+
dict["Normal flow limit (MW)"],
|
| 444 |
+
default = [1e8 for t in 1:T], # Normal operating limit
|
| 445 |
+
),
|
| 446 |
+
timeseries(
|
| 447 |
+
dict["Emergency flow limit (MW)"],
|
| 448 |
+
default = [1e8 for t in 1:T], # Emergency operating limit
|
| 449 |
+
),
|
| 450 |
+
timeseries(
|
| 451 |
+
dict["Flow limit penalty (\$/MW)"],
|
| 452 |
+
default = [5000.0 for t in 1:T], # Penalty for exceeding limits
|
| 453 |
+
),
|
| 454 |
+
)
|
| 455 |
+
# Store line in name mapping and add to lines list
|
| 456 |
+
name_to_line[line_name] = line
|
| 457 |
+
push!(lines, line)
|
| 458 |
+
end
|
| 459 |
+
end
|
| 460 |
+
|
| 461 |
+
# Read contingency data (N-1 security constraints)
|
| 462 |
+
if "Contingencies" in keys(json)
|
| 463 |
+
for (cont_name, dict) in json["Contingencies"]
|
| 464 |
+
# Initialize lists for affected components
|
| 465 |
+
affected_units = ThermalUnit[]
|
| 466 |
+
affected_lines = TransmissionLine[]
|
| 467 |
+
# Map affected line names to TransmissionLine objects
|
| 468 |
+
if "Affected lines" in keys(dict)
|
| 469 |
+
affected_lines =
|
| 470 |
+
[name_to_line[l] for l in dict["Affected lines"]]
|
| 471 |
+
end
|
| 472 |
+
# Map affected unit names to ThermalUnit objects
|
| 473 |
+
if "Affected units" in keys(dict)
|
| 474 |
+
affected_units =
|
| 475 |
+
[name_to_unit[u] for u in dict["Affected units"]]
|
| 476 |
+
end
|
| 477 |
+
# Create Contingency object and add to list
|
| 478 |
+
cont = Contingency(cont_name, affected_lines, affected_units)
|
| 479 |
+
push!(contingencies, cont)
|
| 480 |
+
end
|
| 481 |
+
end
|
| 482 |
+
|
| 483 |
+
# Read price-sensitive loads (demand response)
|
| 484 |
+
if "Price-sensitive loads" in keys(json)
|
| 485 |
+
for (load_name, dict) in json["Price-sensitive loads"]
|
| 486 |
+
bus = name_to_bus[dict["Bus"]]
|
| 487 |
+
# Create PriceSensitiveLoad object
|
| 488 |
+
load = PriceSensitiveLoad(
|
| 489 |
+
load_name, # Load identifier
|
| 490 |
+
bus, # Bus where load is located
|
| 491 |
+
timeseries(dict["Demand (MW)"]), # Demand time series
|
| 492 |
+
timeseries(dict["Revenue (\$/MW)"]), # Revenue for demand reduction
|
| 493 |
+
)
|
| 494 |
+
# Add load to its bus and to the global list
|
| 495 |
+
push!(bus.price_sensitive_loads, load)
|
| 496 |
+
push!(loads, load)
|
| 497 |
+
end
|
| 498 |
+
end
|
| 499 |
+
|
| 500 |
+
# Read storage units (batteries, pumped hydro, etc.)
|
| 501 |
+
if "Storage units" in keys(json)
|
| 502 |
+
for (storage_name, dict) in json["Storage units"]
|
| 503 |
+
bus = name_to_bus[dict["Bus"]]
|
| 504 |
+
# Parse storage level constraints
|
| 505 |
+
min_level =
|
| 506 |
+
timeseries(scalar(dict["Minimum level (MWh)"], default = 0.0)) # Minimum energy level
|
| 507 |
+
max_level = timeseries(dict["Maximum level (MWh)"]) # Maximum energy level
|
| 508 |
+
# Create StorageUnit object with all parameters
|
| 509 |
+
storage = StorageUnit(
|
| 510 |
+
storage_name, # Storage unit identifier
|
| 511 |
+
bus, # Bus where storage is located
|
| 512 |
+
min_level, # Minimum energy level time series
|
| 513 |
+
max_level, # Maximum energy level time series
|
| 514 |
+
timeseries(
|
| 515 |
+
scalar(
|
| 516 |
+
dict["Allow simultaneous charging and discharging"],
|
| 517 |
+
default = true, # Whether unit can charge and discharge simultaneously
|
| 518 |
+
),
|
| 519 |
+
),
|
| 520 |
+
timeseries(dict["Charge cost (\$/MW)"]), # Cost to charge
|
| 521 |
+
timeseries(dict["Discharge cost (\$/MW)"]), # Cost to discharge
|
| 522 |
+
timeseries(scalar(dict["Charge efficiency"], default = 1.0)), # Charging efficiency
|
| 523 |
+
timeseries(scalar(dict["Discharge efficiency"], default = 1.0)), # Discharging efficiency
|
| 524 |
+
timeseries(scalar(dict["Loss factor"], default = 0.0)), # Self-discharge rate
|
| 525 |
+
timeseries(
|
| 526 |
+
scalar(dict["Minimum charge rate (MW)"], default = 0.0), # Minimum charging power
|
| 527 |
+
),
|
| 528 |
+
timeseries(dict["Maximum charge rate (MW)"]), # Maximum charging power
|
| 529 |
+
timeseries(
|
| 530 |
+
scalar(dict["Minimum discharge rate (MW)"], default = 0.0), # Minimum discharging power
|
| 531 |
+
),
|
| 532 |
+
timeseries(dict["Maximum discharge rate (MW)"]), # Maximum discharging power
|
| 533 |
+
scalar(dict["Initial level (MWh)"], default = 0.0), # Initial energy level
|
| 534 |
+
scalar(
|
| 535 |
+
dict["Last period minimum level (MWh)"],
|
| 536 |
+
default = min_level[T], # Final minimum level
|
| 537 |
+
),
|
| 538 |
+
scalar(
|
| 539 |
+
dict["Last period maximum level (MWh)"],
|
| 540 |
+
default = max_level[T], # Final maximum level
|
| 541 |
+
),
|
| 542 |
+
)
|
| 543 |
+
# Add storage unit to its bus and to the global list
|
| 544 |
+
push!(bus.storage_units, storage)
|
| 545 |
+
push!(storage_units, storage)
|
| 546 |
+
end
|
| 547 |
+
end
|
| 548 |
+
|
| 549 |
+
# Create the final UnitCommitmentScenario object with all parsed components
|
| 550 |
+
scenario = UnitCommitmentScenario(
|
| 551 |
+
name = scenario_name, # Scenario identifier
|
| 552 |
+
probability = probability, # Scenario probability/weight
|
| 553 |
+
buses_by_name = Dict(b.name => b for b in buses), # Bus lookup by name
|
| 554 |
+
buses = buses, # List of all buses
|
| 555 |
+
contingencies_by_name = Dict(c.name => c for c in contingencies), # Contingency lookup by name
|
| 556 |
+
contingencies = contingencies, # List of all contingencies
|
| 557 |
+
lines_by_name = Dict(l.name => l for l in lines), # Line lookup by name
|
| 558 |
+
lines = lines, # List of all transmission lines
|
| 559 |
+
power_balance_penalty = power_balance_penalty, # Penalty for power imbalance
|
| 560 |
+
price_sensitive_loads_by_name = Dict(ps.name => ps for ps in loads), # Load lookup by name
|
| 561 |
+
price_sensitive_loads = loads, # List of all price-sensitive loads
|
| 562 |
+
reserves = reserves, # List of all reserves
|
| 563 |
+
reserves_by_name = name_to_reserve, # Reserve lookup by name
|
| 564 |
+
time = T, # Number of time periods
|
| 565 |
+
time_step = time_step, # Time step duration
|
| 566 |
+
thermal_units_by_name = Dict(g.name => g for g in thermal_units), # Thermal unit lookup by name
|
| 567 |
+
thermal_units = thermal_units, # List of all thermal units
|
| 568 |
+
profiled_units_by_name = Dict(pu.name => pu for pu in profiled_units), # Profiled unit lookup by name
|
| 569 |
+
profiled_units = profiled_units, # List of all profiled units
|
| 570 |
+
storage_units_by_name = Dict(su.name => su for su in storage_units), # Storage unit lookup by name
|
| 571 |
+
storage_units = storage_units, # List of all storage units
|
| 572 |
+
isf = spzeros(Float64, length(lines), length(buses) - 1), # Injection Shift Factors (sparse matrix)
|
| 573 |
+
lodf = spzeros(Float64, length(lines), length(lines)), # Line Outage Distribution Factors (sparse matrix)
|
| 574 |
+
)
|
| 575 |
+
# Repair scenario data if requested (validate and fix inconsistencies)
|
| 576 |
+
if repair
|
| 577 |
+
UnitCommitment.repair!(scenario)
|
| 578 |
+
end
|
| 579 |
+
return scenario
|
| 580 |
+
end
|
src/instance/structs.jl
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
mutable struct Bus
|
| 6 |
+
name::String
|
| 7 |
+
offset::Int
|
| 8 |
+
load::Vector{Float64}
|
| 9 |
+
thermal_units::Vector
|
| 10 |
+
price_sensitive_loads::Vector
|
| 11 |
+
profiled_units::Vector
|
| 12 |
+
storage_units::Vector
|
| 13 |
+
end
|
| 14 |
+
|
| 15 |
+
mutable struct CostSegment
|
| 16 |
+
mw::Vector{Float64}
|
| 17 |
+
cost::Vector{Float64}
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
mutable struct StartupCategory
|
| 21 |
+
delay::Int
|
| 22 |
+
cost::Float64
|
| 23 |
+
end
|
| 24 |
+
|
| 25 |
+
Base.@kwdef mutable struct Reserve
|
| 26 |
+
name::String
|
| 27 |
+
type::String
|
| 28 |
+
amount::Vector{Float64}
|
| 29 |
+
thermal_units::Vector
|
| 30 |
+
shortfall_penalty::Float64
|
| 31 |
+
end
|
| 32 |
+
|
| 33 |
+
mutable struct ThermalUnit
|
| 34 |
+
name::String
|
| 35 |
+
bus::Bus
|
| 36 |
+
max_power::Vector{Float64}
|
| 37 |
+
min_power::Vector{Float64}
|
| 38 |
+
must_run::Vector{Bool}
|
| 39 |
+
min_power_cost::Vector{Float64}
|
| 40 |
+
cost_segments::Vector{CostSegment}
|
| 41 |
+
min_uptime::Int
|
| 42 |
+
min_downtime::Int
|
| 43 |
+
ramp_up_limit::Float64
|
| 44 |
+
ramp_down_limit::Float64
|
| 45 |
+
startup_limit::Float64
|
| 46 |
+
shutdown_limit::Float64
|
| 47 |
+
initial_status::Union{Int,Nothing}
|
| 48 |
+
initial_power::Union{Float64,Nothing}
|
| 49 |
+
startup_categories::Vector{StartupCategory}
|
| 50 |
+
reserves::Vector{Reserve}
|
| 51 |
+
commitment_status::Vector{Union{Bool,Nothing}}
|
| 52 |
+
startup_curve::Vector{Float64}
|
| 53 |
+
shutdown_curve::Vector{Float64}
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
mutable struct TransmissionLine
|
| 58 |
+
name::String
|
| 59 |
+
offset::Int
|
| 60 |
+
source::Bus
|
| 61 |
+
target::Bus
|
| 62 |
+
susceptance::Float64
|
| 63 |
+
normal_flow_limit::Vector{Float64}
|
| 64 |
+
emergency_flow_limit::Vector{Float64}
|
| 65 |
+
flow_limit_penalty::Vector{Float64}
|
| 66 |
+
end
|
| 67 |
+
|
| 68 |
+
mutable struct Contingency
|
| 69 |
+
name::String
|
| 70 |
+
lines::Vector{TransmissionLine}
|
| 71 |
+
thermal_units::Vector{ThermalUnit}
|
| 72 |
+
end
|
| 73 |
+
|
| 74 |
+
mutable struct PriceSensitiveLoad
|
| 75 |
+
name::String
|
| 76 |
+
bus::Bus
|
| 77 |
+
demand::Vector{Float64}
|
| 78 |
+
revenue::Vector{Float64}
|
| 79 |
+
end
|
| 80 |
+
|
| 81 |
+
mutable struct ProfiledUnit
|
| 82 |
+
name::String
|
| 83 |
+
bus::Bus
|
| 84 |
+
min_power::Vector{Float64}
|
| 85 |
+
max_power::Vector{Float64}
|
| 86 |
+
cost::Vector{Float64}
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
mutable struct StorageUnit
|
| 90 |
+
name::String
|
| 91 |
+
bus::Bus
|
| 92 |
+
min_level::Vector{Float64}
|
| 93 |
+
max_level::Vector{Float64}
|
| 94 |
+
simultaneous_charge_and_discharge::Vector{Bool}
|
| 95 |
+
charge_cost::Vector{Float64}
|
| 96 |
+
discharge_cost::Vector{Float64}
|
| 97 |
+
charge_efficiency::Vector{Float64}
|
| 98 |
+
discharge_efficiency::Vector{Float64}
|
| 99 |
+
loss_factor::Vector{Float64}
|
| 100 |
+
min_charge_rate::Vector{Float64}
|
| 101 |
+
max_charge_rate::Vector{Float64}
|
| 102 |
+
min_discharge_rate::Vector{Float64}
|
| 103 |
+
max_discharge_rate::Vector{Float64}
|
| 104 |
+
initial_level::Float64
|
| 105 |
+
min_ending_level::Float64
|
| 106 |
+
max_ending_level::Float64
|
| 107 |
+
end
|
| 108 |
+
|
| 109 |
+
Base.@kwdef mutable struct UnitCommitmentScenario
|
| 110 |
+
buses_by_name::Dict{AbstractString,Bus}
|
| 111 |
+
buses::Vector{Bus}
|
| 112 |
+
contingencies_by_name::Dict{AbstractString,Contingency}
|
| 113 |
+
contingencies::Vector{Contingency}
|
| 114 |
+
isf::Array{Float64,2}
|
| 115 |
+
lines_by_name::Dict{AbstractString,TransmissionLine}
|
| 116 |
+
lines::Vector{TransmissionLine}
|
| 117 |
+
lodf::Array{Float64,2}
|
| 118 |
+
name::String
|
| 119 |
+
power_balance_penalty::Vector{Float64}
|
| 120 |
+
price_sensitive_loads_by_name::Dict{AbstractString,PriceSensitiveLoad}
|
| 121 |
+
price_sensitive_loads::Vector{PriceSensitiveLoad}
|
| 122 |
+
probability::Float64
|
| 123 |
+
profiled_units_by_name::Dict{AbstractString,ProfiledUnit}
|
| 124 |
+
profiled_units::Vector{ProfiledUnit}
|
| 125 |
+
reserves_by_name::Dict{AbstractString,Reserve}
|
| 126 |
+
reserves::Vector{Reserve}
|
| 127 |
+
thermal_units_by_name::Dict{AbstractString,ThermalUnit}
|
| 128 |
+
thermal_units::Vector{ThermalUnit}
|
| 129 |
+
storage_units_by_name::Dict{AbstractString,StorageUnit}
|
| 130 |
+
storage_units::Vector{StorageUnit}
|
| 131 |
+
time::Int
|
| 132 |
+
time_step::Int
|
| 133 |
+
end
|
| 134 |
+
|
| 135 |
+
Base.@kwdef mutable struct UnitCommitmentInstance
|
| 136 |
+
time::Int
|
| 137 |
+
scenarios::Vector{UnitCommitmentScenario}
|
| 138 |
+
end
|
| 139 |
+
|
| 140 |
+
function Base.show(io::IO, instance::UnitCommitmentInstance)
|
| 141 |
+
sc = instance.scenarios[1]
|
| 142 |
+
print(io, "UnitCommitmentInstance(")
|
| 143 |
+
print(io, "$(length(instance.scenarios)) scenarios, ")
|
| 144 |
+
print(io, "$(length(sc.thermal_units)) thermal units, ")
|
| 145 |
+
print(io, "$(length(sc.profiled_units)) profiled units, ")
|
| 146 |
+
print(io, "$(length(sc.buses)) buses, ")
|
| 147 |
+
print(io, "$(length(sc.lines)) lines, ")
|
| 148 |
+
print(io, "$(length(sc.contingencies)) contingencies, ")
|
| 149 |
+
print(io, "$(length(sc.price_sensitive_loads)) price sensitive loads, ")
|
| 150 |
+
print(io, "$(instance.time) time steps")
|
| 151 |
+
print(io, ")")
|
| 152 |
+
return
|
| 153 |
+
end
|
| 154 |
+
|
| 155 |
+
export UnitCommitmentInstance
|
src/instance/subhourly.jl
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Subhourly
|
| 3 |
+
|
| 4 |
+
Module for converting UC instances from 40-minute time periods (36 periods/day)
|
| 5 |
+
to 20-minute time periods (72 periods/day).
|
| 6 |
+
"""
|
| 7 |
+
module Subhourly
|
| 8 |
+
|
| 9 |
+
using Dates
|
| 10 |
+
import ..UnitCommitment
|
| 11 |
+
|
| 12 |
+
export convert_to_subhourly, interpolate_values, repeat_values
|
| 13 |
+
|
| 14 |
+
"""
|
| 15 |
+
convert_to_subhourly(instance_path::AbstractString, next_day_path::AbstractString)
|
| 16 |
+
|
| 17 |
+
Convert a UC instance from 36 time periods (40 minutes each) to 72 time periods (20 minutes each).
|
| 18 |
+
|
| 19 |
+
# Arguments
|
| 20 |
+
- `instance_path::AbstractString`: Path to the current day's instance
|
| 21 |
+
- `next_day_path::AbstractString`: Path to the next day's instance (needed for interpolation at boundaries)
|
| 22 |
+
|
| 23 |
+
# Returns
|
| 24 |
+
- Modified `UnitCommitmentInstance` with 72 time periods
|
| 25 |
+
|
| 26 |
+
# Details
|
| 27 |
+
The function performs the following transformations:
|
| 28 |
+
1. **Interpolated quantities** (demands, profiled unit outputs): Linear interpolation using next day's first period
|
| 29 |
+
2. **Repeated quantities** (max_power, min_power, flow limits): Each value repeated twice
|
| 30 |
+
3. **Ramping capacities**: Halved (since time periods are half the duration)
|
| 31 |
+
4. **Time period counts** (min_uptime, min_downtime, startup delay): Doubled
|
| 32 |
+
5. **Power production costs (not the fixed startup costs)**: Halved
|
| 33 |
+
|
| 34 |
+
# Example
|
| 35 |
+
```julia
|
| 36 |
+
current_instance = convert_to_subhourly(
|
| 37 |
+
"matpower/case14/2017-01-01",
|
| 38 |
+
"matpower/case14/2017-01-02"
|
| 39 |
+
)
|
| 40 |
+
println("Total time periods: ", current_instance.time) # Should be 72
|
| 41 |
+
```
|
| 42 |
+
"""
|
| 43 |
+
function convert_to_subhourly(instance_path::AbstractString, next_day_path::AbstractString)
|
| 44 |
+
# Read instances
|
| 45 |
+
instance = read_instance(instance_path)
|
| 46 |
+
next_instance = read_instance(next_day_path)
|
| 47 |
+
|
| 48 |
+
return convert_to_subhourly(instance, next_instance)
|
| 49 |
+
end
|
| 50 |
+
|
| 51 |
+
"""
|
| 52 |
+
convert_to_subhourly(instance::UnitCommitment.UnitCommitmentInstance,
|
| 53 |
+
next_instance::UnitCommitment.UnitCommitmentInstance)
|
| 54 |
+
|
| 55 |
+
Convert a UC instance from 36 time periods to 72 time periods using instance objects.
|
| 56 |
+
"""
|
| 57 |
+
function convert_to_subhourly(instance, next_instance)
|
| 58 |
+
sc_current = instance.scenarios[1]
|
| 59 |
+
sc_next = next_instance.scenarios[1]
|
| 60 |
+
|
| 61 |
+
# Process buses - interpolate loads
|
| 62 |
+
for i in 1:length(sc_current.buses)
|
| 63 |
+
load_current = sc_current.buses[i].load
|
| 64 |
+
load_next_first = sc_next.buses[i].load[1]
|
| 65 |
+
sc_current.buses[i].load = interpolate_values(load_current, load_next_first)
|
| 66 |
+
end
|
| 67 |
+
|
| 68 |
+
# Process thermal units
|
| 69 |
+
for i in 1:length(sc_current.thermal_units)
|
| 70 |
+
unit = sc_current.thermal_units[i]
|
| 71 |
+
unit_next = sc_next.thermal_units[i]
|
| 72 |
+
|
| 73 |
+
# Repeat time-dependent vector quantities
|
| 74 |
+
unit.max_power = repeat_values(unit.max_power)
|
| 75 |
+
unit.min_power = repeat_values(unit.min_power)
|
| 76 |
+
unit.must_run = repeat_values(unit.must_run)
|
| 77 |
+
unit.min_power_cost = repeat_values(unit.min_power_cost)
|
| 78 |
+
|
| 79 |
+
# Process cost segments
|
| 80 |
+
for j in 1:length(unit.cost_segments)
|
| 81 |
+
# cost should be repeated and then halved
|
| 82 |
+
unit.cost_segments[j].cost = interpolate_values(unit.cost_segments[j].cost, unit.cost_segments[j].cost[1]) ./ 2.0
|
| 83 |
+
unit.cost_segments[j].mw = interpolate_values(unit.cost_segments[j].mw, unit.cost_segments[j].mw[1])
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
# Repeat commitment status
|
| 87 |
+
unit.commitment_status = repeat_values(unit.commitment_status)
|
| 88 |
+
|
| 89 |
+
# Halve ramping capacities per time period (since time periods are half the duration)
|
| 90 |
+
unit.ramp_up_limit = unit.ramp_up_limit / 2.0
|
| 91 |
+
unit.ramp_down_limit = unit.ramp_down_limit / 2.0
|
| 92 |
+
# Note: startup_limit and shutdown_limit are NOT modified (they are power limits, not per-period rates)
|
| 93 |
+
|
| 94 |
+
# Double time period counts
|
| 95 |
+
unit.min_uptime = unit.min_uptime * 2
|
| 96 |
+
unit.min_downtime = unit.min_downtime * 2
|
| 97 |
+
|
| 98 |
+
# Double startup delays in startup categories
|
| 99 |
+
for startup_cat in unit.startup_categories
|
| 100 |
+
startup_cat.delay = startup_cat.delay * 2
|
| 101 |
+
end
|
| 102 |
+
end
|
| 103 |
+
|
| 104 |
+
# Process transmission lines
|
| 105 |
+
for i in 1:length(sc_current.lines)
|
| 106 |
+
line = sc_current.lines[i]
|
| 107 |
+
|
| 108 |
+
# Repeat flow limits
|
| 109 |
+
line.normal_flow_limit = repeat_values(line.normal_flow_limit)
|
| 110 |
+
line.emergency_flow_limit = repeat_values(line.emergency_flow_limit)
|
| 111 |
+
line.flow_limit_penalty = repeat_values(line.flow_limit_penalty)
|
| 112 |
+
end
|
| 113 |
+
|
| 114 |
+
# Process reserves - interpolate
|
| 115 |
+
for i in 1:length(sc_current.reserves)
|
| 116 |
+
reserve = sc_current.reserves[i]
|
| 117 |
+
reserve_next = sc_next.reserves[i]
|
| 118 |
+
|
| 119 |
+
# Interpolate reserve requirements
|
| 120 |
+
reserve.amount = interpolate_values(reserve.amount, reserve_next.amount[1])
|
| 121 |
+
end
|
| 122 |
+
|
| 123 |
+
# Process price-sensitive loads - interpolate
|
| 124 |
+
for i in 1:length(sc_current.price_sensitive_loads)
|
| 125 |
+
psl = sc_current.price_sensitive_loads[i]
|
| 126 |
+
psl_next = sc_next.price_sensitive_loads[i]
|
| 127 |
+
|
| 128 |
+
# Interpolate demand and revenue
|
| 129 |
+
psl.demand = interpolate_values(psl.demand, psl_next.demand[1])
|
| 130 |
+
psl.revenue = interpolate_values(psl.revenue, psl_next.revenue[1])
|
| 131 |
+
end
|
| 132 |
+
|
| 133 |
+
# Process profiled units (renewables)
|
| 134 |
+
for i in 1:length(sc_current.profiled_units)
|
| 135 |
+
pu = sc_current.profiled_units[i]
|
| 136 |
+
pu_next = sc_next.profiled_units[i]
|
| 137 |
+
|
| 138 |
+
# Interpolate renewable profiles
|
| 139 |
+
pu.min_power = interpolate_values(pu.min_power, pu_next.min_power[1])
|
| 140 |
+
pu.max_power = interpolate_values(pu.max_power, pu_next.max_power[1])
|
| 141 |
+
pu.cost = interpolate_values(pu.cost, pu_next.cost[1])
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
# Process storage units
|
| 145 |
+
for i in 1:length(sc_current.storage_units)
|
| 146 |
+
su = sc_current.storage_units[i]
|
| 147 |
+
su_next = sc_next.storage_units[i]
|
| 148 |
+
|
| 149 |
+
# Interpolate storage levels
|
| 150 |
+
su.min_level = interpolate_values(su.min_level, su_next.min_level[1])
|
| 151 |
+
su.max_level = interpolate_values(su.max_level, su_next.max_level[1])
|
| 152 |
+
|
| 153 |
+
# Repeat other storage parameters
|
| 154 |
+
su.simultaneous_charge_and_discharge = repeat_values(su.simultaneous_charge_and_discharge)
|
| 155 |
+
su.charge_cost = interpolate_values(su.charge_cost, su_next.charge_cost[1])
|
| 156 |
+
su.discharge_cost = interpolate_values(su.discharge_cost, su_next.discharge_cost[1])
|
| 157 |
+
su.charge_efficiency = repeat_values(su.charge_efficiency)
|
| 158 |
+
su.discharge_efficiency = repeat_values(su.discharge_efficiency)
|
| 159 |
+
su.loss_factor = repeat_values(su.loss_factor)
|
| 160 |
+
|
| 161 |
+
# Repeat rate limits
|
| 162 |
+
su.min_charge_rate = repeat_values(su.min_charge_rate)
|
| 163 |
+
su.max_charge_rate = repeat_values(su.max_charge_rate)
|
| 164 |
+
su.min_discharge_rate = repeat_values(su.min_discharge_rate)
|
| 165 |
+
su.max_discharge_rate = repeat_values(su.max_discharge_rate)
|
| 166 |
+
end
|
| 167 |
+
|
| 168 |
+
# Process scenario-level fields
|
| 169 |
+
sc_current.power_balance_penalty = repeat_values(sc_current.power_balance_penalty)
|
| 170 |
+
|
| 171 |
+
# Update time count
|
| 172 |
+
sc_current.time = 72
|
| 173 |
+
instance.time = 72
|
| 174 |
+
|
| 175 |
+
return instance
|
| 176 |
+
end
|
| 177 |
+
|
| 178 |
+
"""
|
| 179 |
+
interpolate_values(values::Vector{T}, next_first::T) where T
|
| 180 |
+
|
| 181 |
+
Interpolate a vector of 36 values to 72 values using linear interpolation.
|
| 182 |
+
|
| 183 |
+
# Arguments
|
| 184 |
+
- `values::Vector{T}`: Original 36-element vector
|
| 185 |
+
- `next_first::T`: First value from the next day (for boundary interpolation)
|
| 186 |
+
|
| 187 |
+
# Returns
|
| 188 |
+
- 72-element vector with interpolated values
|
| 189 |
+
|
| 190 |
+
# Details
|
| 191 |
+
For each pair of consecutive values, inserts an interpolated midpoint.
|
| 192 |
+
Uses `next_first` to interpolate the value after the last period.
|
| 193 |
+
|
| 194 |
+
# Example
|
| 195 |
+
```julia
|
| 196 |
+
interpolate_values([10.0, 20.0, 30.0], 40.0)
|
| 197 |
+
# Returns: [10.0, 15.0, 20.0, 25.0, 30.0, 35.0]
|
| 198 |
+
```
|
| 199 |
+
"""
|
| 200 |
+
function interpolate_values(values::Vector{T}, next_first::T) where T
|
| 201 |
+
n = length(values)
|
| 202 |
+
result = Vector{T}(undef, 2 * n)
|
| 203 |
+
|
| 204 |
+
for i in 1:n-1
|
| 205 |
+
result[2*i-1] = values[i]
|
| 206 |
+
result[2*i] = (values[i] + values[i+1]) / 2
|
| 207 |
+
end
|
| 208 |
+
|
| 209 |
+
# Handle the last period using next day's first value
|
| 210 |
+
result[2*n-1] = values[n]
|
| 211 |
+
result[2*n] = (values[n] + next_first) / 2
|
| 212 |
+
|
| 213 |
+
return result
|
| 214 |
+
end
|
| 215 |
+
|
| 216 |
+
"""
|
| 217 |
+
repeat_values(values::Vector{T}) where T
|
| 218 |
+
|
| 219 |
+
Repeat each element of a 36-element vector to create a 72-element vector.
|
| 220 |
+
|
| 221 |
+
# Arguments
|
| 222 |
+
- `values::Vector{T}`: Original 36-element vector
|
| 223 |
+
|
| 224 |
+
# Returns
|
| 225 |
+
- 72-element vector with each value repeated twice
|
| 226 |
+
|
| 227 |
+
# Example
|
| 228 |
+
```julia
|
| 229 |
+
repeat_values([1, 2, 3])
|
| 230 |
+
# Returns: [1, 1, 2, 2, 3, 3]
|
| 231 |
+
```
|
| 232 |
+
"""
|
| 233 |
+
function repeat_values(values::Vector{T}) where T
|
| 234 |
+
n = length(values)
|
| 235 |
+
result = Vector{T}(undef, 2 * n)
|
| 236 |
+
|
| 237 |
+
for i in 1:n
|
| 238 |
+
result[2*i-1] = values[i]
|
| 239 |
+
result[2*i] = values[i]
|
| 240 |
+
end
|
| 241 |
+
|
| 242 |
+
return result
|
| 243 |
+
end
|
| 244 |
+
|
| 245 |
+
"""
|
| 246 |
+
read_instance(path::AbstractString)
|
| 247 |
+
|
| 248 |
+
Read a UC instance from a local file or benchmark.
|
| 249 |
+
|
| 250 |
+
# Arguments
|
| 251 |
+
- `path::AbstractString`: Path to instance file or benchmark name
|
| 252 |
+
|
| 253 |
+
# Returns
|
| 254 |
+
- `UnitCommitmentInstance` object
|
| 255 |
+
"""
|
| 256 |
+
function read_instance(path::AbstractString)
|
| 257 |
+
# Check if path exists locally with common extensions
|
| 258 |
+
if isfile(path)
|
| 259 |
+
return UnitCommitment.read(path)
|
| 260 |
+
elseif isfile(path * ".json.gz")
|
| 261 |
+
return UnitCommitment.read(path * ".json.gz")
|
| 262 |
+
elseif isfile(path * ".json")
|
| 263 |
+
return UnitCommitment.read(path * ".json")
|
| 264 |
+
else
|
| 265 |
+
# Try reading as benchmark
|
| 266 |
+
return UnitCommitment.read_benchmark(path)
|
| 267 |
+
end
|
| 268 |
+
end
|
| 269 |
+
|
| 270 |
+
end # module
|
| 271 |
+
|
src/lmp/aelmp.jl
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
using JuMP
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
function compute_lmp(
|
| 9 |
+
model::JuMP.Model,
|
| 10 |
+
method::AELMP;
|
| 11 |
+
optimizer,
|
| 12 |
+
)::OrderedDict{Tuple{String,Int},Float64}
|
| 13 |
+
|
| 14 |
+
Calculates the approximate extended locational marginal prices of the given unit commitment instance.
|
| 15 |
+
|
| 16 |
+
The AELPM does the following three things:
|
| 17 |
+
|
| 18 |
+
1. It sets the minimum power output of each generator to zero
|
| 19 |
+
2. It averages the start-up cost over the offer blocks for each generator
|
| 20 |
+
3. It relaxes all integrality constraints
|
| 21 |
+
|
| 22 |
+
Returns a dictionary mapping `(bus_name, time)` to the marginal price.
|
| 23 |
+
|
| 24 |
+
WARNING: This approximation method is not fully developed. The implementation is based on MISO Phase I only.
|
| 25 |
+
|
| 26 |
+
1. It only supports Fast Start resources. More specifically, the minimum up/down time has to be zero.
|
| 27 |
+
2. The method does NOT support time-varying start-up costs.
|
| 28 |
+
3. An asset is considered offline if it is never on throughout all time periods.
|
| 29 |
+
4. The method does NOT support multiple scenarios.
|
| 30 |
+
|
| 31 |
+
Arguments
|
| 32 |
+
---------
|
| 33 |
+
|
| 34 |
+
- `model`:
|
| 35 |
+
the UnitCommitment model, must be solved before calling this function if offline participation is not allowed.
|
| 36 |
+
|
| 37 |
+
- `method`:
|
| 38 |
+
the AELMP method.
|
| 39 |
+
|
| 40 |
+
- `optimizer`:
|
| 41 |
+
the optimizer for solving the LP problem.
|
| 42 |
+
|
| 43 |
+
Examples
|
| 44 |
+
--------
|
| 45 |
+
|
| 46 |
+
```julia
|
| 47 |
+
using UnitCommitment
|
| 48 |
+
using HiGHS
|
| 49 |
+
|
| 50 |
+
import UnitCommitment: AELMP
|
| 51 |
+
|
| 52 |
+
# Read benchmark instance
|
| 53 |
+
instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01")
|
| 54 |
+
|
| 55 |
+
# Build the model
|
| 56 |
+
model = UnitCommitment.build_model(
|
| 57 |
+
instance = instance,
|
| 58 |
+
optimizer = HiGHS.Optimizer,
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
# Optimize the model
|
| 62 |
+
UnitCommitment.optimize!(model)
|
| 63 |
+
|
| 64 |
+
# Compute the AELMPs
|
| 65 |
+
aelmp = UnitCommitment.compute_lmp(
|
| 66 |
+
model,
|
| 67 |
+
AELMP(
|
| 68 |
+
allow_offline_participation = false,
|
| 69 |
+
consider_startup_costs = true
|
| 70 |
+
),
|
| 71 |
+
optimizer = HiGHS.Optimizer
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# Access the AELMPs
|
| 75 |
+
# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot
|
| 76 |
+
# Note: although scenario is supported, the query still keeps the scenario keys for consistency.
|
| 77 |
+
@show aelmp["s1", "b1", 1]
|
| 78 |
+
```
|
| 79 |
+
"""
|
| 80 |
+
function compute_lmp(
|
| 81 |
+
model::JuMP.Model,
|
| 82 |
+
method::AELMP;
|
| 83 |
+
optimizer,
|
| 84 |
+
)::OrderedDict{Tuple{String,String,Int},Float64}
|
| 85 |
+
@info "Building the approximation model..."
|
| 86 |
+
instance = deepcopy(model[:instance])
|
| 87 |
+
_aelmp_check_parameters(instance, model, method)
|
| 88 |
+
_modify_scenario!(instance.scenarios[1], model, method)
|
| 89 |
+
|
| 90 |
+
# prepare the result dictionary and solve the model
|
| 91 |
+
elmp = OrderedDict()
|
| 92 |
+
@info "Solving the approximation model."
|
| 93 |
+
approx_model = build_model(instance = instance, variable_names = true)
|
| 94 |
+
|
| 95 |
+
# relax the binary constraint, and relax integrality
|
| 96 |
+
for v in all_variables(approx_model)
|
| 97 |
+
if is_binary(v)
|
| 98 |
+
unset_binary(v)
|
| 99 |
+
end
|
| 100 |
+
end
|
| 101 |
+
relax_integrality(approx_model)
|
| 102 |
+
set_optimizer(approx_model, optimizer)
|
| 103 |
+
|
| 104 |
+
# solve the model
|
| 105 |
+
set_silent(approx_model)
|
| 106 |
+
optimize!(approx_model)
|
| 107 |
+
|
| 108 |
+
# access the dual values
|
| 109 |
+
@info "Getting dual values (AELMPs)."
|
| 110 |
+
for (key, val) in approx_model[:eq_net_injection]
|
| 111 |
+
elmp[key] = dual(val)
|
| 112 |
+
end
|
| 113 |
+
return elmp
|
| 114 |
+
end
|
| 115 |
+
|
| 116 |
+
function _aelmp_check_parameters(
|
| 117 |
+
instance::UnitCommitmentInstance,
|
| 118 |
+
model::JuMP.Model,
|
| 119 |
+
method::AELMP,
|
| 120 |
+
)
|
| 121 |
+
# CHECK: model cannot have multiple scenarios
|
| 122 |
+
if length(instance.scenarios) > 1
|
| 123 |
+
error("The method does NOT support multiple scenarios.")
|
| 124 |
+
end
|
| 125 |
+
sc = instance.scenarios[1]
|
| 126 |
+
# CHECK: model must be solved if allow_offline_participation=false
|
| 127 |
+
if !method.allow_offline_participation
|
| 128 |
+
if isnothing(model) || !has_values(model)
|
| 129 |
+
error(
|
| 130 |
+
"A solved UC model is required if allow_offline_participation=false.",
|
| 131 |
+
)
|
| 132 |
+
end
|
| 133 |
+
end
|
| 134 |
+
all_units = sc.thermal_units
|
| 135 |
+
# CHECK: model cannot handle non-fast-starts (MISO Phase I: can ONLY solve fast-starts)
|
| 136 |
+
if any(u -> u.min_uptime > 1 || u.min_downtime > 1, all_units)
|
| 137 |
+
error(
|
| 138 |
+
"The minimum up/down time of all generators must be 1. AELMP only supports fast-starts.",
|
| 139 |
+
)
|
| 140 |
+
end
|
| 141 |
+
if any(u -> u.initial_power > 0, all_units)
|
| 142 |
+
error("The initial power of all generators must be 0.")
|
| 143 |
+
end
|
| 144 |
+
if any(u -> u.initial_status >= 0, all_units)
|
| 145 |
+
error("The initial status of all generators must be negative.")
|
| 146 |
+
end
|
| 147 |
+
# CHECK: model does not support startup costs (in time series)
|
| 148 |
+
if any(u -> length(u.startup_categories) > 1, all_units)
|
| 149 |
+
error("The method does NOT support time-varying start-up costs.")
|
| 150 |
+
end
|
| 151 |
+
end
|
| 152 |
+
|
| 153 |
+
function _modify_scenario!(
|
| 154 |
+
sc::UnitCommitmentScenario,
|
| 155 |
+
model::JuMP.Model,
|
| 156 |
+
method::AELMP,
|
| 157 |
+
)
|
| 158 |
+
# this function modifies the sc units (generators)
|
| 159 |
+
if !method.allow_offline_participation
|
| 160 |
+
# 1. remove (if NOT allowing) the offline generators
|
| 161 |
+
units_to_remove = []
|
| 162 |
+
for unit in sc.thermal_units
|
| 163 |
+
# remove based on the solved UC model result
|
| 164 |
+
# remove the unit if it is never on
|
| 165 |
+
if all(t -> value(model[:is_on][unit.name, t]) == 0, sc.time)
|
| 166 |
+
# unregister from the bus
|
| 167 |
+
filter!(x -> x.name != unit.name, unit.bus.thermal_units)
|
| 168 |
+
# unregister from the reserve
|
| 169 |
+
for r in unit.reserves
|
| 170 |
+
filter!(x -> x.name != unit.name, r.thermal_units)
|
| 171 |
+
end
|
| 172 |
+
# append the name to the remove list
|
| 173 |
+
push!(units_to_remove, unit.name)
|
| 174 |
+
end
|
| 175 |
+
end
|
| 176 |
+
# unregister the units from the remove list
|
| 177 |
+
filter!(x -> !(x.name in units_to_remove), sc.thermal_units)
|
| 178 |
+
end
|
| 179 |
+
|
| 180 |
+
for unit in sc.thermal_units
|
| 181 |
+
# 2. set min generation requirement to 0 by adding 0 to production curve and cost
|
| 182 |
+
# min_power & min_costs are vectors with dimension T
|
| 183 |
+
if unit.min_power[1] != 0
|
| 184 |
+
first_cost_segment = unit.cost_segments[1]
|
| 185 |
+
pushfirst!(
|
| 186 |
+
unit.cost_segments,
|
| 187 |
+
CostSegment(
|
| 188 |
+
ones(size(first_cost_segment.mw)) * unit.min_power[1],
|
| 189 |
+
ones(size(first_cost_segment.cost)) *
|
| 190 |
+
unit.min_power_cost[1] / unit.min_power[1],
|
| 191 |
+
),
|
| 192 |
+
)
|
| 193 |
+
unit.min_power = zeros(size(first_cost_segment.mw))
|
| 194 |
+
unit.min_power_cost = zeros(size(first_cost_segment.cost))
|
| 195 |
+
end
|
| 196 |
+
|
| 197 |
+
# 3. average the start-up costs (if considering)
|
| 198 |
+
# if consider_startup_costs = false, then use the current first_startup_cost
|
| 199 |
+
first_startup_cost = unit.startup_categories[1].cost
|
| 200 |
+
if method.consider_startup_costs
|
| 201 |
+
additional_unit_cost = first_startup_cost / unit.max_power[1]
|
| 202 |
+
for i in eachindex(unit.cost_segments)
|
| 203 |
+
unit.cost_segments[i].cost .+= additional_unit_cost
|
| 204 |
+
end
|
| 205 |
+
first_startup_cost = 0.0 # zero out the start up cost
|
| 206 |
+
end
|
| 207 |
+
unit.startup_categories =
|
| 208 |
+
StartupCategory[StartupCategory(0, first_startup_cost)]
|
| 209 |
+
end
|
| 210 |
+
return sc.thermal_units_by_name =
|
| 211 |
+
Dict(g.name => g for g in sc.thermal_units)
|
| 212 |
+
end
|
src/lmp/conventional.jl
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
|
| 2 |
+
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
|
| 3 |
+
# Released under the modified BSD license. See COPYING.md for more details.
|
| 4 |
+
|
| 5 |
+
using JuMP
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
function compute_lmp(
|
| 9 |
+
model::JuMP.Model,
|
| 10 |
+
method::ConventionalLMP;
|
| 11 |
+
optimizer,
|
| 12 |
+
)::OrderedDict{Tuple{String,String,Int},Float64}
|
| 13 |
+
|
| 14 |
+
Calculates conventional locational marginal prices of the given unit commitment
|
| 15 |
+
instance. Returns a dictionary mapping `(bus_name, time)` to the marginal price.
|
| 16 |
+
|
| 17 |
+
Arguments
|
| 18 |
+
---------
|
| 19 |
+
|
| 20 |
+
- `model`:
|
| 21 |
+
the UnitCommitment model, must be solved before calling this function.
|
| 22 |
+
|
| 23 |
+
- `method`:
|
| 24 |
+
the LMP method.
|
| 25 |
+
|
| 26 |
+
- `optimizer`:
|
| 27 |
+
the optimizer for solving the LP problem.
|
| 28 |
+
|
| 29 |
+
Examples
|
| 30 |
+
--------
|
| 31 |
+
|
| 32 |
+
```julia
|
| 33 |
+
using UnitCommitment
|
| 34 |
+
using HiGHS
|
| 35 |
+
|
| 36 |
+
import UnitCommitment: ConventionalLMP
|
| 37 |
+
|
| 38 |
+
# Read benchmark instance
|
| 39 |
+
instance = UnitCommitment.read_benchmark("matpower/case118/2018-01-01")
|
| 40 |
+
|
| 41 |
+
# Build the model
|
| 42 |
+
model = UnitCommitment.build_model(
|
| 43 |
+
instance = instance,
|
| 44 |
+
optimizer = HiGHS.Optimizer,
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
# Optimize the model
|
| 48 |
+
UnitCommitment.optimize!(model)
|
| 49 |
+
|
| 50 |
+
# Compute the LMPs using the conventional method
|
| 51 |
+
lmp = UnitCommitment.compute_lmp(
|
| 52 |
+
model,
|
| 53 |
+
ConventionalLMP(),
|
| 54 |
+
optimizer = HiGHS.Optimizer,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
# Access the LMPs
|
| 58 |
+
# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot
|
| 59 |
+
@show lmp["s1", "b1", 1]
|
| 60 |
+
```
|
| 61 |
+
"""
|
| 62 |
+
function compute_lmp(
|
| 63 |
+
model::JuMP.Model,
|
| 64 |
+
::ConventionalLMP;
|
| 65 |
+
optimizer,
|
| 66 |
+
)::OrderedDict{Tuple{String,String,Int},Float64}
|
| 67 |
+
if !has_values(model)
|
| 68 |
+
error("The UC model must be solved before calculating the LMPs.")
|
| 69 |
+
end
|
| 70 |
+
lmp = OrderedDict()
|
| 71 |
+
|
| 72 |
+
@info "Fixing binary variables and relaxing integrality..."
|
| 73 |
+
vals = Dict(v => value(v) for v in all_variables(model))
|
| 74 |
+
for v in all_variables(model)
|
| 75 |
+
if is_binary(v)
|
| 76 |
+
unset_binary(v)
|
| 77 |
+
fix(v, vals[v])
|
| 78 |
+
end
|
| 79 |
+
end
|
| 80 |
+
relax_integrality(model)
|
| 81 |
+
set_optimizer(model, optimizer)
|
| 82 |
+
|
| 83 |
+
@info "Solving the LP..."
|
| 84 |
+
JuMP.optimize!(model)
|
| 85 |
+
|
| 86 |
+
@info "Getting dual values (LMPs)..."
|
| 87 |
+
for (key, val) in model[:eq_net_injection]
|
| 88 |
+
lmp[key] = dual(val)
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
return lmp
|
| 92 |
+
end
|