Skip to content

Commit

Permalink
Merge pull request #48 from lanl-ansi/gasmodels-0.8
Browse files Browse the repository at this point in the history
UPD: Update for GasModels v0.8
  • Loading branch information
rb004f authored Oct 1, 2020
2 parents 2963add + 4051850 commit a12d8eb
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ os:
- osx
julia:
- 1.0
- 1.5
- 1
- nightly
codecov: true
jobs:
allow_failures:
- julia: nightly
include:
- stage: "Documentation"
julia: 1.5
julia: 1
os: linux
script:
- julia --project=docs/ -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()))'
Expand Down
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
GasPowerModels.jl Change Log
=======================

### Pending
### v0.3.0
- Update to GasModels v0.8.

### Staged
- none
### v0.2.0
- Update to GasModels v0.7 and PowerModels v0.17.
- Change input conventions for gas and power model linking.

### v0.1.1
- Update to PowerModels v0.12
- Update to PowerModels v0.12.

### v0.1.0
- Initial implementation
- Initial implementation.
11 changes: 8 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Multi Infrastructure Control and Optimization Toolkit (MICOT), LA-CC-13-108

Copyright (c) 2016, Triad National Security, LLC

All rights reserved.

This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration.
Expand All @@ -10,7 +11,11 @@ All rights in the program are reserved by Triad National Security, LLC, and the
The U.S. Government has rights to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR TRIAD NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce derivative works, such modified software should be clearly marked, so as not to confuse it with the version available from LANL.

Additionally, redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Triad National Security, LLC, Los Alamos National Laboratory, LANL, the U.S. Government, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of Triad National Security, LLC, Los Alamos National Laboratory, LANL, the U.S. Government, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY TRIAD NATIONAL SECURITY, LLC AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TRIAD NATIONAL SECURITY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "GasPowerModels"
uuid = "1fcaf345-95e3-5b8b-91d6-2145eb844b9d"
authors = ["Russell Bent"]
repo = "https://github.com/lanl-ansi/GasPowerModels.jl"
version = "0.2.0"
version = "0.3.0"

[deps]
GasModels = "5e113713-6c35-5477-b766-e1109486666f"
Expand All @@ -12,7 +12,7 @@ Memento = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"

[compat]
GasModels = "~0.7"
GasModels = "~0.8"
JSON = "~0.18, ~0.19, ~0.20, ~0.21"
JuMP = "~0.21"
Memento = "~1.0, ~1.1"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ This decoupling enables the definition of a variety of optimization formulations
* Optimal Power Flow with Network Expansion Planning (`opf_ne`)

**Core Network Formulations**
* Mixed-integer nonconvex nonlinear program (`MINLP`)
* Mixed-integer second-order cone program (`MISOCP`)
* Directed flow, mixed-integer nonconvex formulation (`D`)
* Convexly relaxed, directed flow mixed-integer formulation (`CRD`)

