Skip to content

Commit 65c6380

Browse files
committed
enums: add SetterFlags and StorageStates
1 parent af4d658 commit 65c6380

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

dss_python_backend/enums.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ class CapControlModes(IntEnum):
176176
PF = 4
177177
"""ON and OFF settings are power factor, negative for leading"""
178178

179+
180+
class StorageStates(IntEnum):
181+
Charging = -1
182+
Idling = 0
183+
Discharging = 1
184+
185+
179186
class ActionCodes(IntEnum):
180187
none = 0
181188
"""No action"""
@@ -559,6 +566,7 @@ class GeneratorRegisters(IntEnum):
559566
Enumeration of the generator registers by index.
560567
Currently shared between the Generator, Storage and PVSystem models.
561568
"""
569+
562570
kWh = 0
563571
kvarh = 1
564572
MaxkW = 2
@@ -567,6 +575,48 @@ class GeneratorRegisters(IntEnum):
567575
Price = 5
568576

569577

578+
class SetterFlags(IntFlag):
579+
"""
580+
Setter flags customize down how the update of DSS properties are handled by the
581+
engine and parts of the API. Use especially in the `Obj` and `Batch` APIs
582+
"""
583+
584+
ImplicitSizes = 0x00000001
585+
"""
586+
Most array properties depend on sizes defined by other properties.
587+
Using this flag, many properties allow users to skip setting the other property
588+
directly, allowing the engine to use the size of the provided array to
589+
initialize the other property.
590+
"""
591+
592+
AvoidFullRecalc = 0x00000002
593+
"""
594+
Some components like Loads don't need to update YPrim for every change, e.g. setting
595+
"`load.a_load.kW=1`" if was "kW" previously 2 should not force a YPrim update, but it does
596+
force an update by default.
597+
Using this flag will reproduce what the classic OpenDSS API for Loads (DSS.ActiveCircuit.Loads)
598+
does, but removes a lot of duplicated code. Besides that, we can extend the feature
599+
for other components if we think it fits.
600+
"""
601+
602+
SkipNA = 0x00000004
603+
"""
604+
For batch operations with arrays, skip NA values
605+
606+
Currently, NA values are interpret as:
607+
- NaN for float64
608+
- INT32_MIN (0x80000000) for int32
609+
- Null pointers for strings (in this case, use a `"\0"` string for empty strings)
610+
"""
611+
612+
AllowAllConductors = 0x80000000
613+
"""
614+
Used internally for the "Wires" property ("Conductors").
615+
This was left public in case someone tries to implement some internal aspects in
616+
external functions.
617+
"""
618+
619+
570620
__all__ = [
571621
'ActionCodes',
572622
'AltDSSEvent',
@@ -589,8 +639,10 @@ class GeneratorRegisters(IntEnum):
589639
'OCPDevType',
590640
'Options',
591641
'RandomModes',
642+
'SetterFlags',
592643
'SolutionAlgorithms',
593644
'SolutionLoadModels',
645+
'StorageStates',
594646
'SolveModes',
595647
'SparseSolverOptions',
596648
'YMatrixModes',

0 commit comments

Comments
 (0)