Skip to content

โšก Getting Started with grid-reducer

Welcome! Follow the steps below to get grid-reducer up and running locally.
We recommend using a Python virtual environment for a clean install ๐Ÿ”’๐Ÿ.

๐Ÿงช Step 1: Set Up a Python Environment

To avoid dependency conflicts, create and activate a virtual environment.

You can use any tool of your choice โ€” here are a few popular options:

๐ŸŸข Option A: Using venv (Standard Library)
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
๐Ÿ”ต Option B: Using conda
conda create -n grid-reducer-env python=3.11
conda activate grid-reducer-env

๐Ÿš€ Step 2: Install the Project Locally

Install the project in editable mode so changes to the code reflect immediately:

pip install grid_reducer

โœ… This will also install all required dependencies.

๐Ÿ›  Example CLI Usage

Once installed, you can use command line interface. Run grid --help to see all the available command options.

Here is a minimal example to reduce OpenDSS model.

grid reduce -f Master.dss

Example Python Usage

You can also reduce the feeder model through python scripts.

Here is a minimal example to reduce OpenDSS feeder model using Python Script.

from pathlib import Path

from grid_reducer.reducer import OpenDSSModelReducer

file_path = "master.dss"
reducer = OpenDSSModelReducer(master_dss_file=file_path)
reduced_ckt = reducer.reduce(transform_coordinate=True)

out_folder = Path("outputs")
out_folder.mkdir(parents=True, exist_ok=True)
original_circuit_file = out_folder / "original_ckt.dss"
reduced_circuit_file = out_folder / "reduced_ckt.dss"
reducer.export_original_ckt(original_circuit_file)
reducer.export(reduced_ckt, reduced_circuit_file)

๐Ÿ“Œ Notes

  • This is the recommended way to use the project during development.
  • In the future, the project may support installation via:
pip install grid-reducer

Stay tuned for updates! ๐Ÿ“ฌ

Need help? Feel free to open an issue or reach out to the maintainers. ๐Ÿ’ฌ