Skip to content

Commit

Permalink
Updates for DSS C-API 0.12.x
Browse files Browse the repository at this point in the history
- Update version, use DSS_CAPI_TAG = "0.12.0"
- Updated lib names
- LoadShapes: migrate the spelling of SInterval C functions
- Transformers: Xhl/Xht/Xlt and R are (correctly) percent values now.
- In properties in general, DSS Objects are always lowercase now, since we don't keep copies of the original strings anymore in DSS C-API.
- Monitors: Bytestream no longer contains header.
- Some setters now throw instead of silently accepting invalid values.
- LineCodes: C1, C0 in nF.
- Loads: ZipV is always 7 elements.
- tests/Executive: update number of commands - COMHelp was added in 0.12.0b4
- lib: Remove the old function aliases for LoadShapes
- YMatrix: update API (to simple pointer); add `SolveSystem()` without params
- tests/CktElement.AllVariableValues: make it a little lax (win32 failed)
- tests/meters: Run "AllocateLoads" to populate CalcCurrent and AllocFactors
- SwtControls: enable Idx getter and related tests
- Add support for ARM64/M1 on macOS. Tested with Julia 1.8rc, tests pass. Linux added too, but untested currently.
- deps: download help; use it (DSS_SetPropertiesMO)
  • Loading branch information
PMeira committed Jul 13, 2022
1 parent aa0ceeb commit fa71941
Show file tree
Hide file tree
Showing 21 changed files with 154 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OpenDSSDirect"
uuid = "a8b11937-1041-50f2-9818-136bb7a8fb06"
authors = ["Tom Short <[email protected]>"]
version = "0.7.3"
version = "0.8.0-dev"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
68 changes: 56 additions & 12 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ abstract type Windows <: AbstractOS end
abstract type MacOS <: BSD end
abstract type Linux <: BSD end

const DSS_CAPI_TAG = "0.10.7-1"
const DSS_CAPI_TAG = "0.12.0"

function download(::Type{MacOS})
if Sys.ARCH == :aarch64
DSS_CAPI_ARCH = "arm64"
else
DSS_CAPI_ARCH = "x64"
end

url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_darwin_x64.tar.gz"
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_darwin_$(DSS_CAPI_ARCH).tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "dss_capi.tar.gz"))
Base.download(url, filename)
Expand All @@ -20,16 +25,21 @@ function download(::Type{MacOS})
rm(joinpath(@__DIR__, "dss_capi.tar.gz"), force=true)

mkpath(joinpath(@__DIR__, "apple"))
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_x64/libdss_capi_v7.dylib")), normpath(joinpath(@__DIR__, "apple", "libdss_capi_v7.dylib")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_x64/libdss_capi_v7d.dylib")), normpath(joinpath(@__DIR__, "apple", "libdss_capi_v7d.dylib")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_x64/libklusolve.dylib")), normpath(joinpath(@__DIR__, "apple", "libklusolve.dylib")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_$(DSS_CAPI_ARCH)/libdss_capi.dylib")), normpath(joinpath(@__DIR__, "apple", "libdss_capi.dylib")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_$(DSS_CAPI_ARCH)/libdss_capid.dylib")), normpath(joinpath(@__DIR__, "apple", "libdss_capid.dylib")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/darwin_$(DSS_CAPI_ARCH)/libklusolvex.dylib")), normpath(joinpath(@__DIR__, "apple", "libklusolvex.dylib")), force=true)
rm(joinpath(@__DIR__, "dss_capi"), force=true, recursive=true)
println("Success")
end

function download(::Type{Linux})
if Sys.ARCH == :aarch64
DSS_CAPI_ARCH = "arm64"
else
DSS_CAPI_ARCH = "x64"
end

url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_linux_x64.tar.gz"
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/dss_capi_$(DSS_CAPI_TAG)_linux_$(DSS_CAPI_ARCH).tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "dss_capi.tar.gz"))
Base.download(url, filename)
Expand All @@ -39,13 +49,25 @@ function download(::Type{Linux})
rm(joinpath(@__DIR__, "dss_capi.tar.gz"), force=true)

