Overview
The pandapower integration provides a conversion function that transforms pandapower networks into PyPowSyBl networks. This allows you to leverage PyPowSyBl’s simulation capabilities with networks created in pandapower, a popular power system analysis tool.Conversion Function
convert_from_pandapower
Convert a pandapower network to a PyPowSyBl network.The pandapower network to convert
A PyPowSyBl Network object with the converted network data
Conversion Details
Network Structure
The converter creates a simplified network structure:- All voltage levels are placed in a single giant substation with ID
's' - Bus-breaker topology is used for all voltage levels
- Voltage level IDs follow the pattern:
'sub_{bus_index}' - Bus IDs follow the pattern:
'bus_{bus_index}'
Element Mapping
The converter handles the following pandapower elements:Buses
Pandapower buses are converted to PyPowSyBl voltage levels and buses:- Each pandapower bus becomes a voltage level with one bus
- Nominal voltage (
vn_kv) is preserved - Voltage limits (
min_vm_pu,max_vm_pu) are converted if present
Loads
Pandapower loads are converted to PyPowSyBl loads:- Active power (
p_mw) and reactive power (q_mvar) setpoints - In-service status determines initial connection
- Load IDs follow the pattern:
'load_{bus}_{index}'
Generators
Three types of pandapower generators are converted:- Regular generators (
gen): Standard synchronous generators with voltage control - External grids (
ext_grid): Treated as generators with slack bus capability - Static generators (
sgen): Converted to generators without voltage regulation
- Active power setpoint (
p_mw) - Voltage setpoint (
vm_pu) for voltage-regulating generators - Reactive power limits (
min_q_mvar,max_q_mvar) when available - Active power limits (
min_p_mw,max_p_mw) with defaults if not specified - Slack weight for participation in slack distribution
- Generator IDs:
'gen_{bus}_{index}'or'sgen_{bus}_{index}'
Slack Bus Handling
The converter automatically identifies the slack bus:- External grids receive slack weights based on their
slack_weightattribute - Regular generators with
slack=Truealso participate in slack distribution - The generator with the highest slack weight receives a slack terminal extension
- All participating generators receive active power control extensions with their distribution keys (droop)
Shunt Compensators
Pandapower shunts are converted to linear shunt compensators:- Conductance and susceptance calculated from
p_mwandq_mvar - Section count based on the
stepattribute - Maximum sections from
max_stepattribute - Shunt IDs:
'shunt_{bus}_{index}'
Lines
Pandapower lines are converted to PyPowSyBl lines:- Resistance and reactance calculated from per-length parameters and line length
- Shunt conductance and susceptance divided equally between both ends
- Current limits derived from
max_i_kaand derating factor (df) - Parallel lines are properly handled with divided impedances
- Line IDs:
'{from_bus}_{to_bus}_{index}'
Transformers
Pandapower two-winding transformers are converted:- Rated voltages calculated considering tap position and tap side
- Impedances calculated from short-circuit parameters
- Magnetizing admittance from no-load parameters
- Tap changer position considered if present
- Parallel transformers supported
- Transformer IDs:
'{hv_bus}_{lv_bus}_{line_count + index}'
Limitations
The conversion has some limitations:- Three-winding transformers are not currently supported
- DC lines and HVDC systems are not supported
- Controllers and automation are not fully preserved
- Network name defaults to
'network'if not set in pandapower - All elements are placed in a single substation
Example Usage
Basic Conversion
Converting Custom Networks
Working with IEEE Test Cases
Combining with Grid2Op
Accessing Network Elements
Notes
The pandapower library must be installed to use this conversion function. If pandapower is not installed, the function will raise a
PyPowsyblError.Element naming conventions are designed to be compatible with Grid2Op requirements. If elements have explicit names in pandapower, those names are preserved; otherwise, systematic IDs are generated.
