AmesimKnowledge

mil-sil-hil

An example using external data files

external data files example

example using external data files

The simple example shown previously did not contain any external data files (typically look-up tables). For most realistic systems there are one or more tables used, and they are typically stored in files. Most real-time platforms discourage the use of files and the tables are in this case typically included in the generated code. For this to be possible the type of data is restricted to the types normally used in Simcenter Amesim:

  • file with one value per line (0D)

  • one independent variable (1D)

  • two independent variables organized as tables of1D data (T1D)

  • 2 independent variables (2D)

  • 3 independent variables (3D)

  • 3 independent variables arranged as tables of 2D data (2DT).

The 1D, T1D, 2D, 3D formats are the same as the ones supported by the Simcenter Amesim Table Editor. It is recommended that you use the table editor to create the tables you want to use in the model . If you do this Simcenter Amesim will recognize the format without any intervention from you, else you will need to specify the kind of data.

Figure 24: Simcenter Amesim system using lookup-tables.

This very simple Simcenter Amesim system uses three different file types: 1D, 2D and 3D. If the files are generated using the Simcenter Amesim Table editor the file generation using the Generate Files for Real-time command will work with some warnings, as shown in the figure below.

Figure 25: File generation popup with warnings.

You can see that some warnings are displayed: the file generation fails to find files "unnamed fluid". This is perfectly normal since these are actually generic text parameters. The file generation currently looks at all text parameters. This is to ensure that old submodels that were written before the special filename text parameter existed will function correctly.

We will now see what happens if one of the files was created manually (without the special header identifying the type of file). When the Generate command is selected the popup in the figure below is shown. The popup prompts for a file type for the file in question.

Figure 26: Specify data file type

To avoid having to choose the file type every time generating code Simcenter Amesim stores the selected file type in the modelname_.rtcfg file. The next time you select Generate files for real-time you will see the information read from the xx_.rtcfg file as shown in the figure below, and you no longer need to specify the file type.

Figure 27: Initial messages from file generation

If you suspect that some of the data read from the modelname_.rtcfg file is false (not the correct file types are displayed) you should remove it (or very carefully edit the file). You need first to open the Simcenter Amesim system in Simcenter Amesim, the modelname_.rtcfg is then stored in the same directory as the Simcenter Amesim model file (modelname.ame).

Another case when one would need to edit the modelname_.rtcfg is if the data files are specified using the directory name – this will often cause large amount of data to be included – and some real-time targets might fail to run or even compile. What is needed in this case is to exclude the non-required tables from the build. This can be done by changing selected="1" to selected="0" directly in the modelname_.rtcfg file. In future versions of Simcenter Amesim there will be a GUI for this.

Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Real_Time/An_example_using_external_data_files · retrieved 2026-07-17