MBDyn sim suite

Installing the Python package on win32

Until now the only way to install it is to follow the developer steps. As the package did not run correctly on Win32, it was not seen as relevant to build an installer. However some of the tests work. So if you would like to see the current status or investigate the remaining problems, the following notes are for you.

Prerequisites

The list of prerequisites are:
  • Python, install it with its current Windows installer. However you are done only when the interpreter starts by entering 'python' in a command prompt. Those explanations will help you for that step. They will also help each time a new entry needs to be done in the 'Path' variable. In that example, 'C:\Python25' was first added and the version 2.5.1 was used.
  • To ease the prerequisites installation, download the file 'ez_enstaller_setup.py' at the Enthought website. Double click on it and it should install the program 'Enstaller' in your program menu. You will be able to browse a repositories of packages, you can also learn more about that step. The packages to select for installation are:
    • matplotlib, for plotting the results
    • mingw, that will include the gcc, g++ and g77 compilers
    • numpy, for matrix manipulation in Python
    • SWIG, for building the bindings to the MBDyn code
    Hitting 'Install packages' will already bring important dependencies. Moreover, the path should be handled by the installation process. As indication, the version used were: SWIG 1.3.31, mingw 3.4.5, numpy 1.0.3, matplotlib 0.90.1.
  • Scons, download and install its stable version. The version used was 0.97.
  • MSYS (Minimal System), needed to use the programs 'tar', 'sh' and 'patch'. You can get it on the page for the MinGW installer. In those notes, the path added to the 'Path' variable was 'C:\msys\1.0\bin', the version used was 1.0.10. You are done when entering 'tar' in a command prompt returns a description message.
  • GDB, the GNU debugger; optional, but it is already known that the program will crash. You can get it in the the MinGW installer download part. In those notes, the version 6.6 was a package, saved in 'C:\msys\1.0'. Then the archive was uncompressed from there by using the 'tar' command.
It lacks the libtool library and Unix sockets will of course not be available on Win32. That's why some of the MBDyn sources are patched for not using those two dependencies, others are not compiled (see the method 'set_win32modidications' in the 'SConstruct' file). The problem comes certainly from here. Also the file 'fn_WIN32.cc' was created to replace the 'fn_UNIX.cc', this is another uncertainty. But by reading the header 'filename.h', some symbols where not defined for a win32 system.

Extracting the sources

Extract the sources from the zip archive got in the download part to the directory of your choice. Then open a command prompt in the top directory containing the file 'setup.py'.

MBDyn service for Python

First the bindings to MBDyn need to be built, it will require to turn the MBDyn sources into Python module used as a Dll.

Build and Install

To build the Python package, run: # python setup.py build


To install it to its standard location: # python setup.py install


Tests and examples

You can as an example starts in the cantilever directory: # cd doc\example\cantilever_beam


Then try the 4 tests (it should work): # python test.py


A known problem on a fresh win32 install is the lack of the 'MSVCP71.dll' for Matplotlib. In that case download it from a web research and put it, for example, in the place where 'python.exe' is ('C:\Python25' in that example), you are then sure that the system will find it.
Now we will make the package crash. Go to the rigid pendulum example: # cd ..\rigid_pendulum


Run the case 1 of this example: # python rigid_pendulum3cases.py


The last simulation, the fixed distance between the two nodes, should return a run time error. The problem is at the line 34, the coma separator is not returned any more. A GDB investigation has revealed that the 'iostream' library of MinGW 3.4.5 did not return the right string. This problem is still very mysterious.
You can also have a look at the current documentation to understand the package concept. A big user of py-mbdyn-sim-suite is certainly the wind-sim-suite project.
Documentation under Creative Commons - Attribution / Share Alike license.