Skip to content

Instantly share code, notes, and snippets.

@tshort
Created July 27, 2017 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshort/a28a6f0ed086450eec3ca336e43d9c6c to your computer and use it in GitHub Desktop.
Save tshort/a28a6f0ed086450eec3ca336e43d9c6c to your computer and use it in GitHub Desktop.
Storage / CktElement issue in OpenDSSDirect
julia> using OpenDSSDirect
julia> using OpenDSSDirect.DSS
shell> cd C:\\PortableApps\\OpenDSS\\electricdss-git\\Distrib\\IEEETestCases\\13Bus
C:\PortableApps\OpenDSS\electricdss-git\Distrib\IEEETestCases\13Bus
julia> dss("redirect IEEE13Nodeckt.dss")
""
julia> dss("New Storage.611 Bus1=611 phases=1 kV=2.2 kWRated=20 kWhRated=20 kWhStored=20 %IdlingkW=0 %reserve=0 %EffCharge=100 %EffDischarge=100 State=CHARGING")
""
julia> dss("New Storage.675 Bus1=675 phases=1 kV=2.2 kWRated=20 kWhRated=20 kWhStored=20 %IdlingkW=0 %reserve=0 %EffCharge=100 %EffDischarge=100 State=CHARGING")
""
julia> Circuit.SetActiveClass("Storage")
"29"
julia> Circuit.SetActiveElement("675")
"39"
julia> CktElement.AllVariableNames()
7-element Array{String,1}:
"kWh"
"State"
"kWOut"
"kWIn"
"Losses"
"Idling"
"kWh Chg"
julia> DSSCore.CktElementF(4, 1.0)
20.0
julia> DSSCore.CktElementF(4, 2.0)
0.0
julia> DSSCore.CktElementF(4, 3.0)
0.0
julia> DSSCore.CktElementF(4, 4.0)
0.0
@tshort
Copy link
Author

tshort commented Jul 27, 2017

The last crashes with a final argument of 5.0 or 6.0.

Here's a raw script to do the same:

using OpenDSSDirect
using OpenDSSDirect.DSS

cd("C:/PortableApps/OpenDSS/electricdss-git/Distrib/IEEETestCases/13Bus")
 
dss("redirect IEEE13Nodeckt.dss")
dss("New Storage.611 Bus1=611 phases=1 kV=2.2 kWRated=20 kWhRated=20 kWhStored=20 %IdlingkW=0 %reserve=0 %EffCharge=100 %EffDischarge=100 State=CHARGING")
dss("New Storage.675 Bus1=675 phases=1 kV=2.2 kWRated=20 kWhRated=20 kWhStored=20 %IdlingkW=0 %reserve=0 %EffCharge=100 %EffDischarge=100 State=CHARGING")

Circuit.SetActiveClass("Storage")
Circuit.SetActiveElement("675")
CktElement.AllVariableNames()
DSSCore.CktElementF(4, 1.0)
DSSCore.CktElementF(4, 2.0)
DSSCore.CktElementF(4, 3.0)
DSSCore.CktElementF(4, 4.0)
#DSSCore.CktElementF(4, 5.0)     # crashes

@tshort
Copy link
Author

tshort commented Jul 27, 2017

The segfaults go away if I do a Solve first:

Solution.Solve()
DSSCore.CktElementF(4, 5.0)     # works
CktElement.AllVariableValues()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment