-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from lanl-ansi/v0.4-dev
UPD: New multi-infrastructure conventions, examples, and documentation.
- Loading branch information
Showing
120 changed files
with
24,490 additions
and
8,938 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,74 @@ | ||
# Developer Documentation | ||
|
||
The GasPowerModels data format allows the user to specify gas network data, power network data, and data related to the interdependencies between gas and power systems. | ||
|
||
## Data Processing functions | ||
|
||
`GasPowerModels` relies on the automated data processing routines of `GasModels` and `PowerModels`, which include capabilities for status propagation, nondimensionalization, topology correction, etc. | ||
However, these capabilities are typically used on independent infrastructure data, whereas `GasPowerModels` must join these data. | ||
Thus, in preprocessing routines, it is recommended that capabilities be invoked explictly so that external dependencies are accounted for. | ||
For example, the core data parsing function `parse_files` performs the following operations: | ||
|
||
```julia | ||
function parse_files(gas_path::String, power_path::String, link_path::String) | ||
joint_network_data = parse_link_file(link_path) | ||
_IM.update_data!(joint_network_data, parse_gas_file(gas_path)) | ||
_IM.update_data!(joint_network_data, parse_power_file(power_path)) | ||
|
||
# Store whether or not each network uses per-unit data. | ||
g_per_unit = get(joint_network_data["it"][_GM.gm_it_name], "is_per_unit", 0) != 0 | ||
p_per_unit = get(joint_network_data["it"][_PM.pm_it_name], "per_unit", false) | ||
|
||
# Correct the network data. | ||
correct_network_data!(joint_network_data) | ||
|
||
# Ensure all datasets use the same units for power. | ||
resolve_units!(joint_network_data, g_per_unit, p_per_unit) | ||
|
||
# Return the network dictionary. | ||
return joint_network_data | ||
end | ||
``` | ||
|
||
Here, the `parse_gas_file` and `parse_power_file` routines skip their respective data correction steps, i.e., | ||
|
||
```julia | ||
function parse_gas_file(file_path::String; skip_correct::Bool = true) | ||
data = _GM.parse_file(file_path; skip_correct = skip_correct) | ||
... | ||
end | ||
|
||
function parse_power_file(file_path::String; skip_correct::Bool = true) | ||
data = _PM.parse_file(file_path; validate = !skip_correct) | ||
... | ||
end | ||
``` | ||
|
||
This ensures the per-unit statuses within source files are preserved so that `GasPowerModels` can determine if interdependency data requires nondimensionalization. | ||
After these routines are called, `correct_network_data!` executes various data and topology correction routines on gas, power, and linking data. | ||
Then, `resolve_units` ensures that linking data is correctly dimensionalized with respect to the initial gas and power dimensionalizations. | ||
|
||
|
||
## Compositional Problems | ||
|
||
A best practice is to adopt a compositional approach for building problems in `GasPowerModels`, leveraging problem definitions of `PowerModels` and `GasModels`. | ||
This helps lessen the impact of breaking changes across independent infrastructure packages. | ||
For example, the joint network expansion planning problem invokes the network expansion planning problems of `GasModels` and `PowerModels` directly with routines like | ||
|
||
```julia | ||
# Gas-only variables and constraints | ||
_GM.build_nels(_get_gasmodel_from_gaspowermodel(gpm)) | ||
|
||
# Power-only variables and constraints | ||
_PM.build_tnep(_get_powermodel_from_gaspowermodel(gpm)) | ||
|
||
# Gas-power related parts of the problem formulation. | ||
for i in _get_interdependent_deliveries(gpm) | ||
constraint_heat_rate(gpm, i) | ||
end | ||
|
||
# Objective minimizes cost of network expansion. | ||
objective_min_ne_cost(gpm) | ||
``` | ||
|
||
Compared to the `GasModels` (`_GM`) and `PowerModels` (`_PM`) routines, the `GasPowerModels` routines only specify interdependency constraints and the joint objective. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Examples Documentation | ||
|
||
The `examples` folder in the root directory contains a library of gas-power network instances which have been developed in the literature. | ||
|
||
Many of the examples can be run using the `run_examples.jl` script which executes various problems and formulations on the library of instances and verifies that `GasPowerModels` returns solutions which were reported in the literature. | ||
Some results, especially those based on relaxations, have departed from those reported in the literature due to advances that have tightened these relaxations since those papers have been published. | ||
|
||
Long term, the plan is to move the examples out of the `GasPowerModels` repository and maintain a special `GasPowerModelsLib` repository specifically for warehousing models developed in the literature. | ||
|
||
|
||
| Problems | Source | | ||
| ----------------------- | ------------------------ | | ||
| case36 | [1] (base model) | | ||
| case36-ne-* | [1] (network expansion) | | ||
| case14-ne | [2] (0% stress case) | | ||
| case14-ne-100 | [2] (100% stress case) | | ||
| northeast | [1] (base model) | | ||
| northeast-ne-* | [1] (network expansion) | | ||
| northeast-ne-C | [1] (section IV-C) | | ||
| northeast-ne-D-* | [1] (section IV-D) | | ||
| northeast-ne-E-* | [1] (section IV-E) | | ||
| belgian-ne | [2] (0% stress case) | | ||
| belgian-ne-100 | [2] (100% stress case) | | ||
|
||
|
||
## Sources | ||
|
||
[1] Russell Bent, Seth Blumsack, Pascal Van Hentenryck, Conrado Borraz-Sánchez, Mehdi Shahriari. Joint Electricity and Natural Gas Transmission Planning With Endogenous Market Feedbacks. IEEE Transactions on Power Systems. 33 (6): 6397-6409, 2018. | ||
|
||
[2] C. Borraz-Sanchez, R. Bent, S. Backhaus, S. Blumsack, H. Hijazi, and P. van Hentenryck. Convex Optimization for Joint Expansion Planning of Natural Gas and Power Systems. Proceedings of the 49th Hawaii International Conference on System Sciences (HICSS-49) (HICSS 2016), Jan. 2016, Grand Hyatt, Kauai. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# Network Formulations | ||
The network formulations for joint gas-power modeling use the formulations defined in GasModels.jl and PowerModels.jl. | ||
|
||
|
||
# GasPowerModels Types | ||
```@meta | ||
CurrentModule = GasPowerModels | ||
``` | ||
|
||
Specification of a `GasPowerModel` requires the specification of both a `GasModels.AbstractGasModel` and a `PowerModels.AbstractPowerModel`, respectively. | ||
For example, to specify a formulation that leverages the `CRDWPGasModel` and `SOCWRPowerModel` types, the corresponding `GasPowerModel` type would be | ||
```julia | ||
GasPowerModel{CRDWPGasModel, SOCWRPowerModel} | ||
``` | ||
|
||
GasPowerModels then utilizes the following (internal) function to construct a `GasPowerModel` object: | ||
```@docs | ||
instantiate_model | ||
``` | ||
|
||
## Type Hierarchy | ||
|
||
GasPowerModels inherits the type hierarchies of GasModels and PowerModels. | ||
Constraint and objective functions are then dispatched based on the choice of types for each of the models. | ||
An example is seen in the function | ||
```@docs | ||
constraint_heat_rate | ||
constraint_heat_rate_on_off | ||
``` | ||
|
||
The convention is that, if a relaxation or approximation of a nonconvex constraint is used in a natural gas and/or electric power model, the linking constraint will also be similarly relaxed or approximated according to the most "complex" independent infrastructure modeling formulation. | ||
For example, if the natural gas formulation uses a linear representation, and the electric power model uses a quadratic representation, then the linking constraint uses the tightest possible relaxation using linear and quadratic interdependency equations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.