Low-level API (module DSSCore)
The main API is built on the low-level API documented here. The low-level API is implemented in the DSSCore
module. Here is an example using the low-level API:
DSSCore.DSSPut_Command("clear")
DSSCore.DSSPut_Command("compile (C:/OpenDSS/electricdss/IEEETestCases/8500-Node/Master.dss)")
loadnumber = DSSCore.DSSLoads(0, 0)
while loadnumber > 0
DSSCore.DSSLoadsF(1, 50.)
DSSCore.DSSLoadsF(5, 20.)
loadnumber = DSSCore.DSSLoads(1, 0)
end
println(DSSCore.DSSLoads(4, 0))
Integer (I), floating-point (F), string (S), and variant (V) functions are supported. The low-level API functions are not exported.
This low-level API also includes several functions for directly accessing and controlling an OpenDSS solution. These functions include:
OpenDSSDirect.DSSCore.AddInAuxCurrents
OpenDSSDirect.DSSCore.BuildYMatrixD
OpenDSSDirect.DSSCore.GetPCInjCurr
OpenDSSDirect.DSSCore.GetSourceInjCurrents
OpenDSSDirect.DSSCore.SolveSystem
OpenDSSDirect.DSSCore.SystemYChanged
OpenDSSDirect.DSSCore.UseAuxCurrents
OpenDSSDirect.DSSCore.ZeroInjCurr
OpenDSSDirect.DSSCore.getI
OpenDSSDirect.DSSCore.getV
OpenDSSDirect.DSSCore.getYsparse
OpenDSSDirect.DSSCore.getI
— Function.getI()
– Return the complex vector of current injections.
The size of the vector is one more than the number of nodes in the system. This is the same current injection array used in OpenDSS internally, so the current injections can be updated for custom solutions. This could be used to implement a custom power control component.
OpenDSSDirect.DSSCore.getV
— Function.getV()
– Return the complex vector of node voltages.
The size of the vector is one more than the number of nodes in the system. The first element is ground (zero volts). This is the same voltage array used in OpenDSS internally, so the voltages can be updated for custom solutions.
OpenDSSDirect.DSSCore.getYsparse
— Function.getYsparse()
– Return the system sparse Y matrix.
OpenDSSDirect.DSSCore.ZeroInjCurr
— Function.ZeroInjCurr()
– Zero out the current injections vector.
OpenDSSDirect.DSSCore.GetSourceInjCurrents
— Function.GetSourceInjCurrents()
– Update the current injections vector with source injections.
OpenDSSDirect.DSSCore.GetPCInjCurr
— Function.GetPCInjCurr()
– Update the current injections vector with injections from power control elements like loads.
OpenDSSDirect.DSSCore.SystemYChanged
— Function.SystemYChanged()
– Bool indicating whether the system Y matrix has changed.
SystemYChanged(arg)
– Set the status of whether the system Y matrix has changed.
OpenDSSDirect.DSSCore.BuildYMatrixD
— Function.BuildYMatrixD(buildops::Integer, doallocate)
– Rebuild the system Y matrix.
buildops::Integer
indicates the type of build.0 == WHOLEMATRIX
and1 == SERIESONLY
.doallocate::Bool
is used to determine whether to allocate the Y matrix.
OpenDSSDirect.DSSCore.UseAuxCurrents
— Function.UseAuxCurrents()
– Bool indicating whether to use auxiliary currents.
UseAuxCurrents(arg)
– Set the status of whether to use auxiliary currents.
OpenDSSDirect.DSSCore.AddInAuxCurrents
— Function.UseAuxCurrents(arg)
– ??
OpenDSSDirect.DSSCore.SolveSystem
— Function.SolveSystem()
– Update the system node voltages based on the vector of current injections.
Limitations
The functions with input parameters that are Variants are not implemented. An example is DSSCore.SettingsV(5, arg)
where arg
is an Array. These variants are normally array inputs. There are not many of these in the direct API, and most can be handled with the text interface or other functions. Functions that retrieve Variants are supported.