VeraGridEngine.IO package

Subpackages

Submodules

VeraGridEngine.IO.file_open module

class VeraGridEngine.IO.file_open.FileOpen(file_name: str | List[str], previous_circuit: MultiCircuit | None = None, options: FileOpenOptions | None = None)[source]

Bases: object

File open interface

check_json_type(file_name)[source]

Check the json file type from its internal data :param file_name: file path :return: data[β€˜type’] | β€˜Not json file’ | β€˜Unknown json file’

open(text_func: None | Callable = None, progress_func: None | Callable = None) MultiCircuit | None[source]

Load VeraGrid compatible file :param text_func: pointer to function that prints the names :param progress_func: pointer to function that prints the progress 0~100 :return: MultiCircuit

class VeraGridEngine.IO.file_open.FileOpenOptions(file_type: FileType | None = None, crash_on_errors: bool = True, cgmes_version: CGMESVersions | None = None, cgmes_map_areas_like_raw: bool = False, cgmes_try_to_map_dc_to_hvdc_line: bool = True, cgmes_topology_mode: CgmesTopologyMode = Auto, cgmes_create_busbar_section_for_every_connectivity_node: bool = False, cgmes_recovery_mode: CgmesRecoveryMode = CgmesRecoveryMode.Auto, psse_adjust_taps_to_discrete_positions: bool = False, psse_use_short_names: bool = True, psse_flatten_virtual_taps: bool = False, dgs_use_vsc_for_injections: bool = False, dgs_use_dynamic_information: bool = False)[source]

Bases: object

This class is to store the extra stuff that needs to be passed to open more complex files

VeraGridEngine.IO.file_open.determine_file_type(file_name: List[str] | str) FileType | None[source]

Try to determine the type of file The result is stored in self.file_type :param file_name: file path(s) with the extension

VeraGridEngine.IO.file_open.open_cgmes(files: List[str] | str, version: CGMESVersions | None = None, cgmes_map_areas_like_raw: bool = False, try_to_map_dc_to_hvdc_line: bool = False, cgmes_topology_mode: CgmesTopologyMode = Auto, cgmes_create_busbar_section_for_every_connectivity_node: bool = False, text_func: None | Callable = None, progress_func: None | Callable = None, cgmes_logger: DataLogger = <VeraGridEngine.data_logger.DataLogger object>, cgmes_recovery_mode: CgmesRecoveryMode = CgmesRecoveryMode.Auto) Tuple[MultiCircuit, CgmesCircuit][source]

Load cgmes files :param files: file or list of files :param version: :param cgmes_map_areas_like_raw: :param try_to_map_dc_to_hvdc_line: :param cgmes_topology_mode: :param cgmes_create_busbar_section_for_every_connectivity_node: :param text_func: :param progress_func: :param cgmes_logger: :param cgmes_recovery_mode: :return:

VeraGridEngine.IO.file_open.open_ucte(files: List[str] | str, text_func: None | Callable = None, progress_func: None | Callable = None, logger: Logger = <VeraGridEngine.basic_structures.Logger object>) MultiCircuit[source]
Parameters:
  • files – files or list of files

  • text_func

  • progress_func

  • logger

Returns:

VeraGridEngine.IO.file_save module

class VeraGridEngine.IO.file_save.FileSave[source]

Bases: object

save() Logger[source]

Save the file in the corresponding format :return: logger with information

class VeraGridEngine.IO.file_save.FileSavingOptions(file_type: FileType | None = None, sessions_data: List[DriverToSave] = None, dictionary_of_json_files: Dict[str, ~typing.Dict[str, ~typing.Any]]=None, cgmes_boundary_set: str = '', cgmes_version: CGMESVersions = 2.4.15, cgmes_profiles: None | List[CgmesProfileType] = None, cgmes_one_file_per_profile: bool = False, cgmes_map_areas_like_raw: bool = False, raw_version: str = '33', psse_topology_mode: PsseTopologyExportMode = BusBranch, psse_export_mode: PsseExportMode = Single file, dgs_export_mode: DgsExportMode = Single file, matpower_export_mode: MatpowerExportMode = Single file, ucte_export_mode: UcteExportMode = Single file, cgmes_export_mode: CgmesExportMode = Single file, t_idx: int | None = None)[source]

Bases: object

Store the extra data required by the richer file-export paths.

get_power_flow_results() None | PowerFlowResults[source]

Try to extract the power flow results :return: None or PowerFlowResults

VeraGridEngine.IO.file_save.compose_cgmes_batch_folder_name(t_idx: int, time_label: str) str[source]

Compose one deterministic folder name for a CGMES batch-export member set.

Parameters:
  • t_idx – Time index of the exported profile point.

  • time_label – Human-readable time label.

Returns:

Sanitized folder name.

VeraGridEngine.IO.file_save.compose_dgs_batch_file_name(base_name: str, t_idx: int, time_label: str) str[source]

Compose one deterministic file name for a DGS batch-export member.

Parameters:
  • base_name – Base archive name without extension.

  • t_idx – Time index of the exported profile point.

  • time_label – Human-readable time label.

Returns:

Sanitized internal file name.

VeraGridEngine.IO.file_save.compose_matpower_batch_file_name(base_name: str, t_idx: int, time_label: str) str[source]

Compose one deterministic file name for a MATPOWER batch-export member.

