Skip to main content

Data Generation Kit

Project description

Docs Coverage

Overview

This library is brought to you by the GridFM team to generate power flow data to train machine learning and foundation models.



Comparison with other PF datasets/ libraries

Feature GraphNeuralSolver [1] OPFData [2] OPFLearn [3] PowerFlowNet [4] TypedGNN [5] PF△ [6] gridfm-datakit [7]
Generator Profile
N-1
> 1000 Buses
N-k, k > 1
Load Scenarios from Real World Data
Multi-processing and scalable to very large (1M+) datasets

Installation

  1. ⭐ Star the repository on GitHub to support the project!

  2. Run:

    python -m pip install --upgrade pip  # Upgrade pip
    pip install gridfm-datakit
    

Getting Started

Option 1: Run data gen using interactive interface

To use the interactive interface, either open scripts/interactive_interface.ipynb or copy the following into a Jupyter notebook and follow the instructions:

from gridfm_datakit.interactive_utils import interactive_interface
interactive_interface()

Option 2: Using the command line interface

Run the data generation routine from the command line:

gridfm_datakit path/to/config.yaml

Configuration Overview

Refer to the sections Network, Load Scenarios, and Topology perturbations for a description of the configuration parameters.

Sample configuration files are provided in scripts/config, e.g. default.yaml:

network:
  name: "case24_ieee_rts" # Name of the power grid network (without extension)
  source: "pglib" # Data source for the grid; options: pglib, pandapower, file
  network_dir: "scripts/grids" # if using source "file", this is the directory containing the network file (relative to the project root)


load:
  generator: "agg_load_profile" # Name of the load generator; options: agg_load_profile, powergraph
  agg_profile: "default" # Name of the aggregated load profile
  scenarios: 200 # Number of different load scenarios to generate
  # WARNING: the following parameters are only used if generator is "agg_load_profile"
  # if using generator "powergraph", these parameters are ignored
  sigma: 0.05 # max local noise
  change_reactive_power: true # If true, changes reactive power of loads. If False, keeps the ones from the case file
  global_range: 0.4 # Range of the global scaling factor. used to set the lower bound of the scaling factor
  max_scaling_factor: 4.0 # Max upper bound of the global scaling factor
  step_size: 0.025 # Step size when finding the upper bound of the global scaling factor
  start_scaling_factor: 0.8 # Initial value of the global scaling factor

topology_perturbation:
  type: "random" # Type of topology generator; options: n_minus_k, random, none
  # WARNING: the following parameters are only used if type is not "none"
  k: 1 # Maximum number of components to drop in each perturbation
  n_topology_variants: 5 # Number of unique perturbed topologies per scenario
  elements: ["line", "trafo", "gen", "sgen"] # elements to perturb options: line, trafo, gen, sgen

settings:
  num_processes: 10 # Number of parallel processes to use
  data_dir: "./data_out" # Directory to save generated data relative to the project root
  large_chunk_size: 50 # Number of load scenarios processed before saving
  no_stats: false # If true, disables statistical calculations
  overwrite: true # If true, overwrites existing files, if false, appends to files (note that bus_params.csv, edge_params.csv, scenarios_{load.generator}.csv and scenarios_{load.generator}.html will still be overwritten)
  mode: "pf" # Mode of the script; options: contingency, pf

Output Files

The data generation process produces several output files in the specified data directory:

  • tqdm.log: Progress bar log.
  • error.log: Log of the errors raised during data generation.
  • args.log: Copy of the config file used.
  • pf_node.csv: Data related to the nodes (buses) in the network, such as voltage levels and power injections.
  • pf_edge.csv: Branch admittance matrix for each pf case.
  • branch_idx_removed.csv: List of the indices of the branches (lines and transformers) that got removed when perturbing the topologies.
  • edge_params.csv: Branch admittance matrix and branch rate limits for the unperturbed topology.
  • bus_params.csv: Parameters for the buses (voltage limits and the base voltage).
  • scenario_{args.load.generator}.csv: Load element-level load profile obtained after using the load scenario generator.
  • scenario_{args.load.generator}.html: Plots of the element-level load profile.
  • scenario_{args.load.generator}.log: If generator is "agg_load_profile", stores the upper and lower bounds for the global scaling factor.
  • stats.csv: Stats about the generated data.
  • stats_plot.html: Plots of the stats about the generated data.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gridfm_datakit-0.0.2b0.tar.gz (369.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gridfm_datakit-0.0.2b0-py3-none-any.whl (373.4 kB view details)

Uploaded Python 3

File details

Details for the file gridfm_datakit-0.0.2b0.tar.gz.

File metadata

  • Download URL: gridfm_datakit-0.0.2b0.tar.gz
  • Upload date:
  • Size: 369.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gridfm_datakit-0.0.2b0.tar.gz
Algorithm Hash digest
SHA256 78faf501feb7e32e05b4b5c2cdfa2774d399aace5ba1295d5595100f6b121034
MD5 437905e6edf399d2050c43c9502d8844
BLAKE2b-256 a409d11caffc524382e64cfea42fd56fa6f16936cb6242facad3eb88f10add46

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridfm_datakit-0.0.2b0.tar.gz:

Publisher: release.yaml on gridfm/gridfm-datakit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gridfm_datakit-0.0.2b0-py3-none-any.whl.

File metadata

File hashes

Hashes for gridfm_datakit-0.0.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 f12f2698393a64c5931dcc06214b47282c04def267ce892ec02cd81b6e11ac04
MD5 e5d408af5c786710331959a521e3bad2
BLAKE2b-256 40bac19464277b574c2b6b219070127945b26c095d195030148edc0b65ccf8df

See more details on using hashes here.

Provenance

The following attestation bundles were made for gridfm_datakit-0.0.2b0-py3-none-any.whl:

Publisher: release.yaml on gridfm/gridfm-datakit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page