modelicaopenmodelicafmi

How to translate FMU to macOS environment from Linux or Windows using FMPy?


I am interested to run FMPy under macOS using an FMU made by OpenModelica in Linux with source code included.

What are the FMPy commands to do the translation of the FMU to macOS, if at all possible?

Can this be done for macOS running on Intel as well as M-chip?

Example: Code I try where 'model.fmu' is compiled from OpenModelica with source code included. I am not sure of what the arguments: source, filename, and mode, should be.

fmu_model = compile(
   source='model.fmu',
   filename='model_new.fmu'.
   mode='exec'
) 
sim_res = simulate_fmu)
   filename=fmu_model,
   validate=False,
   start_time=0,
   record_events=True
)
            

Solution

  • Well, as far as I understand, it is not possible to translate an FMU made by OpenModelica in Windows or Linux to macOS using FMPy. I base that on Adrian Pops information. OpenModelica does not use Visual Studio.

    For an FMU made by Dymola it is possible to translate it to macOS using FMPy as shown in the answer by Christian Bertsch. The script would be in macOS (Intel) as follows:

    from fmpy.util import compile_platform_binary, create_cmake_project
    compile_platform_binary('Model.fmu', compile_options='-g -fPIC')
    

    For Apple M-chip it is not clear if FMPy can do the corresponding compilation to binary, according Christian Bertsch. My guess here should be a way to do it, since the transition to M-chip was in the pipeline when FMPy was first developed.

    Correct me if I misunderstood something!