mkpath(joinpath(@__DIR__, "linux"))
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_x64/libdss_capi_v7.so")), normpath(joinpath(@__DIR__, "linux", "libdss_capi_v7.so")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_x64/libdss_capi_v7d.so")), normpath(joinpath(@__DIR__, "linux", "libdss_capi_v7d.so")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_x64/libklusolve.so")), normpath(joinpath(@__DIR__, "linux", "libklusolve.so")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_$(DSS_CAPI_ARCH)/libdss_capi.so")), normpath(joinpath(@__DIR__, "linux", "libdss_capi.so")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_$(DSS_CAPI_ARCH)/libdss_capid.so")), normpath(joinpath(@__DIR__, "linux", "libdss_capid.so")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/linux_$(DSS_CAPI_ARCH)/libklusolvex.so")), normpath(joinpath(@__DIR__, "linux", "libklusolvex.so")), force=true)
rm(joinpath(@__DIR__, "dss_capi"), force=true, recursive=true)
println("Success")
end

function download_messages(::Union{Type{Linux}, Type{MacOS}})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/messages.tar.gz"
@show url
filename = normpath(joinpath(@__DIR__, "messages.tar.gz"))
Base.download(url, filename)

directory = normpath(@__DIR__)
run(`tar -xvf $filename -C $directory`)
rm(joinpath(@__DIR__, "messages.tar.gz"), force=true)
println("Success")
end

function download(::Type{Windows})

if typeof(1) === Int64
Expand Down Expand Up @@ -73,13 +95,34 @@ function download(::Type{Windows})
filename = joinpath(directory, basename(filename)[1:end-4])

mkpath(joinpath(@__DIR__, "windows"))
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/dss_capi_v7.dll")), normpath(joinpath(@__DIR__, "windows", "dss_capi_v7.dll")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/dss_capi_v7d.dll")), normpath(joinpath(@__DIR__, "windows", "dss_capi_v7d.dll")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/libklusolve.dll")), normpath(joinpath(@__DIR__, "windows", "libklusolve.dll")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/dss_capi.dll")), normpath(joinpath(@__DIR__, "windows", "dss_capi.dll")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/dss_capid.dll")), normpath(joinpath(@__DIR__, "windows", "dss_capid.dll")), force=true)
cp(normpath(joinpath(@__DIR__, "dss_capi/lib/win_$(BIT)/libklusolvex.dll")), normpath(joinpath(@__DIR__, "windows", "libklusolvex.dll")), force=true)
rm(joinpath(@__DIR__, "dss_capi"), force=true, recursive=true)
println("Success")
end

function download_messages(::Type{Windows})
url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/messages.zip"
@show url
filename = normpath(joinpath(@__DIR__, "messages.zip"))
Base.download(url, filename)

directory = normpath(@__DIR__)

home = (Base.VERSION < v"0.7-") ? JULIA_HOME : Sys.BINDIR
if Base.VERSION < v"1.3.0"
bin7z = "$home/7z"
else
bin7z = "$(joinpath(home, "..", "libexec", "7z"))"
end

success(`$bin7z x $filename -y -o$directory`)
rm(joinpath(@__DIR__, "messages.zip"), force=true)

println("Success")
end


if Sys.iswindows()
os = Windows
Expand All @@ -90,3 +133,4 @@ else
end

download(os)
download_messages(os)
15 changes: 9 additions & 6 deletions src/OpenDSSDirect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ else
end

if Sys.iswindows()
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/windows/dss_capi_v7$(LIBRARY_SUFFIX).dll"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/windows/libklusolve.dll"))
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/windows/dss_capi$(LIBRARY_SUFFIX).dll"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/windows/libklusolvex.dll"))
elseif Sys.islinux()
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/linux/libdss_capi_v7$(LIBRARY_SUFFIX).so"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/linux/libklusolve.so"))
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/linux/libdss_capi$(LIBRARY_SUFFIX).so"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/linux/libklusolvex.so"))
elseif Sys.isapple()
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/apple/libdss_capi_v7$(LIBRARY_SUFFIX).dylib"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/apple/libklusolve.dylib"))
const LIBRARY = abspath(joinpath(@__DIR__, "../deps/apple/libdss_capi$(LIBRARY_SUFFIX).dylib"))
const KLUSOLVE_LIBRARY = abspath(joinpath(@__DIR__, "../deps/apple/libklusolvex.dylib"))
else
error("Unknown operating system. Cannot use OpenDSSDirect")
end
Expand Down Expand Up @@ -135,6 +135,9 @@ function __init__()
error("$LIBRARY cannot be opened. Please check 'deps/build.log' for more information.")
end

