parent
b6ab8fcf4b
commit
12cf9d4b7b
@ -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
|
||||
<center>
|
||||
<img src="../assets/cost_curve.png" style="max-width: 500px"/>
|
||||
<div><b>Figure 1.</b> Piecewise-linear production cost curve.</div>
|
||||
<br/>
|
||||
</center>
|
||||
```
|
||||
|
||||
#### 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.
|
@ -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
|
||||
<center>
|
||||
<img src="../assets/cost_curve.png" style="max-width: 500px"/>
|
||||
<div><b>Figure 1.</b> Piecewise-linear production cost curve.</div>
|
||||
<br/>
|
||||
</center>
|
||||
```
|
||||
|
||||
#### 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.
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
```
|
@ -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 <num-scenarios> 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.
|
@ -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]
|
||||
```
|
@ -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
|
||||
```
|
@ -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 <num-scenarios> 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,
|
||||
)
|
||||
```
|
Loading…
Reference in new issue