Metadata-Version: 2.4
Name: IeeeTopologyDiagrams
Version: 3.0.1
Summary: IEEE 33-Bus single-line diagram drawing primitives based on Baran.1989
Author: FedRL.EV
License-Expression: MIT
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: matplotlib>=3.5

# IeeeTopologyDiagrams

IEEE 33-Bus single-line diagram drawing primitives based on Baran.1989 Figure 2.

## Install

```bash
cd v3/
python -m pip install -e .
```

## Python API

```python
from ieee33bus_lib import (
    draw_switch,                  # horizontal closed switch
    draw_switch_vertical,         # vertical closed switch
    draw_switch_open,             # horizontal open switch
    draw_switch_open_vertical,    # vertical open switch
    draw_bar_node,                # vertical bus bar node
    draw_bar_node_switched,       # horizontal node + switch module
    draw_node,                    # load node
    draw_tf_node,                 # transformer node
    draw_substation_vertical,     # vertical substation (SS1)
    draw_substation_horizontal,   # horizontal substation (SS2)
)
```

## CLI

```bash
IeeeTopologyDiagrams-fig2                 # Full Fig.2 single-line diagram
IeeeTopologyDiagrams-switch               # horizontal closed switch → switch_symbol.png
IeeeTopologyDiagrams-switch-vertical      # vertical closed switch → switch_vertical.png
IeeeTopologyDiagrams-switch-open-h        # horizontal open switch → switch_open_h.png
IeeeTopologyDiagrams-switch-open-v        # vertical open switch → switch_open_v.png
IeeeTopologyDiagrams-bar-node-short       # vertical bus bar node → bar_node_short.png
IeeeTopologyDiagrams-bar-node-horizontal  # horizontal bus bar node → bar_node_horizontal.png
IeeeTopologyDiagrams-node15               # node 15 module → node15.png
IeeeTopologyDiagrams-load-node            # load node → load_node.png
IeeeTopologyDiagrams-tf-node              # transformer node → tf_node.png
IeeeTopologyDiagrams-ss1                  # SS1 substation → ss1_symbol.png
IeeeTopologyDiagrams-ss2                  # SS2 substation → ss2_symbol.png
```

## Standalone Scripts

All `save_*.py` can be run directly to export individual element PNGs:

```bash
cd v3/
python save_switch_symbol.py          # horizontal closed switch
python save_switch_vertical.py        # vertical closed switch
python save_switch_open.py            # switch comparison (open/closed × h/v)
python save_switch_open_h.py          # horizontal open switch
python save_switch_open_v.py          # vertical open switch
python save_bar_node_short.py         # vertical bus bar node
python save_bar_node_horizontal.py    # horizontal bus bar node
python save_node15.py                 # node 15 module (horizontal bar + vertical switch)
python save_load_node.py              # load node
python save_tf_node.py                # transformer node
python save_ss1_symbol.py             # SS1 vertical substation
python save_ss2_symbol.py             # SS2 horizontal substation
python reproduce_fig1.py              # full single-line diagram
```

## Element Reference

| Element | Element (CN) | PNG | CLI |
|---------|-------------|-----|-----|
| Horizontal closed switch | 水平闭合开关 | `switch_symbol.png` | `...-switch` |
| Vertical closed switch | 垂直闭合开关 | `switch_vertical.png` | `...-switch-vertical` |
| Horizontal open switch | 水平断开开关 | `switch_open_h.png` | `...-switch-open-h` |
| Vertical open switch | 垂直断开开关 | `switch_open_v.png` | `...-switch-open-v` |
| Vertical bus bar node | 竖形母线节点 | `bar_node_short.png` | `...-bar-node-short` |
| Horizontal bus bar node | 横形母线节点 | `bar_node_horizontal.png` | `...-bar-node-horizontal` |
| Node 15 module | 节点15模块 | `node15.png` | `...-node15` |
| Load node | 负荷节点 | `load_node.png` | `...-load-node` |
| Transformer node | 配变节点 | `tf_node.png` | `...-tf-node` |
| SS1 substation | SS1变电站 | `ss1_symbol.png` | `...-ss1` |
| SS2 substation | SS2变电站 | `ss2_symbol.png` | `...-ss2` |
| Full diagram | 完整单线图 | `Figure 2 - ...png` | `...-fig2` |

## Package Structure

```
v3/
├── pyproject.toml
├── README.md / README_CN.md
├── ieee33bus_lib/              # core library
│   ├── __init__.py
│   ├── drawing_elements.py     # all drawing primitives
│   ├── coordinates.py          # IEEE 33-Bus coordinates
│   └── cli.py                  # CLI entry points
├── reproduce_fig1.py           # full diagram main script
├── save_*.py                   # individual element export scripts (13)
└── *.png                       # element output images (12)
```
