Rohit_D
Rohit_D

Reputation: 85

Reading data in dymola from chx file

I want to import data into dymola from a chx file which is generated by the output of a program and then run a simulation with those outputs as parameters.

The file has parameters of the form:

<tubedata>
   <nrows>28</nrows>
   <ncolumns>3<ncolumns>
</tubedata>

I want to import this file into dymola, insert all the variables into a record file and then run simulation.

Upvotes: 1

Views: 340

Answers (2)

Dietmar Winkler
Dietmar Winkler

Reputation: 927

I'm not sure if chx files are simply xml formatted files, but if they are then there is a rather new library that allows you reading data from xml files (and xls, json, and ini files for that matter): https://github.com/tbeu/ExternData

Upvotes: 4

Adrian Pop
Adrian Pop

Reputation: 4231

You could write an xslt transformation on the .chx file to put the data in Modelica table fomat. See for example https://build.openmodelica.org/Documentation/Modelica.Blocks.Tables.CombiTable1D.html on how to format the table. Then use the table to set the parameters. Alternatively I think you can load a script .mos file in Dymola with the format (not sure of it 100%):

x1 := value1
x2 := value2

for the parameters.

Upvotes: 2

Related Questions