dss package

General submodules

dss.enums

class dss.enums.ActionCodes(value)

Bases: IntEnum

An enumeration.

Close = 2
Lock = 4
Open = 1
Reset = 3
TapDown = 7
TapUp = 6
Unlock = 5
none = 0
class dss.enums.AutoAddTypes(value)

Bases: IntEnum

An enumeration.

AddCap = 2
AddGen = 1
class dss.enums.CapControlModes(value)

Bases: IntEnum

An enumeration.

Current = 0
KVAR = 2
PF = 4
Time = 3
Voltage = 1
class dss.enums.CktModels(value)

Bases: IntEnum

An enumeration.

Multiphase = 0
PositiveSeq = 1
class dss.enums.ControlModes(value)

Bases: IntEnum

An enumeration.

Event = 1
Multirate = 3
Off = -1
Static = 0
Time = 2
class dss.enums.DSSCompatFlags(value)

Bases: IntFlag

An enumeration.

BadPrecision = 2
InvControl9611 = 4
NoSolverFloatChecks = 1
SaveCalcVoltageBases = 8
class dss.enums.DSSJSONFlags(value)

Bases: IntFlag

An enumeration.

EnumAsInt = 4
ExcludeDisabled = 32
Full = 1
FullNames = 8
LowercaseKeys = 128
Pretty = 16
SkipDSSClass = 64
SkipRedundant = 2
class dss.enums.GeneratorStatus(value)

Bases: IntEnum

An enumeration.

Fixed = 1
Variable = 0
class dss.enums.LineUnits(value)

Bases: IntEnum

An enumeration.

Miles = 1
cm = 7
ft = 5
inch = 6
kFt = 2
km = 3
meter = 4
mm = 8
none = 0
class dss.enums.LoadModels(value)

Bases: IntEnum

An enumeration.

CVR = 4
ConstI = 5
ConstPFixedQ = 6
ConstPFixedX = 7
ConstPQ = 1
ConstZ = 2
Motor = 3
ZIPV = 8
class dss.enums.LoadStatus(value)

Bases: IntEnum

An enumeration.

Exempt = 2
Fixed = 1
Variable = 0
class dss.enums.MonitorModes(value)

Bases: IntEnum

An enumeration.

Magnitude = 32
PosOnly = 64
Power = 1
Sequence = 16
States = 3
Taps = 2
VI = 0
class dss.enums.OCPDevType(value)

Bases: IntEnum

An enumeration.

Fuse = 1
Recloser = 2
Relay = 3
none = 0
class dss.enums.Options(value)

Bases: IntEnum

Deprecated. Please use instead: - AutoAddTypes - CktModels - ControlModes - SolutionLoadModels - SolutionAlgorithms - RandomModes

AddCap = 2
AddGen = 1
Admittance = 2
ControlOFF = -1
Event = 1
Gaussian = 1
LogNormal = 3
Multiphase = 0
NewtonSolve = 1
NormalSolve = 0
PositiveSeq = 1
PowerFlow = 1
Static = 0
Time = 2
Uniform = 2
class dss.enums.RandomModes(value)

Bases: IntEnum

An enumeration.

Gaussian = 1
LogNormal = 3
Uniform = 2
class dss.enums.SolutionAlgorithms(value)

Bases: IntEnum

An enumeration.

NewtonSolve = 1
NormalSolve = 0
class dss.enums.SolutionLoadModels(value)

Bases: IntEnum

An enumeration.

Admittance = 2
PowerFlow = 1
class dss.enums.SolveModes(value)

Bases: IntEnum

An enumeration.

AutoAdd = 13
Daily = 1
Direct = 7
DutyCycle = 6
Dynamic = 14
FaultStudy = 9
Harmonic = 15
HarmonicT = 17
LD1 = 4
LD2 = 12
Monte1 = 3
Monte2 = 10
Monte3 = 11
MonteFault = 8
PeakDay = 5
SnapShot = 0
Time = 16
Yearly = 2
class dss.enums.SparseSolverOptions(value)

Bases: IntEnum

An enumeration.

AlwaysResetYPrimInvalid = 268435456
ReuseCompressedMatrix = 1
ReuseNothing = 0
ReuseNumericFactorization = 3
ReuseSymbolicFactorization = 2
class dss.enums.YMatrixModes(value)

Bases: IntEnum

An enumeration.

SeriesOnly = 1
WholeMatrix = 2

dss.patch_dss_com

dss.patch_dss_com.patch_dss_com(obj)

dss.plot

This module provides a work-in-progress implementation of the original OpenDSS plots using the new features from DSS C-API v0.12+ and common Python modules such as matplotlib.

This is not a complete implementation and there are known limitations, but should suffice for many use-cases. We’d like to add another backend later.

dss.plot.disable()
dss.plot.enable(plot3d=False, plot2d=True, show=True)

Enables the plotting subsystem from DSS-Extensions.

Set plot3d to True to try to reproduce some of the plots from the alternative OpenDSS Visualization Tool / OpenDSS Viewer addition to OpenDSS.

Use show to control whether this backend should call pyplot.show() or leave that to the system or the user. If the user plans to customize the figure, it is better to set show=False in order to preserve the figures, since pyplot.show() discards them.

Interface submodules

dss.IDSS

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IDSS.IDSS(api_util)

Bases: Base

Main OpenDSS interface. Organizes the subclasses trying to mimic the OpenDSSengine.DSS object as seen from win32com.client or comtypes.client.

This main class also includes some global settings. See more settings in ActiveCircuit.Settings.

ClearAll()
NewCircuit(name)
Return type:

ICircuit

NewContext()

Creates a new DSS engine context. A DSS Context encapsulates most of the global state of the original OpenDSS engine, allowing the user to create multiple instances in the same process. By creating contexts manually, the management of threads and potential issues should be handled by the user.

(API Extension)

Return type:

Self

Reset()
SetActiveClass(ClassName)
Return type:

int

ShowPanel()
Start(code)
Return type:

bool

ActiveCircuit: ICircuit

Provides access to the circuit attributes and objects in general.

ActiveClass: IActiveClass

General information about the current active DSS class.

property AdvancedTypes: bool

When enabled, there are two side-effects:

  • Per DSS Context: Complex arrays and complex numbers can be returned and consumed by the Python API.

  • Global effect: The low-level API provides matrix dimensions when available (EnableArrayDimensions is enabled).

As a result, for example, DSS.ActiveCircuit.ActiveCktElement.Yprim is returned as a complex matrix instead of a plain array.

When disabled, the legacy plain arrays are used and complex numbers cannot be consumed by the Python API.

Defaults to **False* for backwards compatibility.*

(API Extension)

property AllowChangeDir: bool

If disabled, the engine will not change the active working directory during execution. E.g. a “compile” command will not “chdir” to the file path.

If you have issues with long paths, enabling this might help in some scenarios.

Defaults to True (allow changes, backwards compatible) in the 0.10.x versions of DSS C-API. This might change to False in future versions.

This can also be set through the environment variable DSS_CAPI_ALLOW_CHANGE_DIR. Set it to 0 to disallow changing the active working directory.

(API Extension)

property AllowDOScmd: bool

If enabled, the DOScmd command is allowed. Otherwise, an error is reported if the user tries to use it.

Defaults to False/0 (disabled state). Users should consider DOScmd deprecated on DSS-Extensions.

This can also be set through the environment variable DSS_CAPI_ALLOW_DOSCMD. Setting it to 1 enables the command.

(API Extension)

property AllowEditor: bool

Gets/sets whether running the external editor for “Show” is allowed

AllowEditor controls whether the external editor is used in commands like “Show”. If you set to 0 (false), the editor is not executed. Note that other side effects, such as the creation of files, are not affected.

(API Extension)

property AllowForms: bool

Gets/sets whether text output is allowed

property COMErrorResults: bool

If enabled, in case of errors or empty arrays, the API returns arrays with values compatible with the official OpenDSS COM interface.

For example, consider the function Loads_Get_ZIPV. If there is no active circuit or active load element: - In the disabled state (COMErrorResults=False), the function will return “[]”, an array with 0 elements. - In the enabled state (COMErrorResults=True), the function will return “[0.0]” instead. This should be compatible with the return value of the official COM interface.

Defaults to True/1 (enabled state) in the v0.12.x series. This will change to false in future series.

This can also be set through the environment variable DSS_CAPI_COM_DEFAULTS. Setting it to 0 disables the legacy/COM behavior. The value can be toggled through the API at any time.

(API Extension)

Circuits: ICircuit

Kept for compatibility. Currently it is an alias to ActiveCircuit.

property Classes: List[str]

List of DSS intrinsic classes (names of the classes)

property CompatFlags: int

Controls some compatibility flags introduced to toggle some behavior from the official OpenDSS.

THESE FLAGS ARE GLOBAL, affecting all DSS engines in the process.

The current bit flags are:

  • 0x1 (bit 0): If enabled, don’t check for NaNs in the inner solution loop. This can lead to various errors.

    This flag is useful for legacy applications that don’t handle OpenDSS API errors properly. Through the development of DSS-Extensions, we noticed this is actually a quite common issue.

  • 0x2 (bit 1): Toggle worse precision for certain aspects of the engine. For example, the sequence-to-phase

    (As2p) and sequence-to-phase (Ap2s) transform matrices. On DSS C-API, we fill the matrix explicitly using higher precision, while numerical inversion of an initially worse precision matrix is used in the official OpenDSS. We will introduce better precision for other aspects of the engine in the future, so this flag can be used to toggle the old/bad values where feasible.

  • 0x4 (bit 2): Toggle some InvControl behavior introduced in OpenDSS 9.6.1.1. It could be a regression

    but needs further investigation, so we added this flag in the time being.

These flags may change for each version of DSS C-API, but the same value will not be reused. That is, when we remove a compatibility flag, it will have no effect but will also not affect anything else besides raising an error if the user tries to toggle a flag that was available in a previous version.

We expect to keep a very limited number of flags. Since the flags are more transient than the other options/flags, it was preferred to add this generic function instead of a separate function per flag.

Related enumeration: DSSCompatFlags

(API Extension)

DSSProgress: IDSSProgress

Kept for compatibility. Controls the progress dialog/output, if avaiable.

DSSim_Coms: IDSSimComs

Kept for compatibility. Apparently was used for DSSim-PC (now OpenDSS-G), a closed-source software developed by EPRI using LabView.

property DataPath: str

DSS Data File Path. Default path for reports, etc. from DSS

property DefaultEditor: str

Returns the path name for the default text editor.

Error: IError

The Error interface provides the current error state and messages. In DSS-Python, this is already mapped to Python exceptions, so the user typpically does not need to worry about this.

Events: IDSSEvents

Kept for compatibility.

Executive: IDSS_Executive

Access to the list of available commands and options, including help text.

property LegacyModels: bool

LegacyModels was a flag used to toggle legacy (pre-2019) models for PVSystem, InvControl, Storage and StorageControl. In the official OpenDSS version 9.0, the old models were removed. They were temporarily present here but were also removed in DSS C-API v0.13.0.

NOTE: this property will be removed for v1.0. It is left to avoid breaking the current API too soon.

(API Extension)

property NumCircuits: int

Number of Circuits currently defined

property NumClasses: int

Number of DSS intrinsic classes

property NumUserClasses: int

Number of user-defined classes

Obj: IObj

An experimental API that exposes all data classes of the DSS engine in a new and pythonic API.

