Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #19

Merged
merged 2 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:2.7-slim-stretch

RUN apt update
RUN apt install -y git gcc make wget unzip tk
RUN pip install numpy
RUN pip install git+https://github.com/UVAdMIST/swmm_mpc


RUN wget https://www.epa.gov/sites/production/files/2017-03/swmm51012_engine_2.zip
RUN mkdir swmm5
RUN unzip swmm51012_engine_2.zip -d swmm5
WORKDIR swmm5/
RUN mkdir src
RUN unzip source5_1_012.zip -d src
RUN mkdir mk
RUN unzip makefiles.zip -d mk
WORKDIR mk/
RUN mkdir gnu
RUN unzip GNU-CLE.zip -d gnu
RUN cp gnu/Makefile ../src/
WORKDIR ../src

RUN sed -i -e 's/#define DLL/\/\/#define DLL/g' swmm5.c
RUN sed -i -e 's/\/\/#define CLE/#define CLE/g' swmm5.c
RUN make
ENV PATH="/swmm5/src:${PATH}"
WORKDIR /
14 changes: 4 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@

# Installation
## 1. Install swmm_mpc
**NOTE**: You must have `numpy` installed already or this will not work
```
git clone https://github.com/UVAdMIST/swmm_mpc.git
pip install swmm_mpc/
```
## 2. Install pyswmm
swmm\_mpc requires a special version of OWA's pyswmm. This version of pyswmm has an additional feature that allows saving a hotstart file at any time step in the simulation run. To install this version of pyswmm do:
pip install git+https://github.com/UVAdMIST/swmm_mpc

```
pip install git+https://github.com/UVAdMIST/pyswmm.git@feature_save_hotstart
```

## 3. Install EPASWMM5
## 2. Install EPASWMM5
You will also need to have a working version of EPASWMM5 on your machine and have it added to the path. You can download the source code from the [EPA Website](https://www.epa.gov/water-research/storm-water-management-model-swmm). In Linux you can do this as follows:
```
wget https://www.epa.gov/sites/production/files/2017-03/swmm51012_engine_2.zip
Expand Down Expand Up @@ -124,7 +118,7 @@ python my_swmm_mpc.py
A Docker image with swmm_mpc and all of its dependencies can be found at [https://hub.docker.com/r/jsadler2/swmm_mpc/](https://hub.docker.com/r/jsadler2/swmm_mpc/). You would run it like so (**this assumes your results\_dir, your workdir, your .inp file, and your config file (\*.json) are all in the same directory**):

```
docker run -v /path/to/run_dir/:/run_dir/ jsadler2/swmm_mpc:latest python /run_script.py
docker run -v /path/to/run_dir/:/run_dir/ -w /run_dir/ jsadler2/swmm_mpc:latest python /run_script.py
```
# Example model
An example use case model is found on HydroShare: [https://www.hydroshare.org/resource/73b38d6417ac4352b9dae38a78a47d81/](https://www.hydroshare.org/resource/73b38d6417ac4352b9dae38a78a47d81/).