pyeplan


Namepyeplan JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryPython library for planning and operation of resilient microgrids.
upload_time2025-07-13 19:23:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseApache Software License
keywords energy planning microgrids optimization resilience power-systems
VCS
bugtrack_url
requirements pandas numpy openpyxl pyomo networkx matplotlib mplleaflet scikit-learn timezonefinder ipython jupyter
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyEPlan: A Python-based Energy Planning tool

[![PyPI version](https://img.shields.io/pypi/v/pyeplan.svg)](https://pypi.python.org/pypi/pyeplan) [![image](https://img.shields.io/github/license/SPS-L/pyeplan)](LICENSE.txt) [![image](https://zenodo.org/badge/DOI/10.5281/zenodo.3894705.svg)](https://doi.org/10.5281/zenodo.3894705)

PyEPlan is a [free software](http://www.gnu.org/philosophy/free-sw.en.html) toolbox for designing resilient mini-grids in developing countries. The initial development was funded under the UKRI GCRF project [CRESUM-HYRES](https://cera.leeds.ac.uk/cresum-hyres/) at the [University of Leeds](https://leeds.ac.uk/), but is now supported and co-developed by people in different universities (such as [CUT](https://sps.cut.ac.cy), [ICL](https://www.imperial.ac.uk/)).

## Overview

PyEPlan is a comprehensive Python library designed for the planning and operation of resilient microgrids. It provides tools for data processing, network routing, and investment/operation optimization of microgrid systems, with particular focus on applications in developing countries and rural electrification projects.

## Key Features

- **Data Processing & Resource Assessment**: Integration with PVGIS API for solar irradiance and wind speed data
- **Network Topology Optimization**: Minimum spanning tree algorithms for optimal network design
- **Investment & Operation Optimization**: Mixed-integer linear programming for microgrid planning
- **Multi-Objective Optimization**: Cost, reliability, and sustainability optimization
- **Geographic Information System**: GIS capabilities for location-based planning
- **Battery Energy Storage**: Comprehensive modeling of energy storage systems
- **Renewable Energy Integration**: Support for solar PV, wind turbines, and hybrid systems
- **Multiple Solver Support**: GLPK, CBC, IPOPT, Gurobi optimization solvers

## Installation

### Prerequisites

- Python 3.7 or higher
- pip package manager

### From PyPI (Recommended)

```bash
pip install pyeplan
```

### From Source

```bash
git clone https://github.com/SPS-L/pyeplan.git
cd pyeplan
pip install -e .
```

### Dependencies

PyEPlan requires the following Python packages:
- pandas
- numpy
- networkx
- matplotlib
- pyomo
- timezonefinder
- scikit-learn
- mplleaflet

These will be automatically installed when installing PyEPlan.

## Quick Start

### Basic Usage

```python
import pyeplan

# 1. Data Processing
data_sys = pyeplan.datsys("input_folder", lat=0.25, lon=32.40, year=2016)
data_sys.data_extract()
data_sys.kmeans_clust()

# 2. Network Routing
route_sys = pyeplan.rousys("input_folder", crs=35, typ=7, vbase=415)
route_sys.min_spn_tre()

# 3. Investment and Operation Optimization
inv_sys = pyeplan.inosys("input_folder", ref_bus=0)
inv_sys.solve(solver='glpk', invest=True, onlyopr=False)

# 4. View Results
inv_sys.resCost()
inv_sys.resSolar()
inv_sys.resWind()
inv_sys.resBat()
```

### Input Data Structure

PyEPlan requires specific CSV files in your input folder:

**Required Files:**
- `mgpc_dist.xlsx`: Load point and load level data
- `cgen_dist.csv`: Conventional generator candidate data
- `egen_dist.csv`: Existing conventional generator data
- `csol_dist.csv`: Solar PV candidate data
- `esol_dist.csv`: Existing solar PV data
- `cwin_dist.csv`: Wind turbine candidate data
- `ewin_dist.csv`: Existing wind turbine data
- `cbat_dist.csv`: Battery storage candidate data
- `elin_dist.csv`: Electrical line data
- `pdem_dist.csv`: Active power demand profiles
- `qdem_dist.csv`: Reactive power demand profiles
- `psol_dist.csv`: Solar power scenarios
- `pwin_dist.csv`: Wind power scenarios
- `dtim_dist.csv`: Time duration for each scenario

## Core Modules

### 1. Data Processing (`datsys`)

Handles renewable energy resource assessment and data preprocessing:

```python
from pyeplan.dataproc import datsys

# Initialize data processing system
data_sys = datsys(
    inp_folder="input_folder",
    lat=0.25,           # Latitude in decimal degrees
    lon=32.40,          # Longitude in decimal degrees
    year=2016,          # Year for data collection
    pvcalc=1,           # PV calculation method (0=radiation, 1=power+radiation)
    pp=50,              # Nominal power of PV system in kW
    n_clust=5,          # Number of clusters for time series
    sbase=1000          # Base apparent power in kW
)

# Extract and process time series data
data_sys.data_extract()

# Perform K-means clustering for scenario reduction
data_sys.kmeans_clust()
```

### 2. Network Routing (`rousys`)

Implements network topology optimization using minimum spanning tree algorithms:

```python
from pyeplan.routing import rousys

# Initialize routing system
route_sys = rousys(
    inp_folder="input_folder",
    crs=35,             # Cross section of cables in mm²
    typ=7,              # Type of cables
    vbase=415,          # Line-to-line voltage in V
    sbase=1             # Base apparent power in kW
)

# Generate minimum spanning tree network topology
route_sys.min_spn_tre()
```

### 3. Investment & Operation Optimization (`inosys`)

Formulates and solves mixed-integer linear programming problems:

```python
from pyeplan.investoper import inosys

# Initialize optimization system
inv_sys = inosys(
    inp_folder="input_folder",
    ref_bus=0,          # Reference bus number
    dshed_cost=1000000, # Demand shedding cost
    rshed_cost=500,     # Renewable shedding cost
    vmin=0.85,          # Minimum voltage limit
    vmax=1.15,          # Maximum voltage limit
    sbase=1             # Base apparent power in kW
)

# Solve optimization problem
inv_sys.solve(
    solver='glpk',      # Optimization solver
    invest=True,        # Include investment decisions
    onlyopr=False       # Solve both investment and operation
)

# View results
inv_sys.resCost()       # Total costs
inv_sys.resSolar()      # Solar investment results
inv_sys.resWind()       # Wind investment results
inv_sys.resBat()        # Battery investment results
inv_sys.resConv()       # Conventional generator results
inv_sys.resCurt()       # Curtailment results
```

## Mathematical Formulation

The optimization problem minimizes total system cost:

```
min Z = C_inv + C_opr + C_shed
```

Subject to constraints:
- Power balance constraints (active and reactive)
- Generator capacity limits
- Battery storage constraints
- Network flow constraints
- Voltage limits
- Investment constraints

Where:
- `C_inv`: Investment costs (generators, storage, renewables)
- `C_opr`: Operational costs (fuel, maintenance, etc.)
- `C_shed`: Penalty costs for demand shedding and curtailment

## Examples

### Example 1: 5-Bus Microgrid Planning

```python
import pyeplan

# Complete microgrid planning workflow
data_sys = pyeplan.datsys("examples/5_bus/", lat=0.25, lon=32.40, year=2016)
data_sys.data_extract()
data_sys.kmeans_clust()

route_sys = pyeplan.rousys("examples/5_bus/", crs=35, typ=7, vbase=415)
route_sys.min_spn_tre()

inv_sys = pyeplan.inosys("examples/5_bus/", ref_bus=0)
inv_sys.solve(solver='glpk', invest=True, onlyopr=False)
inv_sys.resCost()
```

### Example 2: Standalone Hybrid System

```python
import pyeplan

# SHS (Standalone Hybrid System) planning
data_sys = pyeplan.datsys("examples/wat_inv/", lat=0.25, lon=32.40, year=2016)
data_sys.data_extract()
data_sys.kmeans_clust()

inv_sys = pyeplan.inosys("examples/wat_inv/", ref_bus=0)
inv_sys.solve(solver='glpk', invest=True, onlyopr=False)
inv_sys.resSolar()
inv_sys.resBat()
```

## Output Files

PyEPlan generates comprehensive output files in the `results/` directory:

**Investment Results:**
- `xg.csv`: Conventional generator investments
- `xs.csv`: Solar PV investments
- `xw.csv`: Wind turbine investments
- `xb.csv`: Battery storage investments

**Operational Results:**
- `pcg.csv`, `qcg.csv`: Conventional generator operation
- `pcs.csv`, `qcs.csv`: Solar PV operation
- `pcw.csv`, `qcw.csv`: Wind turbine operation
- `pbc.csv`, `pbd.csv`: Battery charging/discharging
- `vol.csv`: Bus voltages
- `pel.csv`, `qel.csv`: Line flows

**Cost Results:**
- `obj.csv`: Total cost breakdown

## Documentation

- **API Reference**: [https://pyeplan.sps-lab.org/](https://pyeplan.sps-lab.org/)
- **User Guide**: Available in the `docs/` directory
- **Examples**: Jupyter notebooks in the `examples/` directory

## Testing

PyEPlan includes comprehensive unit tests covering all major functionality. The test suite ensures code quality and reliability.

### Test Structure

The tests are organized in the `tests/` directory:

- **`test_dataproc.py`**: Data processing module tests (353 lines)
  - PVGIS API integration
  - Time series clustering
  - Data preprocessing and file generation
  - Power factor calculations
  - Timezone handling

- **`test_routing.py`**: Network routing module tests (385 lines)
  - Minimum spanning tree algorithm
  - Geographic distance calculations
  - Cable parameter calculations
  - Network topology generation

- **`test_investoper.py`**: Investment/operation optimization tests (626 lines)
  - Model initialization and data loading
  - Optimization problem formulation
  - Solver integration
  - Result processing and output generation

- **`test_pyeplan_integration.py`**: Integration tests (539 lines)
  - End-to-end workflows
  - Module interactions
  - Real-world example scenarios
  - Error handling and edge cases

### Running Tests

#### Prerequisites

```bash
# Install test dependencies
pip install -r requirements.txt
```

#### Quick Test Run

```bash
# Run all tests
python tests/run_tests.py

# Run with verbose output
python tests/run_tests.py --verbose

# Run specific test module
python tests/run_tests.py --module test_dataproc

# List available test modules
python tests/run_tests.py --list
```

#### Using unittest directly

```bash
# Run all tests
python -m unittest discover tests

# Run specific test file
python -m unittest tests.test_dataproc

# Run specific test class
python -m unittest tests.test_dataproc.TestDatsys

# Run specific test method
python -m unittest tests.test_dataproc.TestDatsys.test_init_basic_parameters
```

#### Using pytest (recommended)

```bash
# Install pytest
pip install pytest

# Run all tests
pytest tests/

# Run with verbose output
pytest tests/ -v

# Run specific test file
pytest tests/test_dataproc.py

# Run tests matching pattern
pytest tests/ -k "test_init"
```

### Test Coverage

The test suite covers:

✅ **Data Processing Module**
- Initialization with various parameters
- PVGIS API integration (mocked)
- Time series data extraction and clustering
- File generation and output validation
- Error handling for invalid inputs

✅ **Network Routing Module**
- Cable parameter calculations
- Minimum spanning tree generation
- Geographic distance calculations
- Network topology validation

✅ **Investment/Operation Module**
- Model initialization and data loading
- Optimization problem formulation (mocked)
- Result processing and output generation
- Utility functions

✅ **Integration Tests**
- Complete workflow testing
- Module interaction testing
- Real example data processing
- Error handling and edge cases

### Mocking Strategy

Tests use mocking to ensure reliability:
- **PVGIS API**: Mocked to avoid network calls
- **Optimization Solvers**: Mocked to avoid solver dependencies
- **File System**: Uses temporary directories
- **Network Operations**: Mocked where appropriate

### Continuous Integration

Tests are designed for CI/CD environments:
- No external network dependencies
- No external solver dependencies
- Fast execution with minimal data processing
- Clear pass/fail criteria

For detailed testing information, see [tests/README.md](tests/README.md).

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.

## Citation

If you use PyEPlan in your research, please cite:

```bibtex
@software{pyeplan2020,
  title={PyEPlan: A Python-based Energy Planning tool},
  author={Dehghan, Shahab and Nakiganda, Agnes and Aristidou, Petros},
  year={2020},
  url={https://github.com/SPS-L/pyeplan},
  doi={10.5281/zenodo.3894705}
}
```

## References

- Dehghan, S., Nakiganda, A., & Aristidou, P. (2020). "Planning and Operation of Resilient Microgrids: A Comprehensive Review." IEEE Transactions on Smart Grid.
- Nakiganda, A., Dehghan, S., & Aristidou, P. (2021). "PyEPlan: An Open-Source Framework for Microgrid Planning and Operation." IEEE Power & Energy Society General Meeting.

## License

This project is licensed under the Apache Software License - see the [LICENSE.txt](LICENSE.txt) file for details.

## Support

- **Email**: s.dehghan@ieee.org
- **Website**: [https://pyeplan.sps-lab.org/](https://pyeplan.sps-lab.org/)
- **GitHub Issues**: [https://github.com/SPS-L/pyeplan/issues](https://github.com/SPS-L/pyeplan/issues)

## Acknowledgments

- UKRI GCRF project [CRESUM-HYRES](https://cera.leeds.ac.uk/cresum-hyres/)
- [University of Leeds](https://leeds.ac.uk/)
- [Cyprus University of Technology](https://sps.cut.ac.cy)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyeplan",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "energy, planning, microgrids, optimization, resilience, power-systems",
    "author": null,
    "author_email": "Shahab Dehghan <s.dehghan@ieee.org>, Agnes Nakiganda <a.m.nakiganda@gmail.com>, Petros Aristidou <petros.aristidou@cut.ac.cy>",
    "download_url": "https://files.pythonhosted.org/packages/93/6e/2dd5897615c1941db9a799a6d8e017df92516b2bf7028012ea68372bc2c1/pyeplan-1.1.0.tar.gz",
    "platform": null,
    "description": "# PyEPlan: A Python-based Energy Planning tool\n\n[![PyPI version](https://img.shields.io/pypi/v/pyeplan.svg)](https://pypi.python.org/pypi/pyeplan) [![image](https://img.shields.io/github/license/SPS-L/pyeplan)](LICENSE.txt) [![image](https://zenodo.org/badge/DOI/10.5281/zenodo.3894705.svg)](https://doi.org/10.5281/zenodo.3894705)\n\nPyEPlan is a [free software](http://www.gnu.org/philosophy/free-sw.en.html) toolbox for designing resilient mini-grids in developing countries. The initial development was funded under the UKRI GCRF project [CRESUM-HYRES](https://cera.leeds.ac.uk/cresum-hyres/) at the [University of Leeds](https://leeds.ac.uk/), but is now supported and co-developed by people in different universities (such as [CUT](https://sps.cut.ac.cy), [ICL](https://www.imperial.ac.uk/)).\n\n## Overview\n\nPyEPlan is a comprehensive Python library designed for the planning and operation of resilient microgrids. It provides tools for data processing, network routing, and investment/operation optimization of microgrid systems, with particular focus on applications in developing countries and rural electrification projects.\n\n## Key Features\n\n- **Data Processing & Resource Assessment**: Integration with PVGIS API for solar irradiance and wind speed data\n- **Network Topology Optimization**: Minimum spanning tree algorithms for optimal network design\n- **Investment & Operation Optimization**: Mixed-integer linear programming for microgrid planning\n- **Multi-Objective Optimization**: Cost, reliability, and sustainability optimization\n- **Geographic Information System**: GIS capabilities for location-based planning\n- **Battery Energy Storage**: Comprehensive modeling of energy storage systems\n- **Renewable Energy Integration**: Support for solar PV, wind turbines, and hybrid systems\n- **Multiple Solver Support**: GLPK, CBC, IPOPT, Gurobi optimization solvers\n\n## Installation\n\n### Prerequisites\n\n- Python 3.7 or higher\n- pip package manager\n\n### From PyPI (Recommended)\n\n```bash\npip install pyeplan\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/SPS-L/pyeplan.git\ncd pyeplan\npip install -e .\n```\n\n### Dependencies\n\nPyEPlan requires the following Python packages:\n- pandas\n- numpy\n- networkx\n- matplotlib\n- pyomo\n- timezonefinder\n- scikit-learn\n- mplleaflet\n\nThese will be automatically installed when installing PyEPlan.\n\n## Quick Start\n\n### Basic Usage\n\n```python\nimport pyeplan\n\n# 1. Data Processing\ndata_sys = pyeplan.datsys(\"input_folder\", lat=0.25, lon=32.40, year=2016)\ndata_sys.data_extract()\ndata_sys.kmeans_clust()\n\n# 2. Network Routing\nroute_sys = pyeplan.rousys(\"input_folder\", crs=35, typ=7, vbase=415)\nroute_sys.min_spn_tre()\n\n# 3. Investment and Operation Optimization\ninv_sys = pyeplan.inosys(\"input_folder\", ref_bus=0)\ninv_sys.solve(solver='glpk', invest=True, onlyopr=False)\n\n# 4. View Results\ninv_sys.resCost()\ninv_sys.resSolar()\ninv_sys.resWind()\ninv_sys.resBat()\n```\n\n### Input Data Structure\n\nPyEPlan requires specific CSV files in your input folder:\n\n**Required Files:**\n- `mgpc_dist.xlsx`: Load point and load level data\n- `cgen_dist.csv`: Conventional generator candidate data\n- `egen_dist.csv`: Existing conventional generator data\n- `csol_dist.csv`: Solar PV candidate data\n- `esol_dist.csv`: Existing solar PV data\n- `cwin_dist.csv`: Wind turbine candidate data\n- `ewin_dist.csv`: Existing wind turbine data\n- `cbat_dist.csv`: Battery storage candidate data\n- `elin_dist.csv`: Electrical line data\n- `pdem_dist.csv`: Active power demand profiles\n- `qdem_dist.csv`: Reactive power demand profiles\n- `psol_dist.csv`: Solar power scenarios\n- `pwin_dist.csv`: Wind power scenarios\n- `dtim_dist.csv`: Time duration for each scenario\n\n## Core Modules\n\n### 1. Data Processing (`datsys`)\n\nHandles renewable energy resource assessment and data preprocessing:\n\n```python\nfrom pyeplan.dataproc import datsys\n\n# Initialize data processing system\ndata_sys = datsys(\n    inp_folder=\"input_folder\",\n    lat=0.25,           # Latitude in decimal degrees\n    lon=32.40,          # Longitude in decimal degrees\n    year=2016,          # Year for data collection\n    pvcalc=1,           # PV calculation method (0=radiation, 1=power+radiation)\n    pp=50,              # Nominal power of PV system in kW\n    n_clust=5,          # Number of clusters for time series\n    sbase=1000          # Base apparent power in kW\n)\n\n# Extract and process time series data\ndata_sys.data_extract()\n\n# Perform K-means clustering for scenario reduction\ndata_sys.kmeans_clust()\n```\n\n### 2. Network Routing (`rousys`)\n\nImplements network topology optimization using minimum spanning tree algorithms:\n\n```python\nfrom pyeplan.routing import rousys\n\n# Initialize routing system\nroute_sys = rousys(\n    inp_folder=\"input_folder\",\n    crs=35,             # Cross section of cables in mm\u00b2\n    typ=7,              # Type of cables\n    vbase=415,          # Line-to-line voltage in V\n    sbase=1             # Base apparent power in kW\n)\n\n# Generate minimum spanning tree network topology\nroute_sys.min_spn_tre()\n```\n\n### 3. Investment & Operation Optimization (`inosys`)\n\nFormulates and solves mixed-integer linear programming problems:\n\n```python\nfrom pyeplan.investoper import inosys\n\n# Initialize optimization system\ninv_sys = inosys(\n    inp_folder=\"input_folder\",\n    ref_bus=0,          # Reference bus number\n    dshed_cost=1000000, # Demand shedding cost\n    rshed_cost=500,     # Renewable shedding cost\n    vmin=0.85,          # Minimum voltage limit\n    vmax=1.15,          # Maximum voltage limit\n    sbase=1             # Base apparent power in kW\n)\n\n# Solve optimization problem\ninv_sys.solve(\n    solver='glpk',      # Optimization solver\n    invest=True,        # Include investment decisions\n    onlyopr=False       # Solve both investment and operation\n)\n\n# View results\ninv_sys.resCost()       # Total costs\ninv_sys.resSolar()      # Solar investment results\ninv_sys.resWind()       # Wind investment results\ninv_sys.resBat()        # Battery investment results\ninv_sys.resConv()       # Conventional generator results\ninv_sys.resCurt()       # Curtailment results\n```\n\n## Mathematical Formulation\n\nThe optimization problem minimizes total system cost:\n\n```\nmin Z = C_inv + C_opr + C_shed\n```\n\nSubject to constraints:\n- Power balance constraints (active and reactive)\n- Generator capacity limits\n- Battery storage constraints\n- Network flow constraints\n- Voltage limits\n- Investment constraints\n\nWhere:\n- `C_inv`: Investment costs (generators, storage, renewables)\n- `C_opr`: Operational costs (fuel, maintenance, etc.)\n- `C_shed`: Penalty costs for demand shedding and curtailment\n\n## Examples\n\n### Example 1: 5-Bus Microgrid Planning\n\n```python\nimport pyeplan\n\n# Complete microgrid planning workflow\ndata_sys = pyeplan.datsys(\"examples/5_bus/\", lat=0.25, lon=32.40, year=2016)\ndata_sys.data_extract()\ndata_sys.kmeans_clust()\n\nroute_sys = pyeplan.rousys(\"examples/5_bus/\", crs=35, typ=7, vbase=415)\nroute_sys.min_spn_tre()\n\ninv_sys = pyeplan.inosys(\"examples/5_bus/\", ref_bus=0)\ninv_sys.solve(solver='glpk', invest=True, onlyopr=False)\ninv_sys.resCost()\n```\n\n### Example 2: Standalone Hybrid System\n\n```python\nimport pyeplan\n\n# SHS (Standalone Hybrid System) planning\ndata_sys = pyeplan.datsys(\"examples/wat_inv/\", lat=0.25, lon=32.40, year=2016)\ndata_sys.data_extract()\ndata_sys.kmeans_clust()\n\ninv_sys = pyeplan.inosys(\"examples/wat_inv/\", ref_bus=0)\ninv_sys.solve(solver='glpk', invest=True, onlyopr=False)\ninv_sys.resSolar()\ninv_sys.resBat()\n```\n\n## Output Files\n\nPyEPlan generates comprehensive output files in the `results/` directory:\n\n**Investment Results:**\n- `xg.csv`: Conventional generator investments\n- `xs.csv`: Solar PV investments\n- `xw.csv`: Wind turbine investments\n- `xb.csv`: Battery storage investments\n\n**Operational Results:**\n- `pcg.csv`, `qcg.csv`: Conventional generator operation\n- `pcs.csv`, `qcs.csv`: Solar PV operation\n- `pcw.csv`, `qcw.csv`: Wind turbine operation\n- `pbc.csv`, `pbd.csv`: Battery charging/discharging\n- `vol.csv`: Bus voltages\n- `pel.csv`, `qel.csv`: Line flows\n\n**Cost Results:**\n- `obj.csv`: Total cost breakdown\n\n## Documentation\n\n- **API Reference**: [https://pyeplan.sps-lab.org/](https://pyeplan.sps-lab.org/)\n- **User Guide**: Available in the `docs/` directory\n- **Examples**: Jupyter notebooks in the `examples/` directory\n\n## Testing\n\nPyEPlan includes comprehensive unit tests covering all major functionality. The test suite ensures code quality and reliability.\n\n### Test Structure\n\nThe tests are organized in the `tests/` directory:\n\n- **`test_dataproc.py`**: Data processing module tests (353 lines)\n  - PVGIS API integration\n  - Time series clustering\n  - Data preprocessing and file generation\n  - Power factor calculations\n  - Timezone handling\n\n- **`test_routing.py`**: Network routing module tests (385 lines)\n  - Minimum spanning tree algorithm\n  - Geographic distance calculations\n  - Cable parameter calculations\n  - Network topology generation\n\n- **`test_investoper.py`**: Investment/operation optimization tests (626 lines)\n  - Model initialization and data loading\n  - Optimization problem formulation\n  - Solver integration\n  - Result processing and output generation\n\n- **`test_pyeplan_integration.py`**: Integration tests (539 lines)\n  - End-to-end workflows\n  - Module interactions\n  - Real-world example scenarios\n  - Error handling and edge cases\n\n### Running Tests\n\n#### Prerequisites\n\n```bash\n# Install test dependencies\npip install -r requirements.txt\n```\n\n#### Quick Test Run\n\n```bash\n# Run all tests\npython tests/run_tests.py\n\n# Run with verbose output\npython tests/run_tests.py --verbose\n\n# Run specific test module\npython tests/run_tests.py --module test_dataproc\n\n# List available test modules\npython tests/run_tests.py --list\n```\n\n#### Using unittest directly\n\n```bash\n# Run all tests\npython -m unittest discover tests\n\n# Run specific test file\npython -m unittest tests.test_dataproc\n\n# Run specific test class\npython -m unittest tests.test_dataproc.TestDatsys\n\n# Run specific test method\npython -m unittest tests.test_dataproc.TestDatsys.test_init_basic_parameters\n```\n\n#### Using pytest (recommended)\n\n```bash\n# Install pytest\npip install pytest\n\n# Run all tests\npytest tests/\n\n# Run with verbose output\npytest tests/ -v\n\n# Run specific test file\npytest tests/test_dataproc.py\n\n# Run tests matching pattern\npytest tests/ -k \"test_init\"\n```\n\n### Test Coverage\n\nThe test suite covers:\n\n\u2705 **Data Processing Module**\n- Initialization with various parameters\n- PVGIS API integration (mocked)\n- Time series data extraction and clustering\n- File generation and output validation\n- Error handling for invalid inputs\n\n\u2705 **Network Routing Module**\n- Cable parameter calculations\n- Minimum spanning tree generation\n- Geographic distance calculations\n- Network topology validation\n\n\u2705 **Investment/Operation Module**\n- Model initialization and data loading\n- Optimization problem formulation (mocked)\n- Result processing and output generation\n- Utility functions\n\n\u2705 **Integration Tests**\n- Complete workflow testing\n- Module interaction testing\n- Real example data processing\n- Error handling and edge cases\n\n### Mocking Strategy\n\nTests use mocking to ensure reliability:\n- **PVGIS API**: Mocked to avoid network calls\n- **Optimization Solvers**: Mocked to avoid solver dependencies\n- **File System**: Uses temporary directories\n- **Network Operations**: Mocked where appropriate\n\n### Continuous Integration\n\nTests are designed for CI/CD environments:\n- No external network dependencies\n- No external solver dependencies\n- Fast execution with minimal data processing\n- Clear pass/fail criteria\n\nFor detailed testing information, see [tests/README.md](tests/README.md).\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n## Citation\n\nIf you use PyEPlan in your research, please cite:\n\n```bibtex\n@software{pyeplan2020,\n  title={PyEPlan: A Python-based Energy Planning tool},\n  author={Dehghan, Shahab and Nakiganda, Agnes and Aristidou, Petros},\n  year={2020},\n  url={https://github.com/SPS-L/pyeplan},\n  doi={10.5281/zenodo.3894705}\n}\n```\n\n## References\n\n- Dehghan, S., Nakiganda, A., & Aristidou, P. (2020). \"Planning and Operation of Resilient Microgrids: A Comprehensive Review.\" IEEE Transactions on Smart Grid.\n- Nakiganda, A., Dehghan, S., & Aristidou, P. (2021). \"PyEPlan: An Open-Source Framework for Microgrid Planning and Operation.\" IEEE Power & Energy Society General Meeting.\n\n## License\n\nThis project is licensed under the Apache Software License - see the [LICENSE.txt](LICENSE.txt) file for details.\n\n## Support\n\n- **Email**: s.dehghan@ieee.org\n- **Website**: [https://pyeplan.sps-lab.org/](https://pyeplan.sps-lab.org/)\n- **GitHub Issues**: [https://github.com/SPS-L/pyeplan/issues](https://github.com/SPS-L/pyeplan/issues)\n\n## Acknowledgments\n\n- UKRI GCRF project [CRESUM-HYRES](https://cera.leeds.ac.uk/cresum-hyres/)\n- [University of Leeds](https://leeds.ac.uk/)\n- [Cyprus University of Technology](https://sps.cut.ac.cy)\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "Python library for planning and operation of resilient microgrids.",
    "version": "1.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/SPS-L/pyeplan/issues",
        "Documentation": "https://pyeplan.sps-lab.org",
        "Homepage": "https://pyeplan.sps-lab.org",
        "Repository": "https://github.com/SPS-L/pyeplan",
        "Source": "https://github.com/SPS-L/pyeplan"
    },
    "split_keywords": [
        "energy",
        " planning",
        " microgrids",
        " optimization",
        " resilience",
        " power-systems"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d7b10b7a61bfebdb42b00fce966a706075224e919d0b5c7a73b5ef66864a52c3",
                "md5": "47436f1a99bfb8bb54ec2ceaae6222ca",
                "sha256": "b45d661f579c417025e8e7a413250b40cdaa0e8f35a88a6306606c1876bc1a88"
            },
            "downloads": -1,
            "filename": "pyeplan-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "47436f1a99bfb8bb54ec2ceaae6222ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 29816,
            "upload_time": "2025-07-13T19:23:10",
            "upload_time_iso_8601": "2025-07-13T19:23:10.014340Z",
            "url": "https://files.pythonhosted.org/packages/d7/b1/0b7a61bfebdb42b00fce966a706075224e919d0b5c7a73b5ef66864a52c3/pyeplan-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "936e2dd5897615c1941db9a799a6d8e017df92516b2bf7028012ea68372bc2c1",
                "md5": "e4b211d5c6ef5e80f7a45c0279a9b880",
                "sha256": "a7a013988addd2f632256b722efb22f636d1dc0267924e2abc88040266605a6e"
            },
            "downloads": -1,
            "filename": "pyeplan-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e4b211d5c6ef5e80f7a45c0279a9b880",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 43717,
            "upload_time": "2025-07-13T19:23:11",
            "upload_time_iso_8601": "2025-07-13T19:23:11.372626Z",
            "url": "https://files.pythonhosted.org/packages/93/6e/2dd5897615c1941db9a799a6d8e017df92516b2bf7028012ea68372bc2c1/pyeplan-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-13 19:23:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SPS-L",
    "github_project": "pyeplan",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.3.4"
                ],
                [
                    "<",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "<",
                    "2.0.0"
                ],
                [
                    ">=",
                    "1.21.0"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    ">=",
                    "3.0.9"
                ],
                [
                    "<",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "pyomo",
            "specs": [
                [
                    ">=",
                    "6.1.2"
                ],
                [
                    "<",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "networkx",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "2.6.3"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "<",
                    "4.0.0"
                ],
                [
                    ">=",
                    "3.3.0"
                ]
            ]
        },
        {
            "name": "mplleaflet",
            "specs": [
                [
                    ">=",
                    "0.0.5"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    "<",
                    "2.0.0"
                ],
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "timezonefinder",
            "specs": [
                [
                    "<",
                    "6.0.0"
                ],
                [
                    ">=",
                    "5.2.0"
                ]
            ]
        },
        {
            "name": "ipython",
            "specs": [
                [
                    "<",
                    "9.0.0"
                ],
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "jupyter",
            "specs": [
                [
                    "<",
                    "2.0.0"
                ],
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        }
    ],
    "lcname": "pyeplan"
}
        
Elapsed time: 0.55457s