This repo contains a Docker container with IRuby Jupyter notebooks with examples using various functionality of the OpenStudio SDK. The examples include
URBANopt Notebooks
- Creating an URBANopt workflow
- Creating an URBANopt OpenStudio Analysis (OSA) workflow for optimization
- Submitting an URBANopt job to a cloud based Server
Creating OpenStudio Workflow (OSW) and OpenStudio Analysis (OSA) jsons Notebooks
- Creating an OSW json to run several Measures on an example OpenStudio Model (OSM)
- Adding a Calibration Measure to the OSW
- Turning the OSW into an OSA to use Algorithms such as Sensitivity Analysis and Optimization. Most of these notebooks are broken up into two parts. The first one Creates the OSA and the second one Submits the OSA job to a running OS-Server.
- There is a ruby file example as well
The notebooks have several dependencies which are pre-installed in a Docker container. The intent is to make that part of the process easier for newer users. The notebooks can be used outside of the containers, provided the dependencies are installed locally. The user needs to install Docker and then either build the container locally or pull the container from dockerhub. Instructions to do that follow:
-
Go to the official Docker website and download the appropriate installer for your platform: www.docker.com
-
Once the download is complete, run the installer and follow the on-screen instructions.
-
After the installation is complete, open a terminal or command prompt and verify that Docker is installed by typing the following command:
docker --version
This should display the version of Docker installed on your system. -
If you plan to use Docker as a non-root user, add your user to the "docker" group with the following command:
sudo usermod -aG docker your-user
Replace "your-user" with your actual username. -
Finally, start the Docker service with the following command:
sudo systemctl start docker
On some systems, you may need to use a different command to start the Docker service.
Git Clone this repo locally, open a terminal or command prompt and build the container with the following command:
docker build . -t "openstudio-jupyter"
This builds the container with the name openstudio-jupyter
.
Once the container is built, to run the container without the full Server stack execute:
docker run -p 127.0.0.1:8888:8888 openstudio-jupyter
This will start the openstudio-jupyter
container, using the localhost IP of 127.0.0.1, on port 8888.
In some instances a different IP or port maybe needed.
To stand up a full stack of the OpenStudio-Server with one worker to submit jobs to, open a terminal or command prompt in the root of the repo and use the following commands:
docker swarm init
docker stack deploy osserver --compose-file=docker-compose.yml
This will start the docker swarm and should print out an IP address to the screen. This is the same IP address from docker info
and looking for the Node Address. Note the port is not needed, just the IP address. In some instances the full file path to the docker-compose.yml file will be needed. You can verify that the stack has started by using the command:
docker service ls
and looking for 1/1 and not 0/1 for all the services. If you have enough base computing resources allocated to Docker on your computer, you can start more worker services by
docker service scale osserver_worker=X
where X is the integer number of workers you want.
Verify that the Server Stack has started by opening localhost:8080 in a web browser. You should see the server main GUI page.
The notebooks can be accessed by opening localhost:8888 in a web browser.
Please submit issues or enhancement requests on the project's Github page.
This project is distributed under a BSD-3 type License. For more details, see the LICENSE.md file.