Mr. Adrian Pop,
in the last week I build a OpenModelica debian package based on Mr. William
Spinelli's package_builder. As sources I used the OpenModelica trunk vers.
3727. All other information about the build environment, compiler, support
libraries and so on, you will find in the appendix A at the end of this mail.
After installation I made some observations concerning the simulation and plot2
command. As test base I created a directory OMC under /home/${USER}/Programs/.
I copied the files UsersGuideExamples.onb and dcmotor.mo from
${OPENMODELICAHOME}/doc/testmodels/ to /home/${USER}/Programs/OMC/. I changed to
/home/${USER}/Programs/OMC/ and started OMNotebook. OMNotebook is a bash shell
script. The following rows shows the contents of the script:
#!/bin/sh
export OPENMODELICAHOME=/usr/share/omc-omshell
export OPENMODELICALIBRARY=${OPENMODELICAHOME}/modelica-2.2/
export DRMODELICAHOME=${OPENMODELICAHOME}/drmodelica/
export QTHOME=${OPENMODELICAHOME}/lib
${OPENMODELICAHOME}/bin/OMNotebook $*
The home of the above script is /usr/bin.
In OMNotebook I opened the notebook file UsersGuideExamples.onb and evaluated
the following commands:
- Input:
loadModel(Modelica)
- Output:
true
- Input:
loadFile("dcmotor.mo")
- Output
true
Running the simulation command from an input cell in OMNotebook stops with
the following error message:
- Input:
simulate(dcmotor,startTime=0.0,stopTime=10.0)
- Output:
record
resultFile = "Simulation failed.
"
end record
In the current working directory (/home/${USER}/Programs/OMC) I found the
executable of the model, in this case dcmotor. I started the executable dcmotor
from a bash shell and got a file dcmotor_res.plt.
I changed to OMNotebook an run the following command in the input frame of an
input cell:
- Input:
plot2({load.w, load.phi})
After some seconds I got the following error message:
- Output:
[Error] Unable to find plot image
"/home/${USER}/Programme/OMC/omc_tmp_plot.png
or /usr/share/omc-omshell/tmp/omc_tmp_plot.png"
Now I closed OMNotebook and deleted all files called dcmotor* accept dcmotor.mo
and I deleted the file output.log. Now I changed the enviroment variable PATH
from:
/usr/local/bin:/usr/bin:/bin:/usr/games
to:
/usr/local/bin:/usr/bin:/bin:/usr/games:/home/${USER}/Programme/OMC
I started OMNotebook again and run the simulation command:
- Input:
loadModel(Modelica)
- Input:
loadFile("dcmotor.mo")
- Input:
simulate(dcmotor,startTime=0.0,stopTime=10.0)
Now I got the following answer in the output frame of the input cell
- Output:
record
resultFile = "dcmotor_res.plt"
end record
Next I started the following plot2 command:
- Input:
plot2({load.w, load.phi})
The Ptolemy Plot client window pops up and shows me the graphs of the load.w
and the load.phi variables. But in the output frame of the input cell I found
the following error message and not the pixel image of the Ptolemy Plot graph:
- Output:
[Error] Unable to find plot image
"/home/${usr}/Programme/OMC/omc_tmp_plot.png
or /usr/share/omc-omshell/tmp/omc_tmp_plot.png"
Now it was time for some questions:
1. Why could the omc compiler put all the following files <model>.cpp,
<model>.libs, <model>.log, <model>_functons.cpp, <model>_init.txt,
<model>.makefile and the compiled executable <model> file in the current
working directory, but couldn't start the executable <model> file to get
the <model>_res.plt file?
2. Where builds the omc compiler the screen shot file omc_tmp_plot.png from
the Ptolemy Plot client graphic window?
The answer of the first question seems very easy. Because the executable <model>
file is not in the path. But why are the other <model> files in depend from the
content of the PATH environment variable. I found the answer in the Ceval.mo
file. The following excerpt shows the code that starts the executable <model>
file:
.
.
.
1917: cit = winCitation();
1918: pd = System.pathDelimiter();
1919: executableSuffixedExe = stringAppend(executable, System.getExeExt());
1920: sim_call = Util.stringAppendList(
1921: {cit,executableSuffixedExe,cit," > output.log 2>&1"});
1922: 0 = System.systemCall(sim_call);
1923: result_file = Util.stringAppendList({executable,"_res.plt"});
1924: simValue = Values.RECORD(Absyn.IDENT("SimulationResult"),
.
.
.
In row 1922 the command System.systemCall(sim_call) starts a file named exe-
cutable - see row 1919. But if the executable is not in the path, the command
System.systemCall(sim_call) can't run the executable. The simulation command
stops with the error message "Simulation failed.".
I made some little changes in the above source code. With this changes the
omc compiler can execute the executable <model> file, without a changed PATH
variable. In the following source code you find my changes in the rows 1918
and 1922. The command System.pwd() reads in the current working directory. In
the row 1922 I put the variable pwd in the function Util.stringAppendList():
.
.
.
1917: cit = winCitation();
1918: pwd = System.pwd();
1919: pd = System.pathDelimiter();
1920: executableSuffixedExe = stringAppend(executable, System.getExeExt());
1921: sim_call = Util.stringAppendList(
1922: {cit,pwd,pd,executableSuffixedExe,cit," > output.log 2>&1"});
1923: 0 = System.systemCall(sim_call);
1924: result_file = Util.stringAppendList({executable,"_res.plt"});
1925: simValue = Values.RECORD(Absyn.IDENT("SimulationResult"),
.
.
.
With the above changes you need no ./ entry in the PATH enviroment variable.
The answer of the second question is the error message of the plot2 command.
The plot2 command looks in the current working directory and in the
${OPENMODELICAHOME}/tmp directory. In my OpenModelica installation the home
of OpenModelica is the base directory /usr/share/omc-omshell/. This path
is read only for ordinary user. After I created a tmp directory in the direc-
tory /usr/share/omc-omshell/ and changed the modus of the directory tmp to
readable and writable the plot2 command finds the file omc_tmp_plot.png and
put it in the output frame of the input cell.
I tried to change this behavior. I think the omc compiler should create the
pixel image in the current directory, because directories under /usr/share
are only writable for user root. But I couldn't find the code where the
omc compiler create the file omc_tmp_plot.png and how the omc compiler write
it in the directory ${OPENMODELICAHOME}/tmp. Perhaps you can give me some
hints.
OMShell and OMShell-terminal shows the same behavior. Both programs put the
file omc_tmp_plot.png in the the directory ${OPENMODELICAHOME}/tmp but don't
delete the file. After terminating OMShell or OMShell-terminal the file
omc_tmp_plot.png is an orphan in the directory ${OPENMODELICAHOME}/tmp.
Regards,
Robert Wotzlaw
A. Operation system, Compiler suite
A.1 Operation system
Debian GNU/Linux testing "Lenny" Kernel Linux 2.6.25-2-686
a) Distribution Lenny testing "Official Snapshot i386 DVD 20080721-11:22"
A.2 Compiler suite and Development software
a) gcc 4.3
Official Debian package gcc_4.3.1-2 and other packages
b) g++ 4.3
Official Debian package g++_4.3.1-2 and other packages
b) antlr 2.7.7
Official Debian package antlr_2.7.7-6
libantlr-dev_2.7.7-6
c) qt4 4.4.0
Official Debian package qt4-dev-tools_4.4.0-4
qt4-qtconfig_4.4.0-4
libqt4-assistant_4.4.0-4
libqt4-dev_4.4.0-4
libqt4-help_4.4.0-4
libqt4-opengl-dev_4.4.0-4
libqt4-sql-sqlite_4.4.0-4
libqt4-test_4.4.0-4
libqt4-webkit_4.4.0-4
libqt4-xmlpattern_4.4.0-4
libqt4-qt3support_4.4.0-4
libqt4-core4_4.4.0-4
libqt4-gui4_4.4.0-4
libqt4-dbus_4.4.0-4
libqt4-network_4.4.0-4
libqt4-opengl-dev_4.4.0-4
libqt4-script_4.4.0-4
libqt4-sql_4.4.0-4
libqt4-sql-mysql-4.4.0-4
libqt4-svg_4.4.0-4
d) sun java 6 jre 1.6.0.07
Official Debian package sun-java6-jre_6-07-4
e) SML/NJ 110.67
Official Debian package smlnj_110.67-3
smlnj-runtime_110.67-3
libsmlnj-smlnj_110.67-3
ml-lex_110.67-3
ml-yacc_110.67-3
f) mico 2.3.13
Home made Debian package libmico-dev_2.3.13-1
libmico2.3.13_2.3.13-1
g) rml-mmc 2.3.8.svn.145
Home made Debian package rml-mmc_2.3.8.svn.145-1
h) OpenSSL 0.9.8g
Official Debian package libssl0.9.8_0.9.8g-10.1
libssl-dev_0.9.8g-10.1
i) GNU readline 5.2
Official Debian package libreadline5_5.2-3
libreadline5-dev_5.2-3
libncurses5-dev_5.6+20080308-1
j) Qt4 GUI component toolkit for Inventor 1.4.1
Official Debian package libsoqt4-20_1.4.1-5
libsoqt4-dev_1.4.1-5
libsoqt-dev-common_1.4.1-5
k) Coin 2.5.0
Official Debian package libcoin40-dev_2.5.0-2
libcoin40c2_2.5.0-2
l) flex 2.5.35
Official Debian package flex_2.5.35-2
m) bison 2.3
Official Debian package bison_1:2.3.dfsg-5
n) autoconf 2.61
Official Debian package autoconf_2.61-7
o) autoconf-archive 20070512
Official Debian package autoconf-archive_20070512-1
p) tofrodos 1.7.8.debian.1 (Converts DOS <-> Unix text files)
Official Debian package tofrodos_1.7.8.debian.1-1
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066