Skip to content

Commit

Permalink
Merge pull request #9 from Electa-Git/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
ckjat authored Jul 10, 2023
2 parents 753337a + 35c272c commit 4f11fb4
Show file tree
Hide file tree
Showing 68 changed files with 1,134 additions and 6,483 deletions.
Binary file removed .DS_Store
Binary file not shown.
31 changes: 28 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
Manifest.toml
.DS_Store
# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov

# Files generated by invoking Julia with --track-allocation
*.jl.mem

# System-specific files and directories generated by the BinaryProvider and BinDeps packages
# They contain absolute paths specific to the host computer, and so should not be committed
deps/deps.jl
deps/build.log
deps/downloads/
deps/usr/
deps/src/

# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/
docs/.documenter

# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml

# Output of test scripts
output/

# OS files
.DS_Store

# VS Code files
.vscode/
*.code-workspace
15 changes: 0 additions & 15 deletions .vscode/launch.json

This file was deleted.

File renamed without changes.
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name = "PowerModelsMCDC"
uuid = "05d58fe5-e6ff-58ad-86d6-05dcc0b74504"
authors = ["Chandra Kant Jat", "Jay Dave", "Hakan Ergun"]
repo = "https://github.com/Electa-Git/PowerModelsMCDC.jl"
version = "0.0.0"
version = "0.1.0"

[deps]
InfrastructureModels = "2030c09a-7f63-5d83-885d-db604e0e9cc0"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Memento = "f28f55f0-a522-5efc-85c2-fe41dfb9b2d9"
PowerModels = "c36e90e8-916a-50a6-bd94-075b64ef4655"

[compat]
HiGHS = "1"
InfrastructureModels = "0.7"
Ipopt = "1"
JuMP = "1"
Expand All @@ -20,8 +20,9 @@ PowerModels = "0.19.8"
julia = "1.6"