## Documentation
The package [documentation](https://lanl-ansi.github.io/GasPowerModels.jl/stable/) includes a [quick start guide](https://lanl-ansi.github.io/GasPowerModels.jl/stable/quickguide).
Expand Down Expand Up @@ -65,7 +65,7 @@ g_file = "examples/data/matgas/belgian.m" # Gas network.
p_file = "examples/data/matpower/case14.m" # Power network.

# Specify the gas and power formulation types separately.
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the gas-power flow feasibility problem.
result = run_gpf(g_file, p_file, g_type, p_type, juniper;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ g_file = "examples/data/matgas/belgian.m" # Gas network.
p_file = "examples/data/matpower/case14.m" # Power network.

# Specify the gas and power formulation types separately.
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the gas-power flow feasibility problem.
result = run_gpf(g_file, p_file, g_type, p_type, juniper;
Expand Down
4 changes: 2 additions & 2 deletions docs/src/quickguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ g_file = "examples/data/matgas/belgian-ne_opf.m" # Gas network.
p_file = "examples/data/matpower/case14-ne.m" # Power network.

# Specify the gas and power formulation types separately.
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the optimal power flow with network expansion problem.
result = run_ne_opf(g_file, p_file, g_type, p_type, juniper;
Expand Down Expand Up @@ -89,7 +89,7 @@ For more information about GasPowerModels result data, see the [GasPowerModels R
To solve the preceding problem using the mixed-integer nonconvex model for natural gas flow, the following can be executed:
```julia
# Specify the gas and power formulation types separately.
g_type, p_type = MINLPGasModel, SOCWRPowerModel
g_type, p_type = DWPGasModel, SOCWRPowerModel

# Solve the optimal power flow with network expansion problem.
result = run_ne_opf(g_file, p_file, g_type, p_type, juniper;
Expand Down
4 changes: 2 additions & 2 deletions src/GasPowerModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ module GasPowerModels
include("core/data.jl")
include("core/ref.jl")

include("form/qp.jl")
include("form/nlp.jl")
include("form/relaxed.jl")
include("form/exact.jl")

include("prob/gpf.jl")
include("prob/opf.jl")
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/form/qp.jl → src/form/relaxed.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function constraint_heat_rate_curve(
pm::_PM.AbstractPowerModel, gm::_GM.AbstractMISOCPModel, n::Int, j::Int,
pm::_PM.AbstractPowerModel, gm::_GM.AbstractCRDWPModel, n::Int, j::Int,
generators::Array, heat_rates::Dict{Int,Any}, constant::Float64, dispatchable::Int)
# If flow is not dispatchable, gas will not be consumed by the generator.
fl = dispatchable == 1 ? _GM.var(gm, n, :fl, j) : 0.0
Expand Down
2 changes: 1 addition & 1 deletion test/base.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@testset "src/core/base.jl" begin
g_file = "../test/data/matgas/GasLib-11-GPF.m"
p_file = "../test/data/matpower/case5-GPF.m"
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

@testset "instantiate_model (with file inputs)" begin
gm, pm = instantiate_model(g_file, p_file, g_type, p_type, build_gpf)
Expand Down
4 changes: 2 additions & 2 deletions test/gpf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-GPF.m"
p_file = "../test/data/matpower/case5-GPF.m"
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the gas-power flow feasibility problem.
result = run_gpf(g_file, p_file, g_type, p_type, juniper;
Expand All @@ -21,7 +21,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-GPF.m"
p_file = "../test/data/matpower/case5-GPF.m"
g_type, p_type = MINLPGasModel, SOCWRPowerModel
g_type, p_type = DWPGasModel, SOCWRPowerModel

# Solve the gas-power flow feasibility problem.
result = run_gpf(g_file, p_file, g_type, p_type, juniper;
Expand Down
4 changes: 2 additions & 2 deletions test/ne.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-NE.m"
p_file = "../test/data/matpower/case5-NE.m"
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the joint gas-power network expansion planning problem.
result = run_ne(g_file, p_file, g_type, p_type, juniper;
Expand All @@ -21,7 +21,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-NE.m"
p_file = "../test/data/matpower/case5-NE.m"
g_type, p_type = MINLPGasModel, SOCWRPowerModel
g_type, p_type = DWPGasModel, SOCWRPowerModel

# Solve the joint gas-power network expansion planning problem.
result = run_ne(g_file, p_file, g_type, p_type, juniper;
Expand Down
4 changes: 2 additions & 2 deletions test/ne_opf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-NE.m"
p_file = "../test/data/matpower/case5-NE.m"
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the joint network expansion, optimal gas-power flow problem.
result = run_ne_opf(g_file, p_file, g_type, p_type, juniper;
Expand All @@ -21,7 +21,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-NE.m"
p_file = "../test/data/matpower/case5-NE.m"
g_type, p_type = MINLPGasModel, SOCWRPowerModel
g_type, p_type = DWPGasModel, SOCWRPowerModel

# Solve the joint network expansion, optimal gas-power flow problem.
result = run_ne_opf(g_file, p_file, g_type, p_type, juniper;
Expand Down
8 changes: 4 additions & 4 deletions test/neopf_long.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@

@testset "36 Bus Ilic 1.1 Northeast 1.0" begin
data = GasModels.parse_file("../data/TC_PennToNortheast_wValves_expansion_1.0.json")
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.1.m", "../data/TC_PennToNortheast_wValves_expansion_1.0.json", SOCWRPowerModel, MISOCPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.1.m", "../data/TC_PennToNortheast_wValves_expansion_1.0.json", SOCWRPowerModel, CRDWPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)
@test result["status"] == :LocalOptimal || result["status"] == :Optimal
@test isapprox(result["objective"], 4.926397139595786e9; atol = 1e6)
end

@testset "36 Bus Ilic 1.1 Northeast 2.25" begin
data = GasModels.parse_file("../data/TC_PennToNortheast_wValves_expansion_2.25.json")
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.1.m", "../data/TC_PennToNortheast_wValves_expansion_2.25.json", SOCWRPowerModel, MISOCPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.1.m", "../data/TC_PennToNortheast_wValves_expansion_2.25.json", SOCWRPowerModel, CRDWPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)

@test result["status"] == :LocalOptimal || result["status"] == :Optimal
@test isapprox(result["objective"], 5.127290418071447e9; atol = 1e6)
end

@testset "36 Bus Ilic 1.0 Northeast 1.0" begin
data = GasModels.parse_file("../data/TC_PennToNortheast_wValves_expansion_1.0.json")
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.0.m", "../data/TC_PennToNortheast_wValves_expansion_1.0.json", SOCWRPowerModel, MISOCPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.0.m", "../data/TC_PennToNortheast_wValves_expansion_1.0.json", SOCWRPowerModel, CRDWPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)

@test result["status"] == :LocalOptimal || result["status"] == :Optimal
@test isapprox(result["objective"], 4.0269404390948544e9; atol = 1e6)
end

@testset "36 Bus Ilic 1.0 Northeast 2.25" begin
data = GasModels.parse_file("../data/TC_PennToNortheast_wValves_expansion_2.25.json")
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.0.m", "../data/TC_PennToNortheast_wValves_expansion_2.25.json", SOCWRPowerModel, MISOCPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)
result = GasPowerModels.run_ne_opf("../data/36bus_ilic_expansion_1.0.m", "../data/TC_PennToNortheast_wValves_expansion_2.25.json", SOCWRPowerModel, CRDWPGasModel, misocp_solver; power_opf_weight=365, gas_price_weight=365)

@test result["status"] == :LocalOptimal || result["status"] == :Optimal
@test isapprox(result["objective"], 4.1859768708376384e9; atol = 1e6)
Expand Down
4 changes: 2 additions & 2 deletions test/opf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-GPF.m"
p_file = "../test/data/matpower/case5-GPF.m"
g_type, p_type = MISOCPGasModel, SOCWRPowerModel
g_type, p_type = CRDWPGasModel, SOCWRPowerModel

# Solve the optimal gas-power flow problem.
result = run_opf(g_file, p_file, g_type, p_type, juniper;
Expand All @@ -20,7 +20,7 @@
# Set up problem metadata.
g_file = "../test/data/matgas/GasLib-11-GPF.m"
p_file = "../test/data/matpower/case5-GPF.m"
g_type, p_type = MINLPGasModel, SOCWRPowerModel
g_type, p_type = DWPGasModel, SOCWRPowerModel

# Solve the optimal gas-power flow problem.
result = run_opf(g_file, p_file, g_type, p_type, juniper;
Expand Down

0 comments on commit a12d8eb

Please sign in to comment.