A Docker container for JModelica on Jupyter

7 posts / 0 new
Last post
bsamadi
Offline
Joined: 2016-10-20
A Docker container for JModelica on Jupyter

Hello everyone,

I have spent a few days for installing JModelica so that you don't have to! I have created a Docker container for JModelica. It simply means that you can instantly have a computer with JModelica installed. 

You can run the container with this command:

docker run -p 8888:8888 mechatronics3d/jjmodelica

Then go to this address on your browser:

http://localhost:8888/

To run the first example, open a new Jupyter Notebook for Python 2 and enter:

%matplotlib inline

from pyjmi.examples import VDP_sim

VDP_sim.run_demo()

There are examples that I still cannot run, for example the cstr demo. I was wondering if you can try this container and let me know what is missing. You can find the installation commands here: https://github.com/Mechatronics3D/jjmodelica

bsamadi
Offline
Joined: 2016-10-20
Automatic tests

It seems a bit quiet here. I was looking for automatic tests of JModelica. I didn't find anything in the documents. I am a newbie and I discovered that I could go to the Python/tests_jmodelica and run ```nosetests tests_jmodelica``` to run the tests. From 1402 tests, 327 of them failed. I was wondering if this is normal. I have Ubuntu 14.04 and Python 2.7.6.

bsamadi
Offline
Joined: 2016-10-20
Example errors

I also face some errors in the examples. You can see them here:

https://github.com/Mechatronics3D/jjmodelica/blob/master/JModelica_examp...

fredrik
Offline
Joined: 2011-08-26
To run the full test suite,

To run the full test suite, run the script called jm_tests in your JModelica install folder. See jm_tests --help for possible options. It is not normal for tests to fail.

One recurring error in the examples is "Failed to start JVM". There are two incompatible frameworks in JModelica that rely on a JVM. The first is related to interacting with the compiler AST, whereas the other is related to CasADi-based optimization. Once you start a JVM for either of these purposes in a Python session, you can't start a JVM for the other purpose (at least not in any way that I know of). I think the only AST-related example is pyjmi.ast_example. Once you run that example, all the CasADi-related examples (which there are many of, e.g., ccpp) will not work unless you restart Python.

bsamadi
Offline
Joined: 2016-10-20
jm_tests

Thank you very much Fredrik. I executed the jm_tests script. The only warning that I got was this:

Running test_examples_casadi.py
----------------------------------------------------------------------
Ran 10 tests in 79.442s

CasADi warning: "Reference counting failure. Possible cause: Circular dependency in user code." (assertion "count==0" on line 125 of file "/home/jserver/Downloads/JModelica.org/ThirdParty/CasADi/CasADi/casadi/core/shared_object.cpp" failed.)

Also, I was missing the Ubuntu dc package. It would be good to add the dc package to JModelica requirements.

 

roel
Offline
Joined: 2010-02-23
great

Great, I totally support this initiative.  I'm using jmodelica in a docker container too, but I have problems maintaining it.

Are you also aware of this image: https://hub.docker.com/r/mclab/jmodelica/ ?

 

bsamadi
Offline
Joined: 2016-10-20
MCLAB/JModelica

I have seen the mclab/jmodelica image. They have not installed IPOPT, which is necessary for CasADi.

The image that I created includes IPOPT and passes all the tests.

Login or register to post comments