Opened 4 years ago

Closed 4 years ago

#6421 closed task (invalid)

translateModelFMU to target directory

Reported by: lukas.koenemann@… Owned by: arunkumar palanisamy
Priority: high Milestone: NeedsInput
Component: OMPython Version: 1.18.0-dev
Keywords: translateModelFMU Cc:

Description

Hello I'm using the scripting API of OpenModelica. I want to compile a FMU to a specific directory. I think in the moment it is not possible.

function translateModelFMU
  input TypeName className "the class that should translated";
  input String version = "2.0" "FMU version, 1.0 or 2.0.";
  input String fmuType = "me" "FMU type, me (model exchange), cs (co-simulation), me_cs (both model exchange and co-simulation)";
  input String fileNamePrefix = "<default>" "fileNamePrefix. <default> = \"className\"";
  input Boolean includeResources = false "include Modelica based resources via loadResource or not";
  output String generatedFileName "Returns the full path of the generated FMU.";
end translateModelFMU;

right?

Change History (2)

comment:1 by arunkumar palanisamy, 4 years ago

@lukas, yes the current API does not support generating a FMU to specific directory, But you can change the directory internally in omc using cd()

>>> from OMPython import OMCSessionZMQ
>>> omc = OMCSessionZMQ()
>>> omc.sendExpression("loadFile(\"C:/OPENMODELICAGIT/OpenModelica/OMCompiler/Examples/BouncingBall.mo\")")
True
>>> omc.sendExpression("cd(\"C:/OPENMODELICAGIT\")") // change the directory to where you want to generate the fmu
'C:/OPENMODELICAGIT'
>>> omc.sendExpression("translateModelFMU(BouncingBall)")
'C:/OPENMODELICAGIT/BouncingBall.fmu'

comment:2 by Francesco Casella, 4 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.