Install JModelica on Ubuntu

What is J Modelica

According to the user guide

To put it simply


Basic information of JModelica

Software name JModelica
version 1.17
Developer Lund University
(Currently developed and maintained by Model on AB)
license GPL v3 ※1
URL http://www.jmodelica.org/
platform Linux(32/64bit) Windows(32/64bit)

Installation

Just follow the basic user guide (round throw) Windows http://www.jmodelica.org/page/27667 Ubuntu 12.04 http://www.jmodelica.org/page/27667 Ubuntu 15.04 http://www.jmodelica.org/27663

For those who like Ubuntu but now it's 2016 and Anaconda is good Below, we explain the installation of Anaconda, JModelica on Ubuntu 16.04.


Prepare the Anaconda environment

Prepare a virtual environment with Anaconda. First, install pyenv

bash


git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
source ~/.bashrc

Next, install Anaconda and create a virtual environment named cae.

bash


wget -P $(pyenv root)/cache https://repo.continuum.io/archive/Anaconda2-4.1.0-Linux-x86_64.sh
pyenv install anaconda2-4.1.0
pyenv global anaconda2-4.1.0
pyenv rehash
conda update -y conda

Normally, the first line above should be unnecessary. When curl is annoying with an error in the TLS encryption size in `pyenv install` First download with wget and then install.


Preparation for installing JModelica on Ubuntu 16.04 (64bit)

Installation of required packages

Install the packages required by JModelica on Ubuntu 16.04. Enter the following at the terminal

bash


sudo apt install -y g++ subversion gfortran cmake swig ant openjdk-8-jdk  zlib1g-dev libboost-dev automake autoconf pkg-config

Install the required Python packages

Install the Python package required by JModelica in the Python environment created earlier. Install jpype and jcc from Anaconda Cloud.

bash


conda install -y anaconda
conda install -y -c omnia jpype1=0.6.0
conda install -y -c ssc jcc=2.21

<!--

Before installing Ipopt

installation of paco

Install paco to manage stray builds. Skip this page if you don't manage packages

bash


sudo apt-get install paco

When you do sudo make install` `` in / usr / local etc., you can enter `` `sudo paco -lp" package name "" make install " Can be managed with paco.

bash example


#Installation of stray packages(If you need sudo)
sudo paco -lp "package name" "make install"
#Packages managed by paco
paco -a
#Installed files
paco -f "package name"
#Uninstall
paco -r "package name"

-->


Install Ipopt

It seems that it is provided as an Ubuntu package, Is there a flaw in the package around Ubuntu 12.04? It seems that it didn't work well. Again compile from source. Change the prefix at the time of configure in your own environment.

bash


mkdir ~/Ipopt
cd ~/Ipopt
wget http://www.coin-or.org/download/source/Ipopt/Ipopt-3.12.6.tgz
tar xzf Ipopt-3.12.6.tgz
cd Ipopt-3.12.6/ThirdParty/Blas
./get.Blas
cd ../Lapack
./get.Lapack
cd ../Mumps
./get.Mumps
cd ../Metis
./get.Metis
cd ../../
mkdir build
cd build
../configure --prefix=/home/ubuntu/Ipopt
make
make install

Install J Modelica on Ubuntu 16.04 (64bit)

Change the prefix and with-ipopt paths when configuring in your own environment According to the configure file, there is an environment variable for PYTHON_HOME Note that PYTHON_INCLUDE and PYTHON_LIB are set to paths that do not match the Anaconda environment.

bash


export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server
export PYTHON_INCLUDE=/home/ubuntu/.pyenv/versions/anaconda2-4.1.0/include/python2.7
export PYTHON_LIB=/home/ubuntu/.pyenv/versions/anaconda2-4.1.0/lib/libpython2.7.so

mkdir -p ~/JModelica
cd ~/JModelica
svn co https://svn.jmodelica.org/trunk JModelica.org
cd JModelica.org
mkdir build
cd build
../configure --prefix=/home/ubuntu/JModelica --with-ipopt=/home/ubuntu/Ipopt
make
make install
make casadi_interface

Operation test

Start ipython with the path required to use JModelica

bash


/home/ubuntu/JModelica/bin/jm_ipython.sh

X environment is required for plot display. After that, operation test in ipython terminal.


Test 1

ipython


from pyjmi.examples import VDP_sim
VDP_sim.run_demo()

