-
Notifications
You must be signed in to change notification settings - Fork 1
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 #9 from Electa-Git/cleanup
Cleanup
- Loading branch information
Showing
68 changed files
with
1,134 additions
and
6,483 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
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 |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -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"]) |
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,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 |
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,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) |
Oops, something went wrong.
4f11fb4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
4f11fb4
There was a problem hiding this comment.
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: