Skip to content

Commit 6e42e25

Browse files
authored
Merge pull request #7 from LAMPSPUC/develop
change devbranch to main in make.jl
2 parents 3a1092a + 0640c7b commit 6e42e25

File tree

10 files changed

+59
-56
lines changed

10 files changed

+59
-56
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "ParserPWF"
1+
name = "PWF"
22
uuid = "0f4c3beb-4231-4c4d-93e1-709cb40a89e6"
33
version = "0.3.0"
44

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<img src="docs/src/assets/lampspucpptreduced.png" align="right" width=300>
2-
<h1>ParserPWF.jl</h1>
2+
<h1>PWF.jl</h1>
33

44
<br>
55
<br>
66

77
---
88

9-
ParserPWF.jl is a Julia package for converting ANAREDE data format (".pwf") into a Julia dictionary.
9+
PWF.jl is a Julia package for converting ANAREDE data format (".pwf") into a Julia dictionary.
1010

11-
Additionaly, ParserPWF provides parsing .pwf file directly to [PowerModels.jl](https://github.com/lanl-ansi/PowerModels.jl) network data dictionary.
11+
Additionaly, PWF provides parsing .pwf file directly to [PowerModels.jl](https://github.com/lanl-ansi/PowerModels.jl) network data dictionary.
1212

1313
The implementations were made based on the ANAREDE user guide manual (v09).
1414

@@ -17,7 +17,7 @@ The implementations were made based on the ANAREDE user guide manual (v09).
1717
Parsing a .pwf file to Julia dictionary is as simple as:
1818

1919
```julia
20-
using ParserPWF
20+
using PWF
2121

2222
file = "3bus.pwf"
2323
pwf_dict = parse_file(file)
@@ -41,10 +41,10 @@ For more information about PowerModels.jl visit the PowerModels [documentation](
4141

4242
## Parser
4343

44-
The package parses all available sections into a julia dictionary. Every key represents a .pwf section as shown below:
44+
The package parses all available sections into a julia dictionary. Each key represents a .pwf section as shown below:
4545

4646
```julia
47-
julia> ParserPWF.parse_file(file)
47+
julia> PWF.parse_file(file)
4848
Dict{String, Any} with 6 entries:
4949
"DLIN" => Dict{String, Any}[Dict("AGGREGATOR 10"=>nothing, "AGGREGATOR 5"=>nothing, "AGGR"
5050
"name" => "3bus"
@@ -57,7 +57,7 @@ Dict{String, Any} with 6 entries:
5757
**PWF Sections Available:**
5858
5959
- DBAR
60-
- DBSH (fban)
60+
- DBSH
6161
- DCBA
6262
- DCCV
6363
- DCER
@@ -72,9 +72,6 @@ Dict{String, Any} with 6 entries:
7272
- DLIN
7373
- DOPC
7474
- DSHL
75-
76-
**Incoming Sections:**
77-
7875
- DARE
7976
- DCAI
8077
- DCAR
@@ -83,13 +80,16 @@ Dict{String, Any} with 6 entries:
8380
- DMFL
8481
- DMOT
8582
- DMTE
83+
- DAGR
84+
- DCMT
85+
- DTPF
8686
8787
## PowerModels.jl converter
8888
8989
The package also allow converting .pwf file directly into PowerModels.jl network data structure:
9090
9191
```julia
92-
julia> ParserPWF.parse_file(file; pm = true)
92+
julia> PWF.parse_file(file; pm = true)
9393
Dict{String, Any} with 13 entries:
9494
"bus" => Dict{String, Any}("1"=>Dict{String, Any}("zone"=>1, "bus_i"=>1, "bus_"…
9595
"source_type" => "pwf"
@@ -133,9 +133,11 @@ julia> data = parse_file(file; pm = true, software = Organon)
133133
134134
**Additional data inside PWF files**
135135
136-
Additional information existing in a PWF file that is not used by PowerModels is stored inside each element in the field "control_data", such as the example below:
136+
If parse_pwf_to_powermodels' argument add_control_data is set to true (default = false), additional information present on the PWF file that is not used by PowerModels will be stored inside each element in the field "control_data", such as the example below:
137137

138138
```julia
139+
julia> data = PWF.parse_pwf_to_powermodels(file, add_control_data = true);
140+
139141
julia> data["shunt"]["1"]["control_data"]
140142
Dict{String, Any} with 9 entries:
141143
"vmmax" => 1.029

docs/make.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Documenter
2-
using ParserPWF
2+
using PWF
33

44
makedocs(
5-
modules = [ParserPWF],
5+
modules = [PWF],
66
format = Documenter.HTML(analytics = "UA-367975-10", mathengine = Documenter.MathJax()),
7-
sitename = "ParserPWF",
7+
sitename = "PWF",
88
authors = "Iago Chávarry and Pedro Hamacher",
99
pages = [
1010
"Home" => "index.md",
@@ -39,5 +39,6 @@ makedocs(
3939
# for more information.
4040
deploydocs(
4141
repo="github.com/LAMPSPUC/PWF.jl.git",
42+
devbranch = "main",
4243
push_preview = true
4344
)

docs/src/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# ParserPWF.jl
1+
# PWF.jl
22

33
```@meta
4-
CurrentModule = ParserPWF
4+
CurrentModule = PWF
55
```
66

77
---
88

9-
ParserPWF.jl is a Julia package for converting ANAREDE data format (".pwf") into a Julia dictionary.
9+
PWF.jl is a Julia package for converting ANAREDE data format (".pwf") into a Julia dictionary.
1010

11-
Additionaly, ParserPWF provides parsing .pwf file directly to [PowerModels.jl](https://github.com/lanl-ansi/PowerModels.jl) network data dictionary.
11+
Additionaly, PWF provides parsing .pwf file directly to [PowerModels.jl](https://github.com/lanl-ansi/PowerModels.jl) network data dictionary.
1212

1313
The implementations were made based on the ANAREDE user guide manual (v09).
1414

@@ -17,7 +17,7 @@ The implementations were made based on the ANAREDE user guide manual (v09).
1717
Parsing a .pwf file to Julia dictionary is as simple as:
1818

1919
```julia
20-
using ParserPWF
20+
using PWF
2121

2222
file = "3bus.pwf"
2323
pwf_dict = parse_pwf(file)

docs/src/quickguide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Parsing a .pwf file to Julia dictionary is as simple as:
44

55
```julia
6-
using ParserPWF
6+
using PWF
77

88
file = "3bus.pwf"
99
pwf_dict = parse_pwf(file)
@@ -30,7 +30,7 @@ For more information about PowerModels.jl visit the PowerModels [documentation](
3030
The package parses all available sections into a julia dictionary. Every key represents a .pwf section as shown below:
3131

3232
```julia
33-
julia> ParserPWF.parse_pwf(file)
33+
julia> PWF.parse_pwf(file)
3434
Dict{String, Any} with 6 entries:
3535
"DLIN" => Dict{String, Any}[Dict("AGGREGATOR 10"=>nothing, "AGGREGATOR 5"=>nothing, "AGGR"
3636
"name" => "3bus"
@@ -45,7 +45,7 @@ Dict{String, Any} with 6 entries:
4545
The package also allow converting .pwf file directly into PowerModels.jl network data structure:
4646
4747
```julia
48-
julia> ParserPWF.parse_pwf_to_powermodels(file)
48+
julia> PWF.parse_pwf_to_powermodels(file)
4949
Dict{String, Any} with 13 entries:
5050
"bus" => Dict{String, Any}("1"=>Dict{String, Any}("zone"=>1, "bus_i"=>1, "bus_"…
5151
"source_type" => "pwf"

src/ParserPWF.jl renamed to src/PWF.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module ParserPWF
1+
module PWF
22

33
# using packages
44
using PowerModels
55

66
# include PWF parser file
7-
include("pwf.jl")
7+
include("pwf2dict.jl")
88

99
# include PowerModels converter files
1010
include("pwf2pm/bus.jl")
File renamed without changes.

test/runtests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ using Ipopt
22
using Test
33
using PowerModels
44

5-
include("../src/ParserPWF.jl")
5+
include("../src/PWF.jl")
66

77
include("test_functions.jl")
88

99
ipopt = optimizer_with_attributes(Ipopt.Optimizer, "tol" => 0.0001, "print_level" => 0)
1010

11-
@testset "ParserPWF" begin
11+
@testset "PWF" begin
1212
include("test_pwf.jl")
1313
include("test_pwf_to_powermodels.jl")
1414
end

test/test_pwf.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
@testset "Intermediary functions" begin
33
file = open(joinpath(@__DIR__,"data/pwf/test_system.pwf"))
44

5-
sections = ParserPWF._split_sections(file)
5+
sections = PWF._split_sections(file)
66
@test isa(sections, Vector{Vector{String}})
77
@test length(sections) == 5
88
@test sections[1][1] == "TITU"
99

1010
data = Dict{String, Any}()
11-
ParserPWF._parse_section!(data, sections[1])
11+
PWF._parse_section!(data, sections[1])
1212
@test haskey(data, "TITU")
13-
ParserPWF._parse_section!(data, sections[2])
13+
PWF._parse_section!(data, sections[2])
1414
@test haskey(data, "DOPC IMPR")
15-
ParserPWF._parse_section!(data, sections[3])
15+
PWF._parse_section!(data, sections[3])
1616
@test haskey(data, "DCTE")
17-
ParserPWF._parse_section!(data, sections[4])
17+
PWF._parse_section!(data, sections[4])
1818
@test haskey(data, "DBAR")
19-
ParserPWF._parse_section!(data, sections[5])
19+
PWF._parse_section!(data, sections[5])
2020
@test haskey(data, "DLIN")
2121
end
2222

2323

2424
@testset "Resulting Dict" begin
2525
file = open(joinpath(@__DIR__,"data//pwf/test_system.pwf"))
26-
dict = ParserPWF._parse_pwf_data(file)
26+
dict = PWF._parse_pwf_data(file)
2727

2828
@testset "Keys" begin
2929
@test haskey(dict, "TITU")
@@ -159,7 +159,7 @@
159159
"DCSC" => Dict("1" => Dict("FROM BUS" => 1, "OPERATION" => 'A', "TO BUS" => 2, "CIRCUIT" => 0, "STATUS" => 'L', "OWNER" => 'F', "BYPASS" => 'D', "MINIMUM VALUE" => -9999.0, "MAXIMUM VALUE" => 0.0, "INITIAL VALUE" => 0.0, "CONTROL MODE" => 'X', "SPECIFIED VALUE" => nothing, "MEASUREMENT EXTREMITY" => 1, "NUMBER OF STAGES" => nothing, "NORMAL CAPACITY" => Inf, "EMERGENCY CAPACITY" => Inf, "EQUIPAMENT CAPACITY" => Inf, "AGGREGATOR 1" => nothing, "AGGREGATOR 2" => nothing, "AGGREGATOR 3" => nothing, "AGGREGATOR 4" => nothing, "AGGREGATOR 5" => nothing, "AGGREGATOR 6" => nothing, "AGGREGATOR 7" => nothing, "AGGREGATOR 8" => nothing, "AGGREGATOR 9" => nothing, "AGGREGATOR 10" => nothing)),
160160
"DCAI" => Dict("1" => Dict("BUS" => 1, "OPERATION" => 'A', "GROUP" => nothing, "STATUS" => 'L', "UNITIES" => 2, "OPERATING UNITIES" => 2, "ACTIVE CHARGE" => 0.0, "REACTIVE CHARGE" => 0.0, "PARAMETER A" => nothing, "PARAMETER B" => nothing, "PARAMETER C" => nothing, "PARAMETER D" => nothing, "VOLTAGE" => 70.0, "CHARGE DEFINITION VOLTAGE" => 1.0)),
161161
"DGEI" => Dict("1" => Dict("BUS" => 1, "OPERATION" => 'A', "AUTOMATIC MODE" => 'N', "GROUP" => nothing, "STATUS" => 'L', "UNITIES" => 2, "OPERATING UNITIES" => 2, "MINIMUM OPERATING UNITIES" => 1, "ACTIVE GENERATION" => 0.0, "REACTIVE GENERATION" => 0.0, "MINIMUM REACTIVE GENERATION" => -9999.0, "MAXIMUM REACTIVE GENERATION" => 99999.0, "ELEVATOR TRANSFORMER REACTANCE" => nothing, "XD" => 0.0, "XQ" => 0.0, "XL" => 0.0, "POWER FACTOR" => 1.0, "APPARENT POWER" => 99999.0, "MECHANICAL LIMIT" => 99999.0)))
162-
parsed_pwf = ParserPWF.parse_file(joinpath(@__DIR__,"data/pwf/test_defaults.pwf"), pm = false)
162+
parsed_pwf = PWF.parse_file(joinpath(@__DIR__,"data/pwf/test_defaults.pwf"), pm = false)
163163

164164
@test parsed_pwf == pwf
165165
end

test/test_pwf_to_powermodels.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
@testset "PowerModels Dict fields" begin
33
@testset "PowerModels conversion" begin
44
file = open(joinpath(@__DIR__,"data/pwf/test_system.pwf"))
5-
pwf_data = ParserPWF._parse_pwf_data(file)
5+
pwf_data = PWF._parse_pwf_data(file)
66
pm_data = Dict{String, Any}()
77

88
@testset "Bus" begin
9-
ParserPWF._pwf2pm_bus!(pm_data, pwf_data, add_control_data = true)
9+
PWF._pwf2pm_bus!(pm_data, pwf_data, add_control_data = true)
1010

1111
@test haskey(pm_data, "bus")
1212
@test length(pm_data["bus"]) == 9
@@ -45,8 +45,8 @@
4545
end
4646

4747
@testset "Branch" begin
48-
ParserPWF._pwf2pm_branch!(pm_data, pwf_data, add_control_data = true)
49-
ParserPWF._pwf2pm_transformer!(pm_data, pwf_data, add_control_data = true)
48+
PWF._pwf2pm_branch!(pm_data, pwf_data, add_control_data = true)
49+
PWF._pwf2pm_transformer!(pm_data, pwf_data, add_control_data = true)
5050

5151
@test haskey(pm_data, "branch")
5252
@test length(pm_data["branch"]) == 7
@@ -93,7 +93,7 @@
9393

9494
@testset "DCline" begin
9595
pwf_dc = open(joinpath(@__DIR__,"data/pwf/300bus.pwf"))
96-
pwf_data_dc = ParserPWF.parse_pwf_to_powermodels(pwf_dc)
96+
pwf_data_dc = PWF.parse_pwf_to_powermodels(pwf_dc)
9797

9898
@test haskey(pwf_data_dc, "dcline")
9999
@test length(pwf_data_dc["dcline"]) == 1
@@ -107,7 +107,7 @@
107107

108108
@testset "Resulting Dict" begin
109109
file = open(joinpath(@__DIR__,"data/pwf/test_system.pwf"))
110-
pm_data = ParserPWF.parse_pwf_to_powermodels(file; software = ParserPWF.Organon)
110+
pm_data = PWF.parse_pwf_to_powermodels(file; software = PWF.Organon)
111111

112112
@testset "PowerModels Dict" begin
113113
@test isa(pm_data, Dict)
@@ -163,7 +163,7 @@
163163
file_raw = joinpath(@__DIR__,"data/raw/$name.raw")
164164
file_pwf = open(joinpath(@__DIR__,"data/pwf/$name.pwf"))
165165

166-
pwf_data = ParserPWF.parse_pwf_to_powermodels(file_pwf)
166+
pwf_data = PWF.parse_pwf_to_powermodels(file_pwf)
167167
raw_data = PowerModels.parse_file(file_raw)
168168

169169
result_pwf = PowerModels.run_ac_pf(pwf_data, ipopt)
@@ -176,7 +176,7 @@
176176

177177
@testset "PWF to PM corrections" begin
178178
file = open(joinpath(@__DIR__,"data/pwf/3bus_corrections.pwf"))
179-
pm_data = ParserPWF.parse_pwf_to_powermodels(file; software = ParserPWF.Organon)
179+
pm_data = PWF.parse_pwf_to_powermodels(file; software = PWF.Organon)
180180

181181
parse_result = PowerModels.run_ac_pf(pm_data, ipopt);
182182

@@ -192,7 +192,7 @@
192192
@testset "Control data fields" begin
193193
@testset "Shunt control_data" begin
194194
file = open(joinpath(@__DIR__,"data/pwf/3bus_shunt_fields.pwf"))
195-
pm_data = ParserPWF.parse_pwf_to_powermodels(file, software = ParserPWF.ANAREDE, add_control_data = true)
195+
pm_data = PWF.parse_pwf_to_powermodels(file, software = PWF.ANAREDE, add_control_data = true)
196196

197197
@test length(pm_data["bus"]) == 3
198198
@test occursin("B s 1", pm_data["bus"]["1"]["name"])
@@ -231,7 +231,7 @@
231231

232232
@testset "Line shunt" begin
233233
file = open(joinpath(@__DIR__,"data/pwf/test_line_shunt.pwf"))
234-
pm_data = ParserPWF.parse_pwf_to_powermodels(file; software = ParserPWF.Organon)
234+
pm_data = PWF.parse_pwf_to_powermodels(file; software = PWF.Organon)
235235

236236
@test pm_data["branch"]["1"]["b_fr"] == 4.5
237237
@test pm_data["branch"]["1"]["b_to"] == 7.8
@@ -244,7 +244,7 @@
244244
end
245245

246246
@testset "Transformer control fields" begin
247-
data = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/9bus_transformer_fields.pwf"), add_control_data = true)
247+
data = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/9bus_transformer_fields.pwf"), add_control_data = true)
248248

249249
tap_automatic_control = findfirst(x -> x["f_bus"] == 1 && x["t_bus"] == 4, data["branch"])
250250
tap_variable_control = findfirst(x -> x["f_bus"] == 2 && x["t_bus"] == 7, data["branch"])
@@ -303,8 +303,8 @@
303303

304304
@testset "Organon vs ANAREDE parser" begin
305305
@testset "DBSH" begin
306-
data_anarede = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DBSH.pwf"), software = ParserPWF.ANAREDE)
307-
data_organon = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DBSH.pwf"), software = ParserPWF.Organon)
306+
data_anarede = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DBSH.pwf"), software = PWF.ANAREDE)
307+
data_organon = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DBSH.pwf"), software = PWF.Organon)
308308

309309
pm_anarede = PowerModels.instantiate_model(data_anarede, PowerModels.ACPPowerModel, PowerModels.build_pf);
310310
pm_organon = PowerModels.instantiate_model(data_organon, PowerModels.ACPPowerModel, PowerModels.build_pf);
@@ -331,8 +331,8 @@
331331
end
332332

333333
@testset "DCER" begin
334-
data_anarede = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCER.pwf"), software = ParserPWF.ANAREDE)
335-
data_organon = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCER.pwf"), software = ParserPWF.Organon)
334+
data_anarede = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCER.pwf"), software = PWF.ANAREDE)
335+
data_organon = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCER.pwf"), software = PWF.Organon)
336336

337337
pm_anarede = PowerModels.instantiate_model(data_anarede, PowerModels.ACPPowerModel, PowerModels.build_pf);
338338
pm_organon = PowerModels.instantiate_model(data_organon, PowerModels.ACPPowerModel, PowerModels.build_pf);
@@ -360,8 +360,8 @@
360360
end
361361

362362
@testset "DSHL" begin
363-
data_anarede = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DSHL.pwf"), software = ParserPWF.ANAREDE)
364-
data_organon = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DSHL.pwf"), software = ParserPWF.Organon)
363+
data_anarede = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DSHL.pwf"), software = PWF.ANAREDE)
364+
data_organon = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DSHL.pwf"), software = PWF.Organon)
365365

366366
pm_anarede = PowerModels.instantiate_model(data_anarede, PowerModels.ACPPowerModel, PowerModels.build_pf);
367367
pm_organon = PowerModels.instantiate_model(data_organon, PowerModels.ACPPowerModel, PowerModels.build_pf);
@@ -404,8 +404,8 @@
404404
end
405405

406406
@testset "DCSC" begin
407-
data_anarede = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCSC.pwf"), software = ParserPWF.ANAREDE)
408-
data_organon = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCSC.pwf"), software = ParserPWF.Organon)
407+
data_anarede = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCSC.pwf"), software = PWF.ANAREDE)
408+
data_organon = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCSC.pwf"), software = PWF.Organon)
409409

410410
pm_anarede = PowerModels.instantiate_model(data_anarede, PowerModels.ACPPowerModel, PowerModels.build_pf);
411411
pm_organon = PowerModels.instantiate_model(data_organon, PowerModels.ACPPowerModel, PowerModels.build_pf);
@@ -450,7 +450,7 @@
450450
end
451451

452452
@testset "DC line" begin
453-
data_anarede = ParserPWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCline.pwf"), software = ParserPWF.ANAREDE)
453+
data_anarede = PWF.parse_pwf_to_powermodels(joinpath(@__DIR__,"data/pwf/3bus_DCline.pwf"), software = PWF.ANAREDE)
454454
pm_anarede = PowerModels.instantiate_model(data_anarede, PowerModels.ACPPowerModel, PowerModels.build_pf);
455455
result_anarede = PowerModels.optimize_model!(pm_anarede, optimizer = ipopt)
456456
PowerModels.update_data!(data_anarede, result_anarede["solution"])

0 commit comments

Comments
 (0)