Skip to content
Snippets Groups Projects
README.md 4.27 KiB
Newer Older
abaucher's avatar
abaucher committed
# Pydynamo
BAUCHER Achille's avatar
BAUCHER Achille committed
Pydynamo is a module to define, run and analyse system dynamics. I first present how to use the practical session we designed to play with the module, and then brief comments and references in english at the end. 
abaucher's avatar
abaucher committed

abaucher's avatar
abaucher committed
# TPworld3
BAUCHER Achille's avatar
BAUCHER Achille committed
Un TP pour jouer avec le modèle World3 et découvrir tout un tas de concepts, qui peuvent servir pour comprendre les dynamiques de la croissance dans un monde fini. Voir dans le fichier [details_TP](details_TP.md) pour plus d'informations !
abaucher's avatar
abaucher committed

BAUCHER Achille's avatar
BAUCHER Achille committed
## Installation
### Avec le jupyterhub de l'UGA si vous avez un compte UGA
abaucher's avatar
abaucher committed
- Se connecter à <https://jupyterhub.univ-grenoble-alpes.fr> avec ses identifiants UGA
- Ouvrir un terminal avec le bouton New en haut à droite
abaucher's avatar
abaucher committed
- Puis, rentrer dans le répertoire _notebook_ et cloner la branche TPworld3 de pydynamo avec les commandes:
abaucher's avatar
abaucher committed
```
cd notebooks
git clone https://gitlab.inria.fr/abaucher/pydynamo.git
abaucher's avatar
abaucher committed
```
- Installer les bibliothèques requises en tapant:
```
cd pydynamo
pip install -r requirements.txt
```
- Et enfin activer les extensions avec:
```
jupyter nbextension enable exercise2/main
jupyter nbextension enable latex_envs/latex_envs
```
- Fermer le terminal, rentrer dans le dossier *pydynamo* et ouvrir le notebook *TP.ipynb*

BAUCHER Achille's avatar
BAUCHER Achille committed
### Autrement, en local sous Linux
abaucher's avatar
abaucher committed
- Il faut avoir Python3 
- Le module a été testé sous Ubuntu 20
BAUCHER Achille's avatar
BAUCHER Achille committed

#### Créer un environnement virtuel
abaucher's avatar
abaucher committed
- Il est préférable d'utiliser un environnement virtuel, qui assure les bonnes versions des librairies.
- Pour installer et créer un nouvel environnement virtuel sous le nom de *dnovenv*:
```
sudo apt install python3.8-venv
python3.8 -m venv dnovenv
```
abaucher's avatar
abaucher committed
Pour l'activer, il faut être dans le dossier qui contient le dossier `dnovenv` et tapper: 
abaucher's avatar
abaucher committed
```
source dnovenv/bin/activate
```
abaucher's avatar
abaucher committed
 et on peut le désactiver avec `deactivate`.
abaucher's avatar
abaucher committed

BAUCHER Achille's avatar
BAUCHER Achille committed
#### Installer le TP
abaucher's avatar
abaucher committed

- Ouvrir un terminal, puis:
  - cloner pydynamo
abaucher's avatar
abaucher committed
  - installer les requirements
  - installer en plus ipykernel et jupyter et le manager d'extensions
  - installer les extensions
- avec les commandes suivantes:
```
git clone https://gitlab.inria.fr/abaucher/pydynamo.git
abaucher's avatar
abaucher committed
python3 -m pip install -r pydynamo/requirements.txt
python3 -m pip install ipykernel
python3 -m pip install jupyter
python3 -m pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable exercise2/main
jupyter nbextension enable latex_envs/latex_envs
```
- Ouvrir le TP.ipynb avec `jupyter notebook pydynamo/TP.ipynb`. Jupyter-lab fonctionne aussi mais sans le mode exercice/correction.


## Jouer
Dans le notebook TP.ipynb, des textes et morceaux de codes montrent l'idée et le fonctionnement de pydynamo et du modèle World3. On peut faire différentes expériences de simulation en changeant des paramètres, et étudier certains phénomènes.
abaucher's avatar
abaucher committed
## Documentation
Tout est dans: <https://abaucher.gitlabpages.inria.fr/pydynamo/>.
BAUCHER Achille's avatar
BAUCHER Achille committed

***

# Comments in english   
It was originally created to run the World3 model [2], written in DYNAMO language [1]. Included in the module are functions to convert DYNAMO code to pydynamo syntax. All scenarios of *Limits to Growth*, updated with 2003 version, are shown in [LimitsToGrowth03](./examples/LimitsToGrowth03.ipynb). For a quick tuto of how to use World3 in pydynamo, see [World3](./examples/World3.ipynb). For a quick tuto on how to use pydynamo, see [BTmodel](./examples/BTmodel.ipynb).

Documentation about the World models is in <https://abaucher.gitlabpages.inria.fr/pydynamo/>.

## Installation
- clone this repository and got to folder
- python -m pip install -r requirements.txt
- you can import pydynamo

## Note
_This is a beta version and all documentation and commands may not be complete or updated_

## Usage
- Define the system equations in a function or file with pydynamo syntax
- Get a System object from this function or file
- Run, change parameters, re-run, plot

## Author
Achille BAUCHER for my internship at the LIG-lab. I used some functions from pyworld3 [3], and nice explanations by it's author Charles Vanwynsberghe.

## References
- [1] How DYNAMO  works: <https://archive.org/details/dynamousersmanua0000pugh/>
  - Some additional explanations about DYNAMO language are in [dynamo_doc](./dynamo_doc.md)
- [2] Book describing the world3 model: <https://archive.org/details/dynamicsofgrowth0000unse/>
- [3] Pyworld3: <https://github.com/cvanwynsberghe/pyworld3>