Sfoglia il codice sorgente

tecnical issues solved with modelica tutorial

Claudio Gomes 6 anni fa
parent
commit
51f67bddd2

File diff suppressed because it is too large
+ 175 - 0
materials/4-Modelica/Modelica.ipynb


+ 1 - 4
materials/Dockerfile

@@ -1,8 +1,5 @@
 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
 
@@ -45,5 +42,5 @@ EXPOSE 8888
 CMD ["/opt/conda/bin/jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
 
 # Uncomment to access command line on the docker container
-# CMD ["bash"]
+CMD ["bash"]
 # to start jupyter run: /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip=0.0.0.0 --port=8888 --no-browser --allow-root

+ 21 - 0
materials/DockerfileTutorials45

@@ -0,0 +1,21 @@
+FROM mechatronics3d/jjmodelica
+
+USER root
+
+# Copy local files to the remote notebooks
+RUN mkdir /opt/notebooks
+
+COPY 4-Modelica /opt/notebooks/4-Modelica
+
+WORKDIR /opt/notebooks/
+
+# Port
+EXPOSE 8888
+
+# Run Jupyter Notebook
+CMD ["jupyter", "notebook", "--notebook-dir=/opt/notebooks", "--ip=0.0.0.0", "--port=8888", "--no-browser"]
+
+# Uncomment to access command line on the docker container
+# CMD ["bash"]
+# to start jupyter run: 
+# jupyter notebook --notebook-dir=/opt/notebooks --ip=0.0.0.0 --port=8888 --no-browser --allow-root

+ 34 - 19
materials/README.md

@@ -2,32 +2,47 @@
 
 This repository contains the materials that are used in the MoDELS tutorial of physical systems modelling for software engineers, in 2019.
 
-# Running the Examples
+# Running the Materials
 
 1. Install [Docker](https://www.docker.com/).
 
-1. Using docker's console, navigate to the root of this repository.
+2. 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. You might need root access.
+3. Build the corresponding docker image: 
+    ```
+    docker build -f DockerfileTutorials123 -t jupyter .
+    ```
+or 
 
-1. Note the host's ip address by running: `docker-machine ip`. Let us denote it by `MACHINE_IP`
+    ```
+    docker build -f DockerfileTutorials45 -t jupyter .
+    ```
 
-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.
+This will download all dependencies you need to run the examples. You might need root access.
 
-1. Open your browser and navigate to `http://MACHINE_IP:8888/?token=TOKEN`
-
-1. Explore the examples.
-
-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. ```bash
-   docker cp jupyterrun:/opt/notebooks/tutorial mytutorial
+4. Note the host's ip address by running: 
    ```
-
+   docker-machine ip
+   ```
+   Let us denote it by `MACHINE_IP`
+
+5. 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. If a token is given, copy it so that you can later access the jupyter notebook from your browser. Let `TOKEN` denote the token given.
+    
+6. Open your browser and navigate to `http://MACHINE_IP:8888/`. If asked for a token, insert `TOKEN`.
+
+7. Explore the examples.
+
+8. Any changes made in the notebooks affect only the files inside the container. To retrieve them, either use the notebook interface to download them to your computer (`File -> Download As -> Notebook`), or detach from the `jupyterrun` container (typing `Ctrl+C` on docker's console), and use the following command on docker's console: 
+    ```bash
+    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
-
-1. `docker stop jupyterrun`
-
-1.  `docker rm jupyterrun`
+9. To terminate and clean up, run the following commands
+    ```
+    docker stop jupyterrun && docker rm jupyterrun
+    ```

+ 2 - 1
materials/generate_exercises.ps1

@@ -1,2 +1,3 @@
 & C:\Anaconda3\python.exe .\generate_exercises.py .\1-NewtonsLaws\NewtonsLaws.ipynb
-& C:\Anaconda3\python.exe .\generate_exercises.py .\2-StationaryAction\StationaryAction.ipynb
+& C:\Anaconda3\python.exe .\generate_exercises.py .\2-StationaryAction\StationaryAction.ipynb
+& C:\Anaconda3\python.exe .\generate_exercises.py .\3-BondGraphs\BondGraphs.ipynb

File diff suppressed because it is too large
+ 1 - 1
materials/notes.drawio