Browse Source

material running

Claudio Gomes 6 years ago
parent
commit
597d3f51da

+ 13 - 6
Dockerfile

@@ -1,17 +1,24 @@
-# Use Anaconda as base container
-FROM continuumio/anaconda3:latest
-
-# Install Jupyter
-RUN /opt/conda/bin/conda install jupyter -y --quiet
+FROM jupyter/minimal-notebook:latest
 
 # Install fmipy
 RUN /opt/conda/bin/conda install -c conda-forge fmpy -y --quiet
 
+# Install simpy
+RUN /opt/conda/bin/conda install sympy
+
+# Install scipy
+RUN /opt/conda/bin/conda install scipy
+
+USER root
+
 # Copy local files to the remote notebooks
 RUN mkdir /opt/notebooks
 COPY tutorial /opt/notebooks/tutorial
-COPY fmus /opt/notebooks/fmus
+COPY fmus/linux/ /opt/notebooks/fmus
 COPY cosimlibrary /opt/notebooks/cosimlibrary
+COPY solutions /opt/notebooks/solutions
+
+WORKDIR /opt/notebooks/
 
 # Port
 EXPOSE 8888

+ 17 - 6
README.md

@@ -4,19 +4,30 @@ This repository contains the materials that are used in the Co-simulation tutori
 
 # Running the Examples
 
-The best way to run the examples is to use [Docker](https://www.docker.com/).
+1. Install [Docker](https://www.docker.com/).
 
-1. Install docker.
 1. Using docker's console, navigate to the root of this repository.
+
 1. Build the docker image: `docker build -t jupyter .` This will download all dependencies you need to run the examples.
+
 1. Note the host's ip address by running: `docker-machine ip`. Let us denote it by `MACHINE_IP`
-1. Run the docker container: `docker run -p 8888:8888 jupyter`. This will start a container of the image tagged with `jupyter` and will forward any traffic going into port 8888 (in the host machine) to the same port in the virtual machine. Let `TOKEN` denote the token given.
+
+1. Run the docker container: `docker run --name jupyterrun -p 8888:8888 -t jupyter`. This will start a container with name `jupyterrun` of the image tagged with `jupyter` and will forward any traffic going into port 8888 (in the host machine) to the same port in the virtual machine. Let `TOKEN` denote the token given.
+
 1. Open your browser and navigate to `http://MACHINE_IP:8888/?token=TOKEN`
+
 1. Explore the examples.
-1. Go back to docker's console, and exit the running container by typing `Ctrl+C`. 
-1. List the running containers: `docker container ls` . If there are running containers, note their ID and stop them using: `docker stop CONTAINERID`. Alternatively, you can just stop all containers by running `docker stop $(docker ps -aq)`.
 
+1. Any changes made in the notebooks affect only the files inside the container. To retrieve them, you need to detach from the `jupyterrun` container (typing `Ctrl+C` on docker's console), and use the following command on docker's console: 
+
+1. ```
+   docker cp jupyterrun:/opt/notebooks/tutorial mytutorial
+   ```
+
+   Which will copy all files under the `tutorial ` folder to the `mytutorial` folder in the repository.
 
+1. To terminate and clean up, run the following commands
 
-Any changes made in the notebooks are not permanent. You have to save them to your computer.
+1. `docker stop jupyterrun`
 
+1.  `docker rm jupyterrun`

+ 3 - 3
solutions/3-ConstructingFMUs/ConstructingFMUs.ipynb

@@ -35,7 +35,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [
     {
@@ -127,7 +127,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -187,7 +187,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [
     {

+ 7 - 7
solutions/4-RunningCosimulations/RunningCosimulations.ipynb

@@ -16,7 +16,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 2,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -41,7 +41,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -147,16 +147,16 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 4,
+   "execution_count": 3,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "<cosimlibrary.scenario.CosimScenario at 0x24ca20f6240>"
+       "<cosimlibrary.scenario.CosimScenario at 0x2070ffa32e8>"
       ]
      },
-     "execution_count": 4,
+     "execution_count": 3,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -225,7 +225,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": 4,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -243,7 +243,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": 5,
    "metadata": {},
    "outputs": [
     {

File diff suppressed because it is too large
+ 309 - 0
tutorial/1-CruiseController/.ipynb_checkpoints/CruiseController-checkpoint.ipynb


File diff suppressed because it is too large
+ 390 - 0
tutorial/2-MassSpringDamper/.ipynb_checkpoints/MassSpringDamper-checkpoint.ipynb


File diff suppressed because it is too large
+ 1819 - 0
tutorial/3-ConstructingFMUs/.ipynb_checkpoints/ConstructingFMUs-checkpoint.ipynb


File diff suppressed because it is too large
+ 196 - 190
tutorial/3-ConstructingFMUs/ConstructingFMUs.ipynb