# Load the default descriptions/help strings
Lib.DSS_SetPropertiesMO(abspath(joinpath(@__DIR__, "../deps/messages/properties-en-US.mo")))

if !Sys.islinux()
global commandhelp = Dict{String, String}()
for i in 1:OpenDSSDirect.Executive.NumCommands()
Expand Down
2 changes: 1 addition & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Automatically generated using Clang.jl


const DSS_CAPI_V7_VERSION = "0.10.7-1"
const DSS_CAPI_VERSION = "0.12.0"

@cenum MonitorModes::UInt32 begin
MonitorModes_VI = 0
Expand Down
14 changes: 5 additions & 9 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2610,14 +2610,6 @@ function LoadShapes_Set_SInterval(Value)
ccall((:LoadShapes_Set_SInterval, LIBRARY), Cvoid, (Cdouble,), Value)
end

function LoadShapes_Get_sInterval()
ccall((:LoadShapes_Get_sInterval, LIBRARY), Cdouble, ())
end

function LoadShapes_Set_Sinterval(Value)
ccall((:LoadShapes_Set_Sinterval, LIBRARY), Cvoid, (Cdouble,), Value)
end

function LoadShapes_Set_HrInterval(Value)
ccall((:LoadShapes_Set_HrInterval, LIBRARY), Cvoid, (Cdouble,), Value)
end
Expand Down Expand Up @@ -5171,7 +5163,7 @@ function YMatrix_getVpointer(VvectorPtr)
end

function YMatrix_SolveSystem(NodeVPtr)
ccall((:YMatrix_SolveSystem, LIBRARY), Int32, (Ptr{Ptr{Cdouble}},), NodeVPtr)
ccall((:YMatrix_SolveSystem, LIBRARY), Int32, (Ptr{Cdouble},), NodeVPtr)
end

function YMatrix_Set_SystemYChanged(arg)
Expand Down Expand Up @@ -6349,3 +6341,7 @@ end
function XYCurves_Set_idx(Value)
ccall((:XYCurves_Set_idx, LIBRARY), Cvoid, (Int32,), Value)
end

function DSS_SetPropertiesMO(Value)
ccall((:DSS_SetPropertiesMO, LIBRARY), Cvoid, (Cstring,), Value)
end
4 changes: 2 additions & 2 deletions src/loadshape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ end

"""Interval of active loadshape in seconds (Getter)"""
function SInterval()::Float64
return @checked Lib.LoadShapes_Get_sInterval()
return @checked Lib.LoadShapes_Get_SInterval()
end

"""Interval of active loadshape in seconds (Setter)"""
function SInterval(Value::Float64)
@checked Lib.LoadShapes_Set_Sinterval(Value)
@checked Lib.LoadShapes_Set_SInterval(Value)
end

"""LoadShape Index (Getter)"""
Expand Down
9 changes: 4 additions & 5 deletions src/swt_controls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,10 @@ function SwitchedTerm(Value::Int)
@checked Lib.SwtControls_Set_SwitchedTerm(Value)
end

# TODO: broken in DSS C-API 0.10.7
# """SwtControl Index (Getter)"""
# function Idx()::Int
# return @checked Lib.SwtControls_Get_idx()
# end
"""SwtControl Index (Getter)"""
function Idx()::Int
return @checked Lib.SwtControls_Get_idx()
end

"""SwtControl Index (Setter)"""
function Idx(Value::Int)
Expand Down
9 changes: 7 additions & 2 deletions src/ymatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,17 @@ function getV()::Vector{ComplexF64}
return unsafe_wrap(Array, VvectorPtr, @checked(Lib.Circuit_Get_NumNodes()) + 1)
end

"""Solve System for V"""
"""Solve System for a given V vector"""
function SolveSystem(NodeV::Vector{ComplexF64})::Int
NodeV = Ref{Ptr{Cdouble}}(pointer(NodeV))
NodeV = pointer(NodeV)
return @checked Lib.YMatrix_SolveSystem(NodeV)
end

"""Solve System for the internal V vector"""
function SolveSystem()::Int
return @checked Lib.YMatrix_SolveSystem(C_NULL)
end