(API Extension)

Parser: IParser

Kept for compatibility.

property Plotting

Shortcut for the plotting module. This property is equivalent to:

` from dss import plot return plot `

Gives access to the enable() and disable() functions. Requires matplotlib and SciPy to be installed, hence it is an optional feature.

(API Extension)

Text: IText

Provides access to command

property UserClasses: List[str]

List of user-defined classes

property Version: str

Get version string for the DSS.

YMatrix: IYMatrix

The YMatrix interface provides advanced access to the internals of the DSS engine. The sparse admittance matrix of the system is also available here.

The original OpenDSSDirect.DLL had some YMatrix_* functions, but we add a lot more here.

(API Extension)

ZIP: IZIP

The ZIP interface provides functions to open compressed ZIP packages and run scripts inside the ZIP, without creating extra files on disk.

(API Extension)

dss.IDSS_Executive

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IDSS_Executive.IDSS_Executive(api_util)

Bases: Base

Command(i)

Get i-th command

Return type:

str

CommandHelp(i)

Get help string for i-th command

Return type:

str

Option(i)

Get i-th option

Return type:

str

OptionHelp(i)

Get help string for i-th option

Return type:

str

OptionValue(i)

Get present value of i-th option

Return type:

str

property NumCommands: int

Number of DSS Executive Commands

property NumOptions: int

Number of DSS Executive Options

dss.IDSSimComs

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IDSSimComs.IDSSimComs(api_util)

Bases: Base

BusVoltage(Index)
Return type:

ndarray[Any, dtype[float64]]

BusVoltagepu(Index)
Return type:

ndarray[Any, dtype[float64]]

dss.IError

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IError.IError(api_util)

Bases: Base

property Description: str

Description of error for last operation

property EarlyAbort: bool

EarlyAbort controls whether all errors halts the DSS script processing (Compile/Redirect), defaults to True.

(API Extension)

property ExtendedErrors: bool

Controls whether the extended error mechanism is used. Defaults to True.

Extended errors are errors derived from checks across the API to ensure a valid state. Although many of these checks are already present in the original/official COM interface, the checks do not produce any error message. An error value can be returned by a function but this value can, for many of the functions, be a valid value. As such, the user has no means to detect an invalid API call.

Extended errors use the Error interface to provide a more clear message and should help users, especially new users, to find usage issues earlier.

At Python level, an exception is raised when an error is detected through the Error interface.

The current default state is ON. For compatibility, the user can turn it off to restore the previous behavior.

(API Extension)

property Number: int

Error Number (returns current value and then resets to zero)

property UseExceptions: bool

Controls whether the automatic error checking mechanism is enable, i.e., if the DSS engine errors (from the Error interface) are mapped exception when detected.

When disabled, the user takes responsibility for checking for errors. This can be done through the Error interface. When Error.Number is not zero, there should be an error message in Error.Description. This is compatible with the behavior on the official OpenDSS (Windows-only COM implementation) when AllowForms is disabled.

Users can also use the DSS command Export ErrorLog to inspect for errors.

WARNING: This is a global setting, affects all DSS instances from DSS-Python and OpenDSSDirect.py.

(API Extension)

dss.IText

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IText.IText(api_util)

Bases: Base

Commands(Value)

Runs a list of strings or a large string as commands directly in the DSS engine. Intermediate results (from Text.Result) are ignored.

Value can be a list of strings, or a single large string (usually faster).

(API Extension)

property Command: str

Input command string for the DSS.

property Result: str

Result string for the last command.

dss.IZIP

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2021-2022 Paulo Meira

class dss.IZIP.IZIP(api_util)

Bases: Base

Close()

Closes the current open ZIP file

(API Extension)

Contains(Name)

Check if the given path name is present in the current ZIP file.

(API Extension)

Return type:

bool

Extract(FileName)

Extracts the contents of the file “FileName” from the current (open) ZIP file. Returns a byte-string.

(API Extension)

Return type:

bytes

List(regexp=None)

List of strings consisting of all names match the regular expression provided in regexp. If no expression is provided, all names in the current open ZIP are returned.

See https://regex.sorokin.engineer/en/latest/regular_expressions.html for information on the expression syntax and options.

(API Extension)

Return type:

List[str]

Open(FileName)

Opens and prepares a ZIP file to be used by the DSS text parser. Currently, the ZIP format support is limited by what is provided in the Free Pascal distribution. Besides that, the full filenames inside the ZIP must be shorter than 256 characters. The limitations should be removed in a future revision.

(API Extension)

Redirect(FileInZip)

Runs a “Redirect” command inside the current (open) ZIP file. In the current implementation, all files required by the script must be present inside the ZIP, using relative paths. The only exceptions are memory-mapped files.

(API Extension)

dss.IActiveClass

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IActiveClass.IActiveClass(api_util)

Bases: Base

ToJSON(options=0)

Returns the data (as a list) of all elements from the active class as a JSON-encoded string.

The options parameter contains bit-flags to toggle specific features. See Obj_ToJSON (C-API) for more, or DSSObj.to_json in Python.

Additionally, the ExcludeDisabled flag can be used to excluded disabled elements from the output.

(API Extension)

Return type:

str

property ActiveClassName: str

Returns name of active class.

property ActiveClassParent: str

Get the name of the parent class of the active class

property AllNames: List[str]

Array of strings consisting of all element names in the active class.

property Count: int

Number of elements in Active Class. Same as NumElements Property.

property First: int

Sets first element in the active class to be the active DSS object. If object is a CktElement, ActiveCktELment also points to this element. Returns 0 if none.

property Name: str

Name of the Active Element of the Active Class

property Next: int

Sets next element in active class to be the active DSS object. If object is a CktElement, ActiveCktElement also points to this element. Returns 0 if no more.

property NumElements: int

Number of elements in this class. Same as Count property.

dss.IBus

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IBus.IBus(api_util)

Bases: Base

GetUniqueNodeNumber(StartNumber)
Return type:

int

ZscRefresh()
Return type:

bool

property AllPCEatBus: List[str]

Returns an array with the names of all PCE connected to the active bus

property AllPDEatBus: List[str]

Returns an array with the names of all PDE connected to the active bus

property Coorddefined: bool

Indicates whether a coordinate has been defined for this bus

property CplxSeqVoltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex Double array of Sequence Voltages (0, 1, 2) at this Bus.

property Cust_Duration: float

Accumulated customer outage durations

property Cust_Interrupts: float

Annual number of customer-interruptions from this bus

property Distance: float

Distance from energymeter (if non-zero)

property Int_Duration: float

Average interruption duration, hr.

property Isc: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Short circuit currents at bus; Complex Array.

property Lambda: float

Accumulated failure rate downstream from this bus; faults per year

property LineList: List[str]

List of strings: Full Names of LINE elements connected to the active bus.

property LoadList: List[str]

List of strings: Full Names of LOAD elements connected to the active bus.

property N_Customers: int

Total numbers of customers served downline from this bus

property N_interrupts: float

Number of interruptions this bus per year

property Name: str

Name of Bus

property Nodes: ndarray[Any, dtype[int32]]

Integer Array of Node Numbers defined at the bus in same order as the voltages.

property NumNodes: int

Number of Nodes this bus.

property SectionID: int

Integer ID of the feeder section in which this bus is located.

property SeqVoltages: ndarray[Any, dtype[float64]]

Double Array of sequence voltages at this bus. Magnitudes only.

property TotalMiles: float

Total length of line downline from this bus, in miles. For recloser siting algorithm.

property VLL: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

For 2- and 3-phase buses, returns array of complex numbers represetin L-L voltages in volts. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only first 3.

property VMagAngle: ndarray[Any, dtype[float64]]

Array of doubles containing voltages in Magnitude (VLN), angle (degrees)

property Voc: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Open circuit voltage; Complex array.

property Voltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of voltages at this bus.

property YscMatrix: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of Ysc matrix at bus. Column by column.

property ZSC012Matrix: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Array of doubles (complex) containing the complete 012 Zsc matrix. Only available after Zsc is computed, either through the “ZscRefresh” command, or running a “FaultStudy” solution. Only available for buses with 3 nodes.

property Zsc0: ndarray[Any, dtype[float64]] | complex

Complex Zero-Sequence short circuit impedance at bus.

property Zsc1: ndarray[Any, dtype[float64]] | complex

Complex Positive-Sequence short circuit impedance at bus.

property ZscMatrix: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of Zsc matrix at bus. Column by column.

property kVBase: float

Base voltage at bus in kV

property puVLL: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Returns Complex array of pu L-L voltages for 2- and 3-phase buses. Returns -1.0 for 1-phase bus. If more than 3 phases, returns only 3 phases.

property puVmagAngle: ndarray[Any, dtype[float64]]

Array of doubles containing voltage magnitude, angle (degrees) pairs in per unit

property puVoltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex Array of pu voltages at the bus.

property x: float

X Coordinate for bus (double)

property y: float

Y coordinate for bus(double)

dss.ICNData

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ICNData.ICNData(api_util)

Bases: Iterable

CNData objects

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property DiaCable: float
property DiaIns: float
property DiaStrand: float
property Diameter: float
property EmergAmps: float

Emergency ampere rating

property EpsR: float
property First: int

Sets the first object of this type active. Returns 0 if none.

property GMRUnits: LineUnits
property GMRac: float
property GmrStrand: float
property InsLayer: float
property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal Ampere rating

property RStrand: float
property Rac: float
property Radius: float
property RadiusUnits: LineUnits
property Rdc: float
property ResistanceUnits: LineUnits
property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property k: int

dss.ICapControls

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ICapControls.ICapControls(api_util)

Bases: Iterable

Reset()
property AllNames: List[str]

Array of all names of this object type

property CTratio: float

Transducer ratio from pirmary current to control current.

property Capacitor: str

Name of the Capacitor that is controlled.

property Count: int

Number of objects of this type

property DeadTime: float
property Delay: float

Time delay [s] to switch on after arming. Control may reset before actually switching.

property DelayOff: float

Time delay [s] before switching off a step. Control may reset before actually switching.

property First: int

Sets the first object of this type active. Returns 0 if none.

property Mode: int

Type of automatic controller.

property MonitoredObj: int

Full name of the element that PT and CT are connected to.

property MonitoredTerm: int

Terminal number on the element that PT and CT are connected to.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property OFFSetting: float

Threshold to switch off a step. See Mode for units.

property ONSetting: float

Threshold to arm or switch on a step. See Mode for units.

property PTratio: float

Transducer ratio from primary feeder to control voltage.

property UseVoltOverride: float

Enables Vmin and Vmax to override the control Mode

property Vmax: float

With VoltOverride, swtich off whenever PT voltage exceeds this level.

property Vmin: float

With VoltOverride, switch ON whenever PT voltage drops below this level.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ICapacitors

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ICapacitors.ICapacitors(api_util)

Bases: Iterable

AddStep()
Return type:

bool

Close()
Open()
SubtractStep()
Return type:

bool

property AllNames: List[str]

Array of all names of this object type

property AvailableSteps: int

Number of Steps available in cap bank to be switched ON.

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsDelta: bool

Delta connection or wye?

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NumSteps: int

Number of steps (default 1) for distributing and switching the total bank kVAR.

property States: ndarray[Any, dtype[int32]]

A array of integer [0..numsteps-1] indicating state of each step. If the read value is -1 an error has occurred.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kV: float

