OMSimulator icon indicating copy to clipboard operation
OMSimulator copied to clipboard

OMSimulator can't handle path with "+" in it.

Open AnHeuermann opened this issue 5 years ago • 1 comments

Description

I have a OpenModelica FMU in a directory that contains a + in its path and when I simulate the FMU OMS can't find some file and reports an error:

assert            | debug   | Failed to open file /home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521%2Bgeba516059d/BouncingBall/model-veidtta5/temp/0001_fmu/resources/BouncingBall_info.json for reading: No such file or directory

Steps to reproduce the behavior

Run buildFMU.mos

loadString("
model BouncingBall
  parameter Real e=0.7 \"coefficient of restitution\";
  parameter Real g=9.81 \"gravity acceleration\";
  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.0 and v <= 0.0,impact} then
    v_new = if edge(impact) then -e*pre(v) else 0;
    flying = v_new > 0;
    reinit(v, v_new);
  end when;
annotation(
  experiment(StartTime = 0, StopTime = 3, Tolerance = 1e-6, Interval = 0.006));
end BouncingBall;"); getErrorString();`

buildModelFMU(BouncingBall, version="2.0", fmuType="me", fileNamePrefix="BouncingBall", platforms="static"); getErrorString();

to generate OpenModelica FMU.

Run

aheuermann1@DESKTOP-BQ04RIC:~/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521+geba516059d/BouncingBall$ OMSimulator BouncingBall.fmu
info:    Set temp directory to    "/home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521+geba516059d/BouncingBall"
info:    Set working directory to "/home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521+geba516059d/BouncingBall"
info:    Set working directory to "/home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521+geba516059d/BouncingBall"
info:    New model "model" with corresponding temp directory "/home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521+geba516059d/BouncingBall/model-prdc9haz"
assert            | debug   | Failed to open file /home/aheuermann1/workspace/fmi-cross-check/fmus/2.0/me/linux64/OpenModelica/v1.16.0-dev.521%2Bgeba516059d/BouncingBall/model-prdc9haz/temp/0001_fmu/resources/BouncingBall_info.json for reading: No such file or directory
getBestJumpBuffer got mmc_jumper=(nil), globalJumpBuffer=(nil)
Aborted

to get the error message. Note that the path OMSimulator outputs is wrong v1.16.0-dev.521+geba516059d -> v1.16.0-dev.521%2Bgeba516059d.

Expected behavior

When unzipping the FMU the expected file BouncingBall_info.json is at the correct location. Copying the FMU to an other location solves the problem.

Version and OS

  • Version: OMSimulator v2.1.0-dev-172-g8995b12-linux
  • OS: Ubuntu 18.04 TLS inside WSL on Windows 10

AnHeuermann avatar Jun 30 '20 09:06 AnHeuermann

I don't think this is an error in OMSimulator. What is sent to an FMU is something as stupid as a file:// URI and I guess OpenModelica just removes the file:// part and doesn't parse the URI (because it doesn't know how to) :D

sjoelund avatar Jun 30 '20 09:06 sjoelund