IscGroup

class ipsa.IscGroup

The IscGroup class provides access to an IPSA group to set and get group members. Note the extension functions will only work for general groups and may not function for other groups e.g., areas, transformer groups.

GetUID() int

Returns the UID of the group.

Returns:

The group UID.

Return type:

int

GetName() str

Returns the user defined group name as a string.

Returns:

The user defined group name.

Return type:

str

SetName(strName: str) None

Sets the name as a string.

Parameters:

strName (str) – The selected string name.

GetGroupType() int

Returns the type of the group where:

  • 0 = No group type

  • 1 = Area type group – contains all busbars in an area

  • 2 = Mixed item group

  • 3 = Load scaling group

  • 4 = Load transfer group

  • 5 = Protection device group

  • 8 = Generator scaling group

  • 9 = Region group

  • 10 = Transformer group (master slave operation)

  • 11 = Feeder group

Returns:

The group type.

Return type:

int

GetMembers() List[int]

Returns a list containing the UIDs of the components in the group.

Returns:

The UIDs of the components in the group.

Return type:

list(int)

SetMembers(nUIDs: List[int]) bool

Overwrites the current list of group members with the given list of component UIDs. This replaces any existing members with the supplied list of UIDs.

NB. The user may not set the members of a Feeder group.

Parameters:

nUIDs (list(int)) – List of component integers.

Returns:

True if the members have been set.

Return type:

bool

ClearMembers() bool

Sets the group members to an empty list. This clears any existing members.

NB. The user may not clear the members of a Feeder group.

Returns:

True if the members have been set.

Return type:

bool

AddMember(nUID: int) bool

Appends the component with the given UID to the list of component UIDs if the UID is not present. All existing group member UIDs are unaffected.

NB. The user may not add members to a Feeder group.

Parameters:

nUID (int) – Component UID.

Returns:

True if the members have been set.

Return type:

bool

RemoveMember(nUID: int) bool

Removes the component with the given UID from the list of component UIDs if the UID is present. All other existing group member UIDs are unaffected.

NB. The user may not remove members from a Feeder group.

Parameters:

nUID (int) – Component UID.

Returns:

True if the members have been set.

Return type:

bool

IsMember(nUID: int) bool

Checks whether the component with the given UID is present in the list of component UIDs. The list of group member UIDs will be unaffected.

Parameters:

nUID (int) – Component UID.

Returns:

True if nUID is present in list of member UIDs.

Return type:

bool

CompareGroups(nGroupUID: int, bUseIntersection: bool = False) List[int]

Compares the current group with the group with UID given by nGroupUID. By default, will perform a difference operation returning a list of component UIDs present in the current group but not present in the group with UID given by nGroupUID. If bUseIntersection is True it will return a list of component UIDs present in both lists. Both lists of group member UIDs will be unaffected.

Parameters:
  • nGroupUID (int) – UID of the group to compare with.

  • bUseIntersection (bool) – If True performs an intersection, if False a difference operation.

Returns:

The list of UIDs that make up the difference (default) or intersection of the two groups.

Return type:

list(int)

MergeGroups(nGroupUID: int, bDeleteGroup: bool = False) bool

Appends the list of component UIDs from the group with the given UID onto the current group’s UID list. By default the group with the given UID will be unnaffected, unless bDeleteGroup is True, in which case it will be deleted.

Parameters:
  • nGroupUID (int) – UID of the group to merge with.

  • bDeleteGroup (bool) – If True deletes the group with nGroupUID, otherwise the group is unnaffected.

Returns:

True if the merge has occurred succesfully.

Return type:

bool

GetLoadScalingReal() float

Returns the per unit scaling factor on the active power for the loads in the group. NB. This will only work for load scaling groups.

Returns:

The per unit scaling factor for the load active power.

Return type:

float

GetLoadScalingReactive() float

Returns the per unit scaling factor on the reactive power for the loads in the group. NB. This will only work for load scaling groups.

Returns:

The per unit scaling factor for the load reactive power.

Return type:

float

SetLoadScaling(fRealScale: float, fReactiveScale: float) bool

Sets the per unit scaling factors for the active and reactive parts of the loads in the group. NB. This will only work for load scaling groups.

Parameters:
  • fRealScale (float) – The new per unit scaling factor for the load active power.

  • fReactiveScale (float) – The new per unit scaling factor for the load reactive power.

Returns:

True if successful.

Return type:

bool

GetGeneratorScalingReal() float

Returns the per unit scaling factor on the active power for the generators in the group. NB. This will only work for generator scaling groups.

Returns:

The per unit scaling factor for the generator active power.

Return type:

float

