Skip to content

📄 Modelica library for data I/O of CSV, INI, JSON, MATLAB MAT, SSV, TIR, Excel XLS/XLSX and XML files

License

Notifications You must be signed in to change notification settings

stjordanis/ExternData

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

ExternData

Free Modelica library for data I/O of CSV, INI, JSON, MATLAB MAT, SSV, TIR, Excel XLS/XLSX and XML files.

Build status

Build Status Build Status

Library description

ExternData is a utility library to access data stored in CSV, INI, JSON, MATLAB MAT, SSV, TIR, Excel XLS/XLSX or XML files. The aim of this library is to provide access from Modelica simulation tools to data sets for convenient model initialization and parametrization.

Main features

All data I/O access is implemented using external Modelica functions.

Known issue with OpenModelica

The example models of the library are known to fail with OpenModelica. However, as a workaround the functions can be rewritten to make them working in OpenModelica by replacing their short class definitions and their appropriate function calls. For example, the short class definition ExternData.XMLFile.getReal

final function getReal = Functions.XML.getReal(xml=xml)
  "Get scalar Real value from XML file";

can be rewritten as function

function __OpenModelica_getReal "Get scalar Real value from XML file"
  extends Modelica.Icons.Function;
  input String fileName="" "File where external data is stored";
  input String varName "Key";
  output Real y "Real value";
  protected
    ExternData.Types.ExternXMLFile xml = ExternData.Types.ExternXMLFile(fileName) "External XML file object";
  algorithm
    y := ExternData.Functions.XML.getReal(xml=xml, varName=varName);
  annotation(Inline=false);
end __OpenModelica_getReal;

taking the file name as explicit argument for the external object.

License

ExternData is released under the terms of the Simplified BSD License.

Acknowledgement

ExternData is based on the following third-party C projects

  • bsxml-json - Borislav Sapundzhiev's fairly simple XML DOM and JSON implementation
  • expat - James Clark's Expat XML parser library
  • hdf5 - The HDF Group's data model, library and file format for storing and managing data
  • inih - Ben Hoyt's simple INI file parser in C
  • libxls - David Hoerl's C library for parsing Excel files
  • matio - Christopher Hulbert's C library for reading and writing MATLAB MAT-files
  • minizip - Gilles Vollant's Zip and UnZip library
  • parson - Krzysztof Gabis' lightweight JSON library written in C
  • uthash - Troy D. Hanson's C macros for hash tables and more
  • zlib - Jean-loup Gailly's and Mark Adler's massively spiffy yet delicately unobtrusive compression library
  • zstring - Fehmi Noyan ISI's string processing library for C

Development and contribution

You may report any issues with using the Issues button.

Contributions in shape of Pull Requests are always welcome.

About

📄 Modelica library for data I/O of CSV, INI, JSON, MATLAB MAT, SSV, TIR, Excel XLS/XLSX and XML files

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 98.6%
  • Other 1.4%