From b29c7b3126d3ed46dc4833a17567f0d0093d0dca Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Wed, 12 Jun 2019 20:10:11 -0600 Subject: [PATCH 1/2] update powermodels function names --- Project.toml | 4 ++-- docs/src/specifications.md | 14 +++++++------- src/core/base.jl | 2 +- src/core/solution.jl | 6 +++--- src/prob/gpf.jl | 4 ++-- src/prob/ne.jl | 17 +++++++++-------- src/prob/neopf.jl | 11 ++++++----- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Project.toml b/Project.toml index bb029e2..4af1e46 100644 --- a/Project.toml +++ b/Project.toml @@ -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.1.0" +version = "0.1.1" [deps] GasModels = "5e113713-6c35-5477-b766-e1109486666f" @@ -16,7 +16,7 @@ PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655" JSON = ">= 0.18" GasModels = "~0.4" InfrastructureModels = "~0.2" -PowerModels = "~0.11" +PowerModels = "~0.12" julia = "^1" [extras] diff --git a/docs/src/specifications.md b/docs/src/specifications.md index 0c8e6f6..b0bcc6a 100644 --- a/docs/src/specifications.md +++ b/docs/src/specifications.md @@ -22,7 +22,7 @@ GasModels.variable_production_mass_flow(gm) ### Constraints ```julia -PowerModels.constraint_voltage(pm) +PowerModels.constraint_model_voltage(pm) for i in PowerModels.ids(pm, :ref_buses) PowerModels.constraint_theta_ref(pm, i) @@ -30,7 +30,7 @@ for i in PowerModels.ids(pm, :ref_buses) end for i in PowerModels.ids(pm, :bus) - PowerModels.constraint_kcl_shunt(pm, i) + PowerModels.constraint_power_balance_shunt(pm, i) if length(ref(pm, :bus_gens, i)) > 0 && !(i in ids(pm,:ref_buses)) PowerModels.constraint_voltage_magnitude_setpoint(pm, i) for j in ref(pm, :bus_gens, i) @@ -103,8 +103,8 @@ PowerModels.variable_generation(pm) PowerModels.variable_branch_flow(pm) PowerModels.variable_dcline_flow(pm) PowerModels.variable_branch_flow_ne(pm) -PowerModels.constraint_voltage(pm) -PowerModels.constraint_voltage_ne(pm) +PowerModels.constraint_model_voltage(pm) +PowerModels.constraint_model_voltage_ne(pm) GasModels.variable_flow(gm) GasModels.variable_pressure_sqr(gm) @@ -118,15 +118,15 @@ GasModels.variable_flow_ne(gm) ### Constraints ```julia -PowerModels.constraint_voltage(pm) -PowerModels.constraint_voltage_ne(pm) +PowerModels.constraint_model_voltage(pm) +PowerModels.constraint_model_voltage_ne(pm) for i in ids(pm, :ref_buses) PowerModels.constraint_theta_ref(pm, i) end for i in ids(pm, :bus) - PowerModels.constraint_kcl_shunt_ne(pm, i) + PowerModels.constraint_power_balance_shunt_ne(pm, i) end for i in ids(pm, :branch) diff --git a/src/core/base.jl b/src/core/base.jl index 83496e6..8359720 100644 --- a/src/core/base.jl +++ b/src/core/base.jl @@ -44,7 +44,7 @@ end "" function build_generic_model(pdata::Dict{String,Any}, gdata::Dict{String,Any}, power_model_constructor, gas_model_constructor, post_method; power_ref_extensions=[], multinetwork=false, multiconductor=false, kwargs...) gm = GasModels.build_generic_model(gdata, gas_model_constructor, empty_post_method; multinetwork=multinetwork, kwargs...) - pm = PowerModels.build_generic_model(pdata, power_model_constructor, empty_post_method; ref_extensions=power_ref_extensions, multinetwork=multinetwork, multiconductor=multiconductor) + pm = PowerModels.build_model(pdata, power_model_constructor, empty_post_method; ref_extensions=power_ref_extensions, multinetwork=multinetwork, multiconductor=multiconductor) add_junction_generators(pm, gm) diff --git a/src/core/solution.jl b/src/core/solution.jl index f6d63cd..cd1bcf3 100644 --- a/src/core/solution.jl +++ b/src/core/solution.jl @@ -28,9 +28,9 @@ end function get_solution(pm::GenericPowerModel, gm::GenericGasModel) sol = Dict{AbstractString,Any}() - PowerModels.add_bus_voltage_setpoint(sol, pm) - PowerModels.add_generator_power_setpoint(sol, pm) - PowerModels.add_branch_flow_setpoint(sol, pm) + PowerModels.add_setpoint_bus_voltage!(sol, pm) + PowerModels.add_setpoint_generator_power!(sol, pm) + PowerModels.add_setpoint_branch_flow!(sol, pm) GasModels.add_junction_pressure_setpoint(sol, gm) return sol end diff --git a/src/prob/gpf.jl b/src/prob/gpf.jl index 8ddd91d..64bdb3c 100644 --- a/src/prob/gpf.jl +++ b/src/prob/gpf.jl @@ -33,7 +33,7 @@ function post_gpf(pm::GenericPowerModel) PowerModels.variable_branch_flow(pm, bounded = false) PowerModels.variable_dcline_flow(pm, bounded = false) - PowerModels.constraint_voltage(pm) + PowerModels.constraint_model_voltage(pm) for i in PowerModels.ids(pm, :ref_buses) PowerModels.constraint_theta_ref(pm, i) @@ -41,7 +41,7 @@ function post_gpf(pm::GenericPowerModel) end for i in PowerModels.ids(pm, :bus) - PowerModels.constraint_kcl_shunt(pm, i) + PowerModels.constraint_power_balance_shunt(pm, i) # PV Bus Constraints if length(ref(pm, :bus_gens, i)) > 0 && !(i in ids(pm,:ref_buses)) diff --git a/src/prob/ne.jl b/src/prob/ne.jl index 55f7d39..d243b09 100644 --- a/src/prob/ne.jl +++ b/src/prob/ne.jl @@ -4,7 +4,7 @@ export run_ne_popf " entry point for running gas and electric power expansion planning only " function run_ne(power_file, gas_file, power_model_constructor, gas_model_constructor, solver; solution_builder=get_ne_solution, kwargs...) - return run_generic_model(power_file, gas_file, power_model_constructor, gas_model_constructor, solver, post_ne; power_ref_extensions=[PowerModels.on_off_va_bounds_ref!,PowerModels.ne_branch_ref!], solution_builder=solution_builder, kwargs...) + return run_generic_model(power_file, gas_file, power_model_constructor, gas_model_constructor, solver, post_ne; power_ref_extensions=[PowerModels.ref_add_on_off_va_bounds!,PowerModels.ref_add_ne_branch!], solution_builder=solution_builder, kwargs...) end "Post all the constraints associated with expansion planning in electric power" @@ -17,15 +17,15 @@ function post_tnep(pm::GenericPowerModel) PowerModels.variable_dcline_flow(pm) # DC line flows. Not used in TPS paper PowerModels.variable_branch_flow_ne(pm) # variable p,q in the TPS paper - PowerModels.constraint_voltage(pm) # adds upper and lower bounds on voltage and voltage squared, constraint 11 in TPS paper - PowerModels.constraint_voltage_ne(pm) # adds upper and lower bounds on voltage and voltage squared, constraint 11 in TPS paper + PowerModels.constraint_model_voltage(pm) # adds upper and lower bounds on voltage and voltage squared, constraint 11 in TPS paper + PowerModels.constraint_model_voltage_ne(pm) # adds upper and lower bounds on voltage and voltage squared, constraint 11 in TPS paper for i in ids(pm, :ref_buses) PowerModels.constraint_theta_ref(pm, i) # sets the reference bus phase angle to 0 (not explictly stated in TPS paper) end for i in ids(pm, :bus) - PowerModels.constraint_kcl_shunt_ne(pm, i) # Kirchoff's laws (constraints 1 and 2 in TPS paper) + PowerModels.constraint_power_balance_shunt_ne(pm, i) # Kirchoff's laws (constraints 1 and 2 in TPS paper) end for i in ids(pm, :branch) @@ -123,9 +123,9 @@ end function get_ne_solution(pm::GenericPowerModel, gm::GenericGasModel) sol = Dict{AbstractString,Any}() - PowerModels.add_bus_voltage_setpoint(sol, pm) - PowerModels.add_generator_power_setpoint(sol, pm) - PowerModels.add_branch_flow_setpoint(sol, pm) + PowerModels.add_setpoint_bus_voltage!(sol, pm) + PowerModels.add_setpoint_generator_power!(sol, pm) + PowerModels.add_setpoint_branch_flow!(sol, pm) GasModels.add_junction_pressure_setpoint(sol, gm) GasModels.add_connection_ne(sol, gm) GasModels.add_load_mass_flow_setpoint(sol, gm) @@ -135,6 +135,7 @@ function get_ne_solution(pm::GenericPowerModel, gm::GenericGasModel) GasModels.add_direction_setpoint(sol, gm) GasModels.add_direction_ne_setpoint(sol,gm) GasModels.add_valve_setpoint(sol, gm) - PowerModels.add_branch_ne_setpoint(sol, pm) + PowerModels.add_setpoint_branch_ne_flow!(sol, pm) + PowerModels.add_setpoint_branch_ne_built!(sol, pm) return sol end diff --git a/src/prob/neopf.jl b/src/prob/neopf.jl index fd3f3ee..56c0610 100644 --- a/src/prob/neopf.jl +++ b/src/prob/neopf.jl @@ -2,7 +2,7 @@ " entry point for running gas and electric power expansion planning with demand-based pricing and a pressure penalty (in TPS paper) " function run_ne_opf(power_file, gas_file, power_model_constructor, gas_model_constructor, solver; solution_builder=get_ne_opf_solution, kwargs...) - return run_generic_model(power_file, gas_file, power_model_constructor, gas_model_constructor, solver, post_ne_opf; power_ref_extensions=[PowerModels.on_off_va_bounds_ref!,PowerModels.ne_branch_ref!], solution_builder=solution_builder, kwargs...) + return run_generic_model(power_file, gas_file, power_model_constructor, gas_model_constructor, solver, post_ne_opf; power_ref_extensions=[PowerModels.ref_add_on_off_va_bounds!,PowerModels.ref_add_ne_branch!], solution_builder=solution_builder, kwargs...) end " Construct the gas flow feasbility problem with demand being the cost model" @@ -30,9 +30,9 @@ end function get_ne_opf_solution(pm::GenericPowerModel, gm::GenericGasModel) sol = Dict{AbstractString,Any}() - PowerModels.add_bus_voltage_setpoint(sol, pm) - PowerModels.add_generator_power_setpoint(sol, pm) - PowerModels.add_branch_flow_setpoint(sol, pm) + PowerModels.add_setpoint_bus_voltage!(sol, pm) + PowerModels.add_setpoint_generator_power!(sol, pm) + PowerModels.add_setpoint_branch_flow!(sol, pm) GasModels.add_junction_pressure_setpoint(sol, gm) GasModels.add_connection_ne(sol, gm) GasModels.add_load_mass_flow_setpoint(sol, gm) @@ -42,7 +42,8 @@ function get_ne_opf_solution(pm::GenericPowerModel, gm::GenericGasModel) GasModels.add_direction_setpoint(sol, gm) GasModels.add_direction_ne_setpoint(sol,gm) GasModels.add_valve_setpoint(sol, gm) - PowerModels.add_branch_ne_setpoint(sol, pm) + PowerModels.add_setpoint_branch_ne_flow!(sol, pm) + PowerModels.add_setpoint_branch_ne_built!(sol, pm) add_zone_cost_setpoint(sol, gm) return sol end From 311f57c03b1df355ab83a547acb6823c85db3409 Mon Sep 17 00:00:00 2001 From: ccoffrin Date: Wed, 12 Jun 2019 20:18:32 -0600 Subject: [PATCH 2/2] update manifest --- Manifest.toml | 4 ++-- Project.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 64726f1..d90829e 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -159,9 +159,9 @@ uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" [[PowerModels]] deps = ["InfrastructureModels", "JSON", "JuMP", "LinearAlgebra", "MathOptInterface", "Memento", "SparseArrays"] -git-tree-sha1 = "74d51121ad6fdf2fd1dc06403e2855dac1b8e192" +git-tree-sha1 = "0fcfcd19dbad6710d0f18bd4ae49a98a398c7b6c" uuid = "c36e90e8-916a-50a6-bd94-075b64ef4655" -version = "0.11.2" +version = "0.12.0" [[Printf]] deps = ["Unicode"] diff --git a/Project.toml b/Project.toml index 4af1e46..3198c78 100644 --- a/Project.toml +++ b/Project.toml @@ -13,9 +13,9 @@ Memento = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9" PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655" [compat] -JSON = ">= 0.18" GasModels = "~0.4" InfrastructureModels = "~0.2" +JSON = ">= 0.18" PowerModels = "~0.12" julia = "^1"