VeraGridEngine.IO.others package

Submodules

VeraGridEngine.IO.others.anarede module

class VeraGridEngine.IO.others.anarede.PWFParser[source]

Bases: object

to_veragrid() MultiCircuit[source]

Convert Anarede grid to VeraGrid :return:

class VeraGridEngine.IO.others.anarede.PwfBus[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(vg_dict: Dict[str, PwfVoltageGroup]) Bus[source]
Parameters:

vg_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfComment[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfDCLine[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) HvdcLine[source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfEquipmentConnection[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfGenerator[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) Generator[source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfGeneratorIdentification[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfGeneratorReactance[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfInjection[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfLine[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) Line[source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfLoad[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) Load[source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfMotorConfiguration[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfNetwork[source]

Bases: object

add_device(device)[source]

Add a device to the appropriate list based on its class type. :param device: :return:

to_veragrid() MultiCircuit[source]
Returns:

class VeraGridEngine.IO.others.anarede.PwfShunt[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) list[tuple[int, Shunt]][source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfStaticCompensator[source]

Bases: object

StaticCompensator

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) tuple[int, ControllableShunt][source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfTransformer[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

to_veragrid(bus_dict: Dict[int, Bus]) Transformer2W[source]
Parameters:

bus_dict

Returns:

class VeraGridEngine.IO.others.anarede.PwfTransformerSettings[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfVoltageGroup[source]

Bases: object

PwfBus

parse(line: str) None[source]
Parameters:

line

Returns:

class VeraGridEngine.IO.others.anarede.PwfVoltageLimitGroup[source]

Bases: object

parse(line: str) None[source]
Parameters:

line

Returns:

VeraGridEngine.IO.others.dpx_parser module

VeraGridEngine.IO.others.dpx_parser.load_dpx(file_name, contraction_factor=1000) tuple[MultiCircuit | Any, Logger | Any][source]

Read DPX file :param file_name: file name :param contraction_factor: contraction factor :return: MultiCircuit

VeraGridEngine.IO.others.dpx_parser.read_dpx_data(file_name)[source]

Read the DPX file into a structured dictionary :param file_name: :return:

VeraGridEngine.IO.others.dpx_parser.reformat(val)[source]

Pick string and give it format :param val: string value :return: int, float or string

VeraGridEngine.IO.others.dpx_parser.repack(data_structures, logger=<VeraGridEngine.basic_structures.Logger object>, verbose=False)[source]

Pack the values as DataFrames with headers where available :param data_structures: Raw data structures :param logger: logger (inherited) :param verbose: print extra stuff :return:

VeraGridEngine.IO.others.helper_pow2pp module

VeraGridEngine.IO.others.helper_pow2pp.add_new_buses_to_pandapower_net(new_buses, pandapower_net, voltage_level: Series, assign_id_column_if_not_set=True)[source]
VeraGridEngine.IO.others.helper_pow2pp.catch_exceptions(func)[source]
VeraGridEngine.IO.others.helper_pow2pp.connect_elements_to_switches_bus_breaker(all_switches: DataFrame, elements_connected_to_switches: DataFrame, pandapower_net: pandapower.pandapowerNet)[source]
VeraGridEngine.IO.others.helper_pow2pp.connect_elements_to_switches_node_breaker(all_switches: DataFrame, pandapower_net: pandapower.pandapowerNet)[source]
VeraGridEngine.IO.others.helper_pow2pp.create_and_match_buses_for_switches(pandapower_net, powsybl_net) DataFrame[source]

Parameters

pandapower_net powsybl_net

Returns

pandapower only allows two types of switches: bus-bus switches and bus-element switches. In the first case, a switch is connected to two pandapower-buses, in the second case, a switch is connected to a pandapower-bus and an element from another pandapower-net-table. Only lines 2w-transformers and 3w-transformers are allowed as elements for a bus-element-switch.

powsybl models switches differently: The connections between switches and elements are defined by nodes. Either switches share nodes with other switches or elements or they share a connection via another node.

There are three cases: 1. A switch shares a node with an element.

a. In this case, if the element is a transformer or a line, the element-index will be referenced in the column β€˜element’ of table switch and the element type in the column β€˜et’. b. If the element is not a transformer or a line, we need to create a new bus between the element and the switch. The index of this new bus will then be referenced in the column β€˜element’ and the entry in column β€˜et’ will be β€˜b’.

2. Two switches share a node. In this case, we need to create a new bus between the switches. It will be referenced in either the β€˜bus’- or the β€˜element’-column. 3. The nodes of two switches have an internal connection via another node. In this case, for each of these nodes not directly referenced by any switch, we create a new bus. The new bus will be referenced by the switches in either the β€˜bus’- or the β€˜element’-column.

VeraGridEngine.IO.others.helper_pow2pp.create_and_match_buses_for_switches_per_voltage_level_bus_breaker(all_switches: DataFrame, elements_connected_to_switches: DataFrame, pandapower_net: pandapower.pandapowerNet, powsybl_net: pypowsybl.network.Network, voltage_level: Series) tuple[DataFrame, DataFrame][source]
VeraGridEngine.IO.others.helper_pow2pp.create_and_match_buses_for_switches_per_voltage_level_node_breaker(all_switches: DataFrame, pandapower_net: pandapower.pandapowerNet, powsybl_net: pypowsybl.network.Network, voltage_level: Series) DataFrame[source]
VeraGridEngine.IO.others.helper_pow2pp.create_new_buses(nodes: Sequence, highest_bus_index: int) tuple[DataFrame, int][source]
VeraGridEngine.IO.others.helper_pow2pp.create_switches(*args, **kwargs)[source]
VeraGridEngine.IO.others.helper_pow2pp.drop_irrelevant_columns(element_table: DataFrame, element_type: str) DataFrame[source]
VeraGridEngine.IO.others.helper_pow2pp.find_voltage_levels(element_table: DataFrame, powsybl_net: Network) DataFrame[source]
VeraGridEngine.IO.others.helper_pow2pp.initialise_new_columns(switches)[source]
VeraGridEngine.IO.others.helper_pow2pp.set_index_as_column(dataframe)[source]

VeraGridEngine.IO.others.ipa_parser module

VeraGridEngine.IO.others.ipa_parser.load_iPA(file_name) MultiCircuit[source]

Read the nuts’ Indra file format :param file_name: json file name :return: MultiCircuit

VeraGridEngine.IO.others.pandapower_parser module

class VeraGridEngine.IO.others.pandapower_parser.Panda2VeraGrid(file_or_net: str | 'pandapowerNet', logger: Logger | None = None)[source]

Bases: object

extract_tap_changers(row) TapChanger | None[source]

# Tap changer mapping (pandapower β†’ GridCal) # # Ratio + tap_step_percent only: # dV = tap_step_percent / 100 # asymmetry_angle = 0Β° # # Ratio + tap_step_percent + tap_step_degree (cross regulator): # Ξ΄u = tap_step_percent / 100 # Ξ± = tap_step_degree (phase shift per tap, deg) # # Conversion (UCTE): # tan(Ξ±) = (Ξ΄u Β· sinΘ) / (1 + Ξ΄u Β· cosΘ) # β‡’ Θ = Ξ± + arcsin(sin(Ξ±) / Ξ΄u) # # If Ξ΄u = 0 or |sin(Ξ±)| > Ξ΄u: # Fallback β†’ treat as Ideal phase shifter: # dV = 0 # asymmetry_angle = Ξ± # # Symmetrical: # dV = tap_step_percent / 100 # asymmetry_angle = 90Β° # # Ideal: # dV = 0 # asymmetry_angle = tap_step_degree For β€œSymmetrical” and β€œIdeal”, mapping stays as before.

get_api_object_by_registry(panda_type: str, panda_code: int) Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement | None[source]

Get a previously registered veragrid object from a pandapower table-key :param panda_type: table name :param panda_code: index key :return: VeraGrid object

get_multicircuit(convert_switches: bool = True) MultiCircuit[source]

Get a VeraGrid Multi-circuit from a PandaPower grid :return: MultiCircuit

parse_buses(grid: MultiCircuit) Dict[str | int, Bus][source]

Add buses to the VeraGrid grid based on Pandapower data :param grid: MultiCircuit grid :return: PP row name or index to VeraGrid Bus object

parse_external_grids(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add external grid (slack bus) generators to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_generators(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add synchronous generators (row) to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_impedances(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add impedances to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_lines(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add lines (conductors) to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary:

parse_loads(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add loads to the VeraGrid grid based on Pandapower data :param grid: MultiCircuit grid :param bus_dictionary:

parse_measurements(grid: MultiCircuit)[source]
Parameters:

grid

Returns:

parse_shunts(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add shunts to the VeraGrid grid based on Pandapower data :param grid: MultiCircuit grid :param bus_dictionary:

parse_static_generators(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add synchronous generators (row) to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_storage(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add storages to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_switches(grid: MultiCircuit, bus_dictionary: Dict[str | int, Bus])[source]

See: https://pandapower.readthedocs.io/en/latest/elements/switch.html :param grid: MultiCircuit grid :param bus_dictionary: :return:

parse_transformers(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add transformers to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary:

parse_transformers3W(grid: MultiCircuit, bus_dictionary: Dict[str, Bus])[source]

Add 3W transformers to the VeraGrid grid :param grid: MultiCircuit grid :param bus_dictionary:

register(panda_type: str, panda_code: int, api_obj: Generator | Battery | Load | ExternalGrid | StaticGenerator | Shunt | ControllableShunt | CurrentInjection | Line | DcLine | Transformer2W | HvdcLine | VSC | UPFC | Winding | Switch | SeriesReactance | FluidNode | FluidPath | FluidP2x | FluidTurbine | FluidPump | Substation | Bus | BusBar | VoltageLevel | Country | Region | Community | Municipality | Area | Zone | Transformer3W | TransformerNW | OverheadLineType | Wire | TransformerType | EmissionGas | BranchGroup | LineLocations | LineLocation | ModellingAuthority | Facility | Fuel | Investment | InvestmentsGroup | Contingency | ContingencyGroup | RemedialAction | RemedialActionGroup | Technology | Owner | UndergroundLineType | SequenceLineType | RmsModelTemplate | EmtModelTemplate | FmuTemplate | RmsEvent | RmsEventsGroup | ShortCircuitEvent | IfMeasurement | ItMeasurement | QfMeasurement | PfMeasurement | QtMeasurement | PtMeasurement | QiMeasurement | PiMeasurement | VmMeasurement | VaMeasurement | PgMeasurement | QgMeasurement)[source]

Register a panda object and it’s associated VeraGrid object :param panda_type: table name :param panda_code: index key :param api_obj: VeraGrid object

VeraGridEngine.IO.others.pandapower_parser.is_pandapower_file(file_path: str)[source]

Check if this is a pandapower file :param file_path: :return:

VeraGridEngine.IO.others.pandapower_parser.is_pandapower_json(file_path)[source]

Check if a file is pandapower JSON :param file_path: :return:

VeraGridEngine.IO.others.pandapower_parser.is_pandapower_pickle(file_path)[source]

Check if a file is pandapower Pickle :param file_path: :return:

VeraGridEngine.IO.others.pandapower_parser.is_pandapower_sqlite(file_path)[source]

Check if a file is pandapower SQLite :param file_path: :return:

VeraGridEngine.IO.others.plx_parser module

class VeraGridEngine.IO.others.plx_parser.PlexosBattery(name='', category='')[source]

Bases: PlxGenerator

class VeraGridEngine.IO.others.plx_parser.PlxBusMode(value)[source]

Bases: Enum

NONE = 4
PQ = 1
PV = 2
REF = 3
STO_DISPATCH = 5
class VeraGridEngine.IO.others.plx_parser.PlxElement(name)[source]

Bases: object

class VeraGridEngine.IO.others.plx_parser.PlxGenerator(name='', category='', p_max=0, p_min=0, node=None)[source]

Bases: PlxElement

class VeraGridEngine.IO.others.plx_parser.PlxLine(name='', units=1, node_from=None, node_to=None, r=0.0, x=0.0, rate_max=0.0, rate_min=0.0)[source]

Bases: PlxElement

delete_zero_coordinates()[source]
Returns:

get_coordinates()[source]

Get polyline of coordinates :return:

get_highest_voltage()[source]

Return the highest voltage at which this line is connected :return:

get_key(sep='-')[source]

Split the name in the plexos way to get the new key

class VeraGridEngine.IO.others.plx_parser.PlxModel(fname, load_profiles=True, text_func=None, prog_func=None)[source]

Bases: object

get_all_branches_dictionary()[source]

Returns a dictionary with all the Branches by the name :return: dictionary name -> object

get_branch_ratings(n=None)[source]

Get DataFrame with the dynamic branch ratings :param n: number of time steps to extrapolate the profile :return: DataFrame

get_buses_dictionary()[source]

Get dictionary relating the bus name to the latitude, longitude, voltage and name >>> bus_dict[name] >>> latitude, longitude, voltage, name :return: dictionary

load_profile(path, zip_file_pointer=None)[source]

Attempt loading the profile :param path: relative or absolute path :param zip_file_pointer: pointer to open zip file is the file ins inside a zip file :return: DataFrame

load_profile_if_necessary(key, path, zip_file_pointer=None)[source]

Load a profile is necessary :param key: object property type :param path: relative or absolute path where to find the file :param zip_file_pointer: pointer to open zip file is the file ins inside a zip file :return: Nothing

load_project_file(fname)[source]

Load a PLEXOS project file :param fname: name of the plexos project file (*.zip, *.xml, *.xlsx)

parse_data(objects, memberships, properties, zip_file_pointer=None)[source]

Pass the loaded DataFrames to model objects :param objects: Objects DataFrame :param memberships: Memberships DataFrame :param properties: Properties DataFrame :param zip_file_pointer: zip file pointer. If not None the data will be read from a zip file :return: Nothing

static parse_excel(fname)[source]

Parse excel export of the plexos file :param fname: complete path to the file

parse_xml(fname, zip_file_pointer=None)[source]

Parse PLEXOS file :param fname: xml PLEXOS file name :param zip_file_pointer: pointer to a zip file, if not none, the file will be read from within a zip file

parse_zip(fname)[source]

Parse zip file with the plexos xml and the profiles utilized :param fname: zip file name :return: Nothing

class VeraGridEngine.IO.others.plx_parser.PlxNode(name='', zone='', region='', voltage=0, latitude=0, longitude=0)[source]

Bases: PlxElement

class VeraGridEngine.IO.others.plx_parser.PlxRegion(name='')[source]

Bases: PlxElement

class VeraGridEngine.IO.others.plx_parser.PlxTransformer(name='')[source]

Bases: PlxLine

class VeraGridEngine.IO.others.plx_parser.PlxZone(name='')[source]

Bases: PlxElement

class VeraGridEngine.IO.others.plx_parser.XmlDictConfig(parent_element, text_to_remove='')[source]

Bases: dict

Note: need to add a root into if no exising Example usage: >>> tree = ElementTree.parse(β€˜your_file.xml’) >>> root = tree.getroot() >>> xmldict = XmlDictConfig(root) Or, if you want to use an XML string: >>> root = ElementTree.XML(xml_string) >>> xmldict = XmlDictConfig(root) And then use xmldict for what it is… a dict.

update_shim(a_dict)[source]
Parameters:

a_dict

Returns:

VeraGridEngine.IO.others.plx_parser.get_st_generation_sent_out(plexos_results_folder)[source]

Get the generation auxiliary use from a PLEXOS results folder :param plexos_results_folder: PLEXOS results folder :return: pandas DataFrame with the generation dispatch

VeraGridEngine.IO.others.plx_parser.get_st_node_load(plexos_results_folder, parse_dates=False)[source]

Get the node load use from a PLEXOS results folder :param plexos_results_folder: PLEXOS results folder :param parse_dates: Parse the dates? :return: pandas DataFrame with the node load

VeraGridEngine.IO.others.plx_parser.plx_to_veragrid(mdl: PlxModel, plexos_results_folder, time_indices=None, text_func=None, prog_func=None)[source]

Reads plexos model with results and creates a VeraGrid model :param mdl: Plexos model instance :param plexos_results_folder: plexos results folder :param time_indices: time indices to sample :param text_func: :param prog_func: :return: MultiCircuit instance

VeraGridEngine.IO.others.pow2pp module

VeraGridEngine.IO.others.pow2pp.add_tap_parameters_for_3w_phase_tap_changer(powsybl_net: pypowsybl.network.Network, trafo_table: DataFrame) DataFrame[source]

Add phase tap changer parameters for 3-winding transformers

VeraGridEngine.IO.others.pow2pp.add_tap_parameters_for_3w_ratio_tap_changer(powsybl_net: pypowsybl.network.Network, trafo_table: DataFrame) DataFrame[source]

Add ratio tap changer parameters for 3-winding transformers

VeraGridEngine.IO.others.pow2pp.add_tap_parameters_for_phase_tap_changer(powsybl_net: pypowsybl.network.Network, trafo_table: DataFrame) DataFrame[source]

Comprehensive phase tap changer parameter calculation

VeraGridEngine.IO.others.pow2pp.add_tap_parameters_for_ratio_tap_changer(powsybl_net: pypowsybl.network.Network, trafo_table: DataFrame) DataFrame[source]

Comprehensive ratio tap changer parameter calculation

VeraGridEngine.IO.others.pow2pp.calculate_3w_impedance_parameters(trafo_table: DataFrame, conv: Literal['pairwise_min', 'global_max', 'common_ref'] = 'pairwise_min', ref_winding: str = 'hv', Sbase_common: float | None = None) None[source]

Convert star-leg impedances (r1,x1,r2,x2,r3,x3 in ohm) to vk_/vkr_ percent fields.

Parameters

trafo_tablepd.DataFrame

Must contain columns: r1,x1,r2,x2,r3,x3, vn_hv_kv, vn_mv_kv, vn_lv_kv, rated_s1/rated_s2/rated_s3 (MVA)

conv{β€œpairwise_min”,”global_max”,”common_ref”}
Which S-base convention to use:
  • β€œpairwise_min”: use S_base for each pair = min(sn_w1, sn_w2) (powsybl-style)

  • β€œglobal_max”: use S_base = max(sn_hv, sn_mv, sn_lv) for all pairs

  • β€œcommon_ref”: use a single Sbase_common and a single ref_winding for Vref

ref_winding{β€œhv”,”mv”,”lv”}

Used only when conv == β€œcommon_ref”.

Sbase_commonfloat | None

If provided used as Sbase in β€œcommon_ref”; otherwise uses max rated winding.

VeraGridEngine.IO.others.pow2pp.calculate_3w_iron_losses(trafo_table: DataFrame) None[source]

Calculate iron losses for 3-winding transformers

VeraGridEngine.IO.others.pow2pp.calculate_detailed_tap_parameters(trafo_table: DataFrame, idx: int, steps: DataFrame, tap_type: str) None[source]

Map powsybl tap data to pandapower so that the current tap position is accurate. This is only good for the snapshot anaylsis. (tap_pos cannot be changed in

pandapower, the position should be changed in powsybl)

VeraGridEngine.IO.others.pow2pp.calculate_iron_losses_and_open_loop_losses(trafo_table: DataFrame) None[source]

Calculate iron losses with proper defaults

VeraGridEngine.IO.others.pow2pp.calculate_short_circuit_voltage(trafo_table: DataFrame) None[source]

Calculate short circuit voltage parameters for transformers with proper defaults

VeraGridEngine.IO.others.pow2pp.convert_to_pandapower(network: pp.network.Network) pdp.pandapowerNet[source]

Convert pypowsybl network to pandapower network

VeraGridEngine.IO.others.pow2pp.create_buses(pandapower_net: pdp.pandapowerNet, powsybl_net: pp.network.Network) None[source]

Create buses from pypowsybl network, handling UUID suffixes

VeraGridEngine.IO.others.pow2pp.create_generators(pandapower_net: pdp.pandapowerNet, powsybl_net: pp.network.Network) None[source]

Create generators from pypowsybl network, excluding slack generators

VeraGridEngine.IO.others.pow2pp.create_intermediate_bus(pandapower_net: pandapower.pandapowerNet, vl_id: str, powsybl_net) int[source]

Create an intermediate bus for element-element switches

VeraGridEngine.IO.others.pow2pp.create_lines(pandapower_net: pdp.pandapowerNet, powsybl_net: pp.network.Network) None[source]

Create lines from pypowsybl network

VeraGridEngine.IO.others.pow2pp.create_loads(pandapower_net: pdp.pandapowerNet, powsybl_net: pp.network.Network) None[source]

Create loads from pypowsybl network

VeraGridEngine.IO.others.pow2pp.create_or_get_bus_for_node(pandapower_net: pandapower.pandapowerNet, node_id: int, nb_topology, powsybl_net) int[source]

Create or get a pandapower bus for a node

VeraGridEngine.IO.others.pow2pp.find_bus_ids(element_table: DataFrame, pandapower_net: pandapower.pandapowerNet, target_column_name: str = 'bus', column_name_element_table: str = 'bus_id') DataFrame[source]

Simplified version that doesn’t rely on the identifier column

VeraGridEngine.IO.others.pow2pp.get_bus_index(pandapower_net: pdp.pandapowerNet, bus_id: str) Any | None[source]

Get pandapower bus index from powsybl bus ID

VeraGridEngine.IO.others.pow2pp.get_pandapower_bus_index(pandapower_net: pandapower.pandapowerNet, bus_id: str) Any | None[source]

Get pandapower bus index from powsybl bus ID

VeraGridEngine.IO.others.pow2pp.identify_slack_generators(powsybl_net: Network, generators: DataFrame, bus: DataFrame) DataFrame[source]

Identify slack generators based on extensions or other criteria

VeraGridEngine.IO.others.pow2pp.map_element_type(powsybl_type: str) str[source]

Map powsybl element types to pandapower element types

VeraGridEngine.IO.others.pypsa_parser module

class VeraGridEngine.IO.others.pypsa_parser.PyPSAParser[source]

Bases: object

parse() MultiCircuit[source]

Parses the PyPSA network. :return: the VeraGrid circuit object.

VeraGridEngine.IO.others.pypsa_parser.parse_pypsa_hdf5(file_path: str, logger: Logger) MultiCircuit[source]

Parses the HDF5 store file using the PyPSA library. :param file_path: the file path :param logger: a logger to produce warnings and/or errors. :return: the VeraGrid circuit object

VeraGridEngine.IO.others.pypsa_parser.parse_pypsa_netcdf(file_path: str, logger: Logger) MultiCircuit[source]

Parses the netCDF file using the PyPSA library. :param file_path: the file path :param logger: a logger to produce warnings and/or errors. :return: the VeraGrid circuit object

VeraGridEngine.IO.others.pypsa_parser.pypsa2veragrid(network: pypsa.Network, logger: Logger) MultiCircuit[source]
Parameters:
  • network

  • logger

Returns:

VeraGridEngine.IO.others.rte_parser module

VeraGridEngine.IO.others.rte_parser.find_class_name(child: Element)[source]

Try to find the CIM class name :param child: XML element :return: class name

VeraGridEngine.IO.others.rte_parser.find_id(child: Element)[source]

Try to find the ID of an element :param child: XML element :return: RDFID

VeraGridEngine.IO.others.rte_parser.fix_child_result_datatype(child_result: Dict)[source]
VeraGridEngine.IO.others.rte_parser.parse_xml_text(text_lines: List[str]) Dict[source]

Fill the XML into the objects :param text_lines: list of text lines :return Dictionary representing the XML

VeraGridEngine.IO.others.rte_parser.parse_xml_to_dict(xml_element: Element)[source]

Parse element into dictionary :param xml_element: XML element :return: Dictionary representing the XML

VeraGridEngine.IO.others.rte_parser.read_cgmes_files(cim_files: List[str] | str, logger: DataLogger) Dict[str, List[str]][source]

Reads a list of .zip or xml into a dictionary of file name -> list of text lines :param cim_files: list of file names :param logger: DataLogger instance :return: dictionary of file name -> list of text lines

VeraGridEngine.IO.others.rte_parser.rte2veragrid(file_name: str, logger: MultiCircuit'>, <class 'bool'>)[source]

Read the RTE internal grid format :param file_name: xml file name :param logger: Logger :return: MultiCircuit

Module contents