GetGeneratorScalingReactive() float

Returns the per unit scaling factor on the reactive power for the generators in the group. NB. This will only work for generator scaling groups.

Returns:

The per unit scaling factor for the generator reactive power.

Return type:

float

SetGeneratorScaling(fRealScale: float, fReactiveScale: float) bool

Sets the per unit scaling factors for the active and reactive parts of the generators in the group. NB. This will only work for generator scaling groups.

Parameters:
  • fRealScale (float) – The new per unit scaling factor for the generator active power.

  • fReactiveScale (float) – The new per unit scaling factor for the generator reactive power.

Returns:

True if successful.

Return type:

bool

GetFeederScalingActive() bool

Returns whether the group feeder active and reactive scaling is in use. NB. This will only work for feeder groups.

Returns:

True if the group feeder scaling is active.

Return type:

bool

SetFeederScalingActive(bUseFeederScaling) bool

Sets whether the group feeder active and reactive scaling is in use. NB. This will only work for feeder groups.

Parameters:

bUseFeederScaling (bool) – If True the feeder scaling will be made active.

Returns:

True if successful

Return type:

bool

GetFeederScalingReal() float

Returns the per unit scaling factor on the active power for the feeder group. NB. This will only work for feeder groups.

Returns:

The per unit scaling factor for the active power.

Return type:

float

GetFeederScalingReactive() float

Returns the per unit scaling factor on the reactive power for the feeder group. NB. This will only work for feeder groups.

Returns:

The per unit scaling factor for the reactive power.

Return type:

float

SetFeederScaling(fRealScale: float, fReactiveScale: float) bool

Sets the per unit scaling factors for the active and reactive parts for the feeder group. NB. This will only work for feeder groups.

Parameters:
  • fRealScale (float) – The new per unit scaling factor for the active power.

  • fReactiveScale (float) – The new per unit scaling factor for the reactive power.

Returns:

True if successful.

Return type:

bool

AddDataExtension(strName: str, default: int | float | str | bool) int

Adds an integer/float/string/double extension data field and returns the new field index. Sets the default value.

This only has to be called once per component type - not for every instance of the component!

Note: The variable of the function is not called default.

You can use either nDefault, dDefault, strDefault or bDefault to specify the default value depending on the type of data extension being added.

Parameters:
  • strName (str) – The name of the field.

  • nDefault (int) – The integer default value.

  • dDefault (float) – The float default value.

  • strDefault (str) – The string default value.

  • bDefault (bool) – The bool default value.

Returns:

The new field index.

Return type:

int

AddListIntDataExtension(strName: str) int

Adds a data field for a list of integers and returns the new field index. Sets the default value to an empty list.

This only has to be called once per component type - not for every instance of the component!

Parameters:

strName (str) – The name of the field.

Returns:

The new field index.

Return type:

int

AddListDblDataExtension(strName: str) int

Adds a data field for a list of doubles and returns the new field index. Sets the default value to an empty list.

This only has to be called once per component type - not for every instance of the component!

Parameters:

strName (str) – The name of the field.

Returns:

The new field index.

Return type:

int

AddListStrDataExtension(strName: str) int

Adds a data field for a list of strings and returns the new field index. Sets the default value to an empty list.

This only has to be called once per component type - not for every instance of the component!

Parameters:

strName (str) – The name of the field.

Returns:

The new field index.

Return type:

int

DeleteDataExtensionField(nFieldIndex: int) bool
DeleteDataExtensionField(strName: str) bool

Deletes the extension field identified by the name strName or index nFieldIndex. This will delete the data in this extension field from this group and all other groups of the same type. It is advised to call NonDefaultExtensionInstanceCount prior to deleting the data extension field to ensure the expected amount of data shall be deleted.

This only has to be called once per component type - not for every instance of the component!

Parameters:
  • strName (str) – The name of the field.

  • nFieldIndex (int) – The index of the field.

Returns:

True if the field is deleted successfully.

Return type:

bool

NonDefaultExtensionInstanceCount(nFieldIndex: int) int
NonDefaultExtensionInstanceCount(strName: str) int

Returns the number of groups of the same type where the extension field identified by strName or nFieldIndex is set to a non-default value. That is, the count of the components where data will be destroyed by calling DeleteDataExtensionField.

Parameters:
  • strName (str) – The name of the field.

  • nFieldIndex (int) – The index of the field.

Returns:

The number of components with a non-default value in the extension field.

Return type:

int

GetIntExtensionValue(nFieldIndex: int) int

Get the integer value from the given extension field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The element value.

Return type:

int

GetDblExtensionValue(nFieldIndex: int) float

Get the float value from the given extension field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The element value.

