From 12cf9d4b7b8ceee2f3fb71ca70dcd0941e54ea3f Mon Sep 17 00:00:00 2001 From: "Alinson S. Xavier" Date: Tue, 20 Feb 2024 15:13:02 -0600 Subject: [PATCH] Update docs --- docs/make.jl | 19 +- docs/src/api.md | 3 +- docs/src/format.md | 408 ---------------------------- docs/src/guides/format.md | 380 ++++++++++++++++++++++++++ docs/src/guides/instances.md | 289 ++++++++++++++++++++ docs/src/guides/model.md | 78 ++++++ docs/src/{ => guides}/problem.md | 176 ++++++------ docs/src/index.md | 36 +-- docs/src/instances.md | 303 --------------------- docs/src/model.md | 233 ---------------- docs/src/tutorials/customizing.md | 182 +++++++++++++ docs/src/tutorials/decomposition.md | 105 +++++++ docs/src/tutorials/market.md | 115 ++++++++ docs/src/tutorials/usage.md | 119 ++++++++ docs/src/usage.md | 381 -------------------------- src/instance/read.jl | 2 +- 16 files changed, 1386 insertions(+), 1443 deletions(-) delete mode 100644 docs/src/format.md create mode 100644 docs/src/guides/format.md create mode 100644 docs/src/guides/instances.md create mode 100644 docs/src/guides/model.md rename docs/src/{ => guides}/problem.md (66%) delete mode 100644 docs/src/instances.md delete mode 100644 docs/src/model.md create mode 100644 docs/src/tutorials/customizing.md create mode 100644 docs/src/tutorials/decomposition.md create mode 100644 docs/src/tutorials/market.md create mode 100644 docs/src/tutorials/usage.md delete mode 100644 docs/src/usage.md diff --git a/docs/make.jl b/docs/make.jl index 1d98256..b00ff2b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -5,12 +5,19 @@ function make() sitename = "UnitCommitment.jl", pages = [ "Home" => "index.md", - "problem.md", - # "usage.md", - # "format.md", - # "instances.md", - # "model.md", - # "api.md", + "Tutorials" => [ + "tutorials/usage.md", + "tutorials/customizing.md", + "tutorials/market.md", + "tutorials/decomposition.md", + ], + "User guide" => [ + "guides/problem.md", + "guides/format.md", + "guides/instances.md", + "guides/model.md", + ], + "api.md", ], format = Documenter.HTML(assets = ["assets/custom.css"]), ) diff --git a/docs/src/api.md b/docs/src/api.md index 3445717..e6a26ba 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -15,17 +15,18 @@ UnitCommitment.write ## Locational Marginal Prices ### Conventional LMPs + ```@docs UnitCommitment.compute_lmp(::JuMP.Model,::UnitCommitment.ConventionalLMP) ``` ### Approximated Extended LMPs + ```@docs UnitCommitment.AELMP UnitCommitment.compute_lmp(::JuMP.Model,::UnitCommitment.AELMP) ``` - ## Modify instance ```@docs diff --git a/docs/src/format.md b/docs/src/format.md deleted file mode 100644 index 6714862..0000000 --- a/docs/src/format.md +++ /dev/null @@ -1,408 +0,0 @@ -Data Format -=========== - -Input Data Format ------------------ - -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". - -* [Parameters](#Parameters) -* [Buses](#Buses) -* [Generators](#Generators) -* [Storage units](#Storage-units) -* [Price-sensitive loads](#Price-sensitive-loads) -* [Transmission lines](#Transmission-lines) -* [Reserves](#Reserves) -* [Contingencies](#Contingencies) - -Each section is described in detail below. See [case118/2017-01-01.json.gz](https://axavier.org/UnitCommitment.jl/0.3/instances/matpower/case118/2017-01-01.json.gz) for a complete example. - -### Parameters - -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. - -| Key | Description | Default | Time series? | Uncertain? -| :----------------------------- | :------------------------------------------------ | :------: | :------------:| :----------: -| `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 -| `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 -| `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 -| `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 -| `Scenario name` | Name of the scenario. | `"s1"` | No | --- -| `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 | --- - - -#### Example -```json -{ - "Parameters": { - "Version": "0.3", - "Time horizon (h)": 4, - "Power balance penalty ($/MW)": 1000.0, - "Scenario name": "s1", - "Scenario weight": 0.5 - } -} -``` - -### Buses - -This section describes the characteristics of each bus in the system. - -| Key | Description | Default | Time series? | Uncertain? -| :----------------- | :------------------------------------------------------------ | ------- | :-----------: | :---: -| `Load (MW)` | Fixed load connected to the bus (in MW). | Required | Yes | Yes - - -#### Example -```json -{ - "Buses": { - "b1": { - "Load (MW)": 0.0 - }, - "b2": { - "Load (MW)": [ - 26.01527, - 24.46212, - 23.29725, - 22.90897 - ] - } - } -} -``` - - -### Generators - -This section describes all generators in the system. Two types of units can be specified: - -- **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. -- **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. - -#### Thermal Units - -| Key | Description | Default | Time series? | Uncertain? -| :------------------------ | :------------------------------------------------| ------- | :-----------: | :---: -| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes -| `Type` | Type of the generator (string). For thermal generators, this must be `Thermal`. | Required | No | No -| `Production cost curve (MW)` and `Production cost curve ($)` | Parameters describing the piecewise-linear production costs. See below for more details. | Required | Yes | Yes -| `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 -| `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 -| `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 -| `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 -| `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 -| `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 -| `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 -| `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 -| `Initial power (MW)` | Amount of power the generator at time step `-1`, immediately before the planning horizon starts. | Required | No | No -| `Must run?` | If `true`, the generator should be committed, even if that is not economical (Boolean). | `false` | Yes | Yes -| `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 -| `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 - -#### Profiled Units - -| Key | Description | Default | Time series? | Uncertain? -| :---------------- | :------------------------------------------------ | :------: | :------------: | :---: -| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes -| `Type` | Type of the generator (string). For profiled generators, this must be `Profiled`. | Required | No | No -| `Cost ($/MW)` | Cost incurred for serving each MW of power by this generator. | Required | Yes | Yes -| `Minimum power (MW)` | Minimum amount of power this generator may supply. | `0.0` | Yes | Yes -| `Maximum power (MW)` | Maximum amount of power this generator may supply. | Required | Yes | Yes - -#### Production costs and limits - -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]`. -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. - -```@raw html -
- -
Figure 1. Piecewise-linear production cost curve.
-
-
-``` - -#### Additional remarks: - -* 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. -* There is no limit to the number of piecewise-linear segments, and different generators may have a different number of segments. -* 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]`. -* Production cost curves must be convex. - -#### Example - -```json -{ - "Generators": { - "gen1": { - "Bus": "b1", - "Type": "Thermal", - "Production cost curve (MW)": [100.0, 110.0, 130.0, 135.0], - "Production cost curve ($)": [1400.0, 1600.0, 2200.0, 2400.0], - "Startup costs ($)": [300.0, 400.0], - "Startup delays (h)": [1, 4], - "Ramp up limit (MW)": 232.68, - "Ramp down limit (MW)": 232.68, - "Startup limit (MW)": 232.68, - "Shutdown limit (MW)": 232.68, - "Minimum downtime (h)": 4, - "Minimum uptime (h)": 4, - "Initial status (h)": 12, - "Initial power (MW)": 115, - "Must run?": false, - "Reserve eligibility": ["r1"] - }, - "gen2": { - "Bus": "b5", - "Type": "Thermal", - "Production cost curve (MW)": [0.0, [10.0, 8.0, 0.0, 3.0]], - "Production cost curve ($)": [0.0, 0.0], - "Initial status (h)": -100, - "Initial power (MW)": 0, - "Reserve eligibility": ["r1", "r2"], - "Commitment status": [true, false, null, true] - }, - "gen3": { - "Bus": "b6", - "Type": "Profiled", - "Minimum power (MW)": 10.0, - "Maximum power (MW)": 120.0, - "Cost ($/MW)": 100.0 - } - } -} -``` - -### Storage units - -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. - -| Key | Description | Default | Time series? | Uncertain? -| :---------------- | :------------------------------------------------ | :------: | :------------: | :----: -| `Bus` | Bus where the storage unit is located. Multiple storage units may be placed at the same bus. | Required | No | Yes -| `Minimum level (MWh)` | Minimum of energy level this storage unit may contain. | `0.0` | Yes | Yes -| `Maximum level (MWh)` | Maximum of energy level this storage unit may contain. | Required | Yes | Yes -| `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 -| `Charge cost ($/MW)` | Cost incurred for charging each MW of power into this storage unit. | Required | Yes | Yes -| `Discharge cost ($/MW)` | Cost incurred for discharging each MW of power from this storage unit. | Required | Yes | Yes -| `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 -| `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 -| `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 -| `Minimum charge rate (MW)` | Minimum amount of power rate this storage unit may charge. | `0.0` | Yes | Yes -| `Maximum charge rate (MW)` | Maximum amount of power rate this storage unit may charge. | Required | Yes | Yes -| `Minimum discharge rate (MW)` | Minimum amount of power rate this storage unit may discharge. | `0.0` | Yes | Yes -| `Maximum discharge rate (MW)` | Maximum amount of power rate this storage unit may discharge. | Required | Yes | Yes -| `Initial level (MWh)` | Amount of energy this storage unit at time step `-1`, immediately before the planning horizon starts. | `0.0` | No | Yes -| `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 -| `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 - -#### Example -```json -{ - "Storage units": { - "su1": { - "Bus": "b2", - "Maximum level (MWh)": 100.0, - "Charge cost ($/MW)": 2.0, - "Discharge cost ($/MW)": 2.5, - "Maximum charge rate (MW)": 10.0, - "Maximum discharge rate (MW)": 8.0 - }, - "su2": { - "Bus": "b2", - "Minimum level (MWh)": 10.0, - "Maximum level (MWh)": 100.0, - "Allow simultaneous charging and discharging": false, - "Charge cost ($/MW)": 3.0, - "Discharge cost ($/MW)": 3.5, - "Charge efficiency": 0.8, - "Discharge efficiency": 0.85, - "Loss factor": 0.01, - "Minimum charge rate (MW)": 5.0, - "Maximum charge rate (MW)": 10.0, - "Minimum discharge rate (MW)": 2.0, - "Maximum discharge rate (MW)": 10.0, - "Initial level (MWh)": 70.0, - "Last period minimum level (MWh)": 80.0, - "Last period maximum level (MWh)": 85.0 - }, - "su3": { - "Bus": "b9", - "Minimum level (MWh)": [10.0, 11.0, 12.0, 13.0], - "Maximum level (MWh)": [100.0, 110.0, 120.0, 130.0], - "Allow simultaneous charging and discharging": [false, false, true, true], - "Charge cost ($/MW)": [2.0, 2.1, 2.2, 2.3], - "Discharge cost ($/MW)": [1.0, 1.1, 1.2, 1.3], - "Charge efficiency": [0.8, 0.81, 0.82, 0.82], - "Discharge efficiency": [0.85, 0.86, 0.87, 0.88], - "Loss factor": [0.01, 0.01, 0.02, 0.02], - "Minimum charge rate (MW)": [5.0, 5.1, 5.2, 5.3], - "Maximum charge rate (MW)": [10.0, 10.1, 10.2, 10.3], - "Minimum discharge rate (MW)": [4.0, 4.1, 4.2, 4.3], - "Maximum discharge rate (MW)": [8.0, 8.1, 8.2, 8.3], - "Initial level (MWh)": 20.0, - "Last period minimum level (MWh)": 21.0, - "Last period maximum level (MWh)": 22.0 - } - } -} -``` - -### Price-sensitive loads - -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. - -| Key | Description | Default | Time series? | Uncertain? -| :---------------- | :------------------------------------------------ | :------: | :------------: | :----: -| `Bus` | Bus where the load is located. Multiple price-sensitive loads may be placed at the same bus. | Required | No | Yes -| `Revenue ($/MW)` | Revenue obtained for serving each MW of power to this load. | Required | Yes | Yes -| `Demand (MW)` | Maximum amount of power required by this load. Any amount lower than this may be served. | Required | Yes | Yes - - -#### Example -```json -{ - "Price-sensitive loads": { - "p1": { - "Bus": "b3", - "Revenue ($/MW)": 23.0, - "Demand (MW)": 50.0 - } - } -} -``` - -### Transmission lines - -This section describes the characteristics of transmission system, such as its topology and the susceptance of each transmission line. - -| Key | Description | Default | Time series? | Uncertain? -| :--------------------- | :----------------------------------------------- | ------- | :------------: | :---: -| `Source bus` | Identifier of the bus where the transmission line originates. | Required | No | Yes -| `Target bus` | Identifier of the bus where the transmission line reaches. | Required | No | Yes -| `Susceptance (S)` | Susceptance of the transmission line (in siemens). | Required | No | Yes -| `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 -| `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 -| `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 - -#### Example - -```json -{ - "Transmission lines": { - "l1": { - "Source bus": "b1", - "Target bus": "b2", - "Susceptance (S)": 29.49686, - "Normal flow limit (MW)": 15000.0, - "Emergency flow limit (MW)": 20000.0, - "Flow limit penalty ($/MW)": 5000.0 - } - } -} -``` - - -### Reserves - -This section describes the hourly amount of reserves required. - - -| Key | Description | Default | Time series? | Uncertain? -| :-------------------- | :------------------------------------------------- | --------- | :----: | :---: -| `Type` | Type of reserve product. Must be either "spinning" or "flexiramp". | Required | No | No -| `Amount (MW)` | Amount of reserves required. | Required | Yes | Yes -| `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 - -#### Example 1 - -```json -{ - "Reserves": { - "r1": { - "Type": "spinning", - "Amount (MW)": [ - 57.30552, - 53.88429, - 51.31838, - 50.46307 - ], - "Shortfall penalty ($/MW)": 5.0 - }, - "r2": { - "Type": "flexiramp", - "Amount (MW)": [ - 20.31042, - 23.65273, - 27.41784, - 25.34057 - ], - } - } -} -``` - -### Contingencies - -This section describes credible contingency scenarios in the optimization, such as the loss of a transmission line or generator. - -| Key | Description | Default | Uncertain? -| :-------------------- | :----------------------------------------------- | :--------: | :---: -| `Affected generators` | List of generators affected by this contingency. May be omitted if no generators are affected. | `[]` | Yes -| `Affected lines` | List of transmission lines affected by this contingency. May be omitted if no lines are affected. | `[]` | Yes - -#### Example - -```json -{ - "Contingencies": { - "c1": { - "Affected lines": ["l1", "l2", "l3"], - "Affected generators": ["g1"] - }, - "c2": { - "Affected lines": ["l4"] - }, - } -} -``` - -### Additional remarks - -#### Time series parameters - -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`: - -```json -{ - "Load (MW)": 800.0, - "Load (MW)": [800.0, 850.0, 730.0] -} -``` - -The value `T` depends on both `Time horizon (h)` and `Time step (min)`, as the table below illustrates. - -Time horizon (h) | Time step (min) | T -:---------------:|:---------------:|:----: -24 | 60 | 24 -24 | 15 | 96 -24 | 5 | 288 -36 | 60 | 36 -36 | 15 | 144 -36 | 5 | 432 - -Output Data Format ------------------- - -The output data format is also JSON-based, but it is not currently documented since we expect it to change significantly in a future version of the package. - - -Current limitations -------------------- - -* Network topology must remain the same for all time periods. -* Only N-1 transmission contingencies are supported. Generator contingencies are not currently supported. -* Time-varying minimum production amounts are not currently compatible with ramp/startup/shutdown limits. -* Flexible ramping products can only be acquired under the `WanHob2016` formulation, which does not support spinning reserves. -* The set of generators must be the same in all scenarios. diff --git a/docs/src/guides/format.md b/docs/src/guides/format.md new file mode 100644 index 0000000..663ce45 --- /dev/null +++ b/docs/src/guides/format.md @@ -0,0 +1,380 @@ +# JSON data format + +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". + +- [Parameters](#Parameters) +- [Buses](#Buses) +- [Generators](#Generators) +- [Storage units](#Storage-units) +- [Price-sensitive loads](#Price-sensitive-loads) +- [Transmission lines](#Transmission-lines) +- [Reserves](#Reserves) +- [Contingencies](#Contingencies) + +Each section is described in detail below. See [case118/2017-01-01.json.gz](https://axavier.org/UnitCommitment.jl/0.3/instances/matpower/case118/2017-01-01.json.gz) for a complete example. + +### Parameters + +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. + +| Key | Description | Default | Time series? | Uncertain? | +| :----------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | :----------: | :--------: | +| `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 | +| `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 | +| `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 | +| `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 | +| `Scenario name` | Name of the scenario. | `"s1"` | No | --- | +| `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 | --- | + +#### Example + +```json +{ + "Parameters": { + "Version": "0.3", + "Time horizon (h)": 4, + "Power balance penalty ($/MW)": 1000.0, + "Scenario name": "s1", + "Scenario weight": 0.5 + } +} +``` + +### Buses + +This section describes the characteristics of each bus in the system. + +| Key | Description | Default | Time series? | Uncertain? | +| :---------- | :--------------------------------------- | -------- | :----------: | :--------: | +| `Load (MW)` | Fixed load connected to the bus (in MW). | Required | Yes | Yes | + +#### Example + +```json +{ + "Buses": { + "b1": { + "Load (MW)": 0.0 + }, + "b2": { + "Load (MW)": [26.01527, 24.46212, 23.29725, 22.90897] + } + } +} +``` + +### Generators + +This section describes all generators in the system. Two types of units can be specified: + +- **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. +- **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. + +#### Thermal Units + +| Key | Description | Default | Time series? | Uncertain? | +| :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | :----------: | :--------: | +| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes | +| `Type` | Type of the generator (string). For thermal generators, this must be `Thermal`. | Required | No | No | +| `Production cost curve (MW)` and `Production cost curve ($)` | Parameters describing the piecewise-linear production costs. See below for more details. | Required | Yes | Yes | +| `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 | +| `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 | +| `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 | +| `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 | +| `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 | +| `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 | +| `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 | +| `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 | +| `Initial power (MW)` | Amount of power the generator at time step `-1`, immediately before the planning horizon starts. | Required | No | No | +| `Must run?` | If `true`, the generator should be committed, even if that is not economical (Boolean). | `false` | Yes | Yes | +| `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 | +| `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 | + +#### Profiled Units + +| Key | Description | Default | Time series? | Uncertain? | +| :------------------- | :-------------------------------------------------------------------------------- | :------: | :----------: | :--------: | +| `Bus` | Identifier of the bus where this generator is located (string). | Required | No | Yes | +| `Type` | Type of the generator (string). For profiled generators, this must be `Profiled`. | Required | No | No | +| `Cost ($/MW)` | Cost incurred for serving each MW of power by this generator. | Required | Yes | Yes | +| `Minimum power (MW)` | Minimum amount of power this generator may supply. | `0.0` | Yes | Yes | +| `Maximum power (MW)` | Maximum amount of power this generator may supply. | Required | Yes | Yes | + +#### Production costs and limits + +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]`. +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. + +```@raw html +
+ +
Figure 1. Piecewise-linear production cost curve.
+
+
+``` + +#### Additional remarks: + +- 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. +- There is no limit to the number of piecewise-linear segments, and different generators may have a different number of segments. +- 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]`. +- Production cost curves must be convex. + +#### Example + +```json +{ + "Generators": { + "gen1": { + "Bus": "b1", + "Type": "Thermal", + "Production cost curve (MW)": [100.0, 110.0, 130.0, 135.0], + "Production cost curve ($)": [1400.0, 1600.0, 2200.0, 2400.0], + "Startup costs ($)": [300.0, 400.0], + "Startup delays (h)": [1, 4], + "Ramp up limit (MW)": 232.68, + "Ramp down limit (MW)": 232.68, + "Startup limit (MW)": 232.68, + "Shutdown limit (MW)": 232.68, + "Minimum downtime (h)": 4, + "Minimum uptime (h)": 4, + "Initial status (h)": 12, + "Initial power (MW)": 115, + "Must run?": false, + "Reserve eligibility": ["r1"] + }, + "gen2": { + "Bus": "b5", + "Type": "Thermal", + "Production cost curve (MW)": [0.0, [10.0, 8.0, 0.0, 3.0]], + "Production cost curve ($)": [0.0, 0.0], + "Initial status (h)": -100, + "Initial power (MW)": 0, + "Reserve eligibility": ["r1", "r2"], + "Commitment status": [true, false, null, true] + }, + "gen3": { + "Bus": "b6", + "Type": "Profiled", + "Minimum power (MW)": 10.0, + "Maximum power (MW)": 120.0, + "Cost ($/MW)": 100.0 + } + } +} +``` + +### Storage units + +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. + +| Key | Description | Default | Time series? | Uncertain? | +| :-------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------: | :----------: | :--------: | +| `Bus` | Bus where the storage unit is located. Multiple storage units may be placed at the same bus. | Required | No | Yes | +| `Minimum level (MWh)` | Minimum of energy level this storage unit may contain. | `0.0` | Yes | Yes | +| `Maximum level (MWh)` | Maximum of energy level this storage unit may contain. | Required | Yes | Yes | +| `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 | +| `Charge cost ($/MW)` | Cost incurred for charging each MW of power into this storage unit. | Required | Yes | Yes | +| `Discharge cost ($/MW)` | Cost incurred for discharging each MW of power from this storage unit. | Required | Yes | Yes | +| `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 | +| `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 | +| `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 | +| `Minimum charge rate (MW)` | Minimum amount of power rate this storage unit may charge. | `0.0` | Yes | Yes | +| `Maximum charge rate (MW)` | Maximum amount of power rate this storage unit may charge. | Required | Yes | Yes | +| `Minimum discharge rate (MW)` | Minimum amount of power rate this storage unit may discharge. | `0.0` | Yes | Yes | +| `Maximum discharge rate (MW)` | Maximum amount of power rate this storage unit may discharge. | Required | Yes | Yes | +| `Initial level (MWh)` | Amount of energy this storage unit at time step `-1`, immediately before the planning horizon starts. | `0.0` | No | Yes | +| `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 | +| `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 | + +#### Example + +```json +{ + "Storage units": { + "su1": { + "Bus": "b2", + "Maximum level (MWh)": 100.0, + "Charge cost ($/MW)": 2.0, + "Discharge cost ($/MW)": 2.5, + "Maximum charge rate (MW)": 10.0, + "Maximum discharge rate (MW)": 8.0 + }, + "su2": { + "Bus": "b2", + "Minimum level (MWh)": 10.0, + "Maximum level (MWh)": 100.0, + "Allow simultaneous charging and discharging": false, + "Charge cost ($/MW)": 3.0, + "Discharge cost ($/MW)": 3.5, + "Charge efficiency": 0.8, + "Discharge efficiency": 0.85, + "Loss factor": 0.01, + "Minimum charge rate (MW)": 5.0, + "Maximum charge rate (MW)": 10.0, + "Minimum discharge rate (MW)": 2.0, + "Maximum discharge rate (MW)": 10.0, + "Initial level (MWh)": 70.0, + "Last period minimum level (MWh)": 80.0, + "Last period maximum level (MWh)": 85.0 + }, + "su3": { + "Bus": "b9", + "Minimum level (MWh)": [10.0, 11.0, 12.0, 13.0], + "Maximum level (MWh)": [100.0, 110.0, 120.0, 130.0], + "Allow simultaneous charging and discharging": [false, false, true, true], + "Charge cost ($/MW)": [2.0, 2.1, 2.2, 2.3], + "Discharge cost ($/MW)": [1.0, 1.1, 1.2, 1.3], + "Charge efficiency": [0.8, 0.81, 0.82, 0.82], + "Discharge efficiency": [0.85, 0.86, 0.87, 0.88], + "Loss factor": [0.01, 0.01, 0.02, 0.02], + "Minimum charge rate (MW)": [5.0, 5.1, 5.2, 5.3], + "Maximum charge rate (MW)": [10.0, 10.1, 10.2, 10.3], + "Minimum discharge rate (MW)": [4.0, 4.1, 4.2, 4.3], + "Maximum discharge rate (MW)": [8.0, 8.1, 8.2, 8.3], + "Initial level (MWh)": 20.0, + "Last period minimum level (MWh)": 21.0, + "Last period maximum level (MWh)": 22.0 + } + } +} +``` + +### Price-sensitive loads + +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. + +| Key | Description | Default | Time series? | Uncertain? | +| :--------------- | :------------------------------------------------------------------------------------------- | :------: | :----------: | :--------: | +| `Bus` | Bus where the load is located. Multiple price-sensitive loads may be placed at the same bus. | Required | No | Yes | +| `Revenue ($/MW)` | Revenue obtained for serving each MW of power to this load. | Required | Yes | Yes | +| `Demand (MW)` | Maximum amount of power required by this load. Any amount lower than this may be served. | Required | Yes | Yes | + +#### Example + +```json +{ + "Price-sensitive loads": { + "p1": { + "Bus": "b3", + "Revenue ($/MW)": 23.0, + "Demand (MW)": 50.0 + } + } +} +``` + +### Transmission lines + +This section describes the characteristics of transmission system, such as its topology and the susceptance of each transmission line. + +| Key | Description | Default | Time series? | Uncertain? | +| :-------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | :----------: | :--------: | +| `Source bus` | Identifier of the bus where the transmission line originates. | Required | No | Yes | +| `Target bus` | Identifier of the bus where the transmission line reaches. | Required | No | Yes | +| `Susceptance (S)` | Susceptance of the transmission line (in siemens). | Required | No | Yes | +| `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 | +| `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 | +| `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 | + +#### Example + +```json +{ + "Transmission lines": { + "l1": { + "Source bus": "b1", + "Target bus": "b2", + "Susceptance (S)": 29.49686, + "Normal flow limit (MW)": 15000.0, + "Emergency flow limit (MW)": 20000.0, + "Flow limit penalty ($/MW)": 5000.0 + } + } +} +``` + +### Reserves + +This section describes the hourly amount of reserves required. + +| Key | Description | Default | Time series? | Uncertain? | +| :------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | :----------: | :--------: | +| `Type` | Type of reserve product. Must be either "spinning" or "flexiramp". | Required | No | No | +| `Amount (MW)` | Amount of reserves required. | Required | Yes | Yes | +| `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 | + +#### Example 1 + +```json +{ + "Reserves": { + "r1": { + "Type": "spinning", + "Amount (MW)": [57.30552, 53.88429, 51.31838, 50.46307], + "Shortfall penalty ($/MW)": 5.0 + }, + "r2": { + "Type": "flexiramp", + "Amount (MW)": [20.31042, 23.65273, 27.41784, 25.34057] + } + } +} +``` + +### Contingencies + +This section describes credible contingency scenarios in the optimization, such as the loss of a transmission line or generator. + +| Key | Description | Default | Uncertain? | +| :-------------------- | :------------------------------------------------------------------------------------------------ | :-----: | :--------: | +| `Affected generators` | List of generators affected by this contingency. May be omitted if no generators are affected. | `[]` | Yes | +| `Affected lines` | List of transmission lines affected by this contingency. May be omitted if no lines are affected. | `[]` | Yes | + +#### Example + +```json +{ + "Contingencies": { + "c1": { + "Affected lines": ["l1", "l2", "l3"], + "Affected generators": ["g1"] + }, + "c2": { + "Affected lines": ["l4"] + } + } +} +``` + +### Additional remarks + +#### Time series parameters + +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`: + +```json +{ + "Load (MW)": 800.0, + "Load (MW)": [800.0, 850.0, 730.0] +} +``` + +The value `T` depends on both `Time horizon (h)` and `Time step (min)`, as the table below illustrates. + +| Time horizon (h) | Time step (min) | T | +| :--------------: | :-------------: | :-: | +| 24 | 60 | 24 | +| 24 | 15 | 96 | +| 24 | 5 | 288 | +| 36 | 60 | 36 | +| 36 | 15 | 144 | +| 36 | 5 | 432 | + +## Current limitations + +- Network topology must remain the same for all time periods. +- Only N-1 transmission contingencies are supported. Generator contingencies are not currently supported. +- Time-varying minimum production amounts are not currently compatible with ramp/startup/shutdown limits. +- Flexible ramping products can only be acquired under the `WanHob2016` formulation, which does not support spinning reserves. +- The set of generators must be the same in all scenarios. diff --git a/docs/src/guides/instances.md b/docs/src/guides/instances.md new file mode 100644 index 0000000..0ad0f49 --- /dev/null +++ b/docs/src/guides/instances.md @@ -0,0 +1,289 @@ +# Benchmark instances + +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.3/instances/). + +!!! warning + + 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. + +## MATPOWER + +[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. + +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: + +- **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. + +- **Load profiles** were generated using a similar data-driven approach. + +- **Ramp-up, ramp-down, startup and shutdown rates** were set to a fixed proportion of the generator's maximum output. + +- **Minimum reserves** were set to a fixed proportion of the total demand. + +- **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. + +For each MATPOWER test case, UC.jl provides 365 variations (`2017-01-01` to `2017-12-31`) corresponding different days of the year. + +### MATPOWER/UW-PSTCA + +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. + +| Name | Buses | Generators | Lines | Contingencies | References | +| ----------------------------- | ----- | ---------- | ----- | ------------- | -------------- | +| `matpower/case14/2017-01-01` | 14 | 5 | 20 | 19 | [MTPWR, PSTCA] | +| `matpower/case30/2017-01-01` | 30 | 6 | 41 | 38 | [MTPWR, PSTCA] | +| `matpower/case57/2017-01-01` | 57 | 7 | 80 | 79 | [MTPWR, PSTCA] | +| `matpower/case118/2017-01-01` | 118 | 54 | 186 | 177 | [MTPWR, PSTCA] | +| `matpower/case300/2017-01-01` | 300 | 69 | 411 | 320 | [MTPWR, PSTCA] | + +### MATPOWER/Polish + +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. + +| Name | Buses | Generators | Lines | Contingencies | References | +| --------------------------------- | ----- | ---------- | ----- | ------------- | ---------- | +| `matpower/case2383wp/2017-01-01` | 2383 | 323 | 2896 | 2240 | [MTPWR] | +| `matpower/case2736sp/2017-01-01` | 2736 | 289 | 3504 | 3159 | [MTPWR] | +| `matpower/case2737sop/2017-01-01` | 2737 | 267 | 3506 | 3161 | [MTPWR] | +| `matpower/case2746wop/2017-01-01` | 2746 | 443 | 3514 | 3155 | [MTPWR] | +| `matpower/case2746wp/2017-01-01` | 2746 | 457 | 3514 | 3156 | [MTPWR] | +| `matpower/case3012wp/2017-01-01` | 3012 | 496 | 3572 | 2854 | [MTPWR] | +| `matpower/case3120sp/2017-01-01` | 3120 | 483 | 3693 | 2950 | [MTPWR] | +| `matpower/case3375wp/2017-01-01` | 3374 | 590 | 4161 | 3245 | [MTPWR] | + +### MATPOWER/PEGASE + +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. + +| Name | Buses | Generators | Lines | Contingencies | References | +| ------------------------------------- | ----- | ---------- | ----- | ------------- | --------------------------- | +| `matpower/case89pegase/2017-01-01` | 89 | 12 | 210 | 192 | [JoFlMa16, FlPaCa13, MTPWR] | +| `matpower/case1354pegase/2017-01-01` | 1354 | 260 | 1991 | 1288 | [JoFlMa16, FlPaCa13, MTPWR] | +| `matpower/case2869pegase/2017-01-01` | 2869 | 510 | 4582 | 3579 | [JoFlMa16, FlPaCa13, MTPWR] | +| `matpower/case9241pegase/2017-01-01` | 9241 | 1445 | 16049 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] | +| `matpower/case13659pegase/2017-01-01` | 13659 | 4092 | 20467 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] | + +### MATPOWER/RTE + +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. + +| Name | Buses | Generators | Lines | Contingencies | References | +| --------------------------------- | ----- | ---------- | ----- | ------------- | ----------------- | +| `matpower/case1888rte/2017-01-01` | 1888 | 296 | 2531 | 1484 | [MTPWR, JoFlMa16] | +| `matpower/case1951rte/2017-01-01` | 1951 | 390 | 2596 | 1497 | [MTPWR, JoFlMa16] | +| `matpower/case2848rte/2017-01-01` | 2848 | 544 | 3776 | 2242 | [MTPWR, JoFlMa16] | +| `matpower/case2868rte/2017-01-01` | 2868 | 596 | 3808 | 2260 | [MTPWR, JoFlMa16] | +| `matpower/case6468rte/2017-01-01` | 6468 | 1262 | 9000 | 6094 | [MTPWR, JoFlMa16] | +| `matpower/case6470rte/2017-01-01` | 6470 | 1306 | 9005 | 6085 | [MTPWR, JoFlMa16] | +| `matpower/case6495rte/2017-01-01` | 6495 | 1352 | 9019 | 6060 | [MTPWR, JoFlMa16] | +| `matpower/case6515rte/2017-01-01` | 6515 | 1368 | 9037 | 6063 | [MTPWR, JoFlMa16] | + +## PGLIB-UC Instances + +[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]. + +### PGLIB-UC/California + +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). + +| Name | Buses | Generators | Lines | Contingencies | References | +| ------------------------------------ | ----- | ---------- | ----- | ------------- | ---------- | +| `pglib-uc/ca/2014-09-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-09-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-09-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-09-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-12-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-12-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-12-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2014-12-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-03-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-03-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-03-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-03-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-06-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-06-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-06-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/2015-06-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/Scenario400_reserves_0` | 1 | 611 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/Scenario400_reserves_1` | 1 | 611 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/Scenario400_reserves_3` | 1 | 611 | 0 | 0 | [KnOsWa20] | +| `pglib-uc/ca/Scenario400_reserves_5` | 1 | 611 | 0 | 0 | [KnOsWa20] | + +### PGLIB-UC/FERC + +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). + +| Name | Buses | Generators | Lines | Contingencies | References | +| ----------------------------- | ----- | ---------- | ----- | ------------- | -------------------- | +| `pglib-uc/ferc/2015-01-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-01-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-02-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-02-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-03-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-03-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-04-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-04-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-05-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-05-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-06-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-06-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-07-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-07-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-08-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-08-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-09-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-09-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-10-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-10-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-11-02_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-11-02_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-12-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | +| `pglib-uc/ferc/2015-12-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] | + +### PGLIB-UC/RTS-GMLC + +[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). + +| Name | Buses | Generators | Lines | Contingencies | References | +| ------------------------------ | ----- | ---------- | ----- | ------------- | ---------- | +| `pglib-uc/rts_gmlc/2020-01-27` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-02-09` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-03-05` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-04-03` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-05-05` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-06-09` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-07-06` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-08-12` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-09-20` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-10-27` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-11-25` | 1 | 154 | 0 | 0 | [BaBlEh19] | +| `pglib-uc/rts_gmlc/2020-12-23` | 1 | 154 | 0 | 0 | [BaBlEh19] | + +## OR-LIB/UC + +[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. + +| Name | Hours | Buses | Generators | Lines | Contingencies | References | +| ------------------- | ----- | ----- | ---------- | ----- | ------------- | --------------- | +| `or-lib/10_0_1_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/10_0_2_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/10_0_3_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/10_0_4_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/10_0_5_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/20_0_1_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/20_0_2_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/20_0_3_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/20_0_4_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/20_0_5_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/50_0_1_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/50_0_2_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/50_0_3_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/50_0_4_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/50_0_5_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/75_0_1_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/75_0_2_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/75_0_3_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/75_0_4_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/75_0_5_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/100_0_1_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/100_0_2_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/100_0_3_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/100_0_4_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/100_0_5_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/150_0_1_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/150_0_2_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/150_0_3_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/150_0_4_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/150_0_5_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_10_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_11_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_12_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_1_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_2_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_3_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_4_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_5_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_6_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_7_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_8_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | +| `or-lib/200_0_9_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] | + +## Tejada19 + +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. + +| Name | Hours | Buses | Generators | Lines | Contingencies | References | +| ----------------------- | ----- | ----- | ---------- | ----- | ------------- | ---------- | +| `tejada19/UC_24h_214g` | 24 | 1 | 214 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_250g` | 24 | 1 | 250 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_290g` | 24 | 1 | 290 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_480g` | 24 | 1 | 480 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_505g` | 24 | 1 | 505 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_623g` | 24 | 1 | 623 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_647g` | 24 | 1 | 647 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_836g` | 24 | 1 | 836 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_850g` | 24 | 1 | 850 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_918g` | 24 | 1 | 918 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_931g` | 24 | 1 | 931 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_940g` | 24 | 1 | 940 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_957g` | 24 | 1 | 957 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_959g` | 24 | 1 | 959 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1069g` | 24 | 1 | 1069 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1130g` | 24 | 1 | 1130 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1376g` | 24 | 1 | 1376 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1393g` | 24 | 1 | 1393 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1577g` | 24 | 1 | 1577 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1615g` | 24 | 1 | 1615 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1632g` | 24 | 1 | 1632 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1768g` | 24 | 1 | 1768 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1804g` | 24 | 1 | 1804 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1820g` | 24 | 1 | 1820 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1823g` | 24 | 1 | 1823 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_24h_1888g` | 24 | 1 | 1888 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_36g` | 168 | 1 | 36 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_38g` | 168 | 1 | 38 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_40g` | 168 | 1 | 40 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_53g` | 168 | 1 | 53 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_58g` | 168 | 1 | 58 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_59g` | 168 | 1 | 59 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_72g` | 168 | 1 | 72 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_84g` | 168 | 1 | 84 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_86g` | 168 | 1 | 86 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_88g` | 168 | 1 | 88 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_93g` | 168 | 1 | 93 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_105g` | 168 | 1 | 105 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_110g` | 168 | 1 | 110 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_125g` | 168 | 1 | 125 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_130g` | 168 | 1 | 130 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_131g` | 168 | 1 | 131 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_140g` | 168 | 1 | 140 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_165g` | 168 | 1 | 165 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_175g` | 168 | 1 | 175 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_179g` | 168 | 1 | 179 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_188g` | 168 | 1 | 188 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_192g` | 168 | 1 | 192 | 0 | 0 | [TeLuSa19] | +| `tejada19/UC_168h_199g` | 168 | 1 | 199 | 0 | 0 | [TeLuSa19] | + +## References + +- [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) + +- [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) + +- [KrHiOn12] **Eric Krall, Michael Higgins and Richard P. O’Neill.** "RTO unit commitment test system." Federal Energy Regulatory Commission. Available at: (Accessed: Nov 14, 2020) + +- [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) + +- [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). + +- [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) + +- [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) + +- [PSTCA] **University of Washington, Dept. of Electrical Engineering.** "Power Systems Test Case Archive". Available at: (Accessed: Nov 14, 2020) + +- [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) + +- [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) + +- [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/). diff --git a/docs/src/guides/model.md b/docs/src/guides/model.md new file mode 100644 index 0000000..ba8d79c --- /dev/null +++ b/docs/src/guides/model.md @@ -0,0 +1,78 @@ +JuMP Model +========== + +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]. + +Decision variables +------------------ + +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. + +!!! note + + 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]`. + +### Generators + +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). + +#### Thermal Units + +Name | Description | Unit | Stage +:-----|:-------------|:------: | :------: +`is_on[g,t]` | True if generator `g` is on at time `t`. | Binary | 1 +`switch_on[g,t]` | True is generator `g` switches on at time `t`. | Binary| 1 +`switch_off[g,t]` | True if generator `g` switches off at time `t`. | Binary| 1 +`startup[g,t,s]` | True if generator `g` switches on at time `t` incurring start-up costs from start-up category `s`. | Binary| 1 +`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 +`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 +`reserve[sn,r,g,t]` | Amount of reserve `r` provided by unit `g` at time `t` in scenario `sn`. | MW | 2 + +!!! warning + + 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. + + +#### Profiled Units + +Name | Description | Unit | Stage +:-----|:-------------|:------: | :------: +`prod_profiled[s,t]` | Amount of power produced by profiled unit `g` at time `t`. | MW | 2 + + +### Buses + +Name | Description | Unit | Stage +:-----|:-------------|:------:| :------: +`net_injection[sn,b,t]` | Net injection at bus `b` at time `t` in scenario `sn`. | MW | 2 +`curtail[sn,b,t]` | Amount of load curtailed at bus `b` at time `t` in scenario `sn`. | MW | 2 + + +### Price-sensitive loads + +Name | Description | Unit | Stage +:-----|:-------------|:------:| :------: +`loads[sn,s,t]` | Amount of power served to price-sensitive load `s` at time `t` in scenario `sn`. | MW | 2 + +### Transmission lines + +Name | Description | Unit | Stage +:-----|:-------------|:------:| :------: +`flow[sn,l,t]` | Power flow on line `l` at time `t` in scenario `sn`. | MW | 2 +`overflow[sn,l,t]` | Amount of flow above the limit for line `l` at time `t` in scenario `sn`. | MW | 2 + +!!! warning + + 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. + +Objective function +------------------ + +TODO + +Constraints +----------- + +TODO + + diff --git a/docs/src/problem.md b/docs/src/guides/problem.md similarity index 66% rename from docs/src/problem.md rename to docs/src/guides/problem.md index 3691e68..0cdd612 100644 --- a/docs/src/problem.md +++ b/docs/src/guides/problem.md @@ -1,4 +1,4 @@ -# Problem Definition +# Problem definition The **Security-Constrained Unit Commitment Problem** (SCUC) is a two-stage stochastic mixed-integer linear optimization problem that aims to find the minimum-cost schedule for electricity generation while satisfying various physical, operational and economic constraints. In its most basic form, the problem is composed by: @@ -30,41 +30,46 @@ A _thermal generator_ is a power generation unit that converts thermal energy, t - **Ramping, minimum up/down:** Due to physical and operational limits, such as thermal inertia and mechanical stress, thermal generators cannot vary their power output too dramatically from one time period to the next. Similarly, thermal generators cannot switch on and off too frequently; after switching on or off, units must remain at that state for a minimum specified number of time steps. +- **Startup and shutdown limit:** A thermal generator cannot shut off if its output power level in the imediately preceeding time step is very high (above a specified value); the unit must first ramp down, over potentially multiple time steps, and only then shut off. Similarly, the unit cannot produce a very large amount of power (above a specified limit) imediately after starting up; it must ramp up over potentially multiple time steps. + - **Initial status:** The optimization process finds optimal commitment status and power output level for all thermal generators starting at time period 1. Many constraints, however, require knowledge of previous time periods (0, -1, -2, ...) which are not part of the optimization model. For this reason, part of the input data is the initial power output $M^{\text{init-power}}_{g}$ of unit $g$ (that is, the output at time 0) and the initial status $M^{\text{init-status}}_{g}$ of unit g (how many time steps has it been online/offline at time time 0). If $M^{\text{init-status}}_{g}$ is positive, its magnitude indicates how many time periods has the unit been online; and if negative, how has it been offline. - **Must-run:** Due to various factors, including reliability considerations, some units must remain operational regardless of whether it is economical for them to do so. Must-run constraints are used to enforce such requirements. ### Sets and constants -| Symbol | Unit | Description | -| :--------------------------- | :----- | :----------------------------------------------------------------------------------------- | -| $K^{cost}_g$ | | Number of piecewise linear segments in the production cost curve. | -| $K^{start}_g$ | | Number of startup categories (e.g. cold, warm, hot). | -| $M^{\text{delay}}_{gk}$ | | Delay for startup category $k$. | -| $M^{\text{init-power}}_{g}$ | MW | Initial power output of unit $g$. | -| $M^{\text{init-status}}_{g}$ | | Initial status of unit $g$. | -| $M^{\text{min-up}}_{g}$ | | Minimum amount of time $g$ must stay on after switching on. | -| $M^{\text{must-run}}_{gt}$ | Binary | One if unit $g$ must be on at time $t$. | -| $M^{\text{pmax}}_{gt}$ | MW | Maximum power output at time $t$. | -| $M^{\text{pmin}}_{gt}$ | MW | Minimum power output at time $t$. | -| $M^{\text{ramp-down}}_{g}$ | MW | Ramp down limit. | -| $M^{\text{ramp-up}}_{g}$ | MW | Ramp up limit. | -| $R_g$ | | Set of spinning reserves that may be served by $g$. | -| $Z^{\text{pmin}}_{gt}$ | \$ | Cost to keep $g$ operational at time $t$ generating at minimum power. | -| $Z^{\text{pvar}}_{gtks}$ | \$/MW | Cost for unit $g$ to produce 1 MW of power under piecewise-linear segment $k$ at time $t$. | -| $Z^{\text{start}}_{gk}$ | \$ | Cost to start unit $g$ at startup category $k$. | +| Symbol | Unit | Description | +| :------------------------------ | :----- | :----------------------------------------------------------------------------------------- | +| $K^{cost}_g$ | | Number of piecewise linear segments in the production cost curve. | +| $K^{start}_g$ | | Number of startup categories (e.g. cold, warm, hot). | +| $M^{\text{delay}}_{gk}$ | | Delay for startup category $k$. | +| $M^{\text{init-power}}_{g}$ | MW | Initial power output of unit $g$. | +| $M^{\text{init-status}}_{g}$ | | Initial status of unit $g$. | +| $M^{\text{min-up}}_{g}$ | | Minimum amount of time $g$ must stay on after switching on. | +| $M^{\text{must-run}}_{gt}$ | Binary | One if unit $g$ must be on at time $t$. | +| $M^{\text{pmax}}_{gt}$ | MW | Maximum power output at time $t$. | +| $M^{\text{pmin}}_{gt}$ | MW | Minimum power output at time $t$. | +| $M^{\text{ramp-down}}_{g}$ | MW | Ramp down limit. | +| $M^{\text{ramp-up}}_{g}$ | MW | Ramp up limit. | +| $M^{\text{seg-pmax}}_{gtks}$ | MW | Maximum power output for piecewise-linear segment $k$ at time $t$ and scenario $s$. | +| $M^{\text{shutdown-limit}}_{g}$ | MW | Maximum power unit $g$ produces immediately before shutting down | +| $M^{\text{startup-limit}}_{g}$ | MW | Maximum power unit $g$ produces immediately after starting up | +| $R_g$ | | Set of spinning reserves that may be served by $g$. | +| $Z^{\text{pmin}}_{gt}$ | \$ | Cost to keep $g$ operational at time $t$ generating at minimum power. | +| $Z^{\text{pvar}}_{gtks}$ | \$/MW | Cost for unit $g$ to produce 1 MW of power under piecewise-linear segment $k$ at time $t$. | +| $Z^{\text{start}}_{gk}$ | \$ | Cost to start unit $g$ at startup category $k$. | ### Decision variables -| Symbol | Description | Unit | Stage | -| :---------------------------- | :-------------------------------------------------------------------------------------------- | :----- | :---- | -| $x^{\text{is-on}}_{gt}$ | One if generator $g$ is on at time $t$. | Binary | 1 | -| $x^{\text{switch-on}}_{gt}$ | One if generator $g$ switches on at time $t$. | Binary | 1 | -| $x^{\text{switch-off}}_{gt}$ | One if generator $g$ switches off at time $t$. | Binary | 1 | -| $x^{\text{start}}_{gtk}$ | One if generator $g$ starts up at time $t$ under startup category $k$. | Binary | 1 | -| $y^{\text{prod-above}}_{gts}$ | Amount of power produced by $g$ at time $t$ in scenario $s$ above the minimum power. | MW | 2 | -| $y^{\text{seg-prod}}_{gtks}$ | Amount of power produced by $g$ at time $t$ in piecewise-linear segment $k$ and scenario $s$. | MW | 2 | -| $y^{\text{res}}_{grts}$ | Amount of spinning reserve $r$ supplied by $g$ at time $t$ in scenario $s$. | MW | 2 | +| Symbol | JuMP name | Description | Unit | Stage | +| :---------------------------- | :------------------ | :-------------------------------------------------------------------------------------------- | :----- | :---- | +| $x^{\text{is-on}}_{gt}$ | `is_on[g,t]` | One if generator $g$ is on at time $t$. | Binary | 1 | +| $x^{\text{switch-on}}_{gt}$ | `switch_on[g,t]` | One if generator $g$ switches on at time $t$. | Binary | 1 | +| $x^{\text{switch-off}}_{gt}$ | `switch_off[g,t]` | One if generator $g$ switches off at time $t$. | Binary | 1 | +| $x^{\text{start}}_{gtk}$ | `startup[g,t,s]` | One if generator $g$ starts up at time $t$ under startup category $k$. | Binary | 1 | +| $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 | +| $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 | +| $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 | ### Objective function terms @@ -92,37 +97,37 @@ A _thermal generator_ is a power generation unit that converts thermal energy, t x^{\text{is-on}}_{gt} \geq M^{\text{must-run}}_{gt} ``` -- After switching on, unit must remain on for some amount of time: +- After switching on, unit must remain on for some amount of time (`eq_min_uptime[g,t]`): ```math \sum_{i=max(1,t-M^{\text{min-up}}_{g}+1)}^t x^{\text{switch-on}}_{gi} \leq x^{\text{is-on}}_{gt} ``` -- Same as above, but covering the initial time steps: +- Same as above, but covering the initial time steps (`eq_min_uptime[g,0]`): ```math \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 ``` -- After switching off, unit must remain offline for some amount of time: +- After switching off, unit must remain offline for some amount of time (`eq_min_downtime[g,t]`): ```math \sum_{i=max(1,t-M^{\text{min-down}}_{g}+1)}^t x^{\text{switch-off}}_{gi} \leq 1 - x^{\text{is-on}}_{gt} ``` -- Same as above, but covering the initial time steps: +- Same as above, but covering the initial time steps (`eq_min_downtime[g,0]`): ```math \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 ``` -- If the unit switches on, it must choose exactly one startup category: +- If the unit switches on, it must choose exactly one startup category (`eq_startup_choose[g,t]`): ```math x^{\text{switch-on}}_{gt} = \sum_{k=1}^{K^{start}_g} x^{\text{start}}_{gtk} ``` -- If unit has not switched off in the last "delay" time periods, then startup category is forbidden. +- If unit has not switched off in the last "delay" time periods, then startup category is forbidden (`eq_startup_restrict[g,t,s]`). The last startup category is always allowed. In the equation below, $L^{\text{start}}_{gtk}=1$ if category should be allowed based on initial status. @@ -130,7 +135,7 @@ x^{\text{switch-on}}_{gt} = \sum_{k=1}^{K^{start}_g} x^{\text{start}}_{gtk} 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} ``` -- Link the binary variables together: +- Link the binary variables together (`eq_binary_link[g,t]`): ```math \begin{align*} @@ -138,47 +143,77 @@ x^{\text{start}}_{gtk} \leq L^{\text{start}}_{gtk} + \sum_{i=min\left(1,t - M^{\ \end{align*} ``` -- If the unit is off, it cannot produce power or provide reserves. If it is on, it must to so within the specified production limits: +- Cannot switch on and off at the same time (`eq_switch_on_off[g,t]`): + +```math +x^{\text{switch-on}}_{gt} + x^{\text{switch-off}}_{gt} \leq 1 +``` + +- If the unit is off, it cannot produce power or provide reserves. If it is on, it must to so within the specified production limits (`eq_prod_limit[s,g,t]`): ```math y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq (M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt} ``` -- Break down the "production above" variable into smaller "segment production" variables, to simplify the objective function: +- Break down the "production above" variable into smaller "segment production" variables, to simplify the objective function (`eq_prod_above_def[s,g,t]`): ```math y^{\text{prod-above}}_{gts} = \sum_{k=1}^{K^{cost}_g} y^{\text{seg-prod}}_{gtks} ``` -- Unit cannot increase its production too quickly: +- Impose upper limit on segment production variables (`eq_segprod_limit[s,g,t,k]`): + +```math +0 \leq y^{\text{seg-prod}}_{gtks} \leq M^{\text{seg-pmax}}_{gtks} +``` + +- Unit cannot increase its production too quickly (`eq_ramp_up[s,g,t]`): ```math y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq y^{\text{prod-above}}_{g,t-1,s} + M^{\text{ramp-up}}_{g} ``` -- Same as above, for initial time: +- Same as above, for initial time (`eq_ramp_up[s,g,1]`): ```math y^{\text{prod-above}}_{g,1,s} + \sum_{r \in R_g} y^{\text{res}}_{gr,1,s} \leq \left(M^{\text{init-power}}_{g} - M^{\text{pmin}}_{gt}\right) + M^{\text{ramp-up}}_{g} ``` -- Unit cannot decrease its production too quickly: +- Unit cannot decrease its production too quickly (`eq_ramp_down[s,g,t]`): ```math y^{\text{prod-above}}_{gts} \geq y^{\text{prod-above}}_{g,t-1,s} - M^{\text{ramp-down}}_{g} ``` -- Same as above, for initial time: +- Same as above, for initial time (`eq_ramp_down[s,g,1]`): ```math y^{\text{prod-above}}_{g,1,s} \geq \left(M^{\text{init-power}}_{g} - M^{\text{pmin}}_{gt}\right) - M^{\text{ramp-down}}_{g} ``` +- Unit cannot produce excessive amount of power immediately after starting up (`eq_startup_limit[s,g,t]`): + +```math +y^{\text{prod-above}}_{gts} + \sum_{r \in R_g} y^{\text{res}}_{grts} \leq +(M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt} - +max\left\{0,M^{\text{pmax}}_{gt} - M^{\text{startup-limit}}_{g}\right\} +x^{\text{switch-on}}_{gt} +``` + +- Unit cannot shutoff it it's producing too much power (`eq_shutdown_limit[s,g,t]`): + +```math +y^{\text{prod-above}}_{gts} \leq +(M^{\text{pmax}}_{gt} - M^{\text{pmin}}_{gt}) x^{\text{is-on}}_{gt} - +max\left\{0,M^{\text{pmax}}_{gt} - M^{\text{shutdown-limit}}_{g}\right\} +x^{\text{switch-off}}_{g,t+1} +``` + ## 3. Profiled generators A _profiled generator_ is a simplified generator model that can be used to represent renewable energy resources, including wind, solar and hydro. Unlike thermal generators, which can be either on or off, profiled generators do not have status variables; the only optimization decision is on their power output level, which must remain between minimum and maximum time-varying amounts. Production cost curves for profiled generators are linear, making them again much simpler than thermal units. @@ -193,9 +228,9 @@ A _profiled generator_ is a simplified generator model that can be used to repre ### Decision variables -| Symbol | Unit | Description | Stage | -| :-------------------- | :--- | :----------------------------------------------------------- | :---- | -| $y^\text{prod}_{sgt}$ | MW | Amount of power produced by $g$ in time $t$ and scenario $s$ | 2 | +| Symbol | JuMP name | Unit | Description | Stage | +| :-------------------- | :--------------------- | :--- | :----------------------------------------------------------- | :---- | +| $y^\text{prod}_{sgt}$ | `prod_profiled[s,g,t]` | MW | Amount of power produced by $g$ in time $t$ and scenario $s$ | 2 | ### Objective function terms @@ -209,7 +244,7 @@ A _profiled generator_ is a simplified generator model that can be used to repre ### Constraints -- Bounds: +- Variable bounds: ```math M^{\text{pmin}}_{sgt} \leq y^\text{prod}_{sgt} \leq M^{\text{pmax}}_{sgt} @@ -228,9 +263,9 @@ Loads represent the demand for electrical power by consumers and devices connect ### Decision variables -| Symbol | Unit | Description | Stage | -| :----------------------- | :--- | :--------------------------------------------------------------- | :---- | -| $y^\text{curtail}_{sbt}$ | MW | Amount of load curtailed at bus $b$ in time $t$ and scenario $s$ | 2 | +| Symbol | JuMP name | Unit | Description | Stage | +| :----------------------- | :--------------- | :--- | :--------------------------------------------------------------- | :---- | +| $y^\text{curtail}_{sbt}$ | `curtail[s,b,t]` | MW | Amount of load curtailed at bus $b$ in time $t$ and scenario $s$ | 2 | ### Objective function terms @@ -244,7 +279,7 @@ Loads represent the demand for electrical power by consumers and devices connect ### Constraints -- Bounds: +- Variable bounds: ```math 0 \leq y^\text{curtail}_{sbt} \leq M^\text{load}_{bts} @@ -264,9 +299,9 @@ Price-sensitive loads refer to components in the system which may increase or re ### Decision variables -| Symbol | Unit | Description | Stage | -| :------------------- | :--- | :------------------------------------------------ | :---- | -| $y^\text{psl}_{spt}$ | MW | Amount served to $p$ in time $t$ and scenario $s$ | 2 | +| Symbol | JuMP name | Unit | Description | Stage | +| :------------------- | :------------- | :--- | :------------------------------------------------ | :---- | +| $y^\text{psl}_{spt}$ | `loads[s,p,t]` | MW | Amount served to $p$ in time $t$ and scenario $s$ | 2 | ### Objective function terms @@ -280,7 +315,7 @@ Price-sensitive loads refer to components in the system which may increase or re ### Constraints -- Bounds: +- Variable bounds: ```math 0 \leq y^\text{psl}_{spt} \leq M^\text{psl-demand}_{spt} @@ -292,43 +327,6 @@ So far, we have described generators, which produce power, and loads, which cons Besides the net balance equations, we must also enforce flow limits on the transmission lines. Unlike flows in other optimization problems, power flows are directly determined by net injections and transmission line parameters, and must follow physical laws. UC.jl uses the DC linearization of AC power flow equations, which are derived the assumptions that (i) line losses are negligible; (ii) voltage magnitudes are constant; and (iii) phase angle differences are small. Under these assumptions, the flow $f_l$ in transmission line $l$ is given by $\sum_{b \in B} \delta_{bl} n_b$, where $\delta_{bl}$ is a constant known as _injection shift factor_, computed from the line parameters, and $n_b$ is the net injection at bus $b$. -### Sets and constants - -| Symbol | Unit | Description | -| :----- | :--- | :------------------------ | -| $B$ | | Set of buses | -| $L$ | | Set of transmission lines | - -| $M^{}\_{} - -| $M^\text{psl-demand}_{spt}$ | MW | Demand of price-sensitive load $p$ at time $t$ and scenario $s$ | -| $Z^\text{psl-revenue}_{spt}$ | \$/MW | Revenue from serving load $p$ at $t$ in scenario $s$ | -| $\text{PSL}$ | | Set of price-sensitive loads | - -### Decision variables - -| Symbol | Unit | Description | Stage | -| :------------------- | :--- | :------------------------------------------------ | :---- | -| $y^\text{psl}_{spt}$ | MW | Amount served to $p$ in time $t$ and scenario $s$ | 2 | - -### Objective function terms - -- Revenue from serving price-sensitive loads: - -```math - - \sum_{s \in S} p(s) \left[ - \sum_{p \in \text{PSL}} \sum_{t \in T} y^\text{psl}_{spt} Z^\text{psl-revenue}_{spt} - \right] -``` - -### Constraints - -- Bounds: - -```math -0 \leq y^\text{psl}_{spt} \leq M^\text{psl-demand}_{spt} -``` - ## 7. Transmission interfaces ## 7. Energy storage devices diff --git a/docs/src/index.md b/docs/src/index.md index 759c62d..86312e8 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,40 +4,34 @@ ## Package Components -* **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. -* **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. -* **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. -* **Benchmark Tools:** The package provides automated benchmark scripts to accurately evaluate the performance impact of proposed code changes. - -## Table of Contents - -```@contents -Pages = ["usage.md", "format.md", "instances.md", "model.md", "api.md"] -Depth = 3 -``` +- **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. +- **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. +- **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. +- **Benchmark Tools:** The package provides automated benchmark scripts to accurately evaluate the performance impact of proposed code changes. ## Authors -* **Alinson S. Xavier** (Argonne National Laboratory) -* **Aleksandr M. Kazachkov** (University of Florida) -* **Ogün Yurdakul** (Technische Universität Berlin) -* **Jun He** (Purdue University) -* **Feng Qiu** (Argonne National Laboratory) + +- **Alinson S. Xavier** (Argonne National Laboratory) +- **Aleksandr M. Kazachkov** (University of Florida) +- **Ogün Yurdakul** (Technische Universität Berlin) +- **Jun He** (Purdue University) +- **Feng Qiu** (Argonne National Laboratory) ## Acknowledgments -* 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. +- 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. -* 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 +- 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 -* Based upon work supported by the **U.S. Department of Energy Advanced Grid Modeling Program** under Grant DE-OE0000875. +- Based upon work supported by the **U.S. Department of Energy Advanced Grid Modeling Program** under Grant DE-OE0000875. ## Citing If you use UnitCommitment.jl in your research (instances, models or algorithms), we kindly request that you cite the package as follows: -* **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 (2023). [DOI: 10.5281/zenodo.4269874](https://doi.org/10.5281/zenodo.4269874). +- **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 (2023). [DOI: 10.5281/zenodo.4269874](https://doi.org/10.5281/zenodo.4269874). -If you use the instances, we additionally request that you cite the original sources, as described in the [instances page](instances.md). +If you use the instances, we additionally request that you cite the original sources, as described in the [instances page](guides/instances.md). ## License diff --git a/docs/src/instances.md b/docs/src/instances.md deleted file mode 100644 index 9034d14..0000000 --- a/docs/src/instances.md +++ /dev/null @@ -1,303 +0,0 @@ -Instances -========= - -UnitCommitment.jl provides a large collection of benchmark instances collected from the literature and converted to a [common data format](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 [usage section](usage.md). Instance files can also be [directly downloaded from our website](https://axavier.org/UnitCommitment.jl/0.3/instances/). - -!!! warning - - 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. - - -MATPOWER --------- - -[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. - -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: - -* **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. - -* **Load profiles** were generated using a similar data-driven approach. - -* **Ramp-up, ramp-down, startup and shutdown rates** were set to a fixed proportion of the generator's maximum output. - -* **Minimum reserves** were set to a fixed proportion of the total demand. - -* **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. - -For each MATPOWER test case, UC.jl provides 365 variations (`2017-01-01` to `2017-12-31`) corresponding different days of the year. - -### MATPOWER/UW-PSTCA - -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. - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `matpower/case14/2017-01-01` | 14 | 5 | 20 | 19 | [MTPWR, PSTCA] -| `matpower/case30/2017-01-01` | 30 | 6 | 41 | 38 | [MTPWR, PSTCA] -| `matpower/case57/2017-01-01` | 57 | 7 | 80 | 79 | [MTPWR, PSTCA] -| `matpower/case118/2017-01-01` | 118 | 54 | 186 | 177 | [MTPWR, PSTCA] -| `matpower/case300/2017-01-01` | 300 | 69 | 411 | 320 | [MTPWR, PSTCA] - - -### MATPOWER/Polish - -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. - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `matpower/case2383wp/2017-01-01` | 2383 | 323 | 2896 | 2240 | [MTPWR] -| `matpower/case2736sp/2017-01-01` | 2736 | 289 | 3504 | 3159 | [MTPWR] -| `matpower/case2737sop/2017-01-01` | 2737 | 267 | 3506 | 3161 | [MTPWR] -| `matpower/case2746wop/2017-01-01` | 2746 | 443 | 3514 | 3155 | [MTPWR] -| `matpower/case2746wp/2017-01-01` | 2746 | 457 | 3514 | 3156 | [MTPWR] -| `matpower/case3012wp/2017-01-01` | 3012 | 496 | 3572 | 2854 | [MTPWR] -| `matpower/case3120sp/2017-01-01` | 3120 | 483 | 3693 | 2950 | [MTPWR] -| `matpower/case3375wp/2017-01-01` | 3374 | 590 | 4161 | 3245 | [MTPWR] - -### MATPOWER/PEGASE - -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. - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `matpower/case89pegase/2017-01-01` | 89 | 12 | 210 | 192 | [JoFlMa16, FlPaCa13, MTPWR] -| `matpower/case1354pegase/2017-01-01` | 1354 | 260 | 1991 | 1288 | [JoFlMa16, FlPaCa13, MTPWR] -| `matpower/case2869pegase/2017-01-01` | 2869 | 510 | 4582 | 3579 | [JoFlMa16, FlPaCa13, MTPWR] -| `matpower/case9241pegase/2017-01-01` | 9241 | 1445 | 16049 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] -| `matpower/case13659pegase/2017-01-01` | 13659 | 4092 | 20467 | 13932 | [JoFlMa16, FlPaCa13, MTPWR] - -### MATPOWER/RTE - -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. - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `matpower/case1888rte/2017-01-01` | 1888 | 296 | 2531 | 1484 | [MTPWR, JoFlMa16] -| `matpower/case1951rte/2017-01-01` | 1951 | 390 | 2596 | 1497 | [MTPWR, JoFlMa16] -| `matpower/case2848rte/2017-01-01` | 2848 | 544 | 3776 | 2242 | [MTPWR, JoFlMa16] -| `matpower/case2868rte/2017-01-01` | 2868 | 596 | 3808 | 2260 | [MTPWR, JoFlMa16] -| `matpower/case6468rte/2017-01-01` | 6468 | 1262 | 9000 | 6094 | [MTPWR, JoFlMa16] -| `matpower/case6470rte/2017-01-01` | 6470 | 1306 | 9005 | 6085 | [MTPWR, JoFlMa16] -| `matpower/case6495rte/2017-01-01` | 6495 | 1352 | 9019 | 6060 | [MTPWR, JoFlMa16] -| `matpower/case6515rte/2017-01-01` | 6515 | 1368 | 9037 | 6063 | [MTPWR, JoFlMa16] - - -PGLIB-UC Instances ------------------- - -[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]. - -### PGLIB-UC/California - -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). - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `pglib-uc/ca/2014-09-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-09-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-09-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-09-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-12-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-12-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-12-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2014-12-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-03-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-03-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-03-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-03-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-06-01_reserves_0` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-06-01_reserves_1` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-06-01_reserves_3` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/2015-06-01_reserves_5` | 1 | 610 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/Scenario400_reserves_0` | 1 | 611 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/Scenario400_reserves_1` | 1 | 611 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/Scenario400_reserves_3` | 1 | 611 | 0 | 0 | [KnOsWa20] -| `pglib-uc/ca/Scenario400_reserves_5` | 1 | 611 | 0 | 0 | [KnOsWa20] - - -### PGLIB-UC/FERC - -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). - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `pglib-uc/ferc/2015-01-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-01-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-02-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-02-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-03-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-03-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-04-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-04-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-05-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-05-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-06-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-06-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-07-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-07-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-08-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-08-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-09-01_hw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-09-01_lw` | 1 | 979 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-10-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-10-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-11-02_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-11-02_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-12-01_hw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] -| `pglib-uc/ferc/2015-12-01_lw` | 1 | 935 | 0 | 0 | [KnOsWa20, KrHiOn12] - - -### PGLIB-UC/RTS-GMLC - -[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). - -| Name | Buses | Generators | Lines | Contingencies | References | -|------|-------|------------|-------|---------------|--------| -| `pglib-uc/rts_gmlc/2020-01-27` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-02-09` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-03-05` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-04-03` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-05-05` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-06-09` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-07-06` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-08-12` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-09-20` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-10-27` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-11-25` | 1 | 154 | 0 | 0 | [BaBlEh19] -| `pglib-uc/rts_gmlc/2020-12-23` | 1 | 154 | 0 | 0 | [BaBlEh19] - - -OR-LIB/UC ---------- - -[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. - -| Name | Hours | Buses | Generators | Lines | Contingencies | References | -|------|-------|-------|------------|-------|---------------|------------| -| `or-lib/10_0_1_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/10_0_2_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/10_0_3_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/10_0_4_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/10_0_5_w` | 24 | 1 | 10 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/20_0_1_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/20_0_2_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/20_0_3_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/20_0_4_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/20_0_5_w` | 24 | 1 | 20 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/50_0_1_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/50_0_2_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/50_0_3_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/50_0_4_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/50_0_5_w` | 24 | 1 | 50 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/75_0_1_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/75_0_2_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/75_0_3_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/75_0_4_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/75_0_5_w` | 24 | 1 | 75 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/100_0_1_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/100_0_2_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/100_0_3_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/100_0_4_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/100_0_5_w` | 24 | 1 | 100 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/150_0_1_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/150_0_2_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/150_0_3_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/150_0_4_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/150_0_5_w` | 24 | 1 | 150 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_10_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_11_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_12_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_1_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_2_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_3_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_4_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_5_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_6_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_7_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_8_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] -| `or-lib/200_0_9_w` | 24 | 1 | 200 | 0 | 0 | [ORLIB, FrGe06] - - -Tejada19 --------- - - 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. - -| Name | Hours | Buses | Generators | Lines | Contingencies | References | -|------|-------|-------|------------|-------|---------------|------------| -| `tejada19/UC_24h_214g` | 24 | 1 | 214 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_250g` | 24 | 1 | 250 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_290g` | 24 | 1 | 290 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_480g` | 24 | 1 | 480 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_505g` | 24 | 1 | 505 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_623g` | 24 | 1 | 623 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_647g` | 24 | 1 | 647 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_836g` | 24 | 1 | 836 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_850g` | 24 | 1 | 850 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_918g` | 24 | 1 | 918 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_931g` | 24 | 1 | 931 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_940g` | 24 | 1 | 940 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_957g` | 24 | 1 | 957 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_959g` | 24 | 1 | 959 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1069g` | 24 | 1 | 1069 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1130g` | 24 | 1 | 1130 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1376g` | 24 | 1 | 1376 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1393g` | 24 | 1 | 1393 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1577g` | 24 | 1 | 1577 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1615g` | 24 | 1 | 1615 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1632g` | 24 | 1 | 1632 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1768g` | 24 | 1 | 1768 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1804g` | 24 | 1 | 1804 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1820g` | 24 | 1 | 1820 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1823g` | 24 | 1 | 1823 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_24h_1888g` | 24 | 1 | 1888 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_36g` | 168 | 1 | 36 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_38g` | 168 | 1 | 38 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_40g` | 168 | 1 | 40 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_53g` | 168 | 1 | 53 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_58g` | 168 | 1 | 58 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_59g` | 168 | 1 | 59 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_72g` | 168 | 1 | 72 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_84g` | 168 | 1 | 84 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_86g` | 168 | 1 | 86 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_88g` | 168 | 1 | 88 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_93g` | 168 | 1 | 93 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_105g` | 168 | 1 | 105 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_110g` | 168 | 1 | 110 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_125g` | 168 | 1 | 125 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_130g` | 168 | 1 | 130 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_131g` | 168 | 1 | 131 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_140g` | 168 | 1 | 140 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_165g` | 168 | 1 | 165 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_175g` | 168 | 1 | 175 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_179g` | 168 | 1 | 179 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_188g` | 168 | 1 | 188 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_192g` | 168 | 1 | 192 | 0 | 0 | [TeLuSa19] -| `tejada19/UC_168h_199g` | 168 | 1 | 199 | 0 | 0 | [TeLuSa19] - - -References ----------- - -* [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) - -* [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) - -* [KrHiOn12] **Eric Krall, Michael Higgins and Richard P. O’Neill.** "RTO unit commitment test system." Federal Energy Regulatory Commission. Available at: (Accessed: Nov 14, 2020) - -* [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) - -* [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). - -* [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) - -* [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) - -* [PSTCA] **University of Washington, Dept. of Electrical Engineering.** "Power Systems Test Case Archive". Available at: (Accessed: Nov 14, 2020) - -* [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) - -* [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) - -* [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/). \ No newline at end of file diff --git a/docs/src/model.md b/docs/src/model.md deleted file mode 100644 index 17ea389..0000000 --- a/docs/src/model.md +++ /dev/null @@ -1,233 +0,0 @@ -JuMP Model -========== - -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]. - -Decision variables ------------------- - -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. - -!!! note - - 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]`. - -### Generators - -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). - -#### Thermal Units - -Name | Description | Unit | Stage -:-----|:-------------|:------: | :------: -`is_on[g,t]` | True if generator `g` is on at time `t`. | Binary | 1 -`switch_on[g,t]` | True is generator `g` switches on at time `t`. | Binary| 1 -`switch_off[g,t]` | True if generator `g` switches off at time `t`. | Binary| 1 -`startup[g,t,s]` | True if generator `g` switches on at time `t` incurring start-up costs from start-up category `s`. | Binary| 1 -`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 -`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 -`reserve[sn,r,g,t]` | Amount of reserve `r` provided by unit `g` at time `t` in scenario `sn`. | MW | 2 - -!!! warning - - 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. - - -#### Profiled Units - -Name | Description | Unit | Stage -:-----|:-------------|:------: | :------: -`prod_profiled[s,t]` | Amount of power produced by profiled unit `g` at time `t`. | MW | 2 - - -### Buses - -Name | Description | Unit | Stage -:-----|:-------------|:------:| :------: -`net_injection[sn,b,t]` | Net injection at bus `b` at time `t` in scenario `sn`. | MW | 2 -`curtail[sn,b,t]` | Amount of load curtailed at bus `b` at time `t` in scenario `sn`. | MW | 2 - - -### Price-sensitive loads - -Name | Description | Unit | Stage -:-----|:-------------|:------:| :------: -`loads[sn,s,t]` | Amount of power served to price-sensitive load `s` at time `t` in scenario `sn`. | MW | 2 - -### Transmission lines - -Name | Description | Unit | Stage -:-----|:-------------|:------:| :------: -`flow[sn,l,t]` | Power flow on line `l` at time `t` in scenario `sn`. | MW | 2 -`overflow[sn,l,t]` | Amount of flow above the limit for line `l` at time `t` in scenario `sn`. | MW | 2 - -!!! warning - - 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. - -Objective function ------------------- - -TODO - -Constraints ------------ - -TODO - - -Inspecting and modifying the model ----------------------------------- - -### Accessing decision variables - -After building a model using `UnitCommitment.build_model`, 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. The script below illustrates how to build a model, solve it and display the solution without using the function `UnitCommitment.solution`. - -```julia -using Cbc -using Printf -using JuMP -using UnitCommitment - -# Load benchmark instance -instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") - -# Build JuMP model -model = UnitCommitment.build_model( - instance=instance, - optimizer=Cbc.Optimizer, -) - -# Solve the model -UnitCommitment.optimize!(model) - -# Display commitment status -for g in instance.units - for t in 1:instance.time - @printf( - "%-10s %5d %5.1f %5.1f %5.1f\n", - g.name, - t, - value(model[:is_on][g.name, t]), - value(model[:switch_on][g.name, t]), - value(model[:switch_off][g.name, t]), - ) - end -end -``` - -### Fixing variables, modifying objective function and adding constraints - -Since we now have a direct reference to the JuMP decision variables, it is possible to fix variables, change the coefficients in the objective function, or even add new constraints to the model before solving it. -!!! warning - - It is important to take into account the stage of the decision variables in modifying the optimization model. In changing a deterministic SCUC model, modifying the second-stage decision variables requires adding the term `s1`, which is the default scenario name assigned to the second-stage decision variables in the SCUC model. For an SUC model, the package permits the modification of the second-stage decision variables individually for each scenario. - -The script below shows how the JuMP model can be modified after it is created. For more information on modifying an existing model, [see the JuMP documentation](https://jump.dev/JuMP.jl/stable/manual/variables/). - -```julia -using Cbc -using JuMP -using UnitCommitment - -# Load benchmark instance -instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") - -# Construct JuMP model -model = UnitCommitment.build_model( - instance=instance, - optimizer=Cbc.Optimizer, -) - -# Fix the commitment status of the generator "g1" in time period 1 to 1.0 -JuMP.fix( - model[:is_on]["g1",1], - 1.0, - force=true, -) - -# Fix the production level of the generator "g1" above its minimum level in time period 1 and -# in scenario "s1" to 20.0 MW. Observe that the three-tuple dictionary key involves the scenario -# index "s1", as production above minimum is a second-stage decision variable. -JuMP.fix( - model[:prod_above]["s1", "g1", 1], - 20.0, - force=true, -) - -# Enforce the curtailment of 20.0 MW of load at bus "b2" in time period 4 in scenario "s1". -JuMP.fix( - curtail["s1", "b2", 4] = - 20.0, - force=true, -) - -# Change the objective function -JuMP.set_objective_coefficient( - model, - model[:switch_on]["g2",1], - 1000.0, -) - -# Create a new constraint -@constraint( - model, - model[:is_on]["g3",1] + model[:is_on]["g4",1] <= 1, -) - -# Solve the model -UnitCommitment.optimize!(model) -``` - -### Adding new component to a bus - -The following snippet shows how to add a new grid component to a particular bus. For each time step, we create decision variables for the new grid component, add these variables to the objective function, then attach the component to a particular bus by modifying some existing model constraints. - -```julia -using Cbc -using JuMP -using UnitCommitment - -# Load instance and build base model -instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") -model = UnitCommitment.build_model( - instance=instance, - optimizer=Cbc.Optimizer, -) - -# Get the number of time steps in the original instance -T = instance.time - -# 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 ≤ x[t] ≤ 10. -@variable(model, x[1:T], lower_bound=0.0, upper_bound=10.0) - -# For each time step -for t in 1:T - - # Add production costs to the objective function. - # In this example, we assume a cost of $5/MW. - set_objective_coefficient(model, x[t], 5.0) - - # Attach the new component to bus b1 in scenario s1, by modifying the - # constraint `eq_net_injection`. - set_normalized_coefficient( - model[:eq_net_injection]["s1", "b1", t], - x[t], - 1.0, - ) -end - -# Solve the model -UnitCommitment.optimize!(model) - -# Show optimal values for the x variables -@show value.(x) -``` - -References ----------- -* [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) - diff --git a/docs/src/tutorials/customizing.md b/docs/src/tutorials/customizing.md new file mode 100644 index 0000000..2a52d06 --- /dev/null +++ b/docs/src/tutorials/customizing.md @@ -0,0 +1,182 @@ +# Customizing the model + +By default, `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. You can, however, construct your own formulation, based on the modeling components that you choose, as shown in the next example. + +```julia +using HiGHS +using UnitCommitment + +import UnitCommitment: + Formulation, + KnuOstWat2018, + MorLatRam2013, + ShiftFactorsFormulation + +instance = UnitCommitment.read_benchmark( + "matpower/case118/2017-02-01", +) + +model = UnitCommitment.build_model( + instance = instance, + optimizer = HiGHS.Optimizer, + formulation = Formulation( + pwl_costs = KnuOstWat2018.PwlCosts(), + ramping = MorLatRam2013.Ramping(), + startup_costs = MorLatRam2013.StartupCosts(), + transmission = ShiftFactorsFormulation( + isf_cutoff = 0.005, + lodf_cutoff = 0.001, + ), + ), +) +``` + +## Inspecting and modifying the model + +### Accessing decision variables + +After building a model using `UnitCommitment.build_model`, 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. The script below illustrates how to build a model, solve it and display the solution without using the function `UnitCommitment.solution`. + +```julia +using Cbc +using Printf +using JuMP +using UnitCommitment + +# Load benchmark instance +instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") + +# Build JuMP model +model = UnitCommitment.build_model( + instance=instance, + optimizer=Cbc.Optimizer, +) + +# Solve the model +UnitCommitment.optimize!(model) + +# Display commitment status +for g in instance.units + for t in 1:instance.time + @printf( + "%-10s %5d %5.1f %5.1f %5.1f\n", + g.name, + t, + value(model[:is_on][g.name, t]), + value(model[:switch_on][g.name, t]), + value(model[:switch_off][g.name, t]), + ) + end +end +``` + +### Fixing variables, modifying objective function and adding constraints + +Since we now have a direct reference to the JuMP decision variables, it is possible to fix variables, change the coefficients in the objective function, or even add new constraints to the model before solving it. +!!! warning + + It is important to take into account the stage of the decision variables in modifying the optimization model. In changing a deterministic SCUC model, modifying the second-stage decision variables requires adding the term `s1`, which is the default scenario name assigned to the second-stage decision variables in the SCUC model. For an SUC model, the package permits the modification of the second-stage decision variables individually for each scenario. + +The script below shows how the JuMP model can be modified after it is created. For more information on modifying an existing model, [see the JuMP documentation](https://jump.dev/JuMP.jl/stable/manual/variables/). + +```julia +using Cbc +using JuMP +using UnitCommitment + +# Load benchmark instance +instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") + +# Construct JuMP model +model = UnitCommitment.build_model( + instance=instance, + optimizer=Cbc.Optimizer, +) + +# Fix the commitment status of the generator "g1" in time period 1 to 1.0 +JuMP.fix( + model[:is_on]["g1",1], + 1.0, + force=true, +) + +# Fix the production level of the generator "g1" above its minimum level in time period 1 and +# in scenario "s1" to 20.0 MW. Observe that the three-tuple dictionary key involves the scenario +# index "s1", as production above minimum is a second-stage decision variable. +JuMP.fix( + model[:prod_above]["s1", "g1", 1], + 20.0, + force=true, +) + +# Enforce the curtailment of 20.0 MW of load at bus "b2" in time period 4 in scenario "s1". +JuMP.fix( + curtail["s1", "b2", 4] = + 20.0, + force=true, +) + +# Change the objective function +JuMP.set_objective_coefficient( + model, + model[:switch_on]["g2",1], + 1000.0, +) + +# Create a new constraint +@constraint( + model, + model[:is_on]["g3",1] + model[:is_on]["g4",1] <= 1, +) + +# Solve the model +UnitCommitment.optimize!(model) +``` + +### Adding new component to a bus + +The following snippet shows how to add a new grid component to a particular bus. For each time step, we create decision variables for the new grid component, add these variables to the objective function, then attach the component to a particular bus by modifying some existing model constraints. + +```julia +using Cbc +using JuMP +using UnitCommitment + +# Load instance and build base model +instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") +model = UnitCommitment.build_model( + instance=instance, + optimizer=Cbc.Optimizer, +) + +# Get the number of time steps in the original instance +T = instance.time + +# 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 ≤ x[t] ≤ 10. +@variable(model, x[1:T], lower_bound=0.0, upper_bound=10.0) + +# For each time step +for t in 1:T + + # Add production costs to the objective function. + # In this example, we assume a cost of $5/MW. + set_objective_coefficient(model, x[t], 5.0) + + # Attach the new component to bus b1 in scenario s1, by modifying the + # constraint `eq_net_injection`. + set_normalized_coefficient( + model[:eq_net_injection]["s1", "b1", t], + x[t], + 1.0, + ) +end + +# Solve the model +UnitCommitment.optimize!(model) + +# Show optimal values for the x variables +@show value.(x) +``` diff --git a/docs/src/tutorials/decomposition.md b/docs/src/tutorials/decomposition.md new file mode 100644 index 0000000..81d457c --- /dev/null +++ b/docs/src/tutorials/decomposition.md @@ -0,0 +1,105 @@ +# Decomposition methods + +## 1. Time decomposition + +Solving unit commitment instances that have long time horizons (for example, year-long 8760-hour instances) 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. + +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. + +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`. + +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. + +> **Warning** +> 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. + +```julia +using UnitCommitment, JuMP, Cbc, HiGHS + +import UnitCommitment: + TimeDecomposition, + ConventionalLMP, + XavQiuWanThi2019, + Formulation + +# specifying the after_build and after_optimize functions +function after_build(model, instance) + @constraint( + model, + model[:is_on]["g3", 1] + model[:is_on]["g4", 1] <= 1, + ) +end + +lmps = [] +function after_optimize(solution, model, instance) + lmp = UnitCommitment.compute_lmp( + model, + ConventionalLMP(), + optimizer = HiGHS.Optimizer, + ) + return push!(lmps, lmp) +end + +# assume the instance is given as a 120h problem +instance = UnitCommitment.read("instance.json") + +solution = UnitCommitment.optimize!( + instance, + TimeDecomposition( + time_window = 36, # solve 36h problems + time_increment = 24, # advance by 24h each time + inner_method = XavQiuWanThi2019.Method(), + formulation = Formulation(), + ), + optimizer = Cbc.Optimizer, + after_build = after_build, + after_optimize = after_optimize, +) +``` + +## 2. Scenario decomposition with Progressive Hedging + +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. + +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. + +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 julia ph.jl`. + +```julia +using HiGHS +using MPI +using UnitCommitment +using Glob + +# 1. Initialize MPI +MPI.Init() + +# 2. Configure progressive hedging method +ph = UnitCommitment.ProgressiveHedging() + +# 3. Read problem instance +instance = UnitCommitment.read(["example/s1.json", "example/s2.json"], ph) + +# 4. Build JuMP model +model = UnitCommitment.build_model( + instance = instance, + optimizer = HiGHS.Optimizer, +) + +# 5. Run the decentralized optimization algorithm +UnitCommitment.optimize!(model, ph) + +# 6. Fetch the solution +solution = UnitCommitment.solution(model, ph) + +# 7. Close MPI +MPI.Finalize() +``` + +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. + +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. + +!!! warning + + Currently, PH can handle only equiprobable scenarios. Further, `solution(model, ph)` can only handle cases where only one scenario is modeled in each process. diff --git a/docs/src/tutorials/market.md b/docs/src/tutorials/market.md new file mode 100644 index 0000000..a6bd2d9 --- /dev/null +++ b/docs/src/tutorials/market.md @@ -0,0 +1,115 @@ +# Market clearing and LMPs + +The UC.jl package offers a comprehensive set of functions for solving marketing problems. The primary function, `solve_market`, facilitates the solution of day-ahead (DA) markets, which can be either deterministic or stochastic in nature. Subsequently, it sequentially maps the commitment status obtained from the DA market to all the real-time (RT) markets, which are deterministic instances. It is essential to ensure that the time span of the DA market encompasses all the RT markets, and the file paths for the RT markets must be specified in chronological order. Each RT market should represent a single time slot, and it is recommended to include a few additional time slots to mitigate the closing window effect. + +The `solve_market` function accepts several parameters, including the file path (or a list of file paths in the case of stochastic markets) for the DA market, a list of file paths for the RT markets, the market settings specified by the `MarketSettings` structure, and an optimizer. The `MarketSettings` structure itself requires three optional arguments: `inner_method`, `lmp_method`, and `formulation`. If the computation of Locational Marginal Prices (LMPs) is not desired, the `lmp_method` can be set to `nothing`. Additional optional parameters include a linear programming optimizer for solving LMPs (if a different optimizer than the required one is desired), callback functions `after_build_da` and `after_optimize_da`, which are invoked after the construction and optimization of the DA market, and callback functions `after_build_rt` and `after_optimize_rt`, which are invoked after the construction and optimization of each RT market. It is crucial to note that the `after_build` function requires its two arguments to consistently correspond to `model` and `instance`, while the `after_optimize` function requires its three arguments to consistently correspond to `solution`, `model`, and `instance`. + +As an illustrative example, suppose the DA market predicts hourly data for a 24-hour period, while the RT markets represent 5-minute intervals. In this scenario, each RT market file corresponds to a specific 5-minute interval, with the first RT market representing the initial 5 minutes, the second RT market representing the subsequent 5 minutes, and so on. Consequently, there should be 12 RT market files for each hour. To mitigate the closing window effect, except for the last few RT markets, each RT market should contain three time slots, resulting in a total time span of 15 minutes. However, only the first time slot is considered in the final solution. The last two RT markets should only contain 2 and 1 time slot(s), respectively, to ensure that the total time covered by all RT markets does not exceed the time span of the DA market. The code snippet below demonstrates a simplified example of how to utilize the `solve_market` function. Please note that it only serves as a simplified example and may require further customization based on the specific requirements of your use case. + +```julia +using UnitCommitment, Cbc, HiGHS + +import UnitCommitment: + MarketSettings, + XavQiuWanThi2019, + ConventionalLMP, + Formulation + +solution = UnitCommitment.solve_market( + "da_instance.json", + ["rt_instance_1.json", "rt_instance_2.json", "rt_instance_3.json"], + MarketSettings( + inner_method = XavQiuWanThi2019.Method(), + lmp_method = ConventionalLMP(), + formulation = Formulation(), + ), + optimizer = Cbc.Optimizer, + lp_optimizer = HiGHS.Optimizer, +) +``` + +## Computing Locational Marginal Prices + +Locational marginal prices (LMPs) refer to the cost of supplying electricity at a particular location of the network. Multiple methods for computing LMPs have been proposed in the literature. UnitCommitment.jl implements two commonly-used methods: conventional LMPs and Approximated Extended LMPs (AELMPs). To compute LMPs for a given unit commitment instance, the `compute_lmp` function can be used, as shown in the examples below. The function accepts three arguments -- a solved SCUC model, an LMP method, and a linear optimizer -- and it returns a dictionary mapping `(bus_name, time)` to the marginal price. + +!!! warning + + Most mixed-integer linear optimizers, such as `HiGHS`, `Gurobi` and `CPLEX` can be used with `compute_lmp`, with the notable exception of `Cbc`, which does not support dual value evaluations. If using `Cbc`, please provide `Clp` as the linear optimizer. + +### Conventional LMPs + +LMPs are conventionally computed by: (1) solving the SCUC model, (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 dual variables' values associated with the net injection constraints. The example below shows how to compute conventional LMPs for a given unit commitment instance. First, we build and optimize the SCUC model. Then, we call the `compute_lmp` function, providing as the second argument `ConventionalLMP()`. + +```julia +using UnitCommitment +using HiGHS + +import UnitCommitment: ConventionalLMP + +# Read benchmark instance +instance = UnitCommitment.read_benchmark("matpower/case118/2018-01-01") + +# Build the model +model = UnitCommitment.build_model( + instance = instance, + optimizer = HiGHS.Optimizer, +) + +# Optimize the model +UnitCommitment.optimize!(model) + +# Compute the LMPs using the conventional method +lmp = UnitCommitment.compute_lmp( + model, + ConventionalLMP(), + optimizer = HiGHS.Optimizer, +) + +# Access the LMPs +# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot +@show lmp["s1","b1", 1] +``` + +### Approximate Extended LMPs + +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 `AELMP()` as the second argument. + +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`. + +!!! warning + + This approximation 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. The method does not support multiple scenarios. If offline participation is not allowed, AELMPs treats an asset to be offline if it is never on throughout all time periods. + +```julia +using UnitCommitment +using HiGHS + +import UnitCommitment: AELMP + +# Read benchmark instance +instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") + +# Build the model +model = UnitCommitment.build_model( + instance = instance, + optimizer = HiGHS.Optimizer, +) + +# Optimize the model +UnitCommitment.optimize!(model) + +# Compute the AELMPs +aelmp = UnitCommitment.compute_lmp( + model, + AELMP( + allow_offline_participation = false, + consider_startup_costs = true + ), + optimizer = HiGHS.Optimizer +) + +# Access the AELMPs +# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot +# Note: although scenario is supported, the query still keeps the scenario keys for consistency. +@show aelmp["s1", "b1", 1] +``` diff --git a/docs/src/tutorials/usage.md b/docs/src/tutorials/usage.md new file mode 100644 index 0000000..8a24297 --- /dev/null +++ b/docs/src/tutorials/usage.md @@ -0,0 +1,119 @@ +# Getting started + +## Installation + +UnitCommitment.jl was tested and developed with [Julia 1.9](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: + +```text +pkg> add UnitCommitment@0.4 +``` + +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 listed in JuMP installation guide should also be compatible. + +## Solving user-provided instances + +The first step to use UC.jl is to construct JSON files that describe each scenario of your deterministic or stochastic unit commitment instance. See [Data Format](../guides/format.md) for a complete description of the data format UC.jl expects. The next steps, as shown below, are to: (1) read the scenario files; (2) build the optimization model; (3) run the optimization; and (4) extract the optimal solution. + +```julia +using HiGHS +using JuMP +using UnitCommitment + +# 1. Read instance +instance = UnitCommitment.read(["example/s1.json", "example/s2.json"]) + +# 2. Construct optimization model +model = UnitCommitment.build_model( + instance=instance, + optimizer=HiGHS.Optimizer, +) + +# 3. Solve model +UnitCommitment.optimize!(model) + +# 4. Write solution to a file +solution = UnitCommitment.solution(model) +UnitCommitment.write("example/out.json", solution) +``` + +To read multiple files from a given folder, the [Glob](https://github.com/vtjnash/Glob.jl) package can be used: + +```jldoctest usage1; output = false +using Glob +using UnitCommitment + +instance = UnitCommitment.read(glob("s*.json", "example/")) + +# output +UnitCommitmentInstance(2 scenarios, 6 thermal units, 0 profiled units, 14 buses, 20 lines, 19 contingencies, 1 price sensitive loads, 4 time steps) +``` + +To solve deterministic instances, a single scenario file may be provided. + +```jldoctest usage1; output = false +instance = UnitCommitment.read("example/s1.json") + +# output +UnitCommitmentInstance(1 scenarios, 6 thermal units, 0 profiled units, 14 buses, 20 lines, 19 contingencies, 1 price sensitive loads, 4 time steps) +``` + +## Solving benchmark instances + +UnitCommitment.jl contains a large number of deterministic benchmark instances collected from the literature and converted into a common data format. To solve one of these instances individually, instead of constructing your own, the function `read_benchmark` can be used, as shown below. See [Instances](../guides/instances.md) for the complete list of available instances. + +```jldoctest usage1; output = false +instance = UnitCommitment.read_benchmark("matpower/case3375wp/2017-02-01") + +# output +UnitCommitmentInstance(1 scenarios, 590 thermal units, 0 profiled units, 3374 buses, 4161 lines, 3245 contingencies, 0 price sensitive loads, 36 time steps) +``` + +## Generating initial conditions + +When creating random unit commitment instances for benchmark purposes, it is often hard to compute, in advance, sensible initial conditions for all thermal generators. 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. 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. + +To help with this issue, UC.jl provides a utility function which can generate feasible initial conditions by solving a single-period optimization problem, as shown below: + +```julia +using HiGHS +using UnitCommitment + +# Read original instance +instance = UnitCommitment.read("example/s1.json") + +# Generate initial conditions (in-place) +UnitCommitment.generate_initial_conditions!(instance, HiGHS.Optimizer) + +# Construct and solve optimization model +model = UnitCommitment.build_model( + instance=instance, + optimizer=HiGHS.Optimizer, +) +UnitCommitment.optimize!(model) +``` + +!!! warning + + 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. + +## Verifying solutions + +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. + +```jldoctest; output = false +using JSON +using UnitCommitment + +# Read instance +instance = UnitCommitment.read("example/s1.json") + +# Read solution (potentially produced by other packages) +solution = JSON.parsefile("example/out.json") + +# Validate solution and print validation errors +UnitCommitment.validate(instance, solution) + +# output + +true +``` diff --git a/docs/src/usage.md b/docs/src/usage.md deleted file mode 100644 index e8d1776..0000000 --- a/docs/src/usage.md +++ /dev/null @@ -1,381 +0,0 @@ -Usage -===== - -Installation ------------- - -UnitCommitment.jl was tested and developed with [Julia 1.9](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: - -```text -pkg> add UnitCommitment@0.4 -``` - -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 listed in JuMP installation guide should also be compatible. - -Typical Usage -------------- - -### Solving user-provided instances - -The first step to use UC.jl is to construct JSON files that describe each scenario of your deterministic or stochastic unit commitment instance. See [Data Format](format.md) for a complete description of the data format UC.jl expects. The next steps, as shown below, are to: (1) read the scenario files; (2) build the optimization model; (3) run the optimization; and (4) extract the optimal solution. - -```julia -using HiGHS -using JuMP -using UnitCommitment - -# 1. Read instance -instance = UnitCommitment.read(["example/s1.json", "example/s2.json"]) - -# 2. Construct optimization model -model = UnitCommitment.build_model( - instance=instance, - optimizer=HiGHS.Optimizer, -) - -# 3. Solve model -UnitCommitment.optimize!(model) - -# 4. Write solution to a file -solution = UnitCommitment.solution(model) -UnitCommitment.write("example/out.json", solution) -``` - -To read multiple files from a given folder, the [Glob](https://github.com/vtjnash/Glob.jl) package can be used: - -```jldoctest usage1; output = false -using Glob -using UnitCommitment - -instance = UnitCommitment.read(glob("s*.json", "example/")) - -# output -UnitCommitmentInstance(2 scenarios, 6 thermal units, 0 profiled units, 14 buses, 20 lines, 19 contingencies, 1 price sensitive loads, 4 time steps) -``` - -To solve deterministic instances, a single scenario file may be provided. - -```jldoctest usage1; output = false -instance = UnitCommitment.read("example/s1.json") - -# output -UnitCommitmentInstance(1 scenarios, 6 thermal units, 0 profiled units, 14 buses, 20 lines, 19 contingencies, 1 price sensitive loads, 4 time steps) -``` - -### Solving benchmark instances - -UnitCommitment.jl contains a large number of deterministic benchmark instances collected from the literature and converted into a common data format. To solve one of these instances individually, instead of constructing your own, the function `read_benchmark` can be used, as shown below. See [Instances](instances.md) for the complete list of available instances. - -```jldoctest usage1; output = false -instance = UnitCommitment.read_benchmark("matpower/case3375wp/2017-02-01") - -# output -UnitCommitmentInstance(1 scenarios, 590 thermal units, 0 profiled units, 3374 buses, 4161 lines, 3245 contingencies, 0 price sensitive loads, 36 time steps) -``` - -## Customizing the formulation - -By default, `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. You can, however, construct your own formulation, based on the modeling components that you choose, as shown in the next example. - -```julia -using HiGHS -using UnitCommitment - -import UnitCommitment: - Formulation, - KnuOstWat2018, - MorLatRam2013, - ShiftFactorsFormulation - -instance = UnitCommitment.read_benchmark( - "matpower/case118/2017-02-01", -) - -model = UnitCommitment.build_model( - instance = instance, - optimizer = HiGHS.Optimizer, - formulation = Formulation( - pwl_costs = KnuOstWat2018.PwlCosts(), - ramping = MorLatRam2013.Ramping(), - startup_costs = MorLatRam2013.StartupCosts(), - transmission = ShiftFactorsFormulation( - isf_cutoff = 0.005, - lodf_cutoff = 0.001, - ), - ), -) -``` - -## Generating initial conditions - -When creating random unit commitment instances for benchmark purposes, it is often hard to compute, in advance, sensible initial conditions for all thermal generators. 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. 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. - -To help with this issue, UC.jl provides a utility function which can generate feasible initial conditions by solving a single-period optimization problem, as shown below: - -```julia -using HiGHS -using UnitCommitment - -# Read original instance -instance = UnitCommitment.read("example/s1.json") - -# Generate initial conditions (in-place) -UnitCommitment.generate_initial_conditions!(instance, HiGHS.Optimizer) - -# Construct and solve optimization model -model = UnitCommitment.build_model( - instance=instance, - optimizer=HiGHS.Optimizer, -) -UnitCommitment.optimize!(model) -``` - -!!! warning - - 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. - -## Verifying solutions - -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. - -```jldoctest; output = false -using JSON -using UnitCommitment - -# Read instance -instance = UnitCommitment.read("example/s1.json") - -# Read solution (potentially produced by other packages) -solution = JSON.parsefile("example/out.json") - -# Validate solution and print validation errors -UnitCommitment.validate(instance, solution) - -# output - -true -``` - -## Progressive Hedging - -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. - -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. - -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 julia ph.jl`. - - -```julia -using HiGHS -using MPI -using UnitCommitment -using Glob - -# 1. Initialize MPI -MPI.Init() - -# 2. Configure progressive hedging method -ph = UnitCommitment.ProgressiveHedging() - -# 3. Read problem instance -instance = UnitCommitment.read(["example/s1.json", "example/s2.json"], ph) - -# 4. Build JuMP model -model = UnitCommitment.build_model( - instance = instance, - optimizer = HiGHS.Optimizer, -) - -# 5. Run the decentralized optimization algorithm -UnitCommitment.optimize!(model, ph) - -# 6. Fetch the solution -solution = UnitCommitment.solution(model, ph) - -# 7. Close MPI -MPI.Finalize() -``` - -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. - -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. - - -!!! warning - - Currently, PH can handle only equiprobable scenarios. Further, `solution(model, ph)` can only handle cases where only one scenario is modeled in each process. - - -## Computing Locational Marginal Prices - -Locational marginal prices (LMPs) refer to the cost of supplying electricity at a particular location of the network. Multiple methods for computing LMPs have been proposed in the literature. UnitCommitment.jl implements two commonly-used methods: conventional LMPs and Approximated Extended LMPs (AELMPs). To compute LMPs for a given unit commitment instance, the `compute_lmp` function can be used, as shown in the examples below. The function accepts three arguments -- a solved SCUC model, an LMP method, and a linear optimizer -- and it returns a dictionary mapping `(bus_name, time)` to the marginal price. - - -!!! warning - - Most mixed-integer linear optimizers, such as `HiGHS`, `Gurobi` and `CPLEX` can be used with `compute_lmp`, with the notable exception of `Cbc`, which does not support dual value evaluations. If using `Cbc`, please provide `Clp` as the linear optimizer. - -### Conventional LMPs - -LMPs are conventionally computed by: (1) solving the SCUC model, (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 dual variables' values associated with the net injection constraints. The example below shows how to compute conventional LMPs for a given unit commitment instance. First, we build and optimize the SCUC model. Then, we call the `compute_lmp` function, providing as the second argument `ConventionalLMP()`. - - -```julia -using UnitCommitment -using HiGHS - -import UnitCommitment: ConventionalLMP - -# Read benchmark instance -instance = UnitCommitment.read_benchmark("matpower/case118/2018-01-01") - -# Build the model -model = UnitCommitment.build_model( - instance = instance, - optimizer = HiGHS.Optimizer, -) - -# Optimize the model -UnitCommitment.optimize!(model) - -# Compute the LMPs using the conventional method -lmp = UnitCommitment.compute_lmp( - model, - ConventionalLMP(), - optimizer = HiGHS.Optimizer, -) - -# Access the LMPs -# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot -@show lmp["s1","b1", 1] -``` - -### Approximate Extended LMPs - -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 `AELMP()` as the second argument. - -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`. - -!!! warning - - This approximation 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. The method does not support multiple scenarios. If offline participation is not allowed, AELMPs treats an asset to be offline if it is never on throughout all time periods. - -```julia -using UnitCommitment -using HiGHS - -import UnitCommitment: AELMP - -# Read benchmark instance -instance = UnitCommitment.read_benchmark("matpower/case118/2017-02-01") - -# Build the model -model = UnitCommitment.build_model( - instance = instance, - optimizer = HiGHS.Optimizer, -) - -# Optimize the model -UnitCommitment.optimize!(model) - -# Compute the AELMPs -aelmp = UnitCommitment.compute_lmp( - model, - AELMP( - allow_offline_participation = false, - consider_startup_costs = true - ), - optimizer = HiGHS.Optimizer -) - -# Access the AELMPs -# Example: "s1" is the scenario name, "b1" is the bus name, 1 is the first time slot -# Note: although scenario is supported, the query still keeps the scenario keys for consistency. -@show aelmp["s1", "b1", 1] -``` - -## Time Decomposition - -Solving unit commitment instances that have long time horizons (for example, year-long 8760-hour instances) 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. - -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. - -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`. - -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. - -> **Warning** -> 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. - -```julia -using UnitCommitment, JuMP, Cbc, HiGHS - -import UnitCommitment: - TimeDecomposition, - ConventionalLMP, - XavQiuWanThi2019, - Formulation - -# specifying the after_build and after_optimize functions -function after_build(model, instance) - @constraint( - model, - model[:is_on]["g3", 1] + model[:is_on]["g4", 1] <= 1, - ) -end - -lmps = [] -function after_optimize(solution, model, instance) - lmp = UnitCommitment.compute_lmp( - model, - ConventionalLMP(), - optimizer = HiGHS.Optimizer, - ) - return push!(lmps, lmp) -end - -# assume the instance is given as a 120h problem -instance = UnitCommitment.read("instance.json") - -solution = UnitCommitment.optimize!( - instance, - TimeDecomposition( - time_window = 36, # solve 36h problems - time_increment = 24, # advance by 24h each time - inner_method = XavQiuWanThi2019.Method(), - formulation = Formulation(), - ), - optimizer = Cbc.Optimizer, - after_build = after_build, - after_optimize = after_optimize, -) -``` - -## Day-ahead (DA) Market to Real-time (RT) Markets -The UC.jl package offers a comprehensive set of functions for solving marketing problems. The primary function, `solve_market`, facilitates the solution of day-ahead (DA) markets, which can be either deterministic or stochastic in nature. Subsequently, it sequentially maps the commitment status obtained from the DA market to all the real-time (RT) markets, which are deterministic instances. It is essential to ensure that the time span of the DA market encompasses all the RT markets, and the file paths for the RT markets must be specified in chronological order. Each RT market should represent a single time slot, and it is recommended to include a few additional time slots to mitigate the closing window effect. - -The `solve_market` function accepts several parameters, including the file path (or a list of file paths in the case of stochastic markets) for the DA market, a list of file paths for the RT markets, the market settings specified by the `MarketSettings` structure, and an optimizer. The `MarketSettings` structure itself requires three optional arguments: `inner_method`, `lmp_method`, and `formulation`. If the computation of Locational Marginal Prices (LMPs) is not desired, the `lmp_method` can be set to `nothing`. Additional optional parameters include a linear programming optimizer for solving LMPs (if a different optimizer than the required one is desired), callback functions `after_build_da` and `after_optimize_da`, which are invoked after the construction and optimization of the DA market, and callback functions `after_build_rt` and `after_optimize_rt`, which are invoked after the construction and optimization of each RT market. It is crucial to note that the `after_build` function requires its two arguments to consistently correspond to `model` and `instance`, while the `after_optimize` function requires its three arguments to consistently correspond to `solution`, `model`, and `instance`. - -As an illustrative example, suppose the DA market predicts hourly data for a 24-hour period, while the RT markets represent 5-minute intervals. In this scenario, each RT market file corresponds to a specific 5-minute interval, with the first RT market representing the initial 5 minutes, the second RT market representing the subsequent 5 minutes, and so on. Consequently, there should be 12 RT market files for each hour. To mitigate the closing window effect, except for the last few RT markets, each RT market should contain three time slots, resulting in a total time span of 15 minutes. However, only the first time slot is considered in the final solution. The last two RT markets should only contain 2 and 1 time slot(s), respectively, to ensure that the total time covered by all RT markets does not exceed the time span of the DA market. The code snippet below demonstrates a simplified example of how to utilize the `solve_market` function. Please note that it only serves as a simplified example and may require further customization based on the specific requirements of your use case. - -```julia -using UnitCommitment, Cbc, HiGHS - -import UnitCommitment: - MarketSettings, - XavQiuWanThi2019, - ConventionalLMP, - Formulation - -solution = UnitCommitment.solve_market( - "da_instance.json", - ["rt_instance_1.json", "rt_instance_2.json", "rt_instance_3.json"], - MarketSettings( - inner_method = XavQiuWanThi2019.Method(), - lmp_method = ConventionalLMP(), - formulation = Formulation(), - ), - optimizer = Cbc.Optimizer, - lp_optimizer = HiGHS.Optimizer, -) -``` diff --git a/src/instance/read.jl b/src/instance/read.jl index 62b0230..fcf8ee9 100644 --- a/src/instance/read.jl +++ b/src/instance/read.jl @@ -14,7 +14,7 @@ const INSTANCES_URL = "https://axavier.org/UnitCommitment.jl/0.3/instances" read_benchmark(name::AbstractString)::UnitCommitmentInstance Read one of the benchmark instances included in the package. See -[Instances](instances.md) for the entire list of benchmark instances available. +[Instances](guides/instances.md) for the entire list of benchmark instances available. # Example ```julia