dss._cffi_api_util
#
Module Contents#
Classes#
An internal class with various API and DSSContext management functions and structures. |
|
Exposes a CFFI Lib object pre-binding the DSSContext ( |
|
Functions#
This function is provided to allow easier migration from |
Data#
API#
- class dss._cffi_api_util.Base(api_util, prefer_lists=False)#
- __init__(api_util, prefer_lists=False)#
- class dss._cffi_api_util.CffiApiUtil(ffi, lib, ctx=None)#
Bases:
object
An internal class with various API and DSSContext management functions and structures.
- __del__()#
- __init__(ffi, lib, ctx=None)#
- clear_buffers()#
- clear_callback(step: int)#
- get_complex128_array(func, *args) dss._types.Float64ArrayOrComplexArray #
- get_complex128_array2(func, *args) dss._types.Float64ArrayOrComplexArray #
- get_complex128_gr_array() dss._types.ComplexArray #
- get_complex128_gr_array2() List[Union[complex, float]] #
- get_complex128_gr_simple() dss._types.Float64ArrayOrSimpleComplex #
- get_complex128_gr_simple2() List[Union[complex, float]] #
- get_complex128_simple(func, *args) dss._types.Float64ArrayOrSimpleComplex #
- get_complex128_simple2(func, *args) List[Union[complex, float]] #
- get_fcomplex128_array(func, *args) Union[dss._types.ComplexArray, None] #
- get_fcomplex128_gr_array() dss._types.ComplexArray #
- get_fcomplex128_gr_simple() complex #
- get_fcomplex128_simple(func, *args) dss._types.Float64ArrayOrSimpleComplex #
- get_float64_array(func, *args) dss._types.Float64Array #
- get_float64_array2(func, *args)#
- get_float64_gr_array() dss._types.Float64Array #
- get_float64_gr_array2()#
- get_int32_array(func: Callable, *args) dss._types.Int32Array #
- get_int32_array2(func, *args)#
- get_int32_gr_array() dss._types.Int32Array #
- get_int32_gr_array2()#
- get_int8_array(func: Callable, *args: Any) dss._types.Int8Array #
- get_int8_array2(func, *args)#
- get_int8_gr_array() dss._types.Int8Array #
- get_int8_gr_array2()#
- get_ptr_array(func: Callable, *args)#
- get_string(b) str #
- get_string_array(func: Callable, *args: Any) List[str] #
- get_string_array2(func, *args)#
- init_buffers()#
- prepare_complex128_array(value)#
- prepare_complex128_simple(value: complex)#
- prepare_float64_array(value)#
- prepare_int32_array(value)#
- prepare_string_array(value: List[AnyStr])#
- register_callbacks()#
- reprocess_buses_callback(step: int)#
Used internally to remap buses to Python objects after the bus list is built.
- set_string_array(func: Callable, value: List[AnyStr], *args)#
- track_batch(batch)#
- track_bus(bus)#
- track_obj(obj)#
- unregister_callbacks()#
- class dss._cffi_api_util.CtxLib(ctx, ffi, lib)#
Exposes a CFFI Lib object pre-binding the DSSContext (
ctx
) object to thectx_*
functions.- __init__(ctx, ffi, lib)#
- exception dss._cffi_api_util.DSSException#
Bases:
Exception
Common base class for all non-exit exceptions.
- class __cause__#
exception cause
- class __context__#
exception context
- __delattr__()#
Implement delattr(self, name).
- __dir__()#
Default dir() implementation.
- __eq__()#
Return self==value.
- __format__()#
Default object formatter.
Return str(self) if format_spec is empty. Raise TypeError otherwise.
- __ge__()#
Return self>=value.
- __getattribute__()#
Return getattr(self, name).
- __getstate__()#
Helper for pickle.
- __gt__()#
Return self>value.
- __hash__()#
Return hash(self).
- __init__()#
Initialize self. See help(type(self)) for accurate signature.
- __le__()#
Return self<=value.
- __lt__()#
Return self<value.
- __ne__()#
Return self!=value.
- __new__()#
Create and return a new object. See help(type) for accurate signature.
- __reduce__()#
Helper for pickle.
- __reduce_ex__()#
Helper for pickle.
- __repr__()#
Return repr(self).
- __setstate__()#
- __sizeof__()#
Size of object in memory, in bytes.
- __str__()#
Return str(self).
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.subclasscheck(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- class __suppress_context__#
- class __traceback__#
- add_note()#
Exception.add_note(note) – add a note to the exception
- class args#
- with_traceback()#
Exception.with_traceback(tb) – set self.traceback to tb and return self.
- dss._cffi_api_util.DssException#
None
- class dss._cffi_api_util.Iterable(api_util)#
Bases:
dss._cffi_api_util.Base
- 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.
- __init__(api_util)#
- __iter__() Iterator[dss._cffi_api_util.Iterable] #
Get an iterator of the object collection.
Note that OpenDSS, via the classic APIs, only allow a single object of a specific type to be activated. That is, you cannot use references of distinct objects and interact with both at the same time, or keep a reference to use later. You need to reactivate the target object or ensure it is the active one.
For an alternative, consider using our AltDSS-Python package.
(API Extension)
- __len__() int #
- 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._cffi_api_util.altdss_python_util_callback(ctx, event_code, step, ptr)#
- dss._cffi_api_util.codec#
‘UTF8’
- dss._cffi_api_util.interface_classes#
‘set(…)’
- dss._cffi_api_util.set_case_insensitive_attributes(use: bool = True, warn: bool = 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.Currently, this also affects all Python packages from DSS-Extensions:
DSS-Python (
dss
package): done to allow easier migration from COM.OpenDSSDirect.py (
opendssdirect
package): mostly done by accident due to the same base classes.AltDSS-Python (
altdss
package): done to allow users to employ the case-insensitive mechanism to address DSS properties in Python code.
Since there is a small performance overhead, users are recommended to use this mechanism as a transition before adjusting the code.
- dss._cffi_api_util.use_com_compat#
None
- dss._cffi_api_util.warn_wrong_case#
False