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) |
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 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.
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 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
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"
-->
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
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
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.
ipython
from pyjmi.examples import VDP_sim
VDP_sim.run_demo()
result
What did you calculate?
ipython
from pyjmi.examples import cstr
cstr.run_demo()
result
It looks like you're optimizing something.
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?
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