ndocquier created page: home authored by Nicolas Docquier's avatar Nicolas Docquier
# Journée utilisateur et ateliers LMGC90: MBS-DEM workshop
Nantes, 12/2006
This page describes the workshop related to the numerical coupling
of granular media models based on a discrete element method (DEM)
and articulated systems modelled as multibody systems (MBS).
It is implemented by coupling two programs:
* LMGC90 for the DEM,
* Robotran for the MBS.
## Outline
* Brief introduction to Robotran
* Installing Robotran:
* MBsysPad: The graphical editor
* MBsysC: The numerical environment, development version
* Compiling MBsysC
* Compiling LMGC90 liking to Robotran/MBsysC
* Compiling a Robotran project
* Simulating MBS-DEM models:
* The multiple pendulum
* The TTT picker robot
## Introduction to Robotran
* The Robotran framework
* [MBS modelling cycle](http://www.robotran.be/documentation/Slides/HTML_RobotranSuite/RobotranSuite.html):
* MBsysPad: Editing the project
* MBsysTran: Generating the symbolic equation
* User brain: Writing the constitutive equation of the model
* MBsysC: Simulating the motion
* MBsysPad: Animating the results
* User brain: Analysing the results
* Structure of a project
* [Structure of the MBsysC numerical modules](http://www.robotran.be/documentation/Slides/HTML_MBsysC/MBsysLibDiag.html)
* How it interacts with LMGC90:
* interaction diagram
* MBS3D and MBS2D, similar to RBDY3 and RBDY2
## Installing
All information is available on www.robotran.eu. Here are some details
and specific instruction for the workshop.
### Installing MBsysPad
Follow instructions here:
* [Linux](http://www.robotran.eu/tutorial/install/Linux/MBsysPad.html)
* [MacOS](http://www.robotran.eu/tutorial/install/MacOS/MBsysPad.html)
* [Windows](http://www.robotran.eu/tutorial/install/Win64/MBsysPad.html), but the MBS-DEM coupling is not working with Windows :-(
### Installing MBsysC
For the workshop, install the development version:
* Go to the directory where you want to put MBsysC modules
* Clone MBsysC modules from git.immc.ucl.ac.be: `git clone git@git.immc.ucl.ac.be:robotran/mbsysc.git`
* Tell MBsysPad that you want to use the development version:
* Open MBsysPad
* Go to menu *Tools/Edit preferences*
* Check the box *Specify a custome MBsysC path*
* Fill the field *MBsysC path* with the path to the development version of MBsysC modules
## Compiling MBsysC modules
First you must install the dependencies:
* Ubuntu 16.04: `sudo apt-get install libxml2-dev libgsl2 libgsl-dev`
* Ubuntu 14.04 and previous: `sudo apt-get install libxml2-dev libgsl0ldbl libgsl0-dev`
* MacOS: look [here](http://www.robotran.be/tutorial/install/MacOS/MBsysC.html) to install GSL and LibXML2
Then you can compile.
* Go to the path: `....../mbsysC/MBsysC`
* Make a build directory: `mkdir build`
* Go to the build directory: `cd build`
* Configure the project: `cmake ..`
* Adapt the options so as to compile the MBS-DEM and the python interfaces
* Open cmake-gui
* Check the following options:
* FLAG_ADDON_MBSLMGC (to compile the MBS-DEM coupling)
* FLAG_INTERFACE_PYTHON (to compile the python interface to MBsysC modules)
* FLAG_IPY_WITH_MBS_LMGC (to compile the python interface to the MBS-DEM coupling)
* **Warning for MacOS user**, you have to force to use the same compiler
as LMGC90, i.e. gcc:
* With cmake-gui: check *avdanced* and set the option CMAKE_C_COMPILER to gcc
* Alternatively, in the command line: `cmake . -DCMAKE_C_COMPILER=gcc`
* Compile MBsysC: `make`
## Compiling LMGC90 by linking to Robotran/MBsysC
* Go to the build folder of LMGC90
* Open cmake-gui and set the following options:
* set EXT_MBS_VERSION to *Robotran*
* set EXT_MBS_FILE with the path `....../mbsysC/MBsysC/build/mbs_add_on/mbs_lmgc/Robotran_Lmgc90.cfg`
* Alternatively, in the command line: `cmake . -DEXT_MBS_VERSION=Robotran -DEXT_MBS_FILE=....../mbsysC/MBsysC/build/mbs_add_on/mbs_lmgc/Robotran_Lmgc90.cfg`
* re-Compile LMGC90: `make`
## Compiling a Robotran project: the MultiplePendulum example
The MultiplePendulum example comes with the MBsysC distribution and is
stroed in the ExampleProjects folder
* Go to the *workR* folder of the MultiplePendulum project
`cd ...../mbsysc/ExampleProjects/MultiplePendulum/workR`
* Create a build directory: `mkdir build`
* Go to the build directory: `cd build`
* Configure the project: `cmake ..`
* Configure the project to build in *separate* mode
* open cmake-gui and check FLAG_SEPARATE_BUILD
* Alternatively, in the shell: `cmake -DFLAG_SEPARATE_BUILD=ON ..`
* Compile the project: `make`
## Running the MultiplePendulum example
The simulation is controlled by a python script. This script is very
similar to the command script of a LMGC90 project with some specific
commands to initialize and call the MBS computations.
Remark: there is no preprocessor for the MBS-DEM coupling: contactors
and mbs elements are added directly in the command script
* Add the MBS-DEM coupling anf the python interface of MBsysC to the
python path:
* `export PYTHONPATH=...../mbsysc/MBsysC/build/mbs_add_on/mbs_lmgc/lib:${PYTHONPATH}`
* `export PYTHONPATH=...../mbsysc/MBsysC/build/mbs_interface/mbs_python/lib:${PYTHONPATH}`
* Go to the work/lmgc90 folder: `cd ...../mbsysc/ExampleProjects/MultiplePendulum/workR/lmgc90`
* Run the script: `python command_MBS_LMGC.py`
You can then look at the simulation results in paraview as for a
LMGC90 project.
## Simulating the TTT picker robot
* Go to the folder in which you want to put the project: `cd my/mbs/folder`
* Get the project from git.immc.ucl.ac.be: `git clone git@git.immc.ucl.ac.be:mbs_lmgc90/Robot-TTT.git`
* Go to the workR directory: `cd Robot-TTT/workR`
* Create the build directory: `mkdir build`
* Go to the build directory: `cd build`
* Configure the project: `cmake ..`
* Adapt options:
* Open cmake-gui
* check FLAG_SEPARATE_BUILD and click configure
* In the field LibRobotranC_DIR, set the path to MBsysC: `....../mbsysC/MBsysC/build`
* Alternatively, in the command line: `cmake .. -DFLAG_SEPARATE_BUILD=ON -DROBOTRAN_SOURCE_DIR=....../mbsysC/MBsysC`
* Compile: `make`
* Go to the work/lmgc90 folder: `cd my/mbs/folder/Robot-TTT/workR/lmgc90`
* Add the MBS-DEM coupling anf the python interface of MBsysC to the
python path:
* `export PYTHONPATH=...../mbsysc/MBsysC/build/mbs_add_on/mbs_lmgc/lib:${PYTHONPATH}`
* `export PYTHONPATH=...../mbsysc/MBsysC/build/mbs_interface/mbs_python/lib:${PYTHONPATH}`
* Run the script: `python command_MBS_interface.py`
* Look at the motion in paraview
* Setting the correct position of the target:
* Open MBsysPad
* OPen the project by selecting the dataR/Rob_TTT.mbs file
* Click on the *User Model* button
* Select the *Target* suer model and set the X and Y values:
* X: -0.1
* Y: -0.3
* Save the project
* Run again