Bank kV rating. Use LL for 2 or 3 phases, or actual can rating for 1 phase.

property kvar: float

Total bank KVAR, distributed equally among phases and steps.

dss.ICircuit

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ICircuit.ICircuit(api_util)

Bases: Base

AllNodeDistancesByPhase(Phase)

Returns an array of doubles representing the distances to parent EnergyMeter. Sequence of array corresponds to other node ByPhase properties.

Return type:

ndarray[Any, dtype[float64]]

AllNodeNamesByPhase(Phase)

Return array of strings of the node names for the By Phase criteria. Sequence corresponds to other ByPhase properties.

Return type:

List[str]

AllNodeVmagByPhase(Phase)

Returns Array of doubles represent voltage magnitudes for nodes on the specified phase.

Return type:

ndarray[Any, dtype[float64]]

AllNodeVmagPUByPhase(Phase)

Returns array of per unit voltage magnitudes for each node by phase

Return type:

ndarray[Any, dtype[float64]]

Capacity(Start, Increment)
Return type:

float

Disable(Name)
ElementLosses(Value)

Array of total losses (complex) in a selection of elements. Use the element indices (starting at 1) as parameter.

(API Extension)

Return type:

Union[ndarray[Any, dtype[float64]], ndarray[Any, dtype[complex128]]]

Enable(Name)
EndOfTimeStepUpdate()
FirstElement()
Return type:

int

FirstPCElement()
Return type:

int

FirstPDElement()
Return type:

int

NextElement()
Return type:

int

NextPCElement()
Return type:

int

NextPDElement()
Return type:

int

Sample()
SaveSample()
SetActiveBus(BusName)
Return type:

int

SetActiveBusi(BusIndex)
Return type:

int

SetActiveClass(ClassName)
Return type:

int

SetActiveElement(FullName)
Return type:

int

UpdateStorage()
ActiveBus: IBus
ActiveCktElement: ICktElement
ActiveClass: IActiveClass
ActiveDSSElement: IDSSElement
ActiveElement: ICktElement
property AllBusDistances: ndarray[Any, dtype[float64]]

Returns distance from each bus to parent EnergyMeter. Corresponds to sequence in AllBusNames.

property AllBusNames: List[str]

Array of strings containing names of all buses in circuit (see AllNodeNames).

property AllBusVmag: ndarray[Any, dtype[float64]]

Array of magnitudes (doubles) of voltages at all buses

property AllBusVmagPu: ndarray[Any, dtype[float64]]

Double Array of all bus voltages (each node) magnitudes in Per unit

property AllBusVolts: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of all bus, node voltages from most recent solution

property AllElementLosses: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Array of total losses (complex) in each circuit element

property AllElementNames: List[str]

Array of strings containing Full Name of all elements.

property AllNodeDistances: ndarray[Any, dtype[float64]]

Returns an array of distances from parent EnergyMeter for each Node. Corresponds to AllBusVMag sequence.

property AllNodeNames: List[str]

Array of strings containing full name of each node in system in same order as returned by AllBusVolts, etc.

Buses: IBus
CNData: ICNData
CapControls: ICapControls
Capacitors: ICapacitors
CktElements: ICktElement
CtrlQueue: ICtrlQueue
DSSim_Coms: IDSSimComs
Fuses: IFuses
GICSources: IGICSources
Generators: IGenerators
ISources: IISources
Isources: IISources
LineCodes: ILineCodes
LineGeometries: ILineGeometries
property LineLosses: ndarray[Any, dtype[float64]] | complex

Complex total line losses in the circuit

LineSpacings: ILineSpacings
Lines: ILines
LoadShapes: ILoadShapes
Loads: ILoads
property Losses: ndarray[Any, dtype[float64]] | complex

Total losses in active circuit, complex number (two-element array of double).

Meters: IMeters
Monitors: IMonitors
property Name: str

Name of the active circuit.

property NumBuses: int

Total number of Buses in the circuit.

property NumCktElements: int

Number of CktElements in the circuit.

property NumNodes: int

Total number of nodes in the circuit.

PDElements: IPDElements
PVSystems: IPVSystems
Parallel: IParallel
property ParentPDElement: int

Sets Parent PD element, if any, to be the active circuit element and returns index>0; Returns 0 if it fails or not applicable.

Reactors: IReactors
Reclosers: IReclosers
ReduceCkt: IReduceCkt

Circuit Reduction Interface

RegControls: IRegControls
Relays: IRelays
Sensors: ISensors
Settings: ISettings
Solution: ISolution
Storages: IStorages
property SubstationLosses: ndarray[Any, dtype[float64]] | complex

Complex losses in all transformers designated to substations.

SwtControls: ISwtControls
property SystemY: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

(read-only) System Y matrix (after a solution has been performed). This is deprecated as it returns a dense matrix. Only use it for small systems. For large-scale systems, prefer YMatrix.GetCompressedYMatrix.

TSData: ITSData
Topology: ITopology
property TotalPower: ndarray[Any, dtype[float64]] | complex

Total power (complex), kVA delivered to the circuit

Transformers: ITransformers
Vsources: IVsources
WireData: IWireData
XYCurves: IXYCurves
property YCurrents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Array of doubles containing complex injection currents for the present solution. Is is the “I” vector of I=YV

property YNodeOrder: List[str]

Array of strings containing the names of the nodes in the same order as the Y matrix

property YNodeVarray: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of actual node voltages in same order as SystemY matrix.

dss.ICktElement

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ICktElement.ICktElement(api_util)

Bases: Base

Close(Term, Phs)
Controller(idx)

Full name of the i-th controller attached to this element. Ex: str = Controller(2). See NumControls to determine valid index range

Return type:

str

IsOpen(Term, Phs)
Return type:

bool

Open(Term, Phs)
Variable(MyVarName)

Returns (value, Code). For PCElement, get the value of a variable by name. If Code>0 Then no variable by this name or not a PCelement.

Return type:

Tuple[float, int]

VariableByIndex(Idx)

Returns (value, Code). For PCElement, get the value of a variable by integer index. If Code>0 Then no variable by this index or not a PCelement.

Return type:

Tuple[float, int]

VariableByName(MyVarName)

Returns (value, Code). For PCElement, get the value of a variable by name. If Code>0 Then no variable by this name or not a PCelement.

Return type:

Tuple[float, int]

Variablei(Idx)

Returns (value, Code). For PCElement, get the value of a variable by integer index. If Code>0 Then no variable by this index or not a PCelement.

Return type:

Tuple[float, int]

setVariableByIndex(Idx, Value)
Return type:

int

setVariableByName(Idx, Value)
Return type:

int

property AllPropertyNames: List[str]

Array containing all property names of the active device.

property AllVariableNames: List[str]

Array of strings listing all the published state variable names. Valid only for PCElements.

property AllVariableValues: ndarray[Any, dtype[float64]]

Array of doubles. Values of state variables of active element if PC element. Valid only for PCElements.

property BusNames: List[str]

Array of strings. Get Bus definitions to which each terminal is connected.

property CplxSeqCurrents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex double array of Sequence Currents for all conductors of all terminals of active circuit element.

property CplxSeqVoltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex double array of Sequence Voltage for all terminals of active circuit element.

property Currents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of currents into each conductor of each terminal

property CurrentsMagAng: ndarray[Any, dtype[float64]]

Currents in magnitude, angle (degrees) format as a array of doubles.

property DisplayName: str

Display name of the object (not necessarily unique)

property EmergAmps: float

Emergency Ampere Rating for PD elements

property Enabled: bool

Boolean indicating that element is currently in the circuit.

property EnergyMeter: str

Name of the Energy Meter this element is assigned to.

property GUID: str

globally unique identifier for this object

property Handle: int

Pointer to this object

property HasOCPDevice: bool

True if a recloser, relay, or fuse controlling this ckt element. OCP = Overcurrent Protection

property HasSwitchControl: bool

This element has a SwtControl attached.

property HasVoltControl: bool

This element has a CapControl or RegControl attached.

property IsIsolated: bool

Returns true if the current active element is isolated. Note that this only fetches the current value. See also the Topology interface.

(API Extension)

property Losses: ndarray[Any, dtype[float64]] | complex

Total losses in the element: two-element double array (complex), in VA (watts, vars)

property Name: str

Full Name of Active Circuit Element

property NodeOrder: ndarray[Any, dtype[int32]]

Array of integer containing the node numbers (representing phases, for example) for each conductor of each terminal.

property NodeRef: ndarray[Any, dtype[int32]]

Array of integers, a copy of the internal NodeRef of the CktElement.

property NormalAmps: float

Normal ampere rating for PD Elements

property NumConductors: int

Number of Conductors per Terminal

property NumControls: int

(read-only) Number of controls connected to this device. Use to determine valid range for index into Controller array.

property NumPhases: int

Number of Phases

property NumProperties: int

Number of Properties this Circuit Element.

property NumTerminals: int

Number of Terminals this Circuit Element

property OCPDevIndex: int

Index into Controller list of OCP Device controlling this CktElement

property OCPDevType: OCPDevType

0=None; 1=Fuse; 2=Recloser; 3=Relay; Type of OCP controller device

property PhaseLosses: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of losses (kVA) by phase

property Powers: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of powers (kVA) into each conductor of each terminal

Properties: IDSSProperty
property Residuals: ndarray[Any, dtype[float64]]

Residual currents for each terminal: (magnitude, angle in degrees)

property SeqCurrents: ndarray[Any, dtype[float64]]

Double array of symmetrical component currents (magnitudes only) into each 3-phase terminal

property SeqPowers: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of sequence powers (kW, kvar) into each 3-phase teminal

property SeqVoltages: ndarray[Any, dtype[float64]]

Double array of symmetrical component voltages (magnitudes only) at each 3-phase terminal

property TotalPowers: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Returns an array with the total powers (complex, kVA) at ALL terminals of the active circuit element.

property Voltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of voltages at terminals

property VoltagesMagAng: ndarray[Any, dtype[float64]]

Voltages at each conductor in magnitude, angle form as array of doubles.

property Yprim: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

YPrim matrix, column order, complex numbers

dss.ICtrlQueue

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.ICtrlQueue.ICtrlQueue(api_util)

Bases: Base

ClearActions()
ClearQueue()
Delete(ActionHandle)
DoAllQueue()
Push(Hour, Seconds, ActionCode, DeviceHandle)

Push a control action onto the DSS control queue by time, action code, and device handle (user defined). Returns Control Queue handle.

Show()
property Action: int

(write-only) Set the active action by index

property ActionCode: int

Code for the active action. Long integer code to tell the control device what to do

property DeviceHandle: int

Handle (User defined) to device that must act on the pending action.

property NumActions: int

Number of Actions on the current actionlist (that have been popped off the control queue by CheckControlActions)

property PopAction: int

Pops next action off the action list and makes it the active action. Returns zero if none.

property Queue: List[str]

Array of strings containing the entire queue in CSV format

property QueueSize: int

Number of items on the OpenDSS control Queue

dss.IDSSElement

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IDSSElement.IDSSElement(api_util)

Bases: Base

ToJSON(options=0)

Returns the properties of the active DSS object as a JSON-encoded string.

The options parameter contains bit-flags to toggle specific features. See Obj_ToJSON (C-API) for more, or DSSObj.to_json in Python.

(API Extension)

Return type:

str

property AllPropertyNames: List[str]

