Dict Module

Inheritance diagram of Dict

Holds all ERACS dictionary classes. These classes hold the dictionaries of element information, and contain methods for validating existence of values and that the values are within appropriate thresholds.

class TEracsDict

A class providing easy methods for storing information into a dictionary. Used for single element information, such as the appearance settings and loadflow parameters.

Inherits

dict.

Assign(ADict, AClear=True)

Copies elements from given dictionary into internal dictionary. This will clear the internal dictionary before copying, unless 2nd parameter is false.

Parameters
  • ADict (dict) – The dictionary to copy data from.

  • AClear (bool) – (Optional) If set to false the current dictionary data is preserved.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

GetValue(AKey)

Get a value from the dictionary.

Parameters

AKey – A desired key within the dictionary.

Raise

TEracsDataError - if the key doesn’t exist in the dictionary.

TryGetValue(AKey, AValue: list = [])

Try to get a value from the dictionary.

Parameters
  • AKey – A desired key within the dictionary.

  • AValue (list) – Out parameter, a list which will be appended to.

Returns

bool (Boolean). True if the key was in the dictionary, false otherwise.

SetValue(AKey, AValue)

Try to set a value in the dictionary.

Parameters
  • AKey – A desired key within the dictionary.

  • AValue – The new value to be stored in the dictionary.

Returns

Tuple, (before, after).

class TEracsDictResult(AMandatory: set = {}, AShown: set = {}, AHidden: set = {}, *args, **kwargs)

This class is a container for singular results, whether it be summary results or a particular elements results.

GetOnlyVisibleResults()

Returns only the visible results. Note, A new plain dictionary is returned, not an instance of TEracsDictResult, thus modifying it will have no effect on actual ERACS results.

Returns

An ordinary dict of all visible results ONLY.

class TEracsDictResultSummary(AMandatory: set = {}, AShown: set = {}, AHidden: set = {}, *args, **kwargs)

This class contains summary results.

class TEracsDictResultElement(AMandatory: set = {}, AShown: set = {}, AHidden: set = {}, *args, **kwargs)

This is a generic result dict class for holding results for any element. It’s used in the result lists.

class TEracsDictDataElement

This generic data element dict class is used to provide handy methods for all element data stored in a TEracsDataCollection object.

Inherits

TEracsDict.

property X

This getter property returns the X coordinate for the element’s symbol.

property Y

This getter property returns the Y coordinate for the element’s symbol.

class TEracsDictDataElementBusbar

This dict data class is used to represent busbar data.

Inherits

TEracsDictDataElement.

property X

This getter property returns the X coordinate for the element’s symbol.

property Y

This getter property returns the Y coordinate for the element’s symbol.

class TEracsDictDataElementEdge

This dict data class is used to represent elements such as cables and lines that have no symbol and connect between busbars.

Inherits

TEracsDictDataElement.

property X

This getter property returns the X coordinate for the element’s symbol.

property Y

This getter property returns the Y coordinate for the element’s symbol.

class TEracsDictDataElementSymbol

This dict data class is used to represent leaf nodes and elements with symbol information, such as motors and generators, or series elements.

Inherits

TEracsDictDataElement.

property X

This getter property returns the X coordinate for the element’s symbol.

property Y

This getter property returns the Y coordinate for the element’s symbol.

class TEracsDictHeader

A class specifically designed for holding Header information in a dictionary. The class checks for the existence of required values such as System Base Frequency (sysfreq).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictLoadflow

A class specifically designed for holding Loadflow Parameters in a dictionary. The class checks for the existence of required values such as Tap Changer Selector (tapsel).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictAppearance

A class specifically designed for holding Appearance Settings in a dictionary. The class checks for the existence of required values such as Default Busbar Thickness (defbusthickness).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictResultSetting

A class specifically designed for holding Result Settings in a dictionary. The class checks for the existence of required values such as Number of Decimal Places (numdps).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictVoltageLevelTable

A class specifically designed for holding Voltage Level information in a dictionary. The class checks for the existence of required values such as Voltage Level Key Visible (visible).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictCanvas

A class specifically designed for holding Canvas Information in a dictionary. The class checks for the existence of required values such as SVG Canvas Width (width).

Inherits

TEracsDict.

update(ADict)

Updates the internal dictionary with the given dictionary, copying over all keys and values, overwriting any duplicates.

Parameters

ADict (dict) – Dictionary containing key-value pairs to copy over.

Raises

TEracsDataError – If a required key is missing.

class TEracsDictSwitchGroup(AGroupDict)

A class specifically for using switch groups. It provides the standard operations that you’d find in ERACS (toggle, open, close).

Inherits

TEracsDict.

ToggleAll(AData)

Toggle the state for each switch in the group.

Parameters

AData (TEracsData) – The data object to grab the actual switch data from.

Returns

None.

CloseAll(AData)

Close all switches in the group.

Parameters

AData (TEracsData) – The data object to grab the actual switch data from.

Returns

None.

OpenAll(AData)

Open all switches in the group.

Parameters

AData (TEracsData) – The data object to grab the actual switch data from.

Returns

None.

Immutable()

When called, this method sets an internal flag to true. This prevents the mutable methods like Toggle() from working. This is often used in conjunction with SwitchGroupsWithSwitchData, which is functional and returns a list copy (and not the original list), thus mutating it wouldn’t have an effect.

Returns

TEracsDictSwitchGroup