Low-level API

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:

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.

source

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.

source

getYsparse() – Return the system sparse Y matrix.

source

ZeroInjCurr() – Zero out the current injections vector.

source

GetSourceInjCurrents() – Update the current injections vector with source injections.

source

GetPCInjCurr() – Update the current injections vector with injections from power control elements like loads.

source

SystemYChanged() – Bool indicating whether the system Y matrix has changed.

source

SystemYChanged(arg) – Set the status of whether the system Y matrix has changed.

source

BuildYMatrixD(buildops::Integer, doallocate) – Rebuild the system Y matrix.

  • buildops::Integer indicates the type of build. 0 == WHOLEMATRIX and 1 == SERIESONLY.

  • doallocate::Bool is used to determine whether to allocate the Y matrix.

source

UseAuxCurrents() – Bool indicating whether to use auxiliary currents.

source

UseAuxCurrents(arg) – Set the status of whether to use auxiliary currents.

source

UseAuxCurrents(arg) – ??

source

SolveSystem() – Update the system node voltages based on the vector of current injections.

source

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.