result

VDP_sim_result.png

What did you calculate?


Test 2

ipython


from pyjmi.examples import cstr
cstr.run_demo()

result

CSTR_result1.png CSTR_result2.png CSTR_result3.png

It looks like you're optimizing something.


Test 3

ipython


from pyjmi.examples import cstr_casadi
cstr_casadi.run_demo()

result

RuntimeError: The assertion "handle!=0" on line 171 of file "/home/ubuntu/JModelica/JModelica.org/ThirdParty/CasADi/CasADi/casadi/core/function/plugin_interface.hpp" failed. 
PluginInterface::loadPlugin: Cannot load shared library:
  Tried libcasadi_nlpsolver_ipopt.so:
    Error code: libcasadi_nlpsolver_ipopt.so: cannot open shared object file: No such file or directory
  Tried /home/ubuntu/JModelica/ThirdParty/CasADi/lib/libcasadi_nlpsolver_ipopt.so:
    Error code: /home/ubuntu/JModelica/ThirdParty/CasADi/lib/libcasadi_nlpsolver_ipopt.so: cannot open shared object file: No such file or directory

Certainly there is no libcasadi_nlpsolver_ipopt.so. Well?


Bonus
Enable JModelica with jupyter notebook

An example is shown when the installation path of JModelica is / home / ubuntu / JModelica. Change the installation path part according to your environment

bash


sed 's/ipython/jupyter notebook --no-browser/g' /home/ubuntu/JModelica/bin/jm_ipython.sh >/home/ubuntu/JModelica/bin/jm_jupyter_notebook.sh
chmod +x /home/ubuntu/JModelica/bin/jm_jupyter_notebook.sh

Start jupyter notebook.

bash


/home/ubuntu/JModelica/bin/jm_jupyter_notebook.sh

Launch your browser and go to http: // localhost: 8888 /.

Recommended Posts

Install JModelica on Ubuntu
Install TensorFlow on Ubuntu
Install PySide2 on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Install Theano on Ubuntu 12.04
Install angr on Ubuntu 18.04
Install pip / pip3 on Ubuntu
Install GoLand IDE on Ubuntu
Install OpenCV on Ubuntu + python
wsl Install PostgreSQL on Ubuntu 18.04
[ROS] Install ROS (melodic) on Ubuntu (18.04)
Install Caffe on Ubuntu 14.04 (GPU)
Install Docker on WSL Ubuntu 18.04
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Install Caffe on Ubuntu 14.04 (CPU mode)
Install Mecab and mecab-python3 on Ubuntu 14.04
Install and run dropbox on Ubuntu 20.04
Install OpenCV and Chainer on Ubuntu
Install CUDA 8.0 and Chainer on Ubuntu 16.04
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Install fabric on Ubuntu and try
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install confluent-kafka for Python on Ubuntu
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
How to install Go on Ubuntu
ROS study # 1 Install ros-noetic on ubuntu 20.04
Shebang on Ubuntu 20.04
Steps to install Python environment on Ubuntu
Install Pleasant on Ubuntu 20.04 (.NetCore3.1 / PostgreSQL version)
Install ubuntu on 32bit UEFI Ultra Notebook
Install Caffe running 3D-CNN on clean Ubuntu 14.04
Install Puppet Master and Client on Ubuntu 16.04
How to install php7.4 on Linux (Ubuntu)
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
Install mecab on Marvericks
Install Tensorflow on Mac
I can't install Dask with pip on Ubuntu
Install Faiss on CentOS 7
Install pyenv on mac
Install pip on Mavericks
Install Python on Pidora.
Install mongodb on termux
Install Scrapy on python3
Install python package in personal environment on Ubuntu
Install docker on Fedora31
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Install numba on CentOS 7.2
Install Ansible on Mac
Install Python on Mac
Install Python 3 on Mac
Install Plone (4.3.6) on MacOSX (10.10.3)
Install Python3.4 on CentOS 6.6
Install Docker (Ubuntu 18.04 LTS)
Install gensim on Marvericks
Install GPU-enabled LightGBM (Ubuntu 16.04)
Install the latest Cuda + CuDNN on Ubuntu 18.04 @ Spring 2020
Install Anaconda on Windows 10
Install numpy on Marvericks
Install python on windows
Install enebular-agent on Chromebook
Install pycuda on Windows10