Skip to content

Commit cf10405

Browse files
authored
Merge pull request #11 from DAI-Lab/readme_update
Readme update
2 parents 974caa1 + 11edc79 commit cf10405

File tree

2 files changed

+63
-33
lines changed

2 files changed

+63
-33
lines changed

README.md

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,37 @@
44
</p>
55

66
<!-- Uncomment these lines after releasing the package to PyPI for version and downloads badges -->
7-
<!--[![PyPI Shield](https://img.shields.io/pypi/v/pygridsim.svg)](https://pypi.python.org/pypi/pygridsim)-->
8-
<!--[![Downloads](https://pepy.tech/badge/pygridsim)](https://pepy.tech/project/pygridsim)-->
9-
[![Github Actions Shield](https://img.shields.io/github/workflow/status/amzhao/PyGridSim/Run%20Tests)](https://github.com/amzhao/PyGridSim/actions)
10-
[![Coverage Status](https://codecov.io/gh/amzhao/PyGridSim/branch/master/graph/badge.svg)](https://codecov.io/gh/amzhao/PyGridSim)
11-
12-
7+
[![Development Status](https://img.shields.io/badge/Development%20Status-2%20--%20Pre--Alpha-yellow)](https://pypi.org/search/?c=Development+Status+%3A%3A+2+-+Pre-Alpha)
8+
[![PyPI Shield](https://img.shields.io/pypi/v/pygridsim.svg)](https://pypi.python.org/pypi/pygridsim)
9+
[![Downloads](https://pepy.tech/badge/pygridsim)](https://pepy.tech/project/pygridsim)
10+
[![Run Tests](https://github.com/DAI-Lab/PyGridSim/actions/workflows/tests.yml/badge.svg)](https://github.com/DAI-Lab/PyGridSim/actions/workflows/tests.yml)
1311

1412
# PyGridSim
1513

16-
Package to simulate OpenDSS circuits on Python.
14+
PyGridSim is a package for simulating OpenDSS circuits. PyGridSim uses a functional interface to allow users to efficiently generate circuits of various scopes.
1715

18-
NOTE: README comes from dai cookie cutter, will be updated
19-
NOTE: will be moved to Dai lab repository
20-
21-
- Documentation: https://amzhao.github.io/PyGridSim
22-
- Homepage: https://github.com/amzhao/PyGridSim
16+
- Documentation: https://dtail.gitbook.io/pygridsim
17+
- Homepage: https://github.com/DAI-Lab/PyGridSim/
2318

2419
# Overview
2520

26-
PyGridSim aims to provide accessible access to tools like OpenDSS, AltDSS using Python. The goal is to create large-scale electrical circuits representing residential neighborhoods (and other scenarios) using an intuitive interface, without any background in OpenDSS software.
21+
PyGridSim allows users to create and customize circuits. Users can either fully specify each component they add to the circuit, or lean on library-provided parameter sets. PyGridSim supports the batch creation of every circuit component, emphasizing scalability and efficiently in building large circuits.
2722

28-
# Install
23+
# Installation
2924

3025
## Requirements
3126

32-
**PyGridSim** has been developed and tested on [Python 3.5, 3.6, 3.7 and 3.8](https://www.python.org/downloads/)
27+
**PyGridSim** has been developed and tested on [Python 3.10, 3.11 and 3.12](https://www.python.org/downloads/)
3328

3429
Also, although it is not strictly required, the usage of a [virtualenv](https://virtualenv.pypa.io/en/latest/)
3530
is highly recommended in order to avoid interfering with other software installed in the system
3631
in which **PyGridSim** is run.
3732

38-
These are the minimum commands needed to create a virtualenv using python3.6 for **PyGridSim**:
33+
These are the minimum commands needed to create a virtualenv using python3.10 for **PyGridSim**:
3934

4035
```bash
4136
pip install virtualenv
42-
virtualenv -p $(which python3.6) PyGridSim-venv
37+
virtualenv -p $(which python3.10) PyGridSim-venv
4338
```
4439

4540
Afterwards, you have to execute this command to activate the virtualenv:
@@ -75,23 +70,58 @@ git checkout stable
7570
make install
7671
```
7772

78-
## Install for Development
73+
# Quick Start
74+
Users of PyGridSim have the option between creating a fully customized circuit and using PyGridSim-provided parameters to build their circuit. Consider the simplest circuit: one source, one load, and a line connecting them. The following code snippet demonstrates how to model and print results on this circuit on PyGridSim with both methods.
75+
76+
## Customized Circuit Creation
77+
```python
78+
circuit = PyGridSim()
79+
80+
# Add Custom Source and Load
81+
circuit.add_load_nodes(params={"kV": 0.12, "kW": 1, "kvar": 1})
82+
circuit.update_source(params={"kV": 0.5})
83+
84+
# Add Line
85+
circuit.add_lines([("source", "load0")], params={"length": 1})
86+
87+
# Solve and Print Results
88+
circuit.solve()
89+
print(circuit.results(["Voltages", "Losses"]))
90+
circuit.clear()
91+
```
92+
93+
Running this code yields the following printed output:
94+
```
95+
{'Voltages': {'source': 499.7123955784113, 'load0': 120.73408045756985}, 'Losses': {'Active Power Loss': 465617.30157676246, 'Reactive Power Loss': 969502.2898991327}}
96+
```
97+
98+
Note that the losses here are expressed in Watts, and the Voltages in Volts. The circuit observes some loss due to a much higher source voltage than load voltage, with most of the loss being reactive power loss. The circuit is created with a step-down transformer in the line by default, which enables the source and load to maintain isolated voltage levels at rest.
7999

80-
If you want to contribute to the project, a few more steps are required to make the project ready
81-
for development.
100+
## Defaults-Based Circuit Creation
101+
```python
102+
circuit = PyGridSim()
82103

83-
Please head to the [Contributing Guide](https://amzhao.github.io/PyGridSim/contributing.html#get-started)
84-
for more details about this process.
104+
# Add Custom Source and Load
105+
circuit.add_load_nodes(load_type="house")
106+
circuit.update_source(source_type="turbine")
85107

86-
# Quickstart
108+
# Add Line
109+
circuit.add_lines([("source", "load0")], line_type="lv")
87110

88-
In this short tutorial we will guide you through a series of steps that will help you
89-
getting started with **PyGridSim**.
111+
# Solve and Print Results
112+
circuit.solve()
113+
print(circuit.results(["Voltages", "Losses"]))
114+
circuit.clear()
115+
```
116+
117+
The following output is printed:
118+
```
119+
{'Voltages': {'source': 2418.845494533779, 'load0': 169.53107121049976}, 'Losses': {'Active Power Loss': 351310.95859906287, 'Reactive Power Loss': 730351.7183868886}}
120+
```
90121

91-
TODO: Create a step by step guide here. Also figure out how to ensure prerequisites properly.
122+
The defaults-based ranges for source and load nodes are higher than the ones specified in the above customization example, explaining the higher voltages set for both nodes. We once again observe some loss in the system, with most of that being in reactive power loss.
92123

93-
# What's next?
124+
# Resources
94125

95126
For more details about **PyGridSim** and all its possibilities
96-
and features, please check the [documentation site](
97-
https://amzhao.github.io/PyGridSim/).
127+
and features, please check the [Gitbook page for PyGridSim](https://dtail.gitbook.io/pygridsim)

sim.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"Voltages": {
3-
"source": 1912.250959225854,
4-
"load0": 164.87512862167387
3+
"source": 9999.598243195385,
4+
"load0": 8294.334838925915
55
},
66
"Losses": {
7-
"Active Power Loss": 181552.68984510849,
8-
"Reactive Power Loss": 377394.0863595363
7+
"Active Power Loss": 9059444.425434513,
8+
"Reactive Power Loss": 31084427.834760502
99
}
1010
}

0 commit comments

Comments
 (0)