List Module

Inheritance diagram of List

Holds all ERACS list classes, including lists for results, and for data. These classes hold the lists of element information, and contain methods for validating that values exist and are within appropriate thresholds.

ListOfDicts(AList)

This method ensures the dictionary is in a list, so when append is called it can call this method to always treat it as a list of dictionaries, regardless of whether a dictionary is passed into append, or a list of dictionaries.

Parameters

AList (list/dict) – The list or dict which should be a list.

Returns

The dictionary in a single-item list, or the original list.

class TEracsList(AList=[])

This class inherits from the list class, and is used to store dictionaries representing elements, for example, a list of busbar dictionaries or a list of cable dictionaries. Each dictionary represents one element, and the key-value pairs make up the data for that element.

Inherits

list.

property Identifier

The identifier key.

Type

str.

Writable

False.

property LibraryKey

The library key identifier.

Type

str.

Writable

False.

property Count

This simple property returns the number of items in the list. An alternative to using len().

Type

int.

Writable

False.

append(ADictionary: dict)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

Append(ADictionary: dict)

An alias method to the ‘append’ method which follows our naming convention of capitalizing method names, this will call and return append().

Parameters

ADictionary (dict) – The dictionary of information for element data.

clear()

This simple method overrides the clear method for a list (unless the Python version is older than Python 3.3 - which doesn’t have a clear method for lists). It clears the list by deleting every item in the list.

Clear()

An alias method to the ‘clear’ method which follows our naming convention of capitalizing method names. This will call and return clear().

FindItems(AKey, AValue, ACaseInsensitive=False)

Uses list comprehension to find all dictionaries containing a specific key-value pair.

Parameters
  • AKey (str) – The key to check value of.

  • AValue (str/anything) – Expected value of the key.

  • ACaseInsensitive (bool) – (Optional) If the comparison should be case-insensitive. When set to True, value must be a string.

Returns

List or items found, or empty list if nothing is found.

Raises

TEracsArgumentError – If ACaseInsensitive was set true but value wasn’t a string, or if key is invalid.

AllFromID(AIdString)

This method returns a list of all items with a particular Identifier.

Parameters

AIdString (str) – The identifier to look for.

Returns

A list of all elements with a particular ID.

IndexFromID(AIdString)

This method returns the index of an item which has a specified identifier.

Parameters

AIdString (str) – The identifier of the element to find and return the index of.

Returns

The index of the item that has an ID value which matches AIdString, or None if nothing was found.

IndexFromSeqnum(ASeqnum)

This method returns the index of an item which has a specified sequence number.

Parameters

ASeqnum (int) – The sequence number of the element to find.

Returns

The index of the item that has a seqnum value which matches ASeqnum, or None if nothing was found.

Raises

TEracsArgumentError – If argument was not an int.

ItemFromID(AIdString)

This method returns a dictionary of an item which has a specified identifier.

Parameters

AIdString (str) – The identifier of the element to find and return.

Returns

A dictionary for a particular item that has a matching identifier, or None if nothing is found.

ItemFromLibraryKey(AKey)

This method returns a dictionary of an item which has a specified library keyname.

Parameters

AKey (str) – The library key of the element to find and return.

Returns

A dictionary for a particular item in the list that has a matching library key to the one given.

ItemFromSeqnum(ASeqnum)
This method returns a dictionary of an item which has the specified

sequence number.

Parameters

ASeqnum (int) – The sequence number of the element to find and return.

Returns

A dictionary for a particular item that matches ASeqnum, or None if nothing is found.

Raises

TEracsArgumentError – If argument was not int.

Assign(AList, AClear=True)

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

Parameters
  • AList (list) – The list to copy data from.

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

class TEracsListResult

Class specifically for holding lists of results. Provides the AddIdToEachDictionary method, which is needed by results for copying over IDs from the original data objects.

Inherits

List.TEracsList.

append(ASimpleObject)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

Assign(AList, AClear=True)

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

