Size: 4607
Comment:
|
Size: 7840
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
= Help = <<TableOfContents>> |
|
Line 3: | Line 5: |
= Help = [[TableOfContents]] |
For questions that are not addressed here or in the manual, send email to https://groups.google.com/group/bcvtb |
Line 8: | Line 8: |
=== Error when compiling Ptolemy II (Windows only) === When running {{{make configPt}}} or when running {{{./configure && make fast install}}} gives the following error |
=== Error when compiling MATLAB === ==== Windows ==== Under Windows, if the BCVTB is compiled using the Microsoft compiler, then the MATLAB libraries also need to be compiled with the Microsoft compiler. If, however, the gcc compiler has been used when compiling the BCVTB, then the following compilation error may be obtained when compiling the MATLAB libraries: |
Line 12: | Line 13: |
/bin/sh: -c: line 1: unexpected EOF while looking for matching `'' /bin/sh: -c: line 4: syntax error: unexpected end of file }}} then the source code is most likely with Unix line endings. Download the Windows source code from the Ptolemy web page. === Error when compiling MATLAB (Windows only) === Under Windows, if the BCVTB is compiled using the Microsoft compiler, then the MATLAB libraries also need to be compiled with the Microsoft compiler. If, however, the gcc compiler has been used when compiling the BCVTB, then the following compilation error may be obtained when compiling the MATLAB libraries: {{{ Writing library for establishBSDSocket.mexw32 c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_establishclientsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_exchangewithsocket' |
Writing library for establishBSDSocket.mexw32 c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_establishclientsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_exchangewithsocket' |
Line 30: | Line 18: |
To fix this problem, open Matlab, run | To fix this problem, open Matlab, run |
Line 36: | Line 24: |
==== Linux Ubuntu 10.10 64-bit ==== In MATLAB R2010b, the command {{{ cd lib/matlab ant all }}} may fail with the error message {{{ Warning: You are using gcc version "4.4.4-14ubuntu5)". The version [exec] currently supported with MEX is "4.3.4". [exec] For a list of currently supported compilers see: [exec] http://www.mathworks.com/support/compilers/current_release/ [exec] [exec] /usr/bin/ld: cannot find -lstdc++ [exec] collect2: ld returned 1 exit status [exec] [exec] mex: link of ' "establishBSDSocket.mexa64"' failed. [exec] [exec] ??? Error using ==> mex at 208 [exec] Unable to complete successfully. [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simuli>> nk/+legacycode/@LCT/compile.p>compile [exec] at 264 [exec] [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simulink/+legacycode/@LCT/legacyCodeImpl.p>legacyCodeImpl [exec] at 84 [exec] [exec] [exec] Error in ==> legacy_code at 87 [exec] [varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, [exec] varargin{1:end}); [exec] [exec] Error in ==> compile at 90 [exec] legacy_code('compile', def, ... [exec] }}} This problem is caused by {{{/usr/bin/ld}}} not finding the {{{stdc++}}} library. As a work-around, proceed as follows: |
|
Line 37: | Line 65: |
=== Error when compiling MATLAB (Mac OS X with Matlab R2009a only) === Under Mac OS X, if the BCVTB is compiled in Matlab R2009a, the following error may occur: |
Type |
Line 40: | Line 67: |
Undefined symbols: "_mxGetM", referenced from: _mexFunction in establishBSDSocket.o "_mxGetN", referenced from: _mexFunction in establishBSDSocket.o "_mxIsNumeric", referenced from: _mexFunction in establishBSDSocket.o "_mxGetClassID", referenced from: _ssGetDTypeIdFromMxArray in establishBSDSocket.o "_mxCalloc", referenced from: __RegNumInputPortsCB in establishBSDSocket.o __RegNumOutputPortsCB in establishBSDSocket.o _mexFunction in establishBSDSocket.o "_mxGetPr", referenced from: _mexFunction in establishBSDSocket.o "_mxIsComplex", referenced from: _mexFunction in establishBSDSocket.o "_mxCreateDoubleMatrix_700", referenced from: _mexFunction in establishBSDSocket.o ld: symbol(s) not found collect2: ld returned 1 exit status |
sudo emacs ~/.matlab/R2010b/mexopts.sh }}} In the section {{{ glnxa64) }}}, change the line {{{ CLIBS="$CLIBS -lstdc++" }}} to {{{ CLIBS="$CLIBS" }}} Now, the command {{{ant all}}} should work and produce the files {{{libbcvtb_thunk_glnxa64.so}}}, {{{establishBSDSocket.mexa64}}}, {{{exchangeDoublesWithBSDSocket.mexa64}}} and {{{closeBSDSocket.mexa64}}}. |
Line 62: | Line 79: |
mex: link of ' "establishBSDSocket.mexmaci"' failed. | |
Line 64: | Line 80: |
??? Error using ==> mex at 218 Unable to complete successfully. Error in ==> /Applications/MATLAB_R2009a.app/toolbox/simulink/simulink/+legacycode/@LCT/compile.p>compile at 261 Error in ==> /Applications/MATLAB_R2009a.app/toolbox/simulink/simulink/legacy_code.p>legacy_code at 91 Error in ==> compile at 58 legacy_code('compile', def, ... }}} This seems to be related with the compiler setup. As a work-around, you may copy the file {{{mexopt.sh}}} from a previous matlab version, i.e., copy {{{$HOME/.matlab/"matlab-version"/mexopt.sh}}} to {{{$HOME/.matlab/R2009a/mexopts.sh}}}. Alternatively, you may run from a matlab prompt {{{ >> mex -setup }}} and select the gcc compiler. This should create the file {{{mexopt.sh}}}. |
|
Line 82: | Line 83: |
Line 85: | Line 85: |
=== Investigate program output === Depending on how simulation programs are called by the {{{Simulation}}} actor in Ptolemy, the console output written by the simulation program may not be visible. To see the console output, change the command line of the Ptolemy actor from{{{ bash ./runClient.sh |
=== Running the BCVTB on Mac OS X version 10.11 === Apple has enabled a new default security oriented featured called System Integrity Protection, often called rootless, in OS X 10.11 onwards. This new feature prevents the BCVTB to set environment variables which are required for the BCVTB to run. To circumvent these problems copy the {{{libbcvtb.dylib}}} which is in {{{$PATH_TO_BCVTB/lib/util}}} to {{{/usr/local/lib}}} with: {{{ sudo cp $PATH_TO_BCVTB/lib/util/libbcvt.dylib /usr/local/lib/ |
Line 89: | Line 95: |
to{{{ xterm -e bash ./runClient.sh |
Next, check if a !HostName is set on your machine from a terminal with: {{{ scutil --get HostName |
Line 92: | Line 101: |
This will start a terminal that shows the output of the running simulation program which help analyzing what goes wrong, for example, when the simulation program terminates due to an error before connecting to the BCVTB. | |
Line 94: | Line 102: |
If there's no !HostName set, then set your !HostName. | |
Line 95: | Line 104: |
=== Investigate log files === If something goes wrong during the simulation, check the files {{{simulation.log}}}, {{{utilSocket.log}}} and {{{utilClient.log}}}. They contain log messages that may indicate the cause of the problem. If these files do not exist, go to the directory {{{bcvtb/lib}}}, open the file {{{defines.h}}} and add the line |
Your !HostName must be the same as your computer's local network name. To find out your computer's local network name, Open Sharing preferences (choose Apple menu > System Preferences, then click Sharing). The local network name is displayed beneath the computer’s name at the top of the pane. The local network name is your computer’s name with “.local” added, and any spaces are replaced with hyphens . For example, if your computer’s name is My Computer, your local network name is “My-Computer.local.” Set your !HostName with: {{{ sudo scutil --set HostName 'YourLocalNetworkName' }}} Check your !HostName with: {{{ echo $HOSTNAME }}} === Check program output === By default, the {{{Simulation}}} actor in Ptolemy writes a copy of the console output of the simulation program to a file called {{{simulation.log}}}. This file can typically be found in the directory from which the simulation program has been started. === Check log files === If something goes wrong during the simulation, check the files {{{simulation.log}}}, {{{utilSocket.log}}} and {{{utilClient.log}}}. They contain log messages that may indicate the cause of the problem. If these files do not exist, go to the directory {{{bcvtb/lib}}}, open the file {{{defines.h}}} and add the line |
Line 104: | Line 135: |
Then, from the directory {{{bcvtb/lib}}} compile the libraries using {{{ make clean make |
Then, from the directory {{{bcvtb/lib/util}}} compile the libraries using{{{ ant clean all |
Line 109: | Line 138: |
and rerun the simulation. Now the log files should be written to the directory from which you started the BCVTB. |
and rerun the simulation. Now the log files should be written to the directory from which you started the BCVTB. === Memory problem === If the following error occurs:{{{ java.lang.OutOfMemoryError: Java heap space}}} then increase the Java heap space by running vergil with the command{{{ java -jar path_to_bcvtb\bin\BCVTB.jar -Xmx1024m system.xml}}} The argument {{{-Xmx1024m}}} declares how much memory is allocated. The default for Java is -Xmx128m === Wrong Java version === The following error occurs if a too old Java version is used:{{{ java.lang.UnsupportedClassVersionError: Bad version number in .class file}}} To fix this problem, update your Java. === EnergyPlus on Windows cannot find Java === If !EnergyPlus writes the error{{{ Instantiating Building Controls Virtual Test Bed ExternalInterface initializes. 'java' is not recognized as an internal or external command, operable program or batch file. **FATAL:Error in ExternalInterface: Check EnergyPlus *.err file. }}} then Java is installed, but not on the {{{Path}}} variable of the operating system. This situation occurred on a Windows 7, 64-bit, installation. The Windows Explorer associated the file extension {{{.jar}}} with Java (which allowed the user to start the BCVTB from the Windows Explorer), but Java could not be found by !EnergyPlus as the Java binary directory was not on the Windows {{{Path}}} variable. To fix this problem, add the directory that contains {{{java.exe}}} to your system path. Java may be installed in {{{C:\Program Files (x86)\Java\jre6\bin}}}. === Java cannot find VergilApplication === If running{{{ bin/bcvtb examples/c-room/system.xml }}} causes the following error{{{ Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/vergil/VergilApplication Caused by: java.lang.ClassNotFoundException: ptolemy.vergil.VergilApplication }}} then the system environment variable {{{PTII}}} is set to a directory that does not contain a Ptolemy II installation. This may happen if a user installed !OpenModelica, as !OpenModelica sets the PTII variable. To fix this error, proceed as follows: * on Windows, add the line{{{ <entry key="PTII">$BCVTB_HOME\lib\ptII</entry>}}} to the file {{{bin\systemVariables-windows.properties}}} in the BCVTB home directory. * on Linux or Mac, add the line{{{ <entry key="PTII">$BCVTB_HOME/lib/ptII</entry>}}} to the file {{{bin/systemVariables-linux.properties}}} or {{{bin/systemVariables-mac.properties}}} in the BCVTB home directory. |
Help
Contents
For questions that are not addressed here or in the manual, send email to https://groups.google.com/group/bcvtb
1. Compilation problems
1.1. Error when compiling MATLAB
1.1.1. Windows
Under Windows, if the BCVTB is compiled using the Microsoft compiler, then the MATLAB libraries also need to be compiled with the Microsoft compiler. If, however, the gcc compiler has been used when compiling the BCVTB, then the following compilation error may be obtained when compiling the MATLAB libraries:
Writing library for establishBSDSocket.mexw32 c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_establishclientsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_exchangewithsocket' c:\docume~1\mwetter\locals~1\temp\mex_ae679\simulinksocket.obj .text: undefined reference to '_closeipc'
To fix this problem, open Matlab, run
mex -setup
and select the Microsoft Visual C++ compiler from the menu. This need to be done only once as it updates your Matlab settings.
1.1.2. Linux Ubuntu 10.10 64-bit
In MATLAB R2010b, the command
cd lib/matlab ant all
may fail with the error message
Warning: You are using gcc version "4.4.4-14ubuntu5)". The version [exec] currently supported with MEX is "4.3.4". [exec] For a list of currently supported compilers see: [exec] http://www.mathworks.com/support/compilers/current_release/ [exec] [exec] /usr/bin/ld: cannot find -lstdc++ [exec] collect2: ld returned 1 exit status [exec] [exec] mex: link of ' "establishBSDSocket.mexa64"' failed. [exec] [exec] ??? Error using ==> mex at 208 [exec] Unable to complete successfully. [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simuli>> nk/+legacycode/@LCT/compile.p>compile [exec] at 264 [exec] [exec] [exec] Error in ==> [exec] /usr/local/matlab/R2010b/toolbox/simulink/simulink/+legacycode/@LCT/legacyCodeImpl.p>legacyCodeImpl [exec] at 84 [exec] [exec] [exec] Error in ==> legacy_code at 87 [exec] [varargout{1:nargout}] = legacycode.LCT.legacyCodeImpl(action, [exec] varargin{1:end}); [exec] [exec] Error in ==> compile at 90 [exec] legacy_code('compile', def, ... [exec]
This problem is caused by /usr/bin/ld not finding the stdc++ library. As a work-around, proceed as follows:
Type
sudo emacs ~/.matlab/R2010b/mexopts.sh
In the section glnxa64) , change the line
CLIBS="$CLIBS -lstdc++"
to
CLIBS="$CLIBS"
Now, the command ant all should work and produce the files libbcvtb_thunk_glnxa64.so, establishBSDSocket.mexa64, exchangeDoublesWithBSDSocket.mexa64 and closeBSDSocket.mexa64.
2. Runtime problems
The following steps typically help analyzing problems if a simulation program does not work as expected.
2.1. Running the BCVTB on Mac OS X version 10.11
Apple has enabled a new default security oriented featured called System Integrity Protection, often called rootless, in OS X 10.11 onwards. This new feature prevents the BCVTB to set environment variables which are required for the BCVTB to run. To circumvent these problems
copy the libbcvtb.dylib which is in $PATH_TO_BCVTB/lib/util to /usr/local/lib with:
sudo cp $PATH_TO_BCVTB/lib/util/libbcvt.dylib /usr/local/lib/
Next, check if a HostName is set on your machine from a terminal with:
scutil --get HostName
If there's no HostName set, then set your HostName.
Your HostName must be the same as your computer's local network name.
To find out your computer's local network name,
Open Sharing preferences (choose Apple menu > System Preferences, then click Sharing).
The local network name is displayed beneath the computer’s name at the top of the pane.
The local network name is your computer’s name with “.local” added, and any spaces are replaced with hyphens . For example, if your computer’s name is My Computer, your local network name is “My-Computer.local.”
Set your HostName with:
sudo scutil --set HostName 'YourLocalNetworkName'
Check your HostName with:
echo $HOSTNAME
2.2. Check program output
By default, the Simulation actor in Ptolemy writes a copy of the console output of the simulation program to a file called simulation.log. This file can typically be found in the directory from which the simulation program has been started.
2.3. Check log files
If something goes wrong during the simulation, check the files simulation.log, utilSocket.log and utilClient.log. They contain log messages that may indicate the cause of the problem. If these files do not exist, go to the directory bcvtb/lib, open the file defines.h and add the line
#define NDEBUG
Then, from the directory bcvtb/lib/util compile the libraries using
ant clean all
and rerun the simulation. Now the log files should be written to the directory from which you started the BCVTB.
2.4. Memory problem
If the following error occurs:
java.lang.OutOfMemoryError: Java heap space
then increase the Java heap space by running vergil with the command
java -jar path_to_bcvtb\bin\BCVTB.jar -Xmx1024m system.xml
The argument -Xmx1024m declares how much memory is allocated. The default for Java is -Xmx128m
2.5. Wrong Java version
The following error occurs if a too old Java version is used:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
To fix this problem, update your Java.
2.6. EnergyPlus on Windows cannot find Java
If EnergyPlus writes the error
Instantiating Building Controls Virtual Test Bed ExternalInterface initializes. 'java' is not recognized as an internal or external command, operable program or batch file. **FATAL:Error in ExternalInterface: Check EnergyPlus *.err file.
then Java is installed, but not on the Path variable of the operating system. This situation occurred on a Windows 7, 64-bit, installation. The Windows Explorer associated the file extension .jar with Java (which allowed the user to start the BCVTB from the Windows Explorer), but Java could not be found by EnergyPlus as the Java binary directory was not on the Windows Path variable.
To fix this problem, add the directory that contains java.exe to your system path. Java may be installed in C:\Program Files (x86)\Java\jre6\bin.
2.7. Java cannot find VergilApplication
If running
bin/bcvtb examples/c-room/system.xml
causes the following error
Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/vergil/VergilApplication Caused by: java.lang.ClassNotFoundException: ptolemy.vergil.VergilApplication
then the system environment variable PTII is set to a directory that does not contain a Ptolemy II installation. This may happen if a user installed OpenModelica, as OpenModelica sets the PTII variable.
To fix this error, proceed as follows:
on Windows, add the line
<entry key="PTII">$BCVTB_HOME\lib\ptII</entry>
to the file bin\systemVariables-windows.properties in the BCVTB home directory.
on Linux or Mac, add the line
<entry key="PTII">$BCVTB_HOME/lib/ptII</entry>
to the file bin/systemVariables-linux.properties or bin/systemVariables-mac.properties in the BCVTB home directory.