Are you ready to talk?

How to Reference Data Files Within a Modelica Package

Table of contents

When creating your own libraries you may want to reference data files that are used within your model. However when another user installs your library they might install it in a different location so any links referencing the data files have to be done in such a way that they will work independently of where the library is installed.

Below is an example of a user defined library were data files are stored in the same directory as the library:

User defined library were data files are stored in same directory

Dymola contains a built in function called classDirectory() that returns the current directory where this function is called from. This function can be used to create a string within your library that refers to the directory where the library is installed. An example of this is given below:

Create string referencing library directory in Dymola

To use this constant string just reference it in a model as in the example below:

Constant string usage in Modelica model

In the example above a clock is connected to a combiTable block. The table used in the combitable is stored in the data directory.

 

Need to talk to an expert?

Our engineering teams are on hand to provide tailored guidance and support with a deep knowledge of the full Dassault Systèmes portfolio.

Want to receive more content like this?

Sign up to receive a weekly roundup of Expert insights as they are published...

  • Related news & articles straight to your inbox
  • Hints, tips & how-tos
  • Thought leadership articles