[extras]
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Ipopt", "Test"]
test = ["HiGHS", "Ipopt", "Test"]
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
[![CI](https://github.com/Electa-Git/PowerModelsMCDC.jl/workflows/CI/badge.svg)](https://github.com/Electa-Git/PowerModelsMCDC.jl/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/Electa-Git/PowerModelsMCDC.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Electa-Git/PowerModelsMCDC.jl)

PowerModelsMCDC.jl is a Julia/JuMP/PowerModels package for hybrid AC/DC systems with multi-conductor model of the DC grid in order to represent unbalanced HVDC grids. The positive and negative poles of bipolar converter stations are modeled separately, and DC buses are modeled using three terminals: the positive, the negative, and the neutral terminal. Each conductor of a DC branch is modeled separately, including the metallic return conductor and converter grounding.
PowerModelsMCDC.jl is a Julia/JuMP/PowerModels package for hybrid AC/DC systems with multiconductor model of the DC grid in order to represent unbalanced HVDC grids. The positive and negative poles of bipolar converter stations are modeled separately, and DC buses are modeled using three terminals: the positive, the negative, and the neutral terminal. Each conductor of a DC branch is modeled separately, including the metallic return conductor and converter grounding.

## Core Problem Specification
* Non-linear AC/DC optimal power flow (OPF) model with multi-conductor DC.
* Non-linear AC/DC optimal power flow (OPF) model with multiconductor DC.
* Only ACP formulation is complete. DCP and convex relaxations are currently under development.

### Other problems (to be added in this package)
* AC/DC SCOPF with multi-conductor DC (MCDC SCOPF): Complete and planned to be added soon.
* AC/DC SCOPF with multiconductor DC (MCDC SCOPF): Complete and planned to be added soon.
* Transmission network expansion planning with mixed monopolar and bipolar HVDC configurations: Complete.
* AC/DC power flow with different converter control modes: Under development.
## Contributors

Chandra Kant Jat (KU Leuven / EnergyVille): Main developer
Jay Dave (KU Leuven / EnergyVille): Testing and validations
Hakan Ergun (KU Leuven / EnergyVille): Supervisor
* Chandra Kant Jat (KU Leuven / EnergyVille): Main developer
* Jay Dave (KU Leuven / EnergyVille): Testing and validations
* Hakan Ergun (KU Leuven / EnergyVille): Supervisor

## Citing PowerModelsMCDC

Expand All @@ -41,4 +41,4 @@ If you have something to discuss about the package or related work please feel f

## License

This code is provided under a [BSD 3-Clause License](/LICENSE).
This code is provided under a [BSD 3-Clause License](/LICENSE.md).
11 changes: 0 additions & 11 deletions REQUIRE

This file was deleted.

28 changes: 28 additions & 0 deletions examples/opf_acp.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# OPF problem, nonlinear formulation

import PowerModels as _PM
import PowerModelsMCDC as _PMMCDC
import Ipopt

nlp_solver = _PMMCDC.optimizer_with_attributes(Ipopt.Optimizer, "tol" => 1e-6, "print_level" => 0)
file = "./test/data/matacdc_scripts/case5_2grids_MC.m"

s = Dict("conv_losses_mp" => false)
result_mcdc = _PMMCDC.solve_mcdcopf(file, _PM.ACPPowerModel, nlp_solver, setting=s)


## Comparison with PowerModelsACDC (single conductor model)

import PowerModelsACDC as _PMACDC

result_acdc = _PMACDC.run_acdcopf(file, _PM.ACPPowerModel, nlp_solver, setting=s)

printstyled("Multiconductor OPF\n"; bold=true)
println(" termination status: ", result_mcdc["termination_status"])
println(" objective: ", result_mcdc["objective"])
println(" solve time: ", result_mcdc["solve_time"])

printstyled("\nSingle-conductor OPF\n"; bold=true)
println(" termination status: ", result_acdc["termination_status"])
println(" objective: ", result_acdc["objective"])
println(" solve time: ", result_acdc["solve_time"])
145 changes: 145 additions & 0 deletions examples/opf_dcp.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# OPF problem, linear formulation

import PowerModels as _PM
import PowerModelsMCDC as _PMMCDC
import HiGHS

lp_solver = _PMMCDC.optimizer_with_attributes(HiGHS.Optimizer, "output_flag" => false)
file = "./test/data/matacdc_scripts/case5_2grids_MC.m"

s = Dict("conv_losses_mp" => false)
result_mcdc = _PMMCDC.solve_mcdcopf(file, _PM.DCPPowerModel, lp_solver, setting=s)


## Comparison with PowerModelsACDC (single conductor model)

import PowerModelsACDC as _PMACDC

result_acdc = _PMACDC.run_acdcopf(file, _PM.DCPPowerModel, lp_solver, setting=s)

printstyled("Multiconductor OPF\n"; bold=true)
println(" termination status: ", result_mcdc["termination_status"])
println(" objective: ", result_mcdc["objective"])
println(" solve time: ", result_mcdc["solve_time"])

printstyled("\nSingle-conductor OPF\n"; bold=true)
println(" termination status: ", result_acdc["termination_status"])
println(" objective: ", result_acdc["objective"])
println(" solve time: ", result_acdc["solve_time"])


## Further analysis of results

# println("#######ACgrid side#######")
# println("generation")
# for (i,gen) in result_mcdc["solution"]["gen"]
# g=gen["pg"]
# display("$i, $g")
# end

# total_gen= sum(gen["pg"] for (i,gen) in result_mcdc["solution"]["gen"])
# println("toptal generation", total_gen)

# data = _PM.parse_file(file)
# total_load= sum(load["pd"] for (i,load) in data["load"])
# println("toptal generation", total_load)

# println("AC Bus Va and Vm")
# for (i,bus) in result_mcdc["solution"]["bus"]
# a=bus["va"]
# b=bus["vm"]
# display("$i, $a, $b")
# # display(a b)
# end

# println("AC branch flows")
# for (i,branch) in result_mcdc["solution"]["branch"]
# flow_from=branch["pf"]
# flow_to=branch["pt"]
# display("$i, $flow_from, $flow_to")
# end

# println("###DC grid side###")
# println("DC bus Vm")
# for (i,dcbus) in result_mcdc["solution"]["busdc"]
# b=dcbus["vm"]
# display("$i, $b")
# end

# println(".....conv....")
# println(".....pgrid....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# # display("power from grid to dc at converter $i")
# a= conv["pgrid"]
# display("$i, $a")
# end

# println(".....pdc....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# a= conv["pdc"]
# display("$i, $a")
# end

# println(".....pdcg....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# a= conv["pdcg"]
# display("$i, $a")
# end

# println(".....pdcg_shunt....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# a= conv["pdcg_shunt"]
# display("$i, $a")
# end

# println(".....iconv_dc....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# a= conv["iconv_dc"]
# display("$i, $a")
# end

# println(".....iconv_dcg_shunt....")
# for (i,conv) in result_mcdc["solution"]["convdc"]
# a= conv["iconv_dcg_shunt"]
# display("$i, $a")
# end
# println(".....conv ground status....")
# for (i,conv) in datadc_new["convdc"]
# a=conv["ground_type"]
# b=conv["ground_z"]
# display("$a, $b")
# end

# println(".....DC branch flows....")
# for (i,branch) in result_mcdc["solution"]["branchdc"]
# flow_from=branch["i_from"]
# flow_to=branch["i_to"]
# display("$i, $flow_from, $flow_to")
# end

# for (i,branch) in datadc_new["branchdc"]
# r=branch["r"]
# display("$i,$r")
# end

# println(".....DC branch losses....")
# for (i,branch) in result_mcdc["solution"]["branchdc"]
# flow_from=branch["pf"]
# flow_to=branch["pt"]
# c=flow_from+flow_to
# # display("$i, $flow_from, $flow_to, $c")
# display("$i, $c")
# end

# println("termination status of the opf is:", result_mcdc["termination_status"])
#
# println("AC branch flows")
# for (i,branch) in datadc_new["branchdc"]
# r=branch["r"]
# display("$i, $r")
# end

# println("...total system losses..")
# Tot_gen= sum(gen["pg"] for (i,gen) in result_mcdc["solution"]["gen"])
# tot_load=sum(load["pd"] for (i,load) in datadc_new["load"])
# tot_loss=Tot_gen-tot_load
72 changes: 72 additions & 0 deletions examples/paper_opf_acp_all_cases.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#this file is to replicae the results presented in the paper (uploaded on arxiv.org)
import PowerModels as _PM
import PowerModelsMCDC as _PMMCDC
import PowerModelsACDC as _PMACDC #to be used while comparing acdc and mcdc results
using JuMP
using Ipopt

ipopt_solver = JuMP.optimizer_with_attributes(Ipopt.Optimizer, "tol" => 1e-6, "print_level" => 0)


# file="./test/data/matacdc_scripts/case5_2grids_MC.m"
# file="./test/data/matacdc_scripts/case39_mcdc.m"
# file="./test/data/matacdc_scripts/case67mcdc_scopf4.m"
# file="./test/data/matacdc_scripts/case3120sp_mcdc.m"

file = "./test/data/matacdc_scripts_opf_paper/balanced/case5_2grids_MC.m"
# file="./test/data/matacdc_scripts_opf_paper/balanced/case39_mcdc.m"
# file="./test/data/matacdc_scripts_opf_paper/balanced/case67mcdc_scopf4.m"
# file="./test/data/matacdc_scripts_opf_paper/balanced/case3120sp_mcdc.m"

# file="./test/data/matacdc_scripts_opf_paper/unbalanced/case5_2grids_MC.m"
# file="./test/data/matacdc_scripts_opf_paper/unbalanced/case39_mcdc.m"
# file="./test/data/matacdc_scripts_opf_paper/unbalanced/case67mcdc_scopf4.m"
# file="./test/data/matacdc_scripts_opf_paper/unbalanced/case3120sp_mcdc.m"


s = Dict("conv_losses_mp" => false)
result_mcdc = _PMMCDC.solve_mcdcopf(file, _PM.ACPPowerModel, ipopt_solver, setting=s)

#--------------------------------------------------------------------------------------------------------
dc_data = PowerModels.parse_file(file)
_PMACDC.process_additional_data!(dc_data)

result_acdc = _PMACDC.run_acdcopf(dc_data, _PM.ACPPowerModel, ipopt_solver, setting=s)


#############

println("termination status of the acdc_opf is:", result_acdc["termination_status"])
println(" Objective acdc_opf is:", result_acdc["objective"])
println(" solve time acdc_opf is:", result_acdc["solve_time"])

println("termination status of the mcdc_opf is:", result_mcdc["termination_status"])
println(" Objective mcdc_opf is:", result_mcdc["objective"])
println(" solve time mcdc_opf is:", result_mcdc["solve_time"])

#########

# N=100
# solve_time_dc=Dict([(l, Dict([("$i", 0.0000) for i in 1:4])) for l in 1:N])

# for k=1:N

# result_mcdc = _PMMCDC.solve_mcdcopf(datadc_new, _PM.ACPPowerModel, ipopt_solver, setting = s)
# result_acdc = _PMACDC.run_acdcopf(dc_data, _PM.ACPPowerModel, ipopt_solver, setting = s)


# # solve_time_dc[k]["1"] = result_mcdc["termination_status"]
# solve_time_dc[k]["2"] = result_mcdc["solve_time"]
# # solve_time_dc[k]["3"] = result_acdc["termination_status"]
# solve_time_dc[k]["4"] = result_acdc["solve_time"]

# end

# avg_solvetime_mcdc= sum(solve_time_dc[k]["2"] for k in 1:N)/N
# avg_solvetime_acdc= sum(solve_time_dc[k]["4"] for k in 1:N)/N

# println(" Objective mcdc_opf is:", result_mcdc["objective"])
# println(" Objective acdc_opf is:", result_acdc["objective"])

# println(" avg_solvetime_mcdcf is:",avg_solvetime_mcdc)
# println(" avg_solvetime_acdcf is:",avg_solvetime_acdc)
Loading

2 comments on commit 4f11fb4

@Electa-Git
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/87159

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 4f11fb499b3294bfd54c20b5104cfacc2495dab8
git push origin v0.1.0

Please sign in to comment.