Overview
The Grid2Op integration provides a backend implementation that allows Grid2Op environments to use PyPowSyBl as their power flow solver. This enables Grid2Op agents to leverage the robust simulation capabilities of PowSyBl for training and evaluation.Backend
Backend Class
The main class for Grid2Op integration.The PyPowSyBl network to use for the backend
Whether to consider reactive flow in open branches
Whether to check for isolated and disconnected injections during validation
Number of buses per voltage level in the bus-breaker topology
Whether to connect all elements to the first bus initially
Methods
network
Get the underlying PyPowSyBl network.The PyPowSyBl network object
get_string_value
Retrieve string values from the backend (e.g., element names).The type of string value to retrieve
Array of string values
get_integer_value
Retrieve integer values from the backend (e.g., bus numbers, topology vector).The type of integer value to retrieve
Array of integer values
get_double_value
Retrieve double/float values from the backend (e.g., power flows, voltages).The type of double value to retrieve
Array of float values
update_double_value
Update double/float values in the backend (e.g., injection setpoints).The type of value to update
Array of new values
Binary array indicating which elements have changed (1 for changed, 0 for unchanged)
update_integer_value
Update integer values in the backend (e.g., bus connections).The type of value to update
Array of new values
Binary array indicating which elements have changed (1 for changed, 0 for unchanged)
check_isolated_and_disconnected_injections
Check if there are any isolated or disconnected injections in the network.True if the network has no isolated or disconnected injections, False otherwise
run_pf
Run a power flow calculation on the network.Whether to run DC power flow (True) or AC power flow (False)
Optional load flow parameters to customize the calculation
List of component results, one per connected component in the network
close
Close the backend and free associated resources.Context Manager Support
The Backend supports Python’s context manager protocol for automatic resource management:Enumerations
StringValueType
Enumeration of string value types that can be retrieved from the backend.| Value | Description |
|---|---|
VOLTAGE_LEVEL_NAME | Names of voltage levels |
LOAD_NAME | Names of loads |
GENERATOR_NAME | Names of generators |
SHUNT_NAME | Names of shunt compensators |
BRANCH_NAME | Names of branches (lines and transformers) |
IntegerValueType
Enumeration of integer value types that can be retrieved from the backend.| Value | Description |
|---|---|
LOAD_VOLTAGE_LEVEL_NUM | Voltage level numbers for loads |
GENERATOR_VOLTAGE_LEVEL_NUM | Voltage level numbers for generators |
SHUNT_VOLTAGE_LEVEL_NUM | Voltage level numbers for shunts |
BRANCH_VOLTAGE_LEVEL_NUM_1 | Voltage level numbers for branch side 1 |
BRANCH_VOLTAGE_LEVEL_NUM_2 | Voltage level numbers for branch side 2 |
SHUNT_LOCAL_BUS | Local bus numbers for shunts |
TOPO_VECT | Topology vector (bus connections for all elements) |
DoubleValueType
Enumeration of double value types that can be retrieved from the backend.| Value | Description |
|---|---|
LOAD_P | Load active power (MW) |
LOAD_Q | Load reactive power (MVar) |
LOAD_V | Load voltage magnitude (kV) |
LOAD_ANGLE | Load voltage angle (degrees) |
GENERATOR_P | Generator active power (MW) |
GENERATOR_Q | Generator reactive power (MVar) |
GENERATOR_V | Generator voltage magnitude (kV) |
GENERATOR_ANGLE | Generator voltage angle (degrees) |
SHUNT_P | Shunt active power (MW) |
SHUNT_Q | Shunt reactive power (MVar) |
SHUNT_V | Shunt voltage magnitude (kV) |
SHUNT_ANGLE | Shunt voltage angle (degrees) |
BRANCH_P1 | Branch active power at side 1 (MW) |
BRANCH_P2 | Branch active power at side 2 (MW) |
BRANCH_Q1 | Branch reactive power at side 1 (MVar) |
BRANCH_Q2 | Branch reactive power at side 2 (MVar) |
BRANCH_V1 | Branch voltage magnitude at side 1 (kV) |
BRANCH_V2 | Branch voltage magnitude at side 2 (kV) |
BRANCH_ANGLE1 | Branch voltage angle at side 1 (degrees) |
BRANCH_ANGLE2 | Branch voltage angle at side 2 (degrees) |
BRANCH_I1 | Branch current at side 1 (A) |
BRANCH_I2 | Branch current at side 2 (A) |
BRANCH_PERMANENT_LIMIT_A | Branch permanent current limit (A) |
UpdateDoubleValueType
Enumeration of double value types that can be updated in the backend.| Value | Description |
|---|---|
UPDATE_LOAD_P | Update load active power setpoint |
UPDATE_LOAD_Q | Update load reactive power setpoint |
UPDATE_GENERATOR_P | Update generator active power setpoint |
UPDATE_GENERATOR_V | Update generator voltage setpoint |
UpdateIntegerValueType
Enumeration of integer value types that can be updated in the backend.| Value | Description |
|---|---|
UPDATE_LOAD_BUS | Update load bus connection |
UPDATE_GENERATOR_BUS | Update generator bus connection |
UPDATE_SHUNT_BUS | Update shunt bus connection |
UPDATE_BRANCH_BUS1 | Update branch side 1 bus connection |
UPDATE_BRANCH_BUS2 | Update branch side 2 bus connection |
