Mini-ISO is an interactive electricity market simulator for classroom use.
It provides three browser-based apps:
Several datasets are shipped with this repository
Name | #Nodes | #Generators | Description | |
---|---|---|---|---|
1. | mini_iso/datasets/one-zone |
1 | 3 | A simple illustration of marginal pricing |
2. | mini_iso/datasets/zones-zones |
3 | 2 | To illustrate congestion and price separation |
3. | mini_iso/datasets/mini-new-england-simple |
8 | 13 | Mini New England network with one offer tranche per generator |
4. | mini_iso/datasets/mini-new-england-nonuniform |
8 | 13 | Mini New England network with three offer tranches per generator |
To create a new dataset, follow the format of the files in the sample directory.
You'll need a three .csv
files and a .json
file that names them.
Classroom scenarios:
- Use the System Overview to illustrate offer stacks, marginal prices, locational marginal prices, and network congestion.
- Add a fun element of competition!
- Assign a group of class members to each generator in the network.
- Ask them to submit bids in the
Offers
app. - Every few minutes, clear the market via the
Auction
app and ask students to record their change in revenue.
⚠️ In a realistic environment, market participants would never see each others' offers, so ask class members not to peek!
git --version # triggers prompts to install git
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global
-
Install Python (
py
) using one of the following installers: -
Use
py
to installpip
andpipx
:
py -m ensurepip --upgrade
py -m pip install --user pipx
sudo apt update
sudo apt install git-all
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global
# Download Mini-ISO and install dependencies
git clone https://github.com/ne-pearl/mini-iso.git
# Move into mini-iso folder
cd mini-iso
# Install Mini ISO dependencies with Poetry
pipx install poetry
poetry env use 3.11 # or 3.12 etc.
poetry install
Path | Description |
---|---|
mini_iso/auction.py | Panel definition for Auction app |
mini_iso/bidders.py | Panel definition for Offers app |
mini_iso/clearance.py | Economic dispatch model in gurobipy |
mini_iso/dashboard.py | Panel definition for System Overview app |
mini_iso/typing_.py | Shared type definitions |
cd your/path/to/mini-iso
poetry env activate
poetry run panel serve mini_iso/app.py --port 5006 --args mini_iso/datasets/one-zone
If you encounter a message like Cannot start Bokeh server, port 5006 is already in use
, try the following commands.
lsof -i :5006 # copy process id, e.g., 12334
kill -9 12345
Get-Process -Id (Get-NetTCPConnection -LocalPort 5006).OwningProcess | Stop-Process -Force
The steps explain the use of PyInstaller to bundle Mini-ISO and its dependencies into a single (platform-dependent) executable file.
⚠️ This shouldn't be necessary (as all dependencies should already have been specified inpyproject.toml
), I seem to have run into problems.
poetry add \
altair dask[dataframe] gurobipy hypothesis ipython matplotlib \
networkx pandas pandera panel pydantic pyinstaller pytest scipy
poetry update
poetry env activate
poetry env use 3.12
# Required for python shared object files
sudo apt-get install python3.12-dev # or python3.11-dev etc.
# Local copy of gurobi.lic from PyPI
cp echo $(which python)/site-packages/gurobipy/.libs/gurobi.lic .
# Create redistributable (only for your platform)
cd your/path/to/mini-iso
pyinstaller \
mini_iso/app.py \
--hiddenimport pydantic.deprecated.decorator \
--add-data ./gurobi.lic:gurobipy/.libs/
# To run
./dist/app/app \
$(realpath mini_iso/datasets/mini_new_england/mini_new_england.json)
For now, please see my notes in
windows.md
.
- Update this document for Windows.
⚠️ When running the Mini-ISO bundle, you may encounter an error about an expired GUROBI license. This might indicate that you have an expiredgurobi.lic
file in your home directory (which GUROBI checks first, before the copy in the Mini-ISO folders). To resolve, please remove/rename the expired file.