Parameters:
  • base_name – Base archive name without extension.

  • t_idx – Time index of the exported profile point.

  • time_label – Human-readable time label.

Returns:

Sanitized internal file name.

VeraGridEngine.IO.file_save.compose_psse_batch_file_name(base_name: str, t_idx: int, time_label: str, extension: str) str[source]

Compose one deterministic file name for a PSSE batch export member.

Parameters:
  • base_name – Base archive name without extension.

  • t_idx – Time index of the exported profile point.

  • time_label – Human-readable time label.

  • extension – PSSE file extension, including the leading dot.

Returns:

Sanitized internal file name.

VeraGridEngine.IO.file_save.compose_ucte_batch_file_name(base_name: str, t_idx: int, time_label: str) str[source]

Compose one deterministic file name for a UCTE batch-export member.

Parameters:
  • base_name – Base archive name without extension.

  • t_idx – Time index of the exported profile point.

  • time_label – Human-readable time label.

Returns:

Sanitized internal file name.

VeraGridEngine.IO.file_save.save_cgmes(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in CGMES format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_cgmes_batch_zip(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Export every time-series point into one ZIP archive with one CGMES export set per step.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target ZIP path.

  • options – Export options.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_cgmes_single(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save one CGMES export artifact for one snapshot or one time-series point.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_cim(circuit: MultiCircuit, file_name: str) Logger[source]

Save the circuit information in CIM format :return: logger with information

VeraGridEngine.IO.file_save.save_dgs(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in DGS format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options, including the optional profile selector.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_dgs_batch_zip(circuit: MultiCircuit, file_name: str, text_func=None, progress_func=None) Logger[source]

Export every time-series point into one ZIP archive with one DGS file per step.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target ZIP path.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_electrical_json_v3(circuit: MultiCircuit, file_name: str, options: FileSavingOptions) Logger[source]

Save the circuit information in json format :return:logger with information

VeraGridEngine.IO.file_save.save_matpower(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in MATPOWER format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options, including the optional profile selector.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_matpower_batch_zip(circuit: MultiCircuit, file_name: str, text_func=None, progress_func=None) Logger[source]

Export every time-series point into one ZIP archive with one MATPOWER file per step.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target ZIP path.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_newton(circuit: MultiCircuit, file_name: str) Logger[source]

Save the circuit information in sqlite :return: logger with information

VeraGridEngine.IO.file_save.save_pgm(circuit: MultiCircuit, file_name: str) Logger[source]

Save to Power Grid Model format :return: logger with information

VeraGridEngine.IO.file_save.save_psse_batch_zip(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Export every time-series point into one ZIP archive with one PSSE file per step.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target ZIP path.

  • options – Export options, including version, topology and internal PSSE format.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_psse_raw(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in PSSE RAW format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options, including the optional profile selector.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_psse_rawx(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in PSSE RAWX format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options, including the optional profile selector.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_ucte(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in UCTE format.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target file path.

  • options – Export options, including the optional profile selector.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_ucte_batch_zip(circuit: MultiCircuit, file_name: str, text_func=None, progress_func=None) Logger[source]

Export every time-series point into one ZIP archive with one UCTE file per step.

Parameters:
  • circuit – Circuit to export.

  • file_name – Target ZIP path.

  • text_func – Optional progress-text callback.

  • progress_func – Optional progress-value callback.

Returns:

Logger with export messages.

VeraGridEngine.IO.file_save.save_veragrid_circuit(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in zip format If a multiverse is passed in the options, it is β€œcommited” before saving :return: logger with information

VeraGridEngine.IO.file_save.save_veragrid_delta(circuit: MultiCircuit, file_name: str, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in zip format If a multiverse is passed in the options, it is β€œcommited” before saving :return: logger with information

VeraGridEngine.IO.file_save.save_veragrid_excel(circuit: MultiCircuit, file_name: str) Logger[source]

Save the circuit information in excel format :param circuit: MultiCircuit :param file_name: file name to save to :return: logger with information

VeraGridEngine.IO.file_save.save_veragrid_h5(circuit: MultiCircuit, file_name: str, text_func=None, progress_func=None) Logger[source]

Save the circuit information in CIM format :return: logger with information

VeraGridEngine.IO.file_save.save_veragrid_multiverse(file_name: str, multiverse: MultiVerse, options: FileSavingOptions, text_func=None, progress_func=None) Logger[source]

Save the circuit information in zip format If a multiverse is passed in the options, it is β€œcommited” before saving :return: logger with information

VeraGridEngine.IO.file_save.save_veragrid_sqlite(circuit: MultiCircuit, file_name: str, text_func=None, progress_func=None) Logger[source]

Save the circuit information in sqlite :return: logger with information

VeraGridEngine.IO.file_system module

VeraGridEngine.IO.file_system.api_keys_path() str[source]

get the api keys file path :return: api keys file path

VeraGridEngine.IO.file_system.get_create_veragrid_folder() str[source]

Get the home folder of VeraGrid, and if it does not exist, create it :return: folder path string

VeraGridEngine.IO.file_system.opf_file_path() str[source]

get the OPF files folder path :return: str

VeraGridEngine.IO.file_system.plugins_path() str[source]

get the plugins file path :return: plugins file path

VeraGridEngine.IO.file_system.scripts_path() str[source]

get the scripts file path :return: scripts file path

VeraGridEngine.IO.file_system.tiles_path() str[source]

get the tiles file path :return: tiles file path

Module contents