Skip to content

Commit

Permalink
Prepare for uploading v2.2 to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
phumthep committed Jan 28, 2025
1 parent b8aa8cd commit b37c963
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 17 deletions.
49 changes: 39 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,63 @@ PowNet is a least-cost optimization model for simulating the Unit Commitment and
Read the PowNet Documentation here: https://pownet.readthedocs.io/en/latest


## Installation
## Installing and using PowNet
To use PowNet, a user needs to supply it with CSV files. For guidance on creating these CSV files, please see examples provided [here](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/tree/master/model_library). Please ensure that column names matches with those from the examples.

Download or clone the PowNet 2.0 repository to your local machine. For example: if we want to clone to "C://user/pownet",
As for installing PowNet, there are multiple options depending on whether we want to modify the source code. However, the following step is highly recommended for any user: creating a virtual environment to manage dependencies. If using Conda, we can create an envrionment with the following command

```
git clone https://github.com/your-username/pownet.git C://user/pownet
conda create --name your_env_name_here
conda activate your_env_name_here
```

Next, open a terminal and navigate to the directory where you cloned the repository:
If deciding on a name for the environment takes too long, please feel free to name the environment as "pownet".

### Option 1: Regular user
A regular user is someone who has created their input files and wish to just run PowNet. In this case, it is best to simply install PowNet as a package from PyPI. We can achieve this with the following command:

```
cd C://user/pownet
pip install pownet
```

Once the package has been installed, we can now go to our working directory. In this example, we assume the following folder structure:

working_directory/
├── scripts/
│ └── [run_quickstart.py](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/blob/master/scripts/run_quickstart.py)
├── model_library/
│ └── dummy/
│ ├── demand_export.csv
│ ├── thermal_unit.csv
│ ├── nondispatch_unit.csv
│ ├── hydropower.csv
│ ├── import.csv
│ ├── contract_cost.csv
│ └── transmission.csv
└── outputs/

A Python script called "[run_quickstart.py](https://github.com/Critical-Infrastructure-Systems-Lab/PowNet/blob/master/scripts/run_quickstart.py)" provides an example on running a simulation, saving the simulation outputs, and visualizing the outputs.

### Option 2: Power user (no pun intended)
In case we wish to modify the source code, PowNet should be installed as an editable package. First, download or clone the PowNet repository to your local machine. For example: if we want to clone to "C://user/pownet",

```
git clone https://github.com/your-username/pownet.git C://user/pownet
```

The following step is highly recommended: creating a virtual environment to manage dependencies. If using Conda, you can create an envrionment named "pownet":
Next, open a terminal and navigate to the directory where we cloned the repository:

```
conda create --name pownet
conda activate pownet
cd C://user/pownet
```

Now, you can install this PowNet package using pip, which is a manager for Python packages:
Now, we can install this PowNet package using pip, which is a manager for Python packages:

```
pip install -e .
```

This command installs the package in "editable" mode (-e) using pyproject.toml that is located in the root directory of PowNet. The editable mode allows you to edit PowNet codebase when you need to modify or implement new features. The pyproject.toml file specifies the dependencies required to run PowNet.
This command installs the package in "editable" mode (-e) using pyproject.toml that is located in the root directory of PowNet. The editable mode allows us to edit PowNet codebase when we need to modify or implement new features. The pyproject.toml file specifies the dependencies required to run PowNet.

A quick start tutorial to run a simple case study is provided here: https://pownet.readthedocs.io/en/latest/pages/quickstarter.html

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Content
pages/support
pages/release
pages/glossary
pages/license
pages/license_page
pages/acknowledgement
pages/publications
api_pages/api
File renamed without changes.
13 changes: 9 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ where = ["src"]
pownet = ["database/*.csv"]

[project]
name = "cisl-pownet"
version = "2.0.0"
name = "pownet"
version = "2.2.0"
description = "A simple production cost model of framework for power systems"
readme = "README.md"
authors = [{ name = "Phumthep Bunnak", email = "[email protected]" }]
keywords = ["power_system", "optimization", "production_cost_model"]
license = { file = "LICENSE" }
keywords = ["power_system", "optimization", "production_cost_model", "unit_commitment"]
dependencies = [
"gurobipy >= 11.0.3",
"highspy >= 1.7.2",
"matplotlib >= 3.7.1",
"networkx >= 3.1.0",
"numpy == 1.26.4",
"numpy == 2.2.0",
"pandas >= 2.1.1",
"pmdarima >= 2.0.4",
"scipy >= 1.11.3",
Expand All @@ -30,3 +31,7 @@ dependencies = [
"contextily >= 1.6.2",
]
requires-python = ">=3.10"

[project.urls]
Homepage = "https://github.com/Critical-Infrastructure-Systems-Lab/PowNet"
Documentation = "https://pownet.readthedocs.io/en/latest/index.html"
4 changes: 2 additions & 2 deletions scripts/run_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def main():
# --------- User inputs

input_folder = "..//model_library"
output_folder = "..//temptemp"
output_folder = "..//outputs"

model_name = "dummy"
model_year = 2016

# Simulation parameters
sim_horizon = 24
steps_to_run = 2
steps_to_run = 2 # 2 Simulation days or 48 hours
solver = "gurobi" # or highs

# --------- End of user inputs
Expand Down

0 comments on commit b37c963

Please sign in to comment.