powerfactorypy.PFBaseInterface
- class powerfactorypy.PFBaseInterface(app)
Base interface for interaction with the PF database.
- __init__(app)
Methods
__init__
(app)activate_study_case
(path)Activate study case under path.
copy_multiple_objects
(...[, overwrite])Copy multiple objects or a whole folder. Arguments: objects_or_folder_to_be_copied: PF objects or a folder path target_folder: Target folder object or path.
copy_obj
(obj_to_be_copied, new_obj_folder[, ...])Copy single object. Arguments: obj_to_be_copied: object or path new_obj_folder: folder object or its path new_name: If not specified, the original name is used overwrite: Overwrite if already exists in target folder.
create_by_path
(path[, overwrite])Create an object by specifying its path including its class. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_by_path(r"LibraryDynamic Modelsdummy.BlkDef") .
create_in_folder
(folder, obj[, overwrite])Creates an obj inside a folder. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_in_folder("LibraryDynamic Models","dummy2.BlkDef").
delete_obj
(obj)delete_obj_from_folder
(folder[, obj_name, ...])Deletes object(s) in a folder. Arguments: folder: PF folder (or its path) obj_name: Can contain wildcards ('*') error_when_nonexistent: Throw an error if the object does not exist. include_subfolders: Search also in subfolders.
get_attr
(obj, attr)Get the value of an attribute of an object. 'obj' can be a path (string) or a Powerfactory object. Example: pfbi.get_attr(terminal_1,"systype").
get_by_attribute
(objects, attr, attr_lambda)From a list of objects, get those for whom the the attr_lambda function returns 'True' when given the attribute attr of an object as input. Example: pfbi.get_by_attribute(list_of_objects,"uknom",lambda x : x==110).
get_from_folder
(folder[, obj_name, attr, ...])Get objects from a folder according to name and attribute. Arguments: folder: Path to folder or folder object obj_name: Name of the object(s), can contain wildcards ('*'). If not specified, all objects are returned. attr: Name of attribute. attr_lambda: Lambda function with condition for the attribute. Example: attr_lambda = lambda x : x>110 This checks if the value of attr is larger than 110.
get_obj
(path[, project_folder, ...])Returns the PowerFactory object under path in the project folder.
get_path_of_object
(obj)is_container
(obj)Checks whether a PF object is a container.
return_obj_if_path_is_provided
(obj)Returns obj if obj is not a string.
set_attr
(obj, params)Set the attribute(s) of an object.
set_attr_by_path
(path_with_attr, value)path_with_attr: path of object plus the attribute name Example: pfbi.set_attr_by_path(self, "LibraryDynamic ModelsLinear_interpolationdesc",["description"]) Here 'desc' is the name of the attribute. .