Array of strings containing the names of all properties for the active DSS object.

property Name: str

Full Name of Active DSS Object (general element or circuit element).

property NumProperties: int

Number of Properties for the active DSS object.

Properties

dss.IDSSEvents

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2019 Paulo Meira

class dss.IDSSEvents.IDSSEvents(api_util)

Bases: object

dss.IDSSProgress

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IDSSProgress.IDSSProgress(api_util)

Bases: Base

Close()
Show()
property Caption: str

(write-only) Caption to appear on the bottom of the DSS Progress form.

property PctProgress: int

(write-only) Percent progress to indicate [0..100]

dss.IDSSProperty

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IDSSProperty.IDSSProperty(api_util)

Bases: Base

property Description: str

Description of the property.

property Name: str

Name of Property

property Val: str

dss.IFuses

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IFuses.IFuses(api_util)

Bases: Iterable

Close()

Close all phases of the fuse.

IsBlown()

Current state of the fuses. TRUE if any fuse on any phase is blown. Else FALSE.

Return type:

bool

Open()

Manual opening of all phases of the fuse.

Reset()

Reset fuse to normal state.

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property Delay: float

A fixed delay time in seconds added to the fuse blowing time determined by the TCC curve. Default is 0. This represents a fuse clear or other delay.

property First: int

Sets the first object of this type active. Returns 0 if none.

property MonitoredObj: str

Full name of the circuit element to which the fuse is connected.

property MonitoredTerm: int

Terminal number to which the fuse is connected.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormalState: List[str]

Array of strings indicating the normal state of each phase of the fuse.

property NumPhases: int

Number of phases, this fuse.

property RatedCurrent: float

Multiplier or actual amps for the TCCcurve object. Defaults to 1.0. Multiply current values of TCC curve by this to get actual amps.

property State: List[str]

Array of strings indicating the state of each phase of the fuse.

property SwitchedObj: str

Full name of the circuit element switch that the fuse controls. Defaults to the MonitoredObj.

property SwitchedTerm: int

Number of the terminal of the controlled element containing the switch controlled by the fuse.

property TCCcurve: str

Name of the TCCcurve object that determines fuse blowing.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IGICSources

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2023 Paulo Meira Copyright (c) 2023 DSS-Extensions contributors

