Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exchanging Modelica FMU Models

I tried to exchange my Modelica model with one of my colleagues but ran into difficulties regarding paths to CSV-Files.

When I create the FMU the paths to some of the CSV files are set and point to folders on my computer. For example C:/Users/Me/file.csv. This obviously doesn't work for my colleague.

How can I export my Modelica model (Dymola) in such a way that the paths are set relative to the user?

like image 618
Phil Avatar asked Jan 01 '23 02:01

Phil


1 Answers

The most common way is to use the loadResource() function provided with the Modelica Standard Library (MSL) at Modelica.Utilities.Files.loadResource to specify the path to the file. This is usually done using a Modelica URI, which could look like this:

filename=Modelica.Utilities.Files.loadResource("modelica://myLib/Resources/Data/file.csv")

This specifies a path relative to the libraries root path. Usually data files are stored in the Resources folder within the library.

This comes with the advantage, that when creating the FMU in Dymola, you can check the flag "Copy resources to FMU", which will embed the file in the FMU directly if checked. If unchecked, the file will be looked for in the specified directory.

like image 111
Markus A. Avatar answered Jan 02 '23 15:01

Markus A.