"""SystemY has changed (Getter)"""
function SystemYChanged()::Bool
return @checked(Lib.YMatrix_Get_SystemYChanged()) != 0
Expand Down
2 changes: 1 addition & 1 deletion test/circuit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ init8500()
@test Circuit.Enable(Circuit.AllElementNames()[10]) == nothing
@test Circuit.SetActiveElement(Circuit.AllElementNames()[10]) == 9
@test Circuit.SetActiveBus(Circuit.AllBusNames()[10]) == 9
@test Circuit.SetActiveClass(ActiveClass.ActiveClassName()) == 16
@test Circuit.SetActiveClass(ActiveClass.ActiveClassName()) == 15
@test Circuit.Losses() 1.218242333223247e6 + 2.798391857088721e6im
@test Circuit.LineLosses() 1042.0872998508387 + 1674.1606828559168im
@test Circuit.SubstationLosses() 65.18947074155649 + 752.3006305284744im
Expand Down
12 changes: 10 additions & 2 deletions test/cktelement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ Lines.Next()
-14.151460302936526 + 7.897357517772179im 14.151460302936526 - 7.897357479424346im]
@test CktElement.CplxSeqVoltages() [-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im]
@test CktElement.CplxSeqCurrents() [-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im,-1.0 + 0.0im]
@test CktElement.AllVariableNames() == []
@test CktElement.AllVariableValues() == [0.0]

@test CktElement.NodeOrder() == [2, 2]
@test CktElement.CurrentsMagAng() [1.8847523948057756 1.8849048106162245
177.9319402443363 -2.0853832620851183]
@test CktElement.VoltagesMagAng() [7691.655711894497 7691.542956049531
-167.10323234086837 -167.10344473228216]
@test CktElement.TotalPowers() [14.0052+3.74347im, -14.005-3.7479im]

# These two will change to empty when COMErrorResults become false by default
@test CktElement.AllVariableNames() == [""]
@test CktElement.AllVariableValues() == [0.0]

# Let's add one dummy element with variables to test it
OpenDSSDirect.Text.Command("New Generator.TestGen")
@test CktElement.AllVariableNames() == ["Frequency", "Theta (Deg)", "Vd", "PShaft", "dSpeed (Deg/sec)", "dTheta (Deg)"]
@test CktElement.AllVariableValues() [60.0, 0.0, 0.0, 0.0, 0.0, 0.0]

end # testset
7 changes: 4 additions & 3 deletions test/executive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ init8500()

@testset "Executive" begin

@test Executive.NumCommands() == 118
@test Executive.NumOptions() == 115
@test Executive.NumCommands() == 125
@test Executive.NumOptions() == 124
@test Executive.Command(2) == "Edit"
@test Executive.Option(2) == "element"
@test Executive.OptionValue(2) == "vreg4_c"

@test Executive.CommandHelp(2)[1:7] == "Edit an"
@test Executive.OptionHelp(2)[1:8] == "Sets the"
@test Executive.OptionValue(2) == "vreg4_c"

end # testset
4 changes: 2 additions & 2 deletions test/linecodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ init8500()
@test LineCodes.R0(LineCodes.R0()) == nothing
@test LineCodes.X0() 0.4047
@test LineCodes.X0(LineCodes.X0()) == nothing
@test LineCodes.C1() 3.4e-9
@test LineCodes.C1() 3.4
@test LineCodes.C1(LineCodes.C1()) == nothing
@test LineCodes.C0() 1.6e-9
@test LineCodes.C0() 1.6
@test LineCodes.C0(LineCodes.C0()) == nothing
@test LineCodes.NormAmps() 400.0
@test LineCodes.NormAmps(LineCodes.NormAmps()) == nothing
Expand Down
4 changes: 2 additions & 2 deletions test/lines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ init8500()
@test Lines.LineCode() == "1ph-x4_acsrx4_acsr"
@test Lines.LineCode(Lines.LineCode()) == nothing
@test Lines.Geometry() == ""
@test Lines.Geometry(Lines.Geometry()) == nothing
@test_throws OpenDSSDirect.OpenDSSDirectException Lines.Geometry(Lines.Geometry())
@test Lines.Spacing() == ""
@test Lines.Spacing(Lines.Spacing()) == nothing
@test_throws OpenDSSDirect.OpenDSSDirectException Lines.Spacing(Lines.Spacing())
@test Lines.AllNames()[end] == "tpx2224500658a0"
@test Lines.RMatrix() reshape([1.67466], (1, 1))
@test Lines.RMatrix(Lines.RMatrix()) == nothing
Expand Down
6 changes: 3 additions & 3 deletions test/loads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ init8500()
@test Loads.Name() == "138237b0"
@test Loads.Name(Loads.Name()) == nothing
@test Loads.CVRCurve() == ""
@test Loads.CVRCurve(Loads.CVRCurve()) == nothing
@test_throws OpenDSSDirect.OpenDSSDirectException Loads.CVRCurve(Loads.CVRCurve())
@test Loads.Daily() == ""
@test Loads.Daily(Loads.Daily()) == nothing
@test Loads.Duty() == ""
Expand All @@ -82,9 +82,9 @@ init8500()
@test Loads.Growth() == ""
@test Loads.Growth(Loads.Growth()) == nothing
@test Loads.AllNames()[end] == "2224500658a0"
@test Loads.ZipV() == Float64[]
# @test Loads.ZipV() == Float64[] -- It only makes sense to test ZipV if the Model() matches
@test Loads.ZipV(Float64[1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0]) == nothing
@test Loads.ZipV() Float64[1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0] # TODO: Does not work for less than 7 elements?
@test Loads.ZipV() Float64[1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0] # This always requires 7 elements