class dss.IGICSources.IGICSources(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property Bus1: str

First bus name of GICSource (Created name)

property Bus2: str

Second bus name

property Count: int

Number of objects of this type

property EE: float

Eastward E Field, V/km

property EN: float

Northward E Field V/km

property First: int

Sets the first object of this type active. Returns 0 if none.

property Lat1: float

Latitude of Bus1 (degrees)

property Lat2: float

Latitude of Bus2 (degrees)

property Lon1: float

Longitude of Bus1 (Degrees)

property Lon2: float

Longitude of Bus2 (Degrees)

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property Phases: int

Number of Phases, this GICSource element.

property Volts: float

Specify dc voltage directly

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IGenerators

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IGenerators.IGenerators(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property Bus1: str

Bus to which the Generator is connected. May include specific node specification.

(API Extension)

property Class: int

An arbitrary integer number representing the class of Generator so that Generator values may be segregated by class.

(API Extension)

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property ForcedON: bool

Indicates whether the generator is forced ON regardles of other dispatch criteria.

property IsDelta: bool

Generator connection. True/1 if delta connection, False/0 if wye.

(API Extension)

property Model: int

Generator Model

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property PF: float

Power factor (pos. = producing vars). Updates kvar based on present kW value.

property Phases: int

Number of phases

property RegisterNames: List[str]

Array of Names of all generator energy meter registers

property RegisterValues: ndarray[Any, dtype[float64]]

Array of valus in generator energy meter registers.

property Status: GeneratorStatus

Response to dispatch multipliers: Fixed=1 (dispatch multipliers do not apply), Variable=0 (follows curves).

Related enumeration: GeneratorStatus

(API Extension)

property Vmaxpu: float

Vmaxpu for generator model

property Vminpu: float

Vminpu for Generator model

property Yearly: str

Name of yearly loadshape

(API Extension)

property daily: str

Name of the loadshape for a daily generation profile.

(API Extension)

property duty: str

Name of the loadshape for a duty cycle simulation.

(API Extension)

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kV: float

Voltage base for the active generator, kV

property kVArated: float

kVA rating of the generator

property kW: float

kW output for the active generator. kvar is updated for current power factor.

property kva: float

kVA rating of electrical machine. Applied to machine or inverter definition for Dynamics mode solutions.

(API Extension)

property kvar: float

kvar output for the active generator. Updates power factor based on present kW value.

dss.IISources

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IISources.IISources(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property Amps: float

Magnitude of the ISource in amps

property AngleDeg: float

Phase angle for ISource, degrees

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Frequency: float

The present frequency of the ISource, Hz

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ILineCodes

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ILineCodes.ILineCodes(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property C0

Zero-sequence capacitance, nF per unit length

property C1

Positive-sequence capacitance, nF per unit length

property Cmatrix: ndarray[Any, dtype[float64]]

Capacitance matrix, nF per unit length

property Count: int

Number of objects of this type

property EmergAmps: float

Emergency ampere rating

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsZ1Z0: bool

Flag denoting whether impedance data were entered in symmetrical components

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal Ampere rating

property Phases: int

Number of Phases

property R0: float

Zero-Sequence Resistance, ohms per unit length

property R1: float

Positive-sequence resistance ohms per unit length

property Rmatrix: ndarray[Any, dtype[float64]]

Resistance matrix, ohms per unit length

property Units: LineUnits
property X0: float

Zero Sequence Reactance, Ohms per unit length

property X1: float

Posiive-sequence reactance, ohms per unit length

property Xmatrix: ndarray[Any, dtype[float64]]

Reactance matrix, ohms per unit length

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ILineGeometries

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ILineGeometries.ILineGeometries(api_util)

Bases: Iterable

LineGeometry objects

(API Extension)

Cmatrix(Frequency, Length, Units)

Capacitance matrix, nF

Return type:

ndarray[Any, dtype[float64]]

Rmatrix(Frequency, Length, Units)

Resistance matrix, ohms

Return type:

ndarray[Any, dtype[float64]]

Xmatrix(Frequency, Length, Units)

Reactance matrix, ohms

Return type:

ndarray[Any, dtype[float64]]

Zmatrix(Frequency, Length, Units)

Complex impedance matrix, ohms

Return type:

Union[ndarray[Any, dtype[float64]], ndarray[Any, dtype[complex128]]]

property AllNames: List[str]

Array of all names of this object type

property Conductors: List[str]

Array of strings with names of all conductors in the active LineGeometry object

property Count: int

Number of objects of this type

property EmergAmps: float

Emergency ampere rating

property First: int

Sets the first object of this type active. Returns 0 if none.

property Name: str

Gets the current name or sets the active object of this type by name

property Nconds: int

Number of conductors in this geometry. Default is 3. Triggers memory allocations. Define first!

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal ampere rating

property Phases: int

Number of Phases

property Reduce: bool
property RhoEarth: float
property Units: List[LineUnits]
property Xcoords: ndarray[Any, dtype[float64]]

Get/Set the X (horizontal) coordinates of the conductors

property Ycoords: ndarray[Any, dtype[float64]]

Get/Set the Y (vertical/height) coordinates of the conductors

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ILineSpacings

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ILineSpacings.ILineSpacings(api_util)

Bases: Iterable

LineSpacing objects

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Name: str

Gets the current name or sets the active object of this type by name

property Nconds: int
property Next: int

Sets next object of this type active. Returns 0 if no more.

property Phases: int

Number of Phases

property Units: LineUnits
property Xcoords: ndarray[Any, dtype[float64]]

Get/Set the X (horizontal) coordinates of the conductors

property Ycoords: ndarray[Any, dtype[float64]]

Get/Set the Y (vertical/height) coordinates of the conductors

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ILines

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ILines.ILines(api_util)

Bases: Iterable

New(Name)
property AllNames: List[str]

Array of all names of this object type

property Bus1: str

Name of bus for terminal 1.

property Bus2: str

Name of bus for terminal 2.

property C0: float

Zero Sequence capacitance, nanofarads per unit length.

property C1: float

Positive Sequence capacitance, nanofarads per unit length.

property Cmatrix: ndarray[Any, dtype[float64]]
property Count: int

Number of objects of this type

property EmergAmps: float

Emergency (maximum) ampere rating of Line.

property First: int

Sets the first object of this type active. Returns 0 if none.

property Geometry: str

Line geometry code

property IsSwitch: bool

Sets/gets the Line element switch status. Setting it has side-effects to the line parameters.

(API Extension)

property Length: float

Length of line section in units compatible with the LineCode definition.

property LineCode: str

Name of LineCode object that defines the impedances.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal ampere rating of Line.

property NumCust: int

Number of customers on this line section.

property Parent: int

Sets Parent of the active Line to be the active line. Returns 0 if no parent or action fails.

property Phases: int

Number of Phases, this Line element.

property R0: float

Zero Sequence resistance, ohms per unit length.

property R1: float

Positive Sequence resistance, ohms per unit length.

property Rg: float

Earth return resistance value used to compute line impedances at power frequency

property Rho: float

Earth Resistivity, m-ohms

property Rmatrix: ndarray[Any, dtype[float64]]

Resistance matrix (full), ohms per unit length. Array of doubles.

property SeasonRating: float

Delivers the rating for the current season (in Amps) if the “SeasonalRatings” option is active

property Spacing: str

Line spacing code

property TotalCust: int

Total Number of customers served from this line section.

property Units: LineUnits
property X0: float

Zero Sequence reactance ohms per unit length.

property X1: float

Positive Sequence reactance, ohms per unit length.

property Xg: float

Earth return reactance value used to compute line impedances at power frequency

property Xmatrix: ndarray[Any, dtype[float64]]

Reactance matrix (full), ohms per unit length. Array of doubles.

property Yprim: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Yprimitive for the active line object (complex array).

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ILoadShapes

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.ILoadShapes.ILoadShapes(api_util)

Bases: Iterable

New(Name)
Normalize()
UseFloat32()

Converts the current LoadShape data to float32/single precision. If there is no data or the data is already represented using float32, nothing is done.

(API Extension)

UseFloat64()

Converts the current LoadShape data to float64/double precision. If there is no data or the data is already represented using float64, nothing is done.

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property HrInterval: float

Fixed interval time value, hours.

property MinInterval: float

Fixed Interval time value, in minutes

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property Npts: int

Get/set Number of points in active Loadshape.

property PBase: float
property Pbase: float
property Pmult: ndarray[Any, dtype[float64]]

Array of doubles for the P multiplier in the Loadshape.

property QBase: float

Base for normalizing Q curve. If left at zero, the peak value is used.

property Qbase: float

Base for normalizing Q curve. If left at zero, the peak value is used.

property Qmult: ndarray[Any, dtype[float64]]

Array of doubles containing the Q multipliers.

property SInterval: float
property Sinterval: float
property TimeArray: ndarray[Any, dtype[float64]]

Time array in hours correscponding to P and Q multipliers when the Interval=0.

property UseActual: bool

Boolean flag to let Loads know to use the actual value in the curve rather than use the value as a multiplier.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property sInterval: float

dss.ILoads

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ILoads.ILoads(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property AllocationFactor: float

Factor for allocating loads by connected xfkva

property CVRcurve: str

Name of a loadshape with both Mult and Qmult, for CVR factors as a function of time.

property CVRvars: float

Percent reduction in Q for percent reduction in V. Must be used with dssLoadModelCVR.

property CVRwatts: float

Percent reduction in P for percent reduction in V. Must be used with dssLoadModelCVR.

property Cfactor: float

Factor relates average to peak kw. Used for allocation with kwh and kwhdays

property Class: int
property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Growth: str

Name of the growthshape curve for yearly load growth factors.

property IsDelta: bool

Delta loads are connected line-to-line.

property Model: LoadModels

The Load Model defines variation of P and Q with voltage.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NumCust: int

Number of customers in this load, defaults to one.

property PF: float

Get or set Power Factor for Active Load. Specify leading PF as negative. Updates kvar based on present value of kW

property PctMean: float

Average percent of nominal load in Monte Carlo studies; only if no loadshape defined for this load.

property PctStdDev: float

Percent standard deviation for Monte Carlo load studies; if there is no loadshape assigned to this load.

property Phases: int

Number of phases

(API Extension)

property RelWeight: float

Relative Weighting factor for the active LOAD

property Rneut: float

Neutral resistance for wye-connected loads.

property Sensor: str

Name of the sensor monitoring this load.

property Spectrum: str

Name of harmonic current spectrrum shape.

property Status: LoadStatus

Response to load multipliers: Fixed (growth only), Exempt (no LD curve), Variable (all).

property Vmaxpu: float

Maximum per-unit voltage to use the load model. Above this, constant Z applies.

property Vminemerg: float

Minimum voltage for unserved energy (UE) evaluation.

property Vminnorm: float

Minimum voltage for energy exceeding normal (EEN) evaluations.

property Vminpu: float

Minimum voltage to apply the load model. Below this, constant Z is used.

property Xneut: float

Neutral reactance for wye-connected loads.

property Yearly: str

Name of yearly duration loadshape

property ZIPV: ndarray[Any, dtype[float64]]

Array of 7 doubles with values for ZIPV property of the load object

property daily: str

Name of the loadshape for a daily load profile.

property duty: str

Name of the loadshape for a duty cycle simulation.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kV: float

Set kV rating for active Load. For 2 or more phases set Line-Line kV. Else actual kV across terminals.

property kW: float

Set kW for active Load. Updates kvar based on present PF.

property kva: float

Base load kva. Also defined kw and kvar or pf input, or load allocation by kwh or xfkva.

property kvar: float

Get/set kvar for active Load. If set, updates PF based on present kW.

property kwh: float

kwh billed for this period. Can be used with Cfactor for load allocation.

property kwhdays: float

Length of kwh billing period for average demand calculation. Default 30.

property pctSeriesRL: float

Percent of Load that is modeled as series R-L for harmonics studies

property xfkVA: float

Rated service transformer kVA for load allocation, using AllocationFactor. Affects kW, kvar, and pf.

dss.IMeters

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IMeters.IMeters(api_util)

Bases: Iterable

CloseAllDIFiles()
DoReliabilityCalc(AssumeRestoration)
OpenAllDIFiles()
Reset()
ResetAll()
Sample()
SampleAll()
Save()
SaveAll()
SetActiveSection(SectIdx)
property AllBranchesInZone: List[str]

Wide string list of all branches in zone of the active energymeter object.

property AllEndElements: List[str]

Array of names of all zone end elements.

property AllNames: List[str]

Array of all names of this object type

property AllocFactors: ndarray[Any, dtype[float64]]

Array of doubles: set the phase allocation factors for the active meter.

property AvgRepairTime: float

Average Repair time in this section of the meter zone

property CalcCurrent: ndarray[Any, dtype[float64]]

Set the magnitude of the real part of the Calculated Current (normally determined by solution) for the Meter to force some behavior on Load Allocation

property Count: int

Number of objects of this type

property CountBranches: int

Number of branches in Active energymeter zone. (Same as sequencelist size)

property CountEndElements: int

Number of zone end elements in the active meter zone.

property CustInterrupts: float

Total customer interruptions for this Meter zone based on reliability calcs.

property DIFilesAreOpen: bool

Global Flag in the DSS to indicate if Demand Interval (DI) files have been properly opened.

property FaultRateXRepairHrs: float

Sum of Fault Rate time Repair Hrs in this section of the meter zone

property First: int

Sets the first object of this type active. Returns 0 if none.

property MeteredElement: str

Set Name of metered element

property MeteredTerminal: int

set Number of Metered Terminal

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NumSectionBranches: int

Number of branches (lines) in this section

property NumSectionCustomers: int

Number of Customers in the active section.

property NumSections: int

Number of feeder sections in this meter’s zone

property OCPDeviceType: int

Type of OCP device. 1=Fuse; 2=Recloser; 3=Relay

property Peakcurrent: ndarray[Any, dtype[float64]]

Array of doubles to set values of Peak Current property

property RegisterNames: List[str]

Array of strings containing the names of the registers.

property RegisterValues: ndarray[Any, dtype[float64]]

Array of all the values contained in the Meter registers for the active Meter.

property SAIDI: float

SAIDI for this meter’s zone. Execute DoReliabilityCalc first.

property SAIFI: float

Returns SAIFI for this meter’s Zone. Execute Reliability Calc method first.

property SAIFIKW: float

SAIFI based on kW rather than number of customers. Get after reliability calcs.

property SectSeqIdx: int

SequenceIndex of the branch at the head of this section

property SectTotalCust: int

Total Customers downline from this section

property SeqListSize: int

Size of Sequence List

property SequenceIndex: int

Get/set Index into Meter’s SequenceList that contains branch pointers in lexical order. Earlier index guaranteed to be upline from later index. Sets PDelement active.

property SumBranchFltRates: float

Sum of the branch fault rates in this section of the meter’s zone

property TotalCustomers: int

Total Number of customers in this zone (downline from the EnergyMeter)

property Totals: ndarray[Any, dtype[float64]]

Totals of all registers of all meters

property ZonePCE: List[str]

Returns the list of all PCE within the area covered by the energy meter

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IMonitors

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IMonitors.IMonitors(api_util)

Bases: Iterable

AsMatrix()

Matrix of the active monitor, containing the hour vector, seconds vector, and all channels (index 2 = channel 1). If you need multiple channels, prefer using this function as it processes the monitor byte-stream once.

Return type:

ndarray[Any, dtype[float64]]

Channel(Index)

(read-only) Array of float32 for the specified channel (usage: MyArray = DSSMonitor.Channel(i)). A Save or SaveAll should be executed first. Done automatically by most standard solution modes. Channels start at index 1.

Return type:

ndarray[Any, dtype[float64]]

Process()
ProcessAll()
Reset()
ResetAll()
Sample()
SampleAll()
Save()
SaveAll()
Show()
property AllNames: List[str]

Array of all names of this object type

property ByteStream: ndarray[Any, dtype[int8]]

Byte Array containing monitor stream values. Make sure a “save” is done first (standard solution modes do this automatically)

property Count: int

Number of objects of this type

property Element: str

Full object name of element being monitored.

property FileName: str

Name of CSV file associated with active Monitor.

property FileVersion: int

Monitor File Version (integer)

property First: int

Sets the first object of this type active. Returns 0 if none.

property Header: List[str]

Header string; Array of strings containing Channel names

property Mode: int

Set Monitor mode (bitmask integer - see DSS Help)

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NumChannels: int

Number of Channels in the active Monitor

property RecordSize: int

Size of each record in ByteStream (Integer). Same as NumChannels.

property SampleCount: int

Number of Samples in Monitor at Present

property Terminal: int

Terminal number of element being monitored.

property dblFreq: ndarray[Any, dtype[float64]]

Array of doubles containing frequency values for harmonics mode solutions; Empty for time mode solutions (use dblHour)

property dblHour: ndarray[Any, dtype[float64]]

Array of doubles containing time value in hours for time-sampled monitor values; Empty if frequency-sampled values for harmonics solution (see dblFreq)

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IPDElements

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IPDElements.IPDElements(api_util)

Bases: Base

AllMaxCurrents(AllNodes=False)

Array of doubles with the maximum current across the conductors, for each PD element.

By default, only the first terminal is used for the maximum current, matching the behavior of the “export capacity” command. Pass AllNodes=True to force the analysis to all terminals.

See also: https://sourceforge.net/p/electricdss/discussion/beginners/thread/da5b93ca/

(API Extension)

Return type:

ndarray[Any, dtype[float64]]

AllPctEmerg(AllNodes=False)

Array of doubles with the maximum current across the conductors as a percentage of the Emergency Ampere Rating, for each PD element.

By default, only the first terminal is used for the maximum current, matching the behavior of the “export capacity” command. Pass AllNodes=True to force the analysis to all terminals.

See also: https://sourceforge.net/p/electricdss/discussion/beginners/thread/da5b93ca/

(API Extension)

Return type:

ndarray[Any, dtype[float64]]

AllPctNorm(AllNodes=False)

Array of doubles with the maximum current across the conductors as a percentage of the Normal Ampere Rating, for each PD element.

By default, only the first terminal is used for the maximum current, matching the behavior of the “export capacity” command. Pass AllNodes=True to force the analysis to all terminals.

See also: https://sourceforge.net/p/electricdss/discussion/beginners/thread/da5b93ca/

(API Extension)

Return type:

ndarray[Any, dtype[float64]]

property AccumulatedL: float

accummulated failure rate for this branch on downline

property AllCplxSeqCurrents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex double array of Sequence Currents for all conductors of all terminals, for each PD elements.

(API Extension)

property AllCurrents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of currents for all conductors, all terminals, for each PD element.

(API Extension)

property AllCurrentsMagAng: ndarray[Any, dtype[float64]]

Complex array (magnitude and angle format) of currents for all conductors, all terminals, for each PD element.

(API Extension)

property AllNames: List[str]

Array of strings consisting of all PD element names.

(API Extension)

property AllNumConductors: ndarray[Any, dtype[int32]]

Integer array listing the number of conductors of all PD elements

(API Extension)

property AllNumPhases: ndarray[Any, dtype[int32]]

Integer array listing the number of phases of all PD elements

(API Extension)

property AllNumTerminals: ndarray[Any, dtype[int32]]

Integer array listing the number of terminals of all PD elements

(API Extension)

property AllPowers: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of powers into each conductor of each terminal, for each PD element.

(API Extension)

property AllSeqCurrents: ndarray[Any, dtype[float64]]

Double array of the symmetrical component currents (magnitudes only) into each 3-phase terminal, for each PD element.

(API Extension)

property AllSeqPowers: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of sequence powers into each 3-phase teminal, for each PD element

(API Extension)

property Count: int

Number of PD elements (including disabled elements)

property FaultRate: float

Get/Set Number of failures per year. For LINE elements: Number of failures per unit length per year.

property First: int

(read-only) Set the first enabled PD element to be the active element. Returns 0 if none found.

property FromTerminal: int

(read-only) Number of the terminal of active PD element that is on the “from” side. This is set after the meter zone is determined.

property IsShunt: bool

(read-only) Boolean indicating of PD element should be treated as a shunt element rather than a series element. Applies to Capacitor and Reactor elements in particular.

property Lambda: float

Failure rate for this branch. Faults per year including length of line.

property Name: str

Get/Set name of active PD Element. Returns null string if active element is not PDElement type.

property Next: int

(read-only) Advance to the next PD element in the circuit. Enabled elements only. Returns 0 when no more elements.

property Numcustomers: int

Number of customers, this branch

property ParentPDElement: int

(read-only) Sets the parent PD element to be the active circuit element. Returns 0 if no more elements upline.

property RepairTime: float

Average repair time for this element in hours

property SectionID: int

Integer ID of the feeder section that this PDElement branch is part of

property TotalMiles: float

Total miles of line from this element to the end of the zone. For recloser siting algorithm.

property Totalcustomers: int

Total number of customers from this branch to the end of the zone

property pctPermanent: float

Get/Set percent of faults that are permanent (require repair). Otherwise, fault is assumed to be transient/temporary.

dss.IPVSystems

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IPVSystems.IPVSystems(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Irradiance: float

Get/set the present value of the Irradiance property in kW/m²

property IrradianceNow: float

Returns the current irradiance value for the active PVSystem. Use it to know what’s the current irradiance value for the PV during a simulation.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property PF: float

Get/set the power factor for the active PVSystem

property Pmpp: float

Gets/sets the rated max power of the PV array for 1.0 kW/sq-m irradiance and a user-selected array temperature of the active PVSystem.

property RegisterNames: List[str]

Array of PVSYSTEM energy meter register names

property RegisterValues: ndarray[Any, dtype[float64]]

Array of doubles containing values in PVSystem registers.

property Sensor: str

Name of the sensor monitoring this element.

property Tdaily: str

Temperature shape to use for daily simulations. Must be previously defined as a TShape object of 24 hrs, typically. The PVSystem element uses this TShape to determine the Pmpp from the Pmpp vs T curve. Units must agree with the Pmpp vs T curve.

(API Extension)

property Tduty: str

Temperature shape to use for duty cycle dispatch simulations such as for solar ramp rate studies. Must be previously defined as a TShape object. Typically would have time intervals of 1-5 seconds. Designate the number of points to solve using the Set Number=xxxx command. If there are fewer points in the actual shape, the shape is assumed to repeat. The PVSystem model uses this TShape to determine the Pmpp from the Pmpp vs T curve. Units must agree with the Pmpp vs T curve.

(API Extension)

property Tyearly: str

Temperature shape to use for yearly simulations. Must be previously defined as a TShape object. If this is not specified, the Daily dispatch shape, if any, is repeated during Yearly solution modes. The PVSystem element uses this TShape to determine the Pmpp from the Pmpp vs T curve. Units must agree with the Pmpp vs T curve.

(API Extension)

property daily: str

Name of the dispatch shape to use for daily simulations. Must be previously defined as a Loadshape object of 24 hrs, typically. In the default dispatch mode, the PVSystem element uses this loadshape to trigger State changes.

(API Extension)

property duty: str

Name of the load shape to use for duty cycle dispatch simulations such as for solar ramp rate studies. Must be previously defined as a Loadshape object. Typically would have time intervals of 1-5 seconds.

(API Extension)

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kVArated: float

Get/set Rated kVA of the PVSystem

property kW: float

Get kW output

property kvar: float

Get/set kvar output value

property yearly: str

Dispatch shape to use for yearly simulations. Must be previously defined as a Loadshape object. If this is not specified, the Daily dispatch shape, if any, is repeated during Yearly solution modes. In the default dispatch mode, the PVSystem element uses this loadshape to trigger State changes.

(API Extension)

dss.IParallel

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IParallel.IParallel(api_util)

Bases: Base

Parallel machine interface

CreateActor()
Wait()
property ActiveActor: int

Gets/sets the ID of the Active Actor

property ActiveParallel: int

(read) Sets ON/OFF (1/0) Parallel features of the Engine (write) Delivers if the Parallel features of the Engine are Active

property ActorCPU: int

Gets/sets the CPU of the Active Actor

property ActorProgress: ndarray[Any, dtype[int32]]

Gets the progress of all existing actors in pct

property ActorStatus: ndarray[Any, dtype[int32]]

Gets the status of each actor

property ConcatenateReports: int

(read) Reads the values of the ConcatenateReports option (1=enabled, 0=disabled) (write) Enable/Disable (1/0) the ConcatenateReports option for extracting monitors data

property NumCPUs: int

Delivers the number of CPUs on the current PC

property NumCores: int

Delivers the number of Cores of the local PC

property NumOfActors: int

Gets the number of Actors created

dss.IParser

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IParser.IParser(api_util)

Bases: Base

Matrix(ExpectedOrder)

Use this property to parse a Matrix token in OpenDSS format. Returns square matrix of order specified. Order same as default Fortran order: column by column.

Return type:

ndarray[Any, dtype[float64]]

ResetDelimiters()
SymMatrix(ExpectedOrder)

Use this property to parse a matrix token specified in lower triangle form. Symmetry is forced.

Return type:

ndarray[Any, dtype[float64]]

Vector(ExpectedSize)

Returns token as array of doubles. For parsing quoted array syntax.

Return type:

ndarray[Any, dtype[float64]]

property AutoIncrement: bool

Default is FALSE. If TRUE parser automatically advances to next token after DblValue, IntValue, or StrValue. Simpler when you don’t need to check for parameter names.

property BeginQuote: str

Get/Set String containing the the characters for Quoting in OpenDSS scripts. Matching pairs defined in EndQuote. Default is “’([{.

property CmdString: str

String to be parsed. Loading this string resets the Parser to the beginning of the line. Then parse off the tokens in sequence.

property DblValue: float

Return next parameter as a double.

property Delimiters: str

String defining hard delimiters used to separate token on the command string. Default is , and =. The = separates token name from token value. These override whitesspace to separate tokens.

property EndQuote: str

String containing characters, in order, that match the beginning quote characters in BeginQuote. Default is “’)]}

property IntValue: int

Return next parameter as a long integer.

property NextParam: str

Get next token and return tag name (before = sign) if any. See AutoIncrement.

property StrValue: str

Return next parameter as a string

property WhiteSpace: str

Get/set the characters used for White space in the command string. Default is blank and Tab.

dss.IReactors

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IReactors.IReactors(api_util)

Bases: Iterable

Reactor objects

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property Bus1: str

Name of first bus. Bus2 property will default to this bus, node 0, unless previously specified. Only Bus1 need be specified for a Yg shunt reactor.

property Bus2: str

Name of 2nd bus. Defaults to all phases connected to first bus, node 0, (Shunt Wye Connection) except when Bus2 is specifically defined. Not necessary to specify for delta (LL) connection

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsDelta: bool

Delta connection or wye?

property LCurve: str

Name of XYCurve object, previously defined, describing per-unit variation of phase inductance, L=X/w, vs. frequency. Applies to reactance specified by X, LmH, Z, or kvar property. L generally decreases somewhat with frequency above the base frequency, approaching a limit at a few kHz.

property LmH: float

Inductance, mH. Alternate way to define the reactance, X, property.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property Parallel: bool

Indicates whether Rmatrix and Xmatrix are to be considered in parallel.

property Phases: int

Number of phases.

property R: float

Resistance (in series with reactance), each phase, ohms. This property applies to REACTOR specified by either kvar or X. See also help on Z.

property RCurve: str

Name of XYCurve object, previously defined, describing per-unit variation of phase resistance, R, vs. frequency. Applies to resistance specified by R or Z property. If actual values are not known, R often increases by approximately the square root of frequency.

property Rmatrix: ndarray[Any, dtype[float64]]

Resistance matrix, ohms at base frequency. Order of the matrix is the number of phases. Mutually exclusive to specifying parameters by kvar or X.

property Rp: float

Resistance in parallel with R and X (the entire branch). Assumed infinite if not specified.

property SpecType: int

How the reactor data was provided: 1=kvar, 2=R+jX, 3=R and X matrices, 4=sym components. Depending on this value, only some properties are filled or make sense in the context.

property X: float

Reactance, each phase, ohms at base frequency. See also help on Z and LmH properties.

property Xmatrix: ndarray[Any, dtype[float64]]

Reactance matrix, ohms at base frequency. Order of the matrix is the number of phases. Mutually exclusive to specifying parameters by kvar or X.

property Z: ndarray[Any, dtype[float64]] | complex

Alternative way of defining R and X properties. Enter a 2-element array representing R +jX in ohms.

property Z0: ndarray[Any, dtype[float64]] | complex

Zero-sequence impedance, ohms, as a 2-element array representing a complex number.

Used to define the impedance matrix of the REACTOR if Z1 is also specified.

Note: Z0 defaults to Z1 if it is not specifically defined.

property Z1: ndarray[Any, dtype[float64]] | complex

Positive-sequence impedance, ohms, as a 2-element array representing a complex number.

If defined, Z1, Z2, and Z0 are used to define the impedance matrix of the REACTOR.

Z1 MUST BE DEFINED TO USE THIS OPTION FOR DEFINING THE MATRIX.

Side Effect: Sets Z2 and Z0 to same values unless they were previously defined.

property Z2: ndarray[Any, dtype[float64]] | complex

Negative-sequence impedance, ohms, as a 2-element array representing a complex number.

Used to define the impedance matrix of the REACTOR if Z1 is also specified.

Note: Z2 defaults to Z1 if it is not specifically defined. If Z2 is not equal to Z1, the impedance matrix is asymmetrical.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kV: float

For 2, 3-phase, kV phase-phase. Otherwise specify actual coil rating.

property kvar: float

Total kvar, all phases. Evenly divided among phases. Only determines X. Specify R separately

dss.IReclosers

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IReclosers.IReclosers(api_util)

Bases: Iterable

Close()
Open()
Reset()

Reset recloser to normal state. If open, lock out the recloser. If closed, resets recloser to first operation.

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property GroundInst: float

Ground (3I0) instantaneous trip setting - curve multipler or actual amps.

property GroundTrip: float

Ground (3I0) trip multiplier or actual amps

property MonitoredObj: str

Full name of object this Recloser to be monitored.

property MonitoredTerm: int

Terminal number of Monitored object for the Recloser

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormalState: int

Get/set normal state (ActionCodes.Open=1, ActionCodes.Close=2) of the recloser.

property NumFast: int

Number of fast shots

property PhaseInst: float

Phase instantaneous curve multipler or actual amps

property PhaseTrip: float

Phase trip curve multiplier or actual amps

property RecloseIntervals: ndarray[Any, dtype[float64]]

Array of Doubles: reclose intervals, s, between shots.

property Shots: int

Number of shots to lockout (fast + delayed)

property State: int

Get/Set present state of recloser. If set to open (ActionCodes.Open=1), open recloser’s controlled element and lock out the recloser. If set to close (ActionCodes.Close=2), close recloser’s controlled element and resets recloser to first operation.

property SwitchedObj: str

Full name of the circuit element that is being switched by the Recloser.

property SwitchedTerm: int

Terminal number of the controlled device being switched by the Recloser

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IReduceCkt

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2019-2020 Paulo Meira

class dss.IReduceCkt.IReduceCkt(api_util)

Bases: Base

Circuit Reduction interface

Do1phLaterals()
DoBranchRemove()
DoDangling()

Reduce Dangling Algorithm; branches with nothing connected

DoDefault()

Do Default Reduction algorithm

DoLoopBreak()
DoParallelLines()
DoShortLines()

Do ShortLines algorithm: Set Zmag first if you don’t want the default

DoSwitches()
SaveCircuit(CktName)

Save present (reduced) circuit Filename is listed in the Text Result interface

property EditString: str

Edit String for RemoveBranches functions

property EnergyMeter: str

Name of Energymeter to use for reduction

property KeepLoad: bool

Keep load flag (T/F) for Reduction options that remove branches

property StartPDElement: str

Start element for Remove Branch function

property Zmag: float

Zmag (ohms) for Reduce Option for Z of short lines

dss.IRegControls

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IRegControls.IRegControls(api_util)

Bases: Iterable

Reset()
property AllNames: List[str]

Array of all names of this object type

property CTPrimary: float

CT primary ampere rating (secondary is 0.2 amperes)

property Count: int

Number of objects of this type

property Delay: float

Time delay [s] after arming before the first tap change. Control may reset before actually changing taps.

property First: int

Sets the first object of this type active. Returns 0 if none.

property ForwardBand: float

Regulation bandwidth in forward direciton, centered on Vreg

property ForwardR: float

LDC R setting in Volts

property ForwardVreg: float

Target voltage in the forward direction, on PT secondary base.

property ForwardX: float

LDC X setting in Volts

property IsInverseTime: bool

Time delay is inversely adjsuted, proportinal to the amount of voltage outside the regulating band.

property IsReversible: bool

Regulator can use different settings in the reverse direction. Usually not applicable to substation transformers.

property MaxTapChange: int

Maximum tap change per iteration in STATIC solution mode. 1 is more realistic, 16 is the default for a faster soluiton.

property MonitoredBus: str

Name of a remote regulated bus, in lieu of LDC settings

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property PTratio: float

PT ratio for voltage control settings

property ReverseBand: float

Bandwidth in reverse direction, centered on reverse Vreg.

property ReverseR: float

Reverse LDC R setting in Volts.

property ReverseVreg: float

Target voltage in the revese direction, on PT secondary base.

property ReverseX: float

Reverse LDC X setting in volts.

property TapDelay: float

Time delay [s] for subsequent tap changes in a set. Control may reset before actually changing taps.

property TapNumber: int

Integer number of the tap that the controlled transformer winding is currentliy on.

property TapWinding: int

Tapped winding number

property Transformer: str

Name of the transformer this regulator controls

property VoltageLimit: float

First house voltage limit on PT secondary base. Setting to 0 disables this function.

property Winding: int

Winding number for PT and CT connections

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IRelays

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IRelays.IRelays(api_util)

Bases: Iterable

Close()

Close the switched object controlled by the relay. Resets relay to first operation.

Open()

Open relay’s controlled element and lock out the relay.

Reset()

Reset relay to normal state. If open, lock out the relay. If closed, resets relay to first operation.

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property MonitoredObj: str

Full name of object this Relay is monitoring.

property MonitoredTerm: int

Number of terminal of monitored element that this Relay is monitoring.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormalState: int

Normal state of relay.

property State: int

Get/Set present state of relay. If set to open, open relay’s controlled element and lock out the relay. If set to close, close relay’s controlled element and resets relay to first operation.

property SwitchedObj: str

Full name of element that will be switched when relay trips.

property SwitchedTerm: int

Terminal number of the switched object that will be opened when the relay trips.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ISensors

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ISensors.ISensors(api_util)

Bases: Iterable

Reset()
ResetAll()
property AllNames: List[str]

Array of all names of this object type

property AllocationFactor

Array of doubles for the allocation factors for each phase.

property Count: int

Number of objects of this type

property Currents: ndarray[Any, dtype[float64]]

Array of doubles for the line current measurements; don’t use with kWS and kVARS.

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsDelta: bool

True if measured voltages are line-line. Currents are always line currents.

property MeteredElement: str

Full Name of the measured element

property MeteredTerminal: int

Number of the measured terminal in the measured element.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property PctError: float

Assumed percent error in the Sensor measurement. Default is 1.

property ReverseDelta: bool

True if voltage measurements are 1-3, 3-2, 2-1.

property Weight: float

Weighting factor for this Sensor measurement with respect to other Sensors. Default is 1.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kVARS: ndarray[Any, dtype[float64]]

Array of doubles for Q measurements. Overwrites Currents with a new estimate using kWS.

property kVS: ndarray[Any, dtype[float64]]

Array of doubles for the LL or LN (depending on Delta connection) voltage measurements.

property kVbase: float

Voltage base for the sensor measurements. LL for 2 and 3-phase sensors, LN for 1-phase sensors.

property kWS: ndarray[Any, dtype[float64]]

Array of doubles for P measurements. Overwrites Currents with a new estimate using kVARS.

dss.ISettings

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.ISettings.ISettings(api_util)

Bases: Base

property AllocationFactors

(write-only) Sets all load allocation factors for all loads defined by XFKVA property to this value.

property AllowDuplicates: bool

{True | False*} Designates whether to allow duplicate names of objects

NOTE: for DSS-Extensions, we are considering removing this option in a future release since it has performance impacts even when not used.

property AutoBusList: str

List of Buses or (File=xxxx) syntax for the AutoAdd solution mode.

property CktModel: int

{dssMultiphase (0) * | dssPositiveSeq (1) } Indicate if the circuit model is positive sequence.

property ControlTrace: bool

{True | False*} Denotes whether to trace the control actions to a file.

property EmergVmaxpu: float

Per Unit maximum voltage for Emergency conditions.

property EmergVminpu: float

Per Unit minimum voltage for Emergency conditions.

property IterateDisabled: int

Controls whether First/Next iteration includes or skips disabled circuit elements. The default behavior from OpenDSS is to skip those. The user can still activate the element by name or index.

The default value for IterateDisabled is 0, keeping the original behavior. Set it to 1 (or True) to include disabled elements. Other numeric values are reserved for other potential behaviors.

(API Extension)

property LoadsTerminalCheck: bool

Controls whether the terminals are checked when updating the currents in Load component. Defaults to True. If the loads are guaranteed to have their terminals closed throughout the simulation, this can be set to False to save some time.

(API Extension)

property LossRegs: ndarray[Any, dtype[int32]]

Integer array defining which energy meter registers to use for computing losses

property LossWeight: float

Weighting factor applied to Loss register values.

property NormVmaxpu: float

Per Unit maximum voltage for Normal conditions.

property NormVminpu: float

Per Unit minimum voltage for Normal conditions.

property PriceCurve: str

Name of LoadShape object that serves as the source of price signal data for yearly simulations, etc.

property PriceSignal: float

Price Signal for the Circuit

property Trapezoidal: bool

Gets value of trapezoidal integration flag in energy meters. Defaults to False.

property UEregs: ndarray[Any, dtype[int32]]

Array of Integers defining energy meter registers to use for computing UE

property UEweight: float

Weighting factor applied to UE register values.

property VoltageBases: ndarray[Any, dtype[float64]]

Array of doubles defining the legal voltage bases in kV L-L

property ZoneLock: bool

{True | False*} Locks Zones on energy meters to prevent rebuilding if a circuit change occurs.

dss.ISolution

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ISolution.ISolution(api_util)

Bases: Base

BuildYMatrix(BuildOption, AllocateVI)
CheckControls()
CheckFaultStatus()
Cleanup()
DoControlActions()
FinishTimeStep()
InitSnap()
SampleControlDevices()
Sample_DoControlActions()
Solve()
SolveAll()
SolveDirect()
SolveNoControl()
SolvePflow()
SolvePlusControl()
SolveSnap()
property AddType: int

Type of device to add in AutoAdd Mode: {dssGen (Default) | dssCap}

property Algorithm: SolutionAlgorithms

Base Solution algorithm: {dssNormalSolve | dssNewtonSolve}

property BusLevels: ndarray[Any, dtype[int32]]
property Capkvar: float

Capacitor kvar for adding capacitors in AutoAdd mode

property ControlActionsDone: bool

Flag indicating the control actions are done.

property ControlIterations: int

Value of the control iteration counter

property ControlMode: ControlModes

{dssStatic* | dssEvent | dssTime} Modes for control devices

property Converged: bool

Flag to indicate whether the circuit solution converged

property DefaultDaily: str

Default daily load shape (defaults to “Default”)

property DefaultYearly: str

Default Yearly load shape (defaults to “Default”)

property EventLog: List[str]

Array of strings containing the Event Log

property Frequency: float

Set the Frequency for next solution

property GenMult: float

Default Multiplier applied to generators (like LoadMult)

property GenPF: float

PF for generators in AutoAdd mode

property GenkW: float

Generator kW for AutoAdd mode

property Hour: int

Set Hour for time series solutions.

property IncMatrix: ndarray[Any, dtype[int32]]
property IncMatrixCols: List[str]
property IncMatrixRows: List[str]
property IntervalHrs: float

Get/Set the Solution.IntervalHrs variable used for devices that integrate / custom solution algorithms

property Iterations: int

Number of iterations taken for last solution. (Same as Totaliterations)

property LDCurve: str

Load-Duration Curve name for LD modes

property Laplacian: ndarray[Any, dtype[int32]]
property LoadModel: int

Load Model: {dssPowerFlow (default) | dssAdmittance}

property LoadMult: float

Default load multiplier applied to all non-fixed loads

property MaxControlIterations: int

Maximum allowable control iterations

property MaxIterations: int

Max allowable iterations.

property MinIterations: int

Minimum number of iterations required for a power flow solution.

property Mode: SolveModes

Set present solution mode

property ModeID: str

ID (text) of the present solution mode

property MostIterationsDone: int

Max number of iterations required to converge at any control iteration of the most recent solution.

property Number: int

Number of solutions to perform for Monte Carlo and time series simulations

property Process_Time: float

Gets the time required to perform the latest solution (Read only)

property Random: int

Randomization mode for random variables “Gaussian” or “Uniform”

property Seconds: float

Seconds from top of the hour.

property StepSize: float

Time step size in sec

property StepsizeHr: float

(write-only) Set Stepsize in Hr

property StepsizeMin: float

(write-only) Set Stepsize in minutes

property SystemYChanged: bool

Flag that indicates if elements of the System Y have been changed by recent activity.

property Time_of_Step: float

Get the solution process time + sample time for time step

property Tolerance: float

Solution convergence tolerance.

property Total_Time: float

Gets/sets the accumulated time of the simulation

property Totaliterations: int

Total iterations including control iterations for most recent solution.

property Year: int

Set year for planning studies

property dblHour: float

Hour as a double, including fractional part

property pctGrowth: float

Percent default annual load growth rate

dss.IStorages

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2023 Paulo Meira Copyright (c) 2023 DSS-Extensions contributors

class dss.IStorages.IStorages(api_util)

Bases: Iterable

Storage objects

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property RegisterNames: List[str]

Array of Names of all Storage energy meter registers

property RegisterValues: ndarray[Any, dtype[float64]]

Array of values in Storage registers.

property State: int

Get/set state: 0=Idling; 1=Discharging; -1=Charging;

Related enumeration: StorageStates

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property puSOC: float

Per unit state of charge

dss.ISwtControls

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ISwtControls.ISwtControls(api_util)

Bases: Iterable

Reset()
property Action: int

Open or Close the switch. No effect if switch is locked. However, Reset removes any lock and then closes the switch (shelf state).

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property Delay: float

Time delay [s] betwen arming and opening or closing the switch. Control may reset before actually operating the switch.

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsLocked: bool

The lock prevents both manual and automatic switch operation.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormalState: int

Get/set Normal state of switch (see actioncodes) dssActionOpen or dssActionClose

property State: int

Set it to force the switch to a specified state, otherwise read its present state.

property SwitchedObj: str

Full name of the switched element.

property SwitchedTerm: int

Terminal number where the switch is located on the SwitchedObj

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ITSData

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.ITSData.ITSData(api_util)

Bases: Iterable

TSData objects

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property DiaCable: float
property DiaIns: float
property DiaShield: float
property Diameter: float
property EmergAmps: float

Emergency ampere rating

property EpsR: float
property First: int

Sets the first object of this type active. Returns 0 if none.

property GMRUnits: int
property GMRac: float
property InsLayer: float
property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal Ampere rating

property Rac: float
property Radius: float
property RadiusUnits: int
property Rdc: float
property ResistanceUnits: int
property TapeLap: float
property TapeLayer: float
property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.ITopology

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.ITopology.ITopology(api_util)

Bases: Base

property ActiveBranch: int

Returns index of the active branch

property ActiveLevel: int

Topological depth of the active branch

property AllIsolatedBranches: List[str]

Array of all isolated branch names.

property AllIsolatedLoads: List[str]

Array of all isolated load names.

property AllLoopedPairs: List[str]

Array of all looped element names, by pairs.

property BackwardBranch: int

Move back toward the source, return index of new active branch, or 0 if no more.

property BranchName: str

Name of the active branch.

property BusName: str

Set the active branch to one containing this bus, return index or 0 if not found

property First: int

Sets the first branch active, returns 0 if none.

property FirstLoad: int

First load at the active branch, return index or 0 if none.

property ForwardBranch: int

Move forward in the tree, return index of new active branch or 0 if no more

property LoopedBranch: int

Move to looped branch, return index or 0 if none.

property Next: int

Sets the next branch active, returns 0 if no more.

property NextLoad: int

Next load at the active branch, return index or 0 if no more.

property NumIsolatedBranches: int

Number of isolated branches (PD elements and capacitors).

property NumIsolatedLoads: int

Number of isolated loads

property NumLoops: int

Number of loops

property ParallelBranch: int

Move to directly parallel branch, return index or 0 if none.

dss.ITransformers

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.ITransformers.ITransformers(api_util)

Bases: Iterable

property AllLossesByType: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array with the losses by type (total losses, load losses, no-load losses), in VA, concatenated for ALL transformers

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property CoreType: int

Transformer Core Type: 0=Shell; 1=1ph; 3-3leg; 4=4-Leg; 5=5-leg; 9=Core-1-phase

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property IsDelta: bool

Active Winding delta or wye connection?

property LossesByType: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array with the losses by type (total losses, load losses, no-load losses), in VA

(API Extension)

property MaxTap: float

Active Winding maximum tap in per-unit.

property MinTap: float

Active Winding minimum tap in per-unit.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NumTaps: int

Active Winding number of tap steps betwein MinTap and MaxTap.

property NumWindings: int

Number of windings on this transformer. Allocates memory; set or change this property first.

property R: float

Active Winding resistance in %

property RdcOhms: float

dc Resistance of active winding in ohms for GIC analysis

property Rneut: float

Active Winding neutral resistance [ohms] for wye connections. Set less than zero for ungrounded wye.

property Tap: float

Active Winding tap in per-unit.

property Wdg: int

Active Winding Number from 1..NumWindings. Update this before reading or setting a sequence of winding properties (R, Tap, kV, kVA, etc.)

property WdgCurrents: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

All Winding currents (ph1, wdg1, wdg2,… ph2, wdg1, wdg2 …)

WARNING: If the transformer has open terminal(s), results may be wrong, i.e. avoid using this in those situations. For more information, see https://github.com/dss-extensions/dss-extensions/issues/24

property WdgVoltages: ndarray[Any, dtype[float64]] | ndarray[Any, dtype[complex128]]

Complex array of voltages for active winding

WARNING: If the transformer has open terminal(s), results may be wrong, i.e. avoid using this in those situations. For more information, see https://github.com/dss-extensions/dss-extensions/issues/24

property XfmrCode: str

Name of an XfrmCode that supplies electircal parameters for this Transformer.

property Xhl: float

Percent reactance between windings 1 and 2, on winding 1 kVA base. Use for 2-winding or 3-winding transformers.

property Xht: float

Percent reactance between windigns 1 and 3, on winding 1 kVA base. Use for 3-winding transformers only.

property Xlt: float

Percent reactance between windings 2 and 3, on winding 1 kVA base. Use for 3-winding transformers only.

property Xneut: float

Active Winding neutral reactance [ohms] for wye connections.

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property kV: float

Active Winding kV rating. Phase-phase for 2 or 3 phases, actual winding kV for 1 phase transformer.

property kVA: float

Active Winding kVA rating. On winding 1, this also determines normal and emergency current ratings for all windings.

property kva: float

Active Winding kVA rating. On winding 1, this also determines normal and emergency current ratings for all windings.

property strWdgCurrents: str

All winding currents in CSV string form like the WdgCurrents property

WARNING: If the transformer has open terminal(s), results may be wrong, i.e. avoid using this in those situations. For more information, see https://github.com/dss-extensions/dss-extensions/issues/24

dss.IVsources

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IVsources.IVsources(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property AngleDeg: float

Phase angle of first phase in degrees

property BasekV: float

Source voltage in kV

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Frequency: float

Source frequency in Hz

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property Phases: int

Number of phases

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property pu: float

Per-unit value of source voltage

dss.IWireData

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IWireData.IWireData(api_util)

Bases: Iterable

WireData objects

(API Extension)

property AllNames: List[str]

Array of all names of this object type

property CapRadius: float

Equivalent conductor radius for capacitance calcs. Specify this for bundled conductors. Defaults to same value as radius.

property Count: int

Number of objects of this type

property Diameter: float
property EmergAmps: float

Emergency ampere rating

property First: int

Sets the first object of this type active. Returns 0 if none.

property GMRUnits: LineUnits
property GMRac: float
property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property NormAmps: float

Normal Ampere rating

property Rac: float
property Radius: float
property RadiusUnits: int
property Rdc: float
property ResistanceUnits: LineUnits
property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

dss.IXYCurves

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2022 Paulo Meira

Copyright (c) 2018-2022 DSS-Extensions contributors

class dss.IXYCurves.IXYCurves(api_util)

Bases: Iterable

property AllNames: List[str]

Array of all names of this object type

property Count: int

Number of objects of this type

property First: int

Sets the first object of this type active. Returns 0 if none.

property Name: str

Gets the current name or sets the active object of this type by name

property Next: int

Sets next object of this type active. Returns 0 if no more.

property Npts: int

Get/Set Number of points in X-Y curve

property Xarray: ndarray[Any, dtype[float64]]

Get/set X values as a Array of doubles. Set Npts to max number expected if setting

property Xscale: float

Factor to scale X values from original curve

property Xshift: float

Amount to shift X value from original curve

property Yarray: ndarray[Any, dtype[float64]]

Get/Set Y values in curve; Set Npts to max number expected if setting

property Yscale: float

Factor to scale Y values from original curve

property Yshift: float

Amount to shift Y value from original curve

property idx: int

Gets the current index or sets the active object of this type by index

While the official API included this for some classes, this is an API Extension for:

  • Capacitors

  • CapControls

  • ISources

  • LineCodes

  • Lines

  • LoadShapes

  • Meters

  • Monitors

  • RegControls

  • Sensors

  • SwtControls

  • Transformers

  • Vsources

  • XYCurves

(API Extension)

property x: float

Set X value or get interpolated value after setting Y

property y: float

Set Y value or get interpolated Y value after setting X

dss.IYMatrix

A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.

Copyright (c) 2016-2023 Paulo Meira

Copyright (c) 2018-2023 DSS-Extensions contributors

class dss.IYMatrix.IYMatrix(api_util)

Bases: Base

AddInAuxCurrents(SType)
BuildYMatrixD(BuildOps, AllocateVI)
CheckConvergence()
Return type:

bool

GetCompressedYMatrix(factor=True)

Return as (data, indices, indptr) that can fed into scipy.sparse.csc_matrix

Return type:

Tuple[ndarray[Any, dtype[complex128]], ndarray[Any, dtype[int32]], ndarray[Any, dtype[int32]]]

GetIPointer()

Get access to the internal Current pointer

GetPCInjCurr()
GetSourceInjCurrents()
GetVPointer()

Get access to the internal Voltage pointer

SetGeneratordQdV()
SolveSystem(NodeV=None)
Return type:

int

ZeroInjCurr()
getI()

Get the data from the internal Current pointer

Return type:

List[float]

getV()

Get the data from the internal Voltage pointer

Return type:

List[float]

getYSparse(factor=True)

Return as (data, indices, indptr) that can fed into scipy.sparse.csc_matrix

Return type:

Tuple[ndarray[Any, dtype[complex128]], ndarray[Any, dtype[int32]], ndarray[Any, dtype[int32]]]

property Iteration: int
property LoadsNeedUpdating: bool
property SolutionInitialized: bool
property SolverOptions: int

Sparse solver options. See the enumeration SparseSolverOptions

property SystemYChanged: bool
property UseAuxCurrents: bool

Module contents

DSS-Python provides a compatibility layer for DSS_CAPI that mimics the official OpenDSS COM interface, with various extensions and quality-of-life tweaks.

dss is the main package for DSS-Python. DSS-Python is a compatibility layer for the DSS C-API library that mimics the official OpenDSS COM interface, with many extensions and a few limitations.

This module used to provide instances for the OpenDSS Version 7 implementation. As of 2022, most of the parallel-machine functions of EPRI’s OpenDSS have been reimplemented using a different approach. Therefore the PM functions are available in the instances of this module too. Besides the parallel-machine mechanisms, DSS-Python also exposes the DSSContext mechanism provided by DSS-Extensions. DSSContexts allow using multiple OpenDSS instances directly, including user-managed multi-threading, without using the internal OpenDSS actors.

Starting April 2023, our CFFI extension modules and DSS C-API binaries moved to dss_python_backend and are justed consumed here.

exception dss.DSSException

Bases: Exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
class dss.Edit(obj_or_batch, num_changes=1, needs_begin=True)

Bases: object

Edit is a helper class that makes block-editing DSS properties easier. It supports instances for the new Obj and Batch APIs.

dss.patch_dss_com(obj)
dss.set_case_insensitive_attributes(use=True, warn=False)

This function is provided to allow easier migration from win32com.client.

When used with late bindings, win32com allows using mixed-case names for any of the COM-related items. When migrating or testing with DSS-Python, users can then use this function to continue using the same code, optionally emitting warnings when the canonical casing is different from the one used. Note that there is a small overhead for allowing case-insensitive names, thus is not recommended to continue using it after migration/adjustments to the user code.

dss.DSS(single=None, block=None): IDSS = <dss.IDSS.IDSS object>

Same as DSS_GR

dss.DSS_GR(single=None, block=None): IDSS = <dss.IDSS.IDSS object>

GR (Global Result) interface using the new DSSContext API

dss.api_util: CffiApiUtil = <dss._cffi_api_util.CffiApiUtil object>

API utility functions and low-level access to the classic API

dss.dss(single=None, block=None): IDSS = <dss.IDSS.IDSS object>

Same as DSS_GR

dss.prime_api_util = <dss._cffi_api_util.CffiApiUtil object>

API utility functions and low-level access for DSSContext API