altdss.Batch#

Module Contents#

Classes#

BatchCommon

DSSBatch

NonUniformBatch

A batch of non-uniform objects.

API#

class altdss.Batch.BatchCommon#
FullName() List[str]#

Returns the full name (including object type) for all objects in this batch

property Name: List[str]#
__call__()#
__len__() int#
to_json(options: Union[int, dss.enums.DSSJSONFlags] = 0)#

Returns the data (as a list) of the elements in a batch 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.

to_list()#
class altdss.Batch.DSSBatch(api_util, **kwargs)#

Bases: altdss.common.Base, altdss.Batch.BatchCommon

FullName() List[str]#

Returns the full name (including object type) for all objects in this batch

property Name: List[str]#
__call__()#
__getitem__(idx0) altdss.DSSObj.DSSObj#

Get element at 0-based index of the batch pointer array

__init__(api_util, **kwargs)#
__iter__()#
__len__() int#
batch(**kwargs) altdss.Batch.DSSBatch#

Filter a batch using integer or float DSS properties, returning a new batch.

For integers, provide a single value to match.

For floats, provide a range as a 2-valued tuple/list (min value, max value), or an exact value to value (not recommended).

Multiple properties can be listed to allow filtering various conditions.

Example for loads:

    # Create an initial batch using a regular expression
    abc_loads = altdss.Load.batch(re=r'^abc.*$') # a batch of all loads with names starting with "abc"
    abc_loads_filtered = abc_loads.batch(Class=1, Phases=1, kV=(0.1, 1.0))

    # Create an initial batch, already filtered
    abc_loads_filtered = altdss.Load.batch(re=r'^abc.*$', Class=1, Phases=1, kV=(0.1, 1.0))
begin_edit() None#

Marks for editing all DSS objects in the batch

In the editing mode, some final side-effects of changing properties are postponed until end_edit is called. This side-effects can be somewhat costly, like updating the model parameters or internal matrices.

If you don’t have any performance constraint, you may edit each property individually without worrying about using begin_edit and end_edit. For convenience, those are emitted automatically when editing single properties outside an edit block.

end_edit(num_changes: int = 1) None#

Leaves the editing states of all DSS objects in the batch

num_changes is required for a few classes to correctly match the official OpenDSS behavior and must be the number of properties modified in the current editing block. As of DSS C-API v0.13, this is only required for the Monitor class, when the Action property is used with the Process value.

to_json(options: Union[int, dss.enums.DSSJSONFlags] = 0)#

Returns the data (as a list) of the elements in a batch 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.

to_list()#
class altdss.Batch.NonUniformBatch(func, parent, pycls=None, copy_safe=False, sync_cls_idx=None)#

Bases: altdss.common.Base, altdss.Batch.BatchCommon

A batch of non-uniform objects.

Currently, provides:

  • iteration through individual objects

  • access as a list of objects, either through a call statement or to_list() function.

  • all basic names as a list of strings

  • all full names (including DSS object type) as a list of strings

FullName() List[str]#

Returns the full name (including object type) for all objects in this batch

property Name: List[str]#
__call__()#
__getitem__(idx: int) altdss.DSSObj.DSSObj#

Return an object of the batch by index (0-based).

__init__(func, parent, pycls=None, copy_safe=False, sync_cls_idx=None)#
__iter__() Iterator[altdss.DSSObj.DSSObj]#
__len__() int#
to_json(options: Union[int, dss.enums.DSSJSONFlags] = 0)#

Returns the data (as a list) of the elements in a batch 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.

to_list()#