Return type:

float

GetStrExtensionValue(nFieldIndex: int) str

Get the string value from the given extension field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The element value.

Return type:

str

GetBoolExtensionValue(nFieldIndex: int) bool

Get the boolean value from the given extension field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The element value.

Return type:

bool

GetListIntExtensionValue(nFieldIndex: int, nIndex: int) int

Get a single integer value from the list within the given enumerated field.

Note, the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

Returns:

The element value.

Return type:

int

GetListDblExtensionValue(nFieldIndex: int, nIndex: int) float

Get a single float value from the list within the given enumerated field.

Note, the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

Returns:

The element value.

Return type:

float

GetListStrExtensionValue(nFieldIndex: int, nIndex: int) str

Get a single string value from the list within the given enumerated field.

Note, the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

Returns:

The element value.

Return type:

str

GetListIntSize(nFieldIndex: int) int

Gets the size of the list of integers for the given enumerated field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The size of the field list.

Return type:

int

GetListDblSize(nFieldIndex: int) int

Gets the size of the list of doubles for the given enumerated field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The size of the field list.

Return type:

int

GetListStrSize(nFieldIndex: int) int

Gets the size of the list of strings for the given enumerated field.

Parameters:

nFieldIndex (int) – The field index.

Returns:

The size of the field list.

Return type:

int

SetIntExtensionValue(nFieldIndex: int, nValue: int) bool

Set the integer value for the given extension field.

Parameters:
  • nFieldIndex (int) – The field index.

  • nValue (int) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetDblExtensionValue(nFieldIndex: int, dValue: float) bool

Set the float value for the given extension field.

Parameters:
  • nFieldIndex (int) – The field index.

  • dValue (float) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetStrExtensionValue(nFieldIndex: int, sValue: str) bool

Set the string value for the given extension field.

Parameters:
  • nFieldIndex (int) – The field index.

  • sValue (str) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetBoolExtensionValue(nFieldIndex: int, bValue: bool) bool

Set the boolean value for the given extension field.

Parameters:
  • nFieldIndex (int) – The field index.

  • bValue (bool) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetListIntExtensionValue(nFieldIndex: int, nIndex: int, nValue: int) bool

Sets the value of a specified element in a list of integers within the given enumerated field.

Note the index within the list, nIndex, must already exist - that is, the size of the list (i.e., GetListIntSize) must be larger than nIndex. Note also that the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

  • nValue (int) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetListDblExtensionValue(nFieldIndex: int, nIndex: int, dValue: float) bool

Sets the value of a specified element in a list of doubles within the given enumerated field.

Note the index within the list, nIndex, must already exist - that is, the size of the list (i.e., GetListDblSize) must be larger than nIndex. Note also that the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

  • dValue (float) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

SetListStrExtensionValue(nFieldIndex: int, nIndex: int, strValue: str) bool

Sets the value of a specific element in a list of strings within the given enumerated field.

Note the index within the list, nIndex, must already exist - that is, the size of the list (i.e., GetListStrSize) must be larger than nIndex. Note also that the PyIPSA nIndex starts from 0, while the UI index starts from 1.

Parameters:
  • nFieldIndex (int) – The field index.

  • nIndex (int) – The index of the selected element.

  • strValue (str) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

PushBackListIntExtensionValue(nFieldIndex: int, nValue: int) bool

Adds an item with the given value to the end of a list of integers within the given enumerated field.

Parameters:
  • nFieldIndex (int) – The field index.

  • nValue (int) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

PushBackListDblExtensionValue(nFieldIndex: int, dValue: float) bool

Adds an item with the given value to the end of a list of doubles within the given enumerated field.

Parameters:
  • nFieldIndex (int) – The field index.

  • dValue (float) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

PushBackListStrExtensionValue(nFieldIndex: int, strValue: str) bool

Adds an item with the given value to the end of a list of strings within the given enumerated field.

Parameters:
  • nFieldIndex (int) – The field index.

  • strValue (str) – The selected value.

Returns:

True if the operation was successful.

Return type:

bool

GetExtensionFieldIndex(strName: str) int

Returns the field index for the extended data field of a specified name.

Parameters:

strName (str) – The name of the extended data field.

Returns:

The field index.

Return type:

int

GetExtensionNames() Dict[int, str]

Returns a dictionary of extension field indexes and field names. The dictionary keys are integers representing all the extended data fields. The dictionary values are the field names of the individual extended data fields. Each extended data field is therefore represented by {nIndex:strName}, where integer nIndex is the field index and string strName is the field name.

Returns:

Dictionary of extension field indexes and field names.

Return type:

dict(int, str)