Skip to content

Commit 32ef788

Browse files
refactor function names
1 parent 3d7d06d commit 32ef788

6 files changed

+19
-17
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
## v0.9.3
77
- update Memento dependency version
88
- adds linear relaxation formulation for steady state OGF
9+
- adds a new `run_ogf_comp_power_proxy` problem formulation
10+
- the `LRWPGasModel` now is populated
911

1012

1113
## v0.9.2

src/GasModels.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ module GasModels
8383
include("prob/ls.jl")
8484
include("prob/nels.jl")
8585
include("prob/ogf.jl")
86-
include("prob/new_ogf.jl")
86+
include("prob/ogf_comp_power_proxy.jl")
8787
include("prob/transient_ogf.jl")
8888
include("prob/transient_ogf_archived_storage.jl")
8989

src/core/objective.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ end
205205

206206
"function for minimizing new economic costs: ``\\min \\sum_{j \\in {\\cal D}} \\kappa_j \\boldsymbol{d}_j - \\sum_{j \\in {\\cal T}} \\kappa_j \\boldsymbol{\\tau}_j - \\sum_{j \\in {\\cal R}} \\kappa_j \\boldsymbol{r}_j -
207207
\\sum_{k \\in {\\cal C}} |\\boldsymbol{p^2}_{jk} - \\boldsymbol{p^2}_{ik}| ``"
208-
function objective_min_new_economic_costs(gm::AbstractGasModel, nws = [nw_id_default])
208+
function objective_min_proxy_economic_costs(gm::AbstractGasModel, nws = [nw_id_default])
209209
mpp = Dict(n => var(gm, n, :min_power_proxy) for n in nws)
210210
f = Dict(n => var(gm, n, :f_compressor) for n in nws)
211211
p2 = Dict(n => var(gm, n, :psqr) for n in nws)

src/prob/new_ogf.jl src/prob/ogf_comp_power_proxy.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Definitions for running the new optimal gas flow (ogf) (with a proxy compressor power term in the objective)
22

33
"entry point into running the new ogf problem"
4-
function run_new_ogf(file, model_type, optimizer; kwargs...)
4+
function run_ogf_comp_power_proxy(file, model_type, optimizer; kwargs...)
55
return run_model(
66
file,
77
model_type,
88
optimizer,
9-
build_new_ogf;
9+
build_ogf_comp_power_proxy;
1010
solution_processors = [
1111
sol_psqr_to_p!,
1212
sol_compressor_p_to_r!,
@@ -19,18 +19,18 @@ end
1919

2020
""
2121
function run_soc_new_ogf(file, optimizer; kwargs...)
22-
return run_new_ogf(file, CRDWPGasModel, optimizer; kwargs...)
22+
return run_ogf_comp_power_proxy(file, CRDWPGasModel, optimizer; kwargs...)
2323
end
2424

2525

2626
""
2727
function run_dwp_new_ogf(file, optimizer; kwargs...)
28-
return run_new_ogf(file, DWPGasModel, optimizer; kwargs...)
28+
return run_ogf_comp_power_proxy(file, DWPGasModel, optimizer; kwargs...)
2929
end
3030

3131

3232
"construct the new ogf problem"
33-
function build_new_ogf(gm::AbstractGasModel)
33+
function build_ogf_comp_power_proxy(gm::AbstractGasModel)
3434
bounded_compressors = Dict(
3535
x for x in ref(gm, :compressor) if
3636
_calc_is_compressor_energy_bounded(
@@ -53,7 +53,7 @@ function build_new_ogf(gm::AbstractGasModel)
5353
variable_storage(gm)
5454
variable_form_specific(gm)
5555

56-
objective_min_new_economic_costs(gm)
56+
objective_min_proxy_economic_costs(gm)
5757

5858
for (i, junction) in ref(gm, :junction)
5959
constraint_mass_flow_balance(gm, i)

test/new_ogf.jl test/ogf_comp_power_proxy.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
@testset "test new ogf" begin
22
@testset "test wp new ogf" begin
33
@testset "case 6 new ogf" begin
4-
@info "Testing NEW OGF"
4+
@info "Testing OGF with compressor power proxy (linear)"
55
data = GasModels.parse_file("../test/data/matgas/case-6-no-power-limits.m")
6-
result = run_new_ogf(data, WPGasModel, nlp_solver)
6+
result = run_ogf_comp_power_proxy(data, WPGasModel, nlp_solver)
77
@test result["termination_status"] in [LOCALLY_SOLVED, ALMOST_LOCALLY_SOLVED, OPTIMAL, :Suboptimal]
88
@test isapprox(result["objective"], -253.683; atol = 1e-2)
99
GasModels.make_si_units!(result["solution"])
1010
@test isapprox(result["solution"]["receipt"]["1"]["fg"], 123.6822; atol = 1e-2)
1111
end
1212

1313
@testset "case 6 new ogf weymouth lin rel" begin
14-
@info "Testing NEW OGF Linear Relaxation of Pipe Weymouth Physics"
14+
@info "Testing OGF with compressor power proxy Linear Relaxation of Pipe Weymouth Physics"
1515
data = GasModels.parse_file("../test/data/matgas/case-6-no-power-limits.m")
16-
result = run_new_ogf(data, LRWPGasModel, lp_solver)
16+
result = run_ogf_comp_power_proxy(data, LRWPGasModel, lp_solver)
1717
@test result["termination_status"] in [LOCALLY_SOLVED, ALMOST_LOCALLY_SOLVED, OPTIMAL, :Suboptimal]
1818
@test isapprox(result["objective"], -260.00; atol = 1e-2)
1919
GasModels.make_si_units!(result["solution"])
@@ -22,19 +22,19 @@
2222

2323

2424
@testset "case 6 wp new ogf binding energy constraint" begin
25-
@info "Testing NEW OGF Binding Energy Cosntraint"
25+
@info "Testing OGF with compressor power proxy Binding Energy Cosntraint"
2626
data = GasModels.parse_file("../test/data/matgas/case-6.m")
27-
result = run_new_ogf(data, WPGasModel, nlp_solver)
27+
result = run_ogf_comp_power_proxy(data, WPGasModel, nlp_solver)
2828
@test result["termination_status"] in [LOCALLY_SOLVED, ALMOST_LOCALLY_SOLVED, OPTIMAL, :Suboptimal]
2929
@test isapprox(result["objective"], -237.718; atol = 1e-2)
3030
GasModels.make_si_units!(result["solution"])
3131
@test isapprox(result["solution"]["receipt"]["1"]["fg"], 97.33; atol = 1e-2)
3232
end
3333

3434
@testset "case 6 wp new ogf elevation constraint" begin
35-
@info "Testing NEW OGF Elevation Cosntraint"
35+
@info "Testing OGF with compressor power proxy Elevation Cosntraint"
3636
data = GasModels.parse_file("../test/data/matgas/case-6-elevation.m")
37-
result = run_new_ogf(data, WPGasModel, nlp_solver)
37+
result = run_ogf_comp_power_proxy(data, WPGasModel, nlp_solver)
3838
@test result["termination_status"] in [LOCALLY_SOLVED, ALMOST_LOCALLY_SOLVED, OPTIMAL, :Suboptimal]
3939
@test isapprox(result["objective"], -245.251; atol = 1e-2)
4040
GasModels.make_si_units!(result["solution"])

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ include("common.jl")
5252

5353
include("ogf.jl")
5454

55-
include("new_ogf.jl")
55+
include("ogf_comp_power_proxy.jl")
5656

5757
include("ls.jl")
5858

0 commit comments

Comments
 (0)