powfacpy.PFStudyCases
- class powfacpy.PFStudyCases(app)
- __init__(app)
Methods
__init__(app)activate_grids(case_num)Activate the corresponding grids of a study case.
activate_study_case(path)Activate study case under path.
add_results_variable(obj, variables[, ...])Adds variables of the object to the PowerFactory results object (ElmRes) obj: PowerFactory object or its path
copy_obj(obj_or_path, target_folder[, ...])Copies object(s) by using 'get_obj' in first step and the copying the returned objects to 'target_folder'.
copy_single_obj(obj_or_path, target_folder)Copies single object by using 'get_single_obj' in first step and the copying the returned objects to 'target_folder'.
create_by_path(path[, overwrite])Create an object by specifying its path including its class and return the object. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_by_path(r"LibraryDynamic Modelsdummy.BlkDef") .
create_cases()Create study cases (and corresponding scenarios/variations) Iterates through all cases and creates study cases (and folders according to 'hierarchy') using parameter-value strings for the study cases (and folder names).
create_directory(directory[, parent_folder])Create a directory of folders ('IntFolder') if the directory does not yet exist. Arguments: path: path of folders parent_folder: If not specified, the active project folder is used.
create_in_folder(folder, obj[, overwrite])Creates an obj inside a folder and returns the object. If overwrite is true, objects with the same name will be overwritten. Example: pfbi.create_in_folder("LibraryDynamic Models","dummy2.BlkDef").
create_scenario(parameter_values_string, ...)Creates a scenario with the name 'parameter_values_string' in the folder corresponding to 'folder_path' (this parth is relativ to 'parent_folder_scenarios)
create_study_case(parameter_values_string, ...)Creates a study case with the name 'parameter_values_string' in the folder corresponding to 'folder_path' (this path is relativ to 'parent_folder_study_cases)
create_variation(parameter_values_string, ...)Creates a variation with the name 'parameter_values_string' in the folder corresponding to 'folder_path' (this path is relativ to 'parent_folder_variations)
delete_obj(obj_or_path[, condition, ...])Delete object(s).
get_active_project()Returns the currently active project and throws an error if no prject has been activated.
get_active_user_folder()Return the folder of the active user.
get_attr(obj, attr[, parent_folder])Get the value of an attribute of an object.
get_attr_by_path(path_with_attr)get_by_condition(objects, condition)From a list of objects, get those for whom the 'condition' (which is a function) returns 'True'. Example: pfbi.get_by_condition(list_of_objects,lambda x : getattr(x,"uknom")==110).
get_case_params_value_string(...[, ...])Returns the parameter-value string for a case name.
get_first_level_folder(folder)Returns folder on first level of PF database.
get_folder_path(case_num)Returns the folder path of a case.
get_multiple_obj_from_similar_sub_directories(...)Returns multiple objects that are in a similar subdirectory relativ to their parent folders. Arguments: parents: Parent folders (string path,list of objects/string paths) sub_path: Path within the parent folders (string). Must be unique (don't use placeholders '*').
get_obj(path[, condition, parent_folder, ...])Returns the PowerFactory object(s) under 'path'. 'path' can contain wildcards ("*") after the last "". A condition may be specified as a function, for example to check certain attributes with lambda function: (eg. "condition = lambda x : getattr(x,"uknom")==110)". By default, the 'path' is relative to the folder of the active project. Only if 'parent_folder' is specified, it is relative to that folder. The parent_folder can be a PF container object or a string: parent_folder = "user" means 'path' is relative to the active user instead of the active project. An error is raised if no object is found, unless 'error_if_non_existent=False'.
get_parameter_value_string(parameters[, ...])get_path_of_object(obj)get_single_obj(path[, parent_folder, ...])Use this method if you want to access one single unique object.
get_study_cases(conditions)Retrieve study case objects depending on parameter values. Arguments: conditions: A dictionary with keys: parameter names values: lambda function with boolean return value depending on parameter (key) Returns the study case objects whose parameters fullfill the conditions.
get_value_of_parameter_for_case(par_name, ...)Returns a parameter value for a certain case. Arguments: par_name: Parameter name (string) case_obj_or_case_num: Either the case number (int) or a study case PF object (then the case number/index is derived first).
handle_case_input(case_obj_or_case_num)Accepts PF study case object or integer.
handle_condition_of_obj_not_met(path, obj, ...)Handles the attempted access to an object with a certain condition that does not exist.
handle_inclusion_of_subfolders(path, ...)If subfolders are included, 'GetChildren' must be used instead of 'GetContents'.
handle_non_existing_obj(path, parent_folder, ...)Handles the attempted access to a non existent object.
handle_pf_object_or_path_input(obj_or_path)Handles the input argument when a method accepts either
handle_single_pf_object_or_path_input(obj[, ...])Handles the input argument when a method accepts either
is_container(obj)Checks whether a PF object is a container.
path_exists(path[, parent, return_info])Check if the path exists.
set_attr(obj, params[, parent_folder])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. .
set_parameters(case_obj_or_case_num)Set the parameters according to paths specified in 'parameter_paths' and values specified in 'parameter_values'.
Attributes
languagestudy_casesself.parent_folder_study_cases = powfacpy.PFTranslator.get_default_study_case_folder_name(