XML Reader Library

Quick overview of how the XML Reader library works


The XMLReader library provides models and functions for extracting data from XML files. Real and String scalars and matrices can be extracted and used to set model parameters.

Reading parameters from an XML provides a way to log the setup of a model and allows for easy modification of model parameters. Efficient batch simulation is supported as the model does not have to be recompiled to read any changes in the XML file, any XML changes will be read during initialisation of the model.

Key Features
Reading data
Document wizard
    • Reads parameter values from XML documents directly into a Modelica model.
    • A wizard is provided to help configure the XML reader so that it understands your document format.
    • Reads both Real and String values.
    • Reading of matrices in delimited, Matlab ® syntax and other formats is supported.
    • Reading of XML matrices into .mat files, for efficient handling of tables.
    • Able to efficiently handle large XML documents.
    • Supports Dymola 2012 FD01 and later.
    Overview of the XML reader used to get parameters for a model
  • To read a value from the XML document and return it as a real scalar in Modelica, the user simply calls a function called readReal that exists within the Document model that has been added to the system model. This readReal function is used to set parameters to be equal to the values in an XML file.

    Other functions are supplied for extracting String values and for extracting Real and String matrices. A number of different matrix formats are supported including delimited matrices and the Matlab&Reg; matrix syntax and more.

    Matrices can also be read into .mat files for efficient use in the Table blocks.

    Reading xml data using the XML Reader library
  • Each model requires an XML document that defines what XML file is to be read and the format of the XML file. A wizard is supplied that helps generate the document model that describes the format used in the XML file.

    This wizard searches through the XML document and finds the possible formats where componentName is a component and parameterName is a parameter and allows the user to select which of these formats is the desired format.

    Wizard used to define XML data models

Discover Dymola