Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/powerio-companion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
agent/release-0.11
codex/tellegen-release-fixes
2 changes: 1 addition & 1 deletion .github/powerio-release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ schema = 1
state = "draft"
julia_version = "0.11.1"
powerio_tag = "v0.11.1"
source_digest = "sha256:1067946d318998e061ff033a5e26706d474719d305516b03e69024f029bf299a"
source_digest = "sha256:881f873e4930e058dbd41b0a2b4103be2850ce52e9b4bdd8fecc1215a524fed4"
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.11.1

- Preserve BMOPF bus coordinates and line paths through typed access, PowerIO IR,
and explicit schema-version output with PowerIO 0.11.1. Read geographic bus
locations from supported New England PWB records without changing C ABI 7.

- `to_powerdata` returns `bus.va` in radians, as its docstring states and as
the branch `shift`, `angmin`, and `angmax` fields already did (#138).
- `to_powerdata` generator rows carry `model`: 0 without a cost record,
Expand Down
4 changes: 3 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ makedocs(;
],
)

deploydocs(; repo = "github.com/eigenergy/PowerIO.jl.git", devbranch = "main")
if get(ENV, "GITHUB_ACTIONS", "false") == "true"
deploydocs(; repo = "github.com/eigenergy/PowerIO.jl.git", devbranch = "main")
end
17 changes: 17 additions & 0 deletions docs/src/networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,20 @@ reference_bus_ids
to_dense
to_graph
```

## Geographic data

`bus.location` provides x/y coordinates, and `net.geo` names their coordinate
space. Balanced branches and multiconductor lines expose optional `route`
points. Geographic x/y means longitude/latitude; drawing x/y retains drawing
units. PowerIO IR preserves these values.

PowerIO 0.11.1 reads supported PWB bus locations and the BMOPFTools proposed
Point/LineString values. Explicit BMOPF output writes geometry under the
schema-valid `extras.geojson` location. Same-type source emission retains source
bytes; after changes, the typed coordinates determine the output.

A geographic file or a PWD drawing currently appears as a `PioModule{UnknownValue}`
with `type_name == "powerio.GeoLayer"`. It can still be serialized and emitted
through the ordinary module methods. Typed bus locations and line paths remain
available on the electrical networks.
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fixture(parts...) = joinpath(DATA, parts...)
include("test_public_api.jl") # the exported surface
include("test_operations.jl") # parse, emit, serialize, deserialize
include("test_network.jl") # BalancedNetwork element tables
include("test_geography.jl")
include("test_dist.jl") # MulticonductorNetwork element tables
include("test_collections.jl") # TimeSeries, ScenarioSet, instances, solutions
include("test_updates.jl") # typed updates and apply_updates!
Expand Down
44 changes: 44 additions & 0 deletions test/test_geography.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@testset "Geographic data" begin
if !LIBRARY_AVAILABLE
@test_skip "libpowerio_capi unavailable"
else
source = raw"""{
"meta":{"schema_version":"0.2.0"},
"bus":{
"a":{"terminal_names":["1"],"geo":{"type":"Point","coordinates":[-83.7,42.3]}},
"b":{"terminal_names":["1"],"geo":{"type":"Point","coordinates":[-83.6,42.4]}}
},
"line":{"ab":{"bus_from":"a","bus_to":"b",
"terminal_map_from":["1"],"terminal_map_to":["1"],
"R_series_1_1":0.1,"X_series_1_1":0.2,
"geo":{"type":"LineString","coordinates":[[-83.7,42.3],[-83.68,42.36],[-83.6,42.4]]}}}
}"""
m = parse(IOBuffer(source); format="bmopf-json", name="geo.bmopf.json")
@test m.value.geo.space == "geographic"
@test m.value.buses[1].location.x == -83.7
@test length(m.value.lines[1].route) == 3
@test m.value.lines[1].route[2].y == 42.36
ir = JSON3.read(serialize(m).text, Dict{String,Any})
ir["value"]["data"]["buses"][1]["location"]["x"] = -83.72
edited = deserialize(Vector{UInt8}(JSON3.write(ir)))
for version in ("0.1.0", "0.2.0")
written = emit(edited, "bmopf-json@" * version)
doc = JSON3.read(written.text)
@test !haskey(doc.bus.a, :geo)
@test doc.extras.geojson.type == "FeatureCollection"
again = parse(IOBuffer(written.text); format="bmopf-json", name="edited.bmopf.json")
@test again.value.buses[1].location.x == -83.72
@test again.value.lines[1].route[2].y == 42.36
end
dataset = get(ENV, "POWERIO_GEO_DATASET", "")
if !isempty(dataset)
case = parse(dataset)
@test case isa PioModule{BalancedNetwork}
@test length(case.value.buses) == 250
@test all(bus -> bus.location !== nothing, case.value.buses)
restored = deserialize(Vector{UInt8}(serialize(case).text))
@test [(b.id, b.location.x, b.location.y) for b in restored.value.buses] ==
[(b.id, b.location.x, b.location.y) for b in case.value.buses]
end
end
end
Loading