Skip to content

Commit

Permalink
DSS C-API 0.14 and updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PMeira committed Dec 13, 2023
1 parent 34e3db2 commit b1ef9b9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

For a more complete list of changes, visit the [Git repository and Releases page on GitHub](https://github.com/dss-extensions/OpenDSSDirect.jl).

### OpenDSSDirect v0.9.6 Release Notes

- TODO


### OpenDSSDirect v0.9.5 Release Notes

- Update the DocStringExtensions dependency to avoid conflicts with other packages.
Expand All @@ -15,7 +20,7 @@ For a more complete list of changes, visit the [Git repository and Releases page
- Update the engine to DSS C-API v0.13.3. This includes important bugfixes to UPFC, Capacitor, and Reactor components, as well as other small changes.
- Update documentation.
- Add new flag `DSSCompatFlags_SaveCalcVoltageBases`: this flag forces the `save circuit` to always include `CalcVoltageBases` in the saved files.
Use it with `Basic.DSSCompatFlags()`.
Use it with `Basic.CompatFlags()`.

### OpenDSSDirect v0.9.2 Release Notes

Expand Down
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ abstract type Windows <: AbstractOS end
abstract type MacOS <: BSD end
abstract type Linux <: BSD end

const DSS_CAPI_TAG = "0.13.4"
const DSS_CAPI_TAG = "0.14.0b1"

function download(::Type{MacOS})
if Sys.ARCH == :aarch64
Expand Down
2 changes: 2 additions & 0 deletions src/OpenDSSDirect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ function __init__()

# Load the default descriptions/help strings
Lib.DSS_SetPropertiesMO(abspath(joinpath(@__DIR__, "../deps/messages/properties-en-US.mo")))
# Leave the properties with the legacy names for now
Lib.Settings_SetPropertyNameStyle(C_NULL, 2)

if !Sys.islinux()
global commandhelp = Dict{String, String}()
Expand Down
1 change: 1 addition & 0 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,5 @@ end
DSSCompatFlags_BadPrecision = 2
DSSCompatFlags_InvControl9611 = 4
DSSCompatFlags_SaveCalcVoltageBases = 8
DSSCompatFlags_ActiveLine = 16
end
4 changes: 4 additions & 0 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4443,6 +4443,10 @@ function Settings_Set_IterateDisabled(ctx::Ptr{Cvoid}, Value)
ccall((:ctx_Settings_Set_IterateDisabled, LIBRARY), Cvoid, (Ptr{Cvoid}, Int32,), ctx, Value)
end

function Settings_SetPropertyNameStyle(ctx::Ptr{Cvoid}, Value)
ccall((:ctx_Settings_SetPropertyNameStyle, LIBRARY), Cvoid, (Ptr{Cvoid}, Int32,), ctx, Value)
end

function Solution_Get_Frequency(ctx::Ptr{Cvoid})
ccall((:ctx_Solution_Get_Frequency, LIBRARY), Cdouble, (Ptr{Cvoid},), ctx)
end
Expand Down
5 changes: 5 additions & 0 deletions test/lines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ init8500()

@testset "Lines" begin

# These three used to get invalid data as the Lines API used the last activated CktElement
# instead of a Line. This was changed in DSS C-API 0.14.0, so no error anymore. We can get
# the old behavior with the compat flag.
Basic.CompatFlags(OpenDSSDirect.Lib.DSSCompatFlags_ActiveLine)
@test_throws OpenDSSDirect.OpenDSSDirectException Lines.RMatrix() == reshape([], (0, 0))
@test_throws OpenDSSDirect.OpenDSSDirectException Lines.CMatrix() == reshape([], (0, 0))
@test_throws OpenDSSDirect.OpenDSSDirectException Lines.XMatrix() == reshape([], (0, 0))
Basic.CompatFlags(UInt32(0))

@test Lines.First() == 1
@test Lines.Next() == 2
Expand Down

0 comments on commit b1ef9b9

Please sign in to comment.