arr = String[]
for i in OpenDSSDirect.EachMember(Loads); push!(arr, Loads.Name()); end
Expand Down
25 changes: 21 additions & 4 deletions test/meters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ OpenDSSDirect.Text.Command("MakeBusList")
@test Meters.Totals()[1] 23830.586235396186
@test Meters.PeakCurrent()[1] 400.0
@test Meters.PeakCurrent(Meters.PeakCurrent()) == nothing
@test 1 + Meters.CalcCurrent()[1] 1 + 0.0
@test Meters.CalcCurrent(Meters.CalcCurrent()) == nothing
@test 1 + Meters.AllocFactors()[1] 1 + 0.0
@test Meters.AllocFactors(Meters.AllocFactors()) == nothing

arr = String[]
for i in OpenDSSDirect.EachMember(Meters); push!(arr, Meters.Name()); end
Expand All @@ -97,6 +93,27 @@ end

@test Meters.ZonePCE() == []

# We need to populate AllocFactors
OpenDSSDirect.Text.Command("Set ControlMode=Off")
OpenDSSDirect.Text.Command("AllocateLoads")

@test Meters.CalcCurrent()[1] 550.6519471768315
@test Meters.CalcCurrent(Meters.CalcCurrent()) == nothing
@test Meters.AllocFactors()[1] 0.7264116690239316
@test Meters.AllocFactors(Meters.AllocFactors()) == nothing

# ZonePCE is updated too now, let's check the first 10 elements
@test Meters.ZonePCE()[1:10] == [
"Load.226195333c0",
"Load.223658a0",
"Capacitor.capbank2a",
"Capacitor.capbank2b",
"Capacitor.capbank2c",
"Load.223660c0",
"Load.223661c0",
"Load.223662c0",
"Load.223663c0",
"Load.346639c0"
]

end # testset
5 changes: 4 additions & 1 deletion test/monitors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ OpenDSSDirect.Text.Command("""
@test Monitors.Element() == "line.ln5815900-1"
@test Monitors.Element(Monitors.Element()) == nothing
@test Monitors.AllNames() == ["m1"]
@test Monitors.ByteStream() == Int8[-20, -86, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 104, 111, 117, 114, 44, 32, 116, 40, 115, 101, 99, 41, 44, 32, 86, 49, 44, 32, 86, 65, 110, 103, 108, 101, 49, 44, 32, 86, 50, 44, 32, 86, 65, 110, 103, 108, 101, 50, 44, 32, 86, 51, 44, 32, 86, 65, 110, 103, 108, 101, 51, 44, 32, 73, 49, 44, 32, 73, 65, 110, 103, 108, 101, 49, 44, 32, 73, 50, 44, 32, 73, 65, 110, 103, 108, 101, 50, 44, 32, 73, 51, 44, 32, 73, 65, 110, 103, 108, 101, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

# In 2021, the header was removed from the bytestream (following the official OpenDSS implementation)
@test Monitors.ByteStream() == Int8[-20, -86, 0, 0, 1, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

@test Monitors.Channel(1) == Float64[0.0] #TODO: better test -- solve in daily mode, capture a sample channel
# @test Monitors.DblHourS()[1] == " V1"
@test Monitors.DblHour() [0.0]
Expand Down
Loading

0 comments on commit fa71941

Please sign in to comment.