Open RasPiTool opened 6 years ago
Building this code should probably work under Raspberry Pi.
Be warned that this code is fairly old, to get a more recent version of the FMU SDK, you might try FMUSDK 2.0.6 from https://resources.qtronic.de/fmusdk/FmuSdk_reference.html
The failure you are seeing is because the fmu10/src/models/build_fmu script is not executing.
Under macOS, I cloned the repo, ran make and the build completed. For your reference, here is the first part of the build. Note that under macOS, make is in /Applications/Xcode.app/Contents/Developer/usr/bin/make, under other operating systems, you would see different values for the make executable
bash-3.2$ make
(cd fmu10; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd src; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
if [ ! -d ../bin ]; then \
echo "Creating ../bin/"; \
mkdir ../bin/; \
fi
Creating ../bin/
cc -g -Wall -DFMI_COSIMULATION -DSTANDALONE_XML_PARSER \
-Ico_simulation/fmusim_cs -Ico_simulation/include \
-Ishared \
co_simulation/fmusim_cs/main.c shared/sim_support.c shared/stack.c shared/xml_parser.c \
-o fmusim_cs -lexpat -ldl
cp fmusim_cs ../bin/
cc -g -Wall -DSTANDALONE_XML_PARSER \
-Imodel_exchange/fmusim_me -Imodel_exchange/include -Ishared \
model_exchange/fmusim_me/main.c shared/sim_support.c shared/stack.c shared/xml_parser.c \
-o fmusim_me -lexpat -ldl
cp fmusim_me ../bin/
(cd models; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
./build_fmu me bouncingBall
+ cd bouncingBall
+ make dirclean
rm -rf *.so *.dylib *.o *.fmu *~ fmu
+ make ARCH=darwin64 CBITSFLAGS= CSORME=me CSORME_INCLUDE=-I../../model_exchange/include PIC= SHARED_LIBRARY_SUFFIX=dylib boun\
cingBall.fmu
echo `pwd`
/Users/cxh/src/fmusdk2/fmu10/src/models/bouncingBall
cc -g -c -Wall -I../../model_exchange/include -I.. bouncingBall.c -o bouncingBall.o
cc -dynamiclib -o bouncingBall.dylib bouncingBall.o
rm -rf fmu
mkdir -p fmu/binaries/darwin64 fmu/sources fmu/documentation
cp bouncingBall.dylib fmu/binaries/darwin64
cp *.c *.h fmu/sources
cp: *.h: No such file or directory
make[4]: [bouncingBall.fmu] Error 1 (ignored)
cp *.html *.png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
mkdir -p ../../../fmu/me
(cd fmu; zip -q -r ../../../../fmu/me/bouncingBall.fmu *)
rm bouncingBall.o bouncingBall.dylib
./build_fmu me dq
The build_fmu script has these permissions:
bash-3.2$ ls -l fmu10/src/models/build_fmu
-rwxr-xr-x 1 cxh staff 1347 Jul 21 08:45 fmu10/src/models/build_fmu
If the permissions of your build_fmu file are not the same, then try
chmod a+x fmu10/src/models/build_fmu fmu20/src/models/build_fmu
Then re-run make
It looks like 2.0.6 has a bug fix that might help:
https://resources.qtronic.de/fmusdk/FmuSdk_reference.html says:
20.07.2018, Version 2.0.6
update libxml2.lib to work for windows 7 and Visual Studio 2013 and 2015
linux - give exec right to build_fmu.sh before executing it
copy .h model files with rsync to avoid missing file error
Thank you for the answer! I downloaded the latest version from https://resources.qtronic.de/fmusdk/FmuSdk_reference.html . I changed also the permissions like you said.
**The build_fmu script has these permissions:
bash-3.2$ ls -l fmu10/src/models/build_fmu -rwxr-xr-x 1 cxh staff 1347 Jul 21 08:45 fmu10/src/models/build_fmu If the permissions of your build_fmu file are not the same, then try
chmod a+x fmu10/src/models/build_fmu fmu20/src/models/build_fmu**
Then I re-run the installation with make and i get an error like this:
(cd fmu10; make) make[1]: Entering directory '/home/pi/Documents/neue_FMU/fmu10' (cd src; make) make[2]: Entering directory '/home/pi/Documents/neue_FMU/fmu10/src' (cd models; make) make[3]: Entering directory '/home/pi/Documents/neue_FMU/fmu10/src/models' ./build_fmu me bouncingBall
pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. bouncingBall.c -o bouncingBall.o
cc -shared -Wl,-soname,bouncingBall.so -o bouncingBall.so bouncingBall.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp bouncingBall.so fmu/binaries/linux64
cp .c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'bouncingBall.fmu' failed
make[4]: [bouncingBall.fmu] Error 1 (ignored)
cp .html .png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/bouncingBall.fmu )
rm bouncingBall.o bouncingBall.so
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall'
./build_fmu me dqpwd
/home/pi/Documents/neue_FMU/fmu10/src/models/dq
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. dq.c -o dq.o
In file included from dq.c:64:0:
../fmuTemplate.c: In function ‘dq_fmiGetEventIndicators’:
../fmuTemplate.c:768:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
cc -shared -Wl,-soname,dq.so -o dq.so dq.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp dq.so fmu/binaries/linux64
cp .c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'dq.fmu' failed
make[4]: [dq.fmu] Error 1 (ignored)
cp .html .png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/dq.fmu )
rm dq.o dq.so
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/dq'
./build_fmu me incpwd
/home/pi/Documents/neue_FMU/fmu10/src/models/inc
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. inc.c -o inc.o
In file included from inc.c:55:0:
../fmuTemplate.c: In function ‘inc_fmiGetReal’:
../fmuTemplate.c:324:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiSetContinuousStates’:
../fmuTemplate.c:644:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiGetStateValueReferences’:
../fmuTemplate.c:693:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiGetContinuousStates’:
../fmuTemplate.c:712:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiGetDerivatives’:
../fmuTemplate.c:748:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiGetEventIndicators’:
../fmuTemplate.c:768:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
cc -shared -Wl,-soname,inc.so -o inc.so inc.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp inc.so fmu/binaries/linux64
cp .c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'inc.fmu' failed
make[4]: [inc.fmu] Error 1 (ignored)
cp .html .png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/inc.fmu )
rm inc.so inc.o
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/inc'
./build_fmu me valuespwd
/home/pi/Documents/neue_FMU/fmu10/src/models/values
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. values.c -o values.o
In file included from values.c:84:0:
../fmuTemplate.c: In function ‘values_fmiGetEventIndicators’:
../fmuTemplate.c:768:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
cc -shared -Wl,-soname,values.so -o values.so values.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp values.so fmu/binaries/linux64
cp .c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'values.fmu' failed
make[4]: [values.fmu] Error 1 (ignored)
cp .html .png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/values.fmu )
rm values.o values.so
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/values'
./build_fmu me vanDerPolpwd
/home/pi/Documents/neue_FMU/fmu10/src/models/vanDerPol
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. vanDerPol.c -o vanDerPol.o
In file included from vanDerPol.c:72:0:
../fmuTemplate.c: In function ‘vanDerPol_fmiGetEventIndicators’:
../fmuTemplate.c:768:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
cc -shared -Wl,-soname,vanDerPol.so -o vanDerPol.so vanDerPol.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp vanDerPol.so fmu/binaries/linux64
cp .c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'vanDerPol.fmu' failed
make[4]: [vanDerPol.fmu] Error 1 (ignored)
cp .html .png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/vanDerPol.fmu )
rm vanDerPol.so vanDerPol.o
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/vanDerPol'
./build_fmu cs bouncingBallpwd
/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall
cc -g -c -fPIC -Wall -DFMI_COSIMULATION -I../../co_simulation/include -I.. bouncingBall.c -o bouncingBall.o
In file included from bouncingBall.c:104:0:
../fmuTemplate.c: In function ‘bouncingBall_fmiDoStep’:
../fmuTemplate.c:496:12: warning: variable ‘prevState’ set but not used [-Wunused-but-set-variable]
double prevState[max(NUMBER_OF_STATES, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/dq
cc -g -c -fPIC -Wall -DFMI_COSIMULATION -I../../co_simulation/include -I.. dq.c -o dq.o
In file included from dq.c:64:0:
../fmuTemplate.c: In function ‘dq_fmiDoStep’:
../fmuTemplate.c:498:9: warning: unused variable ‘stateEvent’ [-Wunused-variable]
int stateEvent = 0;
^pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/inc
cc -g -c -fPIC -Wall -DFMI_COSIMULATION -I../../co_simulation/include -I.. inc.c -o inc.o
In file included from inc.c:55:0:
../fmuTemplate.c: In function ‘inc_fmiGetReal’:
../fmuTemplate.c:324:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘inc_fmiDoStep’:
../fmuTemplate.c:498:9: warning: unused variable ‘stateEvent’ [-Wunused-variable]
int stateEvent = 0;
^pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/values
cc -g -c -fPIC -Wall -DFMI_COSIMULATION -I../../co_simulation/include -I.. values.c -o values.o
In file included from values.c:84:0:
../fmuTemplate.c: In function ‘values_fmiDoStep’:
../fmuTemplate.c:498:9: warning: unused variable ‘stateEvent’ [-Wunused-variable]
int stateEvent = 0;
^pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/vanDerPol
cc -g -c -fPIC -Wall -DFMI_COSIMULATION -I../../co_simulation/include -I.. vanDerPol.c -o vanDerPol.o
In file included from vanDerPol.c:72:0:
../fmuTemplate.c: In function ‘vanDerPol_fmiDoStep’:
../fmuTemplate.c:498:9: warning: unused variable ‘stateEvent’ [-Wunused-variable]
int stateEvent = 0;
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/bouncingBall
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. bouncingBall.c -o bouncingBall.o
In file included from bouncingBall.c:121:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:610:12: warning: variable ‘prevState’ set but not used [-Wunused-but-set-variable]
double prevState[max(NUMBER_OF_STATES, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/dq
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. dq.c -o dq.o
In file included from dq.c:69:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/inc
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. inc.c -o inc.o
In file included from inc.c:61:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2GetReal’:
../fmuTemplate.c:345:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/values
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. values.c -o values.o
In file included from values.c:90:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/vanDerPol
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. vanDerPol.c -o vanDerPol.o
In file included from vanDerPol.c:77:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/bouncingBall
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. bouncingBall.c -o bouncingBall.o
In file included from bouncingBall.c:121:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:610:12: warning: variable ‘prevState’ set but not used [-Wunused-but-set-variable]
double prevState[max(NUMBER_OF_STATES, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/dq
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. dq.c -o dq.o
In file included from dq.c:69:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/inc
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. inc.c -o inc.o
In file included from inc.c:61:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2GetReal’:
../fmuTemplate.c:345:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/values
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. values.c -o values.o
In file included from values.c:90:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^pwd
/home/pi/Documents/neue_FMU/fmu20/src/models/vanDerPol
cc -g -c -fPIC -Wall -DDISABLE_PREFIX -I../../shared/include -I.. vanDerPol.c -o vanDerPol.o
In file included from vanDerPol.c:77:0:
../fmuTemplate.c: In function ‘unsupportedFunction’:
../fmuTemplate.c:93:24: warning: unused variable ‘log’ [-Wunused-variable]
fmi2CallbackLogger log = comp->functions->logger;
^~~
../fmuTemplate.c: In function ‘fmi2SetString’:
../fmuTemplate.c:499:12: warning: unused variable ‘n’ [-Wunused-variable]
int i, n;
^
../fmuTemplate.c: In function ‘fmi2DoStep’:
../fmuTemplate.c:611:12: warning: unused variable ‘prevEventIndicators’ [-Wunused-variable]
double prevEventIndicators[max(NUMBER_OF_EVENT_INDICATORS, 1)];
^I don't know in which directory i should copy .h file with rsync.
I searched the .h files and i get this:
$ find -name *.h ./fmu20/src/models/fmuTemplate.h ./fmu20/src/shared/sim_support.h ./fmu20/src/shared/parser/libxml/tree.h ./fmu20/src/shared/parser/libxml/xmlstring.h ./fmu20/src/shared/parser/libxml/hash.h ./fmu20/src/shared/parser/libxml/SAX.h ./fmu20/src/shared/parser/libxml/SAX2.h ./fmu20/src/shared/parser/libxml/entities.h ./fmu20/src/shared/parser/libxml/parser.h ./fmu20/src/shared/parser/libxml/xmlIO.h ./fmu20/src/shared/parser/libxml/xmlerror.h ./fmu20/src/shared/parser/libxml/list.h ./fmu20/src/shared/parser/libxml/valid.h ./fmu20/src/shared/parser/libxml/threads.h ./fmu20/src/shared/parser/libxml/xmlexports.h ./fmu20/src/shared/parser/libxml/xmlversion.h ./fmu20/src/shared/parser/libxml/relaxng.h ./fmu20/src/shared/parser/libxml/xlink.h ./fmu20/src/shared/parser/libxml/xmlreader.h ./fmu20/src/shared/parser/libxml/xmlmemory.h ./fmu20/src/shared/parser/libxml/xmlschemas.h ./fmu20/src/shared/parser/libxml/globals.h ./fmu20/src/shared/parser/libxml/xmlregexp.h ./fmu20/src/shared/parser/libxml/xmlautomata.h ./fmu20/src/shared/parser/libxml/dict.h ./fmu20/src/shared/parser/libxml/encoding.h ./fmu20/src/shared/parser/fmu20/XmlParser.h ./fmu20/src/shared/parser/fmu20/XmlParserException.h ./fmu20/src/shared/parser/fmu20/XmlElement.h ./fmu20/src/shared/parser/XmlParserCApi.h ./fmu20/src/shared/xmlVersionParser.h ./fmu20/src/shared/fmi2.h ./fmu20/src/shared/include/fmi2TypesPlatform.h ./fmu20/src/shared/include/fmi2FunctionTypes.h ./fmu20/src/shared/include/fmi2Functions.h ./fmu10/src/co_simulation/include/fmiPlatformTypes.h ./fmu10/src/co_simulation/include/fmiFunctions.h ./fmu10/src/co_simulation/fmusim_cs/fmi_cs.h ./fmu10/src/models/fmuTemplate.h ./fmu10/src/model_exchange/include/fmiModelFunctions.h ./fmu10/src/model_exchange/include/fmiModelTypes.h ./fmu10/src/model_exchange/fmusim_me/fmi_me.h ./fmu10/src/shared/expat.h ./fmu10/src/shared/sim_support.h ./fmu10/src/shared/stack.h ./fmu10/src/shared/libxml/tree.h ./fmu10/src/shared/libxml/xmlstring.h ./fmu10/src/shared/libxml/hash.h ./fmu10/src/shared/libxml/SAX.h ./fmu10/src/shared/libxml/SAX2.h ./fmu10/src/shared/libxml/entities.h ./fmu10/src/shared/libxml/parser.h ./fmu10/src/shared/libxml/xmlIO.h ./fmu10/src/shared/libxml/xmlerror.h ./fmu10/src/shared/libxml/list.h ./fmu10/src/shared/libxml/valid.h ./fmu10/src/shared/libxml/threads.h ./fmu10/src/shared/libxml/xmlexports.h ./fmu10/src/shared/libxml/xmlversion.h ./fmu10/src/shared/libxml/relaxng.h ./fmu10/src/shared/libxml/xlink.h ./fmu10/src/shared/libxml/xmlreader.h ./fmu10/src/shared/libxml/xmlmemory.h ./fmu10/src/shared/libxml/xmlschemas.h ./fmu10/src/shared/libxml/globals.h ./fmu10/src/shared/libxml/xmlregexp.h ./fmu10/src/shared/libxml/xmlautomata.h ./fmu10/src/shared/libxml/dict.h ./fmu10/src/shared/libxml/encoding.h ./fmu10/src/shared/xmlVersionParser.h ./fmu10/src/shared/expat_external.h ./fmu10/src/shared/xml_parser.h
The question is, which files should i rsync in which directory?
I'm new in the Linux world.
It looks to me like it is working. Your run is below:
make ARCH=linux64 CBITSFLAGS= CSORME=me CSORME_INCLUDE=-I../../model_exchange/include PIC=-fPIC SHARED_LIBRARY_SUFFIX=so bouncingBall.fmu
make[4]: Entering directory '/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall'
echo pwd
/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall
cc -g -c -fPIC -Wall -I../../model_exchange/include -I.. bouncingBall.c -o bouncingBall.o
cc -shared -Wl,-soname,bouncingBall.so -o bouncingBall.so bouncingBall.o
rm -rf fmu
mkdir -p fmu/binaries/linux64 fmu/sources fmu/documentation
cp bouncingBall.so fmu/binaries/linux64
cp *.c .h fmu/sources
cp: cannot stat '.h': No such file or directory
../Makefile:49: recipe for target 'bouncingBall.fmu' failed
make[4]: [bouncingBall.fmu] Error 1 (ignored)
cp *.html *.png fmu/documentation
cat modelDescription.xml ../me.xml > fmu/modelDescription.xml
cp model.png fmu
(cd fmu; zip -q -r ../../../../fmu/me/bouncingBall.fmu *)
rm bouncingBall.o bouncingBall.so
make[4]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models/bouncingBall'
One mystery is that you have
cp *.c .h fmu/sources
whereas under Ubuntu with Gnu Make 4.1, I have
cp *.c *.h fmu/sources
Anyway, what is happening here is that fmusdk/fmu10/src/models/Makefile contains:
%.fmu: %.$(SHARED_LIBRARY_SUFFIX)
rm -rf fmu
mkdir -p fmu/binaries/$(ARCH) fmu/sources fmu/documentation
cp $< fmu/binaries/$(ARCH)
-cp *.c *.h fmu/sources
-cp *.html *.png fmu/documentation
cat modelDescription.xml ../$(CSORME).xml > fmu/modelDescription.xml
cp model.png fmu
@if [ ! -d ../../../fmu/$(CSORME) ]; then \
echo "mkdir -p ../../../fmu/$(CSORME)"; \
mkdir -p ../../../fmu/$(CSORME); \
fi
(cd fmu; zip -q -r ../../../../fmu/$(CSORME)/$@ *)
The - at the beginning of the
-cp *.c *.h fmu/sources
line causes make to ignore errors, print a message and proceed. See https://www.gnu.org/software/make/manual/html_node/Errors.html
So, I believe that the fmu file was successfully created. Here's what I have:
cxh@swarmnuc2008:~/src/fmusdk$ pwd
/home/cxh/src/fmusdk
cxh@swarmnuc2008:~/src/fmusdk$ ls
doc fmu10 fmu20 fmusim.bat install.bat Makefile make.out result.csv run_all.bat
cxh@swarmnuc2008:~/src/fmusdk$ ls -l fmu10/fmu/me/bouncingBall.fmu
-rw-rw-r-- 1 cxh cxh 16496 Jul 23 04:52 fmu10/fmu/me/bouncingBall.fmu
cxh@swarmnuc2008:~/src/fmusdk$
See https://resources.qtronic.de/fmusdk/FmuSdk_reference.html for instructions about how to run it.
The instructions seem slightly wrong, I used fmu10/bin/fmusim_me to run the binary.
cxh@swarmnuc2008:~/src/fmusdk$ fmu10/bin/fmusim_me fmu10/fmu/me/bouncingBall.fmu 5 0.1 0 s
cmd='unzip -o -d fmuTmp6DI5U2/ "fmu10/fmu/me/bouncingBall.fmu" > /dev/null'
parse fmuTmp6DI5U2/modelDescription.xml
fmiModelDescription
fmiVersion=1.0
modelName=bouncingBall
modelIdentifier=bouncingBall
guid={8c4e810f-3df3-4a00-8276-176fa3c9f003}
numberOfContinuousStates=2
numberOfEventIndicators=1
FMU Simulator: run 'fmu10/fmu/me/bouncingBall.fmu' from t=0..5 with step size h=0.1, loggingOn=0, csv separator=';'
Simulation from 0 to 5 terminated successful
steps ............ 51
fixed step size .. 0.1
time events ...... 0
state events ..... 14
step events ...... 0
CSV file 'result.csv' written
cxh@swarmnuc2008:~/src/fmusdk$ cat result.csv
time;h;der(h);v;der(v);g;e
0;1;0;0;-9,81;9,81;0,7
0,1;1;-0,9810000000000001;-0,9810000000000001;-9,81;9,81;0,7
0,2;0,9018999999999999;-1,962;-1,962;-9,81;9,81;0,7
0,3;0,7056999999999998;-2,943000000000001;-2,943000000000001;-9,81;9,81;0,7
0,4;0,4113999999999998;-3,924;-3,924;-9,81;9,81;0,7
0,5;0,01899999999999979;-4,905;-4,905;-9,81;9,81;0,7
0,6;-0,4715000000000001;4,1202;4,1202;-9,81;9,81;0,7
0,7;-0,05948000000000025;3,1392;3,1392;-9,81;9,81;0,7
0,7999999999999999;0,2544399999999997;2,1582;2,1582;-9,81;9,81;0,7
0,8999999999999999;0,4702599999999996;1,1772;1,1772;-9,81;9,81;0,7
0,9999999999999999;0,5879799999999995;0,1962000000000002;0,1962000000000002;-9,81;9,81;0,7
...
Note that running the command unzips the fmu file and creates the following files.
cxh@swarmnuc2008:~/src/fmusdk$ ls -R fmuTmp6DI5U2
fmuTmp6DI5U2:
binaries documentation modelDescription.xml model.png sources
fmuTmp6DI5U2/binaries:
linux64
fmuTmp6DI5U2/binaries/linux64:
bouncingBall.so
fmuTmp6DI5U2/documentation:
index.html model.png
fmuTmp6DI5U2/sources:
bouncingBall.c
cxh@swarmnuc2008:~/src/fmusdk$
The key files are modelDescription.xml and binaries/linux64/bouncingBall.so
I suspect that the version of fmusdk.zip that is available on the qtronic website is not the most recent version because the files in fmusdk.zip do not contain "rsync". I'll contact them and ask.
Thank you for the detailed answer Your example simulation doesn't work for me, because i don't have the file linux 32. My operating system is 32Bit version. So i get some error:
$ fmu10/bin/fmusim_me fmu10/fmu/me/bouncingBall.fmu 5 0.1 0 s
cmd='unzip -o -d fmuTmpV0yCjD/ "fmu10/fmu/me/bouncingBall.fmu" > /dev/null'
parse fmuTmpV0yCjD/modelDescription.xml
fmiModelDescription
fmiVersion=1.0
modelName=bouncingBall
modelIdentifier=bouncingBall
guid={8c4e810f-3df3-4a00-8276-176fa3c9f003}
numberOfContinuousStates=2
numberOfEventIndicators=1
The error was: fmuTmpV0yCjD/binaries/linux32/bouncingBall.so: cannot open shared object file: No such file or directory
error: Could not load fmuTmpV0yCjD/binaries/linux32/bouncingBall.so
I tried also to simulate a FMU2.0. This fmu i have simulated successfully with this python package. But here i get an error like this:
$ fmu20/bin/fmusim_me neue_FMUS_Probe/CoupledClutches.fmu 5 0.1 0 s
cmd='unzip -o -d fmuTmpQAoC0w/ "neue_FMUS_Probe/CoupledClutches.fmu" > /dev/null'
fmiModelDescription
fmiVersion=2.0
modelName=CoupledClutches
guid={90a4fe90-30dd-5bf8-3836-8fd77672ce82}
description=Model CoupledClutches
author=
version=
error: No ModelExchange element found in model description. This FMU is not for Model Exchange.
Sory, here is the python package: https://github.com/CATIA-Systems/FMPy
FMPy looks pretty good!
I asked Qtronics if the version of fmusdk.zip on their server was 2.0.6 and they replied that it was not, and they updated it. I checked and http://www.qtronic.de/doc/fmusdk.zip is now fmusdk2.0.6.
I don't have access to a 32-bit linux right now, I tried the steps below under 64-bit Ubuntu, but I'm missing 32-bit versions of libxml2 and libexpat.
In fmusdk2.0.6, fmu10/src/Makefile contains:
# Set CFLAGS to -m32 to build for linux32
#CFLAGS=-m32
# See also models/build_fmu
If you uncomment the CFLAGS line:
CFLAGS=-m32
and also edit fmu10/src/models/build_fmu
# Uncomment the next line to force building 32-bit
#bits=32
# See also ../Makefile
by uncommenting
bits=32
You would need to make similar edits in fmu20/src/Makefile and fmu20/src/models/build_fmu, then run
make clean
make
I still get an error.
These are my installation steps:
Download the zip file http://www.qtronic.de/doc/fmusdk.zip , that you have posted. I extract the zip file in the folder /home/pi/Downloads/FMUSDK_HOME Create a folder => /tmp/FMUSDK_HOME
sudo cp -r /home/pi/Downloads/FMUSDK_HOME/. /tmp/FMUSDK_HOME/
Change the permission:
$ sudo chmod a+x fmu10/src/models/build_fmu fmu20/src/models/build_fmu
-rwxr-xr-x 1 root root 1347 Jul 24 20:51 fmu10/src/models/build_fmu
-rwxr-xr-x 1 root root 1347 Jul 24 20:51 fmu10/src/models/build_fmu
install:
$ sudo make
(cd fmu10; make)
make[1]: Entering directory '/tmp/FMUSDK_HOME/fmu10'
(cd src; make)
make[2]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src'
cc -m32 -g -Wall -DFMI_COSIMULATION -DSTANDALONE_XML_PARSER \
-Ico_simulation/fmusim_cs -Ico_simulation/include \
-Ishared \
co_simulation/fmusim_cs/main.c shared/sim_support.c shared/stack.c shared/xml_parser.c shared/xmlVersionParser.c \
-o fmusim_cs -lexpat -lxml2 -ldl
cc: error: unrecognized command line option ‘-m32’
Makefile:59: recipe for target 'fmusim_cs' failed
make[2]: *** [fmusim_cs] Error 1
make[2]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src'
Makefile:2: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/tmp/FMUSDK_HOME/fmu10'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2
Then I run:
$ make clean
(cd fmu10; make clean)
make[1]: Entering directory '/tmp/FMUSDK_HOME/fmu10'
(cd src; make clean)
make[2]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src'
rm -f fmusim_cs fmusim_me
rm -rf *.dSYM
rm -f cosimulation/fmusim_cs/*.o
rm -f model_exchange/fmusim_me/*.o
(cd models; make clean)
make[3]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models'
(cd bouncingBall; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models/bouncingBall'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models/bouncingBall'
(cd dq; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models/dq'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models/dq'
(cd inc; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models/inc'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models/inc'
(cd values; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models/values'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models/values'
(cd vanDerPol; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src/models/vanDerPol'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models/vanDerPol'
make[3]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src/models'
make[2]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src'
make[1]: Leaving directory '/tmp/FMUSDK_HOME/fmu10'
(cd fmu20; make clean)
make[1]: Entering directory '/tmp/FMUSDK_HOME/fmu20'
(cd src; make clean)
make[2]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src'
rm -f fmusim_cs fmusim_me
rm -rf *.dSYM
rm -f cosimulation/*.o
rm -f model_exchange/*.o
(cd models; make clean)
make[3]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models'
(cd bouncingBall; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models/bouncingBall'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models/bouncingBall'
(cd dq; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models/dq'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models/dq'
(cd inc; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models/inc'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models/inc'
(cd values; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models/values'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models/values'
(cd vanDerPol; make dirclean)
make[4]: Entering directory '/tmp/FMUSDK_HOME/fmu20/src/models/vanDerPol'
rm -rf *.so *.dylib *.o *.fmu *~ fmu
make[4]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models/vanDerPol'
make[3]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src/models'
make[2]: Leaving directory '/tmp/FMUSDK_HOME/fmu20/src'
make[1]: Leaving directory '/tmp/FMUSDK_HOME/fmu20'
and subsequently I run make and i get the same error.
$ sudo make
(cd fmu10; make)
make[1]: Entering directory '/tmp/FMUSDK_HOME/fmu10'
(cd src; make)
make[2]: Entering directory '/tmp/FMUSDK_HOME/fmu10/src'
cc -m32 -g -Wall -DFMI_COSIMULATION -DSTANDALONE_XML_PARSER \
-Ico_simulation/fmusim_cs -Ico_simulation/include \
-Ishared \
co_simulation/fmusim_cs/main.c shared/sim_support.c shared/stack.c shared/xml_parser.c shared/xmlVersionParser.c \
-o fmusim_cs -lexpat -lxml2 -ldl
cc: error: unrecognized command line option ‘-m32’
Makefile:59: recipe for target 'fmusim_cs' failed
make[2]: *** [fmusim_cs] Error 1
make[2]: Leaving directory '/tmp/FMUSDK_HOME/fmu10/src'
Makefile:2: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/tmp/FMUSDK_HOME/fmu10'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2
I installed it without uncomment the Makefiles. This was comment:
#bits=32
#CFLAGS=-m32
And i haven't some errors. I install it as superuser, like:
$ sudo su
$ make
Now if i try to simulate some FMU i get problems whit permission and ModelExchange.
$ sudo fmu20/bin/fmusim_me /home/pi/Documents/FMI2.0/Test/CoupledClutches.fmu 5 0.1 0 s
cmd='unzip -o -d fmuTmpeDj3zQ/ "/home/pi/Documents/FMI2.0/Test/CoupledClutches.fmu" > /dev/null'
fmiModelDescription
fmiVersion=2.0
modelName=CoupledClutches
guid={90a4fe90-30dd-5bf8-3836-8fd77672ce82}
description=Model CoupledClutches
author=
version=
error: No ModelExchange element found in model description. This FMU is not for Model Exchange.
:/tmp/FMUSDK_HOME $ ls
doc fmu20 fmuTmpeDj3zQ install.bat run_all.bat
fmu10 fmusim.bat fmuTmpN4vqUj Makefile
:/tmp/FMUSDK_HOME $ cd fmuTmpeDj3zQ/
bash: cd: fmuTmpeDj3zQ/: Permission denied
$ sudo su
:/tmp/FMUSDK_HOME# cd fmuTmpeDj3zQ/
:/tmp/FMUSDK_HOME/fmuTmpeDj3zQ# ls
binaries data documentation modelDescription.xml sources
Hello, I have a question. It is possible to install this package on Raspberry Pi (Rasbian, CPU: armv7l)? I have tried it and i get this error: (cd fmu10; make) make[1]: Entering directory '/home/pi/Documents/neue_FMU/fmu10' (cd src; make) make[2]: Entering directory '/home/pi/Documents/neue_FMU/fmu10/src' (cd models; make) make[3]: Entering directory '/home/pi/Documents/neue_FMU/fmu10/src/models' ./build_fmu me bouncingBall make[3]: execvp: ./build_fmu: Permission denied Makefile:25: recipe for target 'all' failed make[3]: [all] Error 127 make[3]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src/models' Makefile:9: recipe for target 'all' failed make[2]: [all] Error 2 make[2]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10/src' Makefile:2: recipe for target 'all' failed make[1]: [all] Error 2 make[1]: Leaving directory '/home/pi/Documents/neue_FMU/fmu10' Makefile:2: recipe for target 'all' failed make: [all] Error 2
Best Regards Max