Opened 4 years ago

Last modified 3 years ago

#6041 new defect

Fix FMU dependencies with CVODE

Reported by: Andreas Heuermann Owned by: Andreas Heuermann
Priority: high Milestone:
Component: FMI Version: v1.16.0-dev
Keywords: fmi-cross-check fmi cvode Cc:

Description

FMUs exported with CVODE are missing some libraries in the binary folder of the FMU.

loadString("
model BouncingBall
  parameter Real e=0.7 \"coefficient of restitution\";
  parameter Real g=9.81 \"gravity acceleration\";
  parameter Real v_stick = 1e-4 \"below this velocity, the ball is stuck to the table\";
  
  output Real h(fixed=true, start=1) \"height of ball\";
  output Real v(fixed=true) \"velocity of ball\";
  Boolean flying(fixed=true, start=true) \"true, if ball is flying\";
  Boolean impact;
  Real v_new(fixed=true);
  Integer foo;
equation
  impact = h <= 0.0;
  foo = if impact then 1 else 2;
  der(v) = if flying then -g else 0;
  der(h) = v;
  when h <= 0 then
    v_new = -e*pre(v);
    flying = v_new > v_stick;
    reinit(v, if flying then v_new else 0);
  end when;
annotation(
    experiment(StartTime = 0, StopTime = 4, Tolerance = 1e-6, Interval = 0.006));
end BouncingBall;"); getErrorString();

setCommandLineOptions("--fmiFlags=s:cvode"); getErrorString();

buildModelFMU(BouncingBall, version="2.0", fmuType="cs", platforms={"static"}); getErrorString();

FMPy is reporting

BouncingBall# fmpy simulate BouncingBall.fmu
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi1.py", line 142, in __init__
    self.dll = cdll.LoadLibrary(libraryPath)
  File "/usr/lib/python3.8/ctypes/__init__.py", line 451, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libsundials_cvode.so.1: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/fmpy", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/fmpy/command_line.py", line 104, in main
    result = simulate_fmu(args.fmu_filename,
  File "/usr/local/lib/python3.8/dist-packages/fmpy/simulation.py", line 557, in simulate_fmu
    fmu = instantiate_fmu(unzipdir, model_description, fmi_type, visible, debug_logging, logger, fmi_call_logger, use_remoting)
  File "/usr/local/lib/python3.8/dist-packages/fmpy/simulation.py", line 632, in instantiate_fmu
    fmu = FMU2Slave(**fmu_args)
  File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi2.py", line 496, in __init__
    super(FMU2Slave, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi2.py", line 85, in __init__
    super(_FMU2, self).__init__(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/fmpy/fmi1.py", line 144, in __init__
    raise Exception("Failed to load shared library %s. %s" % (libraryPath, e))
Exception: Failed to load shared library /tmp/tmpxa7o573d/binaries/linux64/BouncingBall.so. libsundials_cvode.so.1: cannot open shared object file: No such file or directory

Change History (2)

comment:1 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:2 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.