Parameters
  • AList (list) – The list to copy data from.

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

AddIdToDictionary(AIndex, ADataDict)

Given an index and a data object, modify the current dictionary item at the given index location in self and copy over relevant ID’s and other information from the data dictionary provided. The result dictionary should contain a sequence number which matches the sequence number of an element within the data dictionary.

Parameters
  • AIndex (str) – The target result dictionary index.

  • ADataDict (dict) – The data dictionary which we’ll be copying from.

AddIdToLastDictionary(*ADataLists)

Given a data object, this finds the data dictionary which matches our last result dictionary by comparing sequence numbers, then populate the result dictionary with ID’s from the data dictionary.

Parameters

ADataList (TEracsListData) – A list of data lists. Search through them to find the correct data element matching the sequence number given. We can pass in multiple data lists when multiple similar element types share a single set of sequence numbers, like grid infeeds and synchronous machines.

AddIdToEachDictionary(ADataList)

Cycle through internal list and find the element with the same sequence number in given data object, then copy over IDs from the given data object.

Parameters

ADataList (TEracsListData) – A list of data dictionaries which should contain data for the same elements as our results. Map by using the assigned seqnum.

class TEracsListData

List class for specifically holding lists of data for elements in an ERACS network.

Inherits

List.TEracsList.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

clear()

This simple method overrides the clear method for a list (unless the Python version is older than Python 3.3 - which doesn’t have a clear method for lists). It clears the list by deleting every item in the list.

Assign(AList, AClear=True)

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

Parameters
  • AList (list) – The list to copy data from.

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

ChildOf(APId, APTypeCode)

This method gets an element from the list that is a child of an element with ID and TypeCode specified in the arguments.

Parameters
  • APid (str) – The parent ID.

  • APTypeCode (str) – The parent typecode.

Returns

A dictionary of the item that has a pid value of APid and a ptypecode value of APTypeCode, or None.

ChildrenOf(APId, APTypeCode)
This method gets elements from the list that are children of an element

with ID and TypeCode specified in the arguments.

Parameters
  • APid (str) – The parent ID.

  • APTypeCode (str) – The parent typecode.

Returns

A dictionary of the item that has a pid value of APid and a ptypecode value of APTypeCode, or None.

UniqueTypecodes()

This method returns all unique typecodes in the list of dictionaries. This method is useful for transformer windings, and other elements which can vary in typecode depending on parent.

Returns

A set of all typecodes in the list of data.

class TEracsListDataText

List of all text elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataBusbar

List of all busbar elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataLine

List of all transmission line elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None, ALoadflowRecords=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataCable

List of all cable elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataSeries

List of all series elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataTap

List of all tap changer elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None, ATransformers=None, AParentDict=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataTransformer

List of all transformer elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataWinding

List of all transformer winding elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

property Identifier

The identifier key, which is “pid” for windings, since they’re not uniquely identified by name.

Type

str.

Writable

False.

append(ADictionary, ABusbars=None, AParentDict=None, AGrandparentDict=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataNeutral

List of all neutral earth elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, APId=None, APTypeCode=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataEmbeddedCable

List of all embedded cable elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, AParentDict=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataInduction

List of all induction machine elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataSynchronous

List of all synchronous machine elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataEmbeddedTransformer

List of all embedded transformer elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, AParentDict=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataGrid

List of all grid infeed elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None, ASynchronousMachines=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataShunt

List of all shunt elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataBusSection

List of all bus section elements loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary, ABusbars=None)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataSwitch

List of all switches loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.

class TEracsListDataProtection

List of all protection devices loaded from an ERACS Network data file.

Inherits

List.TEracsListData.

append(ADictionary)

Overrides the original list append method and ensures the dict contains all necessary data which may be required by the calculation modules.

Parameters

ADictionary (dict) – The dictionary of information, containing key-value pairs of the element data.

Raises

TEracsArgumentError – If the argument was not a dictionary.