Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4528 closed defect (fixed)

buildModelFMU doesn't respect the fileNamePrefix argument

Reported by: Lennart Ochel Owned by: Lennart Ochel
Priority: high Milestone: 1.13.0
Component: Code Generation Version:
Keywords: Cc:

Description

  1. Is there a good reason to replace . with _ in the prefix string?
  2. If the Cpp runtime is selected as target, then the fileNamePrefix isn't considered at all.

You can use the following script to obtain this behaviour:

loadString("
model A
  input Real p;
  input Real u;
  output Real y;
equation
  y = u * p;
end A;
"); getErrorString();

buildModelFMU(A, version="2.0", fmuType="me", fileNamePrefix="me.A.c", platforms={"static"}); getErrorString();

setCommandLineOptions("--simCodeTarget=Cpp"); getErrorString();

buildModelFMU(A, version="2.0", fmuType="me", fileNamePrefix="me.A.cpp", platforms={"static"}); getErrorString();

I have expected two FMUs to be generated: me.A.c.fmu and me.A.cpp.fmu
However, the script will generate the following two FMUs: me_A_c.fmu and A.fmu

Change History (5)

comment:1 by Lennart Ochel, 7 years ago

For some reasons the compilation process doesn't work if the target name contains dots:

cp: cannot stat ‘me.A.c.so’: No such file or directory
make: *** [me.A.c_FMU] Error 1

Can someone have a look?

comment:2 by Rüdiger Franke, 7 years ago

Cpp uses the model name as FMU name (including possible packages separated with dots). What is the use case / work flow for selecting a different fileNamePrefix?

comment:3 by Lennart Ochel, 7 years ago

This is from the User’s Guide:

input String fileNamePrefix = "<default>" "fileNamePrefix. <default> = \"className\"";

The behaviour should be, that the name of the generated FMU is the class name, containing dots as class separator if no fileNamePrefix (i.e. fileNamePrefix = "<default>") is specified. Otherwise the fileNamePrefix should be used for the file name. This is quite useful to generate several FMUs out of the same Modelica class. I use this for testing purpose, e.g., to compare ME/CS, C/CPP runtime and so on.

comment:4 by Lennart Ochel, 7 years ago

Resolution: fixed
Status: newclosed

This is fixed with OMCompiler#1827 and OMCompiler#1843.

comment:5 by Adrian Pop, 7 years ago

Milestone: 1.12.01.13.0
Note: See TracTickets for help on using tickets.