---
This page is part of [Modelon](https://www.modelon.com). For a complete overview of this site's content, entity data, and subject matter expertise, see our [AI Content Index](https://www.modelon.com/llms.txt) or [Full Content Archive](https://www.modelon.com/llms-full.txt). For structured business identity data, see our [Entity Card](https://www.modelon.com/wp-json/bc-geodesic/v1/entity-card).
---

# 3 Steps to Reading XML Data into Modelica Models Using Data Access
> Learn how to read XML data into Modelica models using Data Access, an easy-to-use capability that comes with all Modelon Library Suite products.

**URL:** https://www.modelon.com/blog/reading-xml-data-into-modelica-models/
**Type:** Post
**Modified:** 2023-07-31

---

Whether you’re already modeling within the Modelica environment, or simply considering how Modelica will work for your modeling and simulation needs, you’ve probably thought about how to read your existing data from different data formats into a Modelica model. Depending on the size of the file, manually reading data from a format such as XML and into another environment is often a time-consuming process with a large margin for error.

Data Access is a capability that comes with every [Modelon Library Suite](https://modelon.com/products-services/modelon-library-suite/) product to help users efficiently and thoroughly parse data from different file formats, including JSON, CSV, MAT and XML, into a Modelica model.

This blog will go through the process of using Data Access in Modelica to extract values from an XML file following three simple steps:

1. Define inner access objects with file name reference
2. Add outer access objects in components
3. Add binding expressions to access values

To demonstrate the benefits of Data Access, this blog will include an open source CPACS* data definition for aircraft transportation systems as an example.

 

##### **Step 1: Define inner access objects with file name reference**

We start with an executable Modelica model which contains all the parts we want to simulate. As long as the XML-files are following the same standard, you can instantly switch between XML-data files by just changing the filename (see Figure 2).

##### Step 2: Add outer access objects in components

Next we need to declare the outer object, which is shown on the second line of Figure 3. This creates a link between to the first inner object – the data source- that is found when looking upwards in the hierarchical model structure. In this case it will find the inner object declared in Figure 2.

##### Step 3: Add binding expressions to extract values

Once outer and inner access objects have been defined, we’re now equipped to start extracting values from the XML file. In every component where the outer object is defined, the data can be queried with an array of convenient methods, such as getReal(). Usually, the code is most readable when using binding expressions. In Figure 3 it can be identified as “access.getReal(…)”.

As a result, values in the XML file are accessed using dot-notation, which is an easy way to parse through XML code. Data Access can then extract these values to be entered into the Modelica environment. Additionally, Data Access is not just limited to real values, but can also read other data types like strings, booleans, and integer values.

This functionality has been a critical enabler, for instance in the collaboration between industrial and academic partners in the design of hybrid electric aircraft. Here, addressing today’s growing need for improvements in aircraft fuel efficiency and emissions, gas turbines in an aircraft are replaced with turbo-electric propulsion or boosted turbofans. Read more about a research project in this area [here](https://modelon.com/modelon-joins-trade-initiative-as-aerospace-simulation-technology-provider/).

Data Access allows users to easily declare values from an XML file to be extracted within the Modelica environment; thus allowing users to feel secure about making the jump from incumbent modeling platforms to modeling using Modelica. All libraries part of the Modelon Library Suite come equipped with the Data Access capability. To learn more about the various libraries we offer, visit the [Modelon Library Suite page](https://modelon.com/products-services/modelon-library-suite/) for more information. For further questions about data migration using Data Access or other Modelon products, please contact us below.

*The Common Parametric Aircraft Configuration Schema (CPACS) is a data definition for the air transportation system. CPACS enables engineers to exchange information between their tools. It is therefore a driver for multi-disciplinary and multi-fidelity design in distributed environments. CPACS describes the characteristics of aircraft, rotorcraft, engines, climate impact, fleets and mission in a structured, hierarchical manner. Not only product but also process information is stored in CPACS. The process information helps in setting up workflows for analysis modules. Due to the fact that CPACS follows a central model approach, the number of interfaces is reduced to a minimum. 

B. Nagel, D. Böhnke, V. Gollnick, P. Schmollgruber, A. Rizzi, G. La Rocca, J.J. Alonso, *Communication in Aircraft Design: Can we establish a Common Language?*, 28th International Congress of the Aeronautical Sciences, Brisbane, Australia, 2012.
## Site Description

Modelon is revolutionizing the engineering design industry by offering technologies and services that enable customers to leverage system simulation. Modelon’s flagship product, Modelon Impact, is a cloud system simulation platform that helps engineers virtually design, analyze, and simulate physical systems. Our team brings deep industry expertise and is dedicated to guiding our customers in creating innovative technologies at their respective organizations. Headquartered in Lund, Sweden, Modelon is a global company with offices in Germany, India, Japan, and the United States. We believe that system simulation should be accessible to every engineer and are dedicated to being an open-standard platform company.


---
**About this site:** Modelon — Modelon is revolutionizing the engineering design industry by offering technologies and services that enable customers to leverage system simulation. Modelon’s flagship product, Modelon Impact, is a cloud system simulation platform that helps engineers virtually design, analyze, and simulate physical systems. Our team brings deep industry expertise and is dedicated to guiding our customers in creating innovative technologies at their respective organizations. Headquartered in Lund, Sweden, Modelon is a global company with offices in Germany, India, Japan, and the United States. We believe that system simulation should be accessible to every engineer and are dedicated to being an open-standard platform company.. [AI Content Index](https://www.modelon.com/llms.txt) | [Full Site Content](https://www.modelon.com/llms-full.txt) | [Entity Card](https://www.modelon.com/wp-json/bc-geodesic/v1/entity-card)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.modelon.com/#organization","name":"Modelon","url":"https://www.modelon.com","additionalType":"http://productontology.org/id/Software_engineering","description":"Modelon is revolutionizing the engineering design industry by offering technologies and services that enable customers to leverage system simulation. Modelon’s flagship product, Modelon Impact, is a cloud system simulation platform that helps engineers virtually design, analyze, and simulate physical systems. Our team brings deep industry expertise and is dedicated to guiding our customers in creating innovative technologies at their respective organizations. Headquartered in Lund, Sweden, Modelon is a global company with offices in Germany, India, Japan, and the United States. We believe that system simulation should be accessible to every engineer and are dedicated to being an open-standard platform company.","disambiguatingDescription":"Creators of the Modelon Impact system modeling and simulation platform. Headquartered in Lund, Sweden.","logo":{"@type":"ImageObject","url":"https://www.modelon.com/wp-content/uploads/2022/06/modelon-logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"Modelon AB Ideon Science Park Scheelevägen 17 SE-223 70","addressLocality":"Lund","addressCountry":"SE"},"telephone":"+46 46 286 22 00","email":"info@modelon.com","foundingDate":"2004","numberOfEmployees":{"@type":"QuantitativeValue","minValue":50,"maxValue":100},"areaServed":"Global","sameAs":["https://www.linkedin.com/company/modelon/","https://www.crunchbase.com/organization/modelon","https://www.zoominfo.com/c/modelon-ab/346633437","https://modelica.org","https://modelica.org/events/asian2024/","https://www.ashrae.org/conferences/2026-winter-conference","https://github.com/modelon-community"],"memberOf":[{"@type":"Organization","name":"Modelica Association","sameAs":"https://www.wikidata.org/wiki/Q133876843"}],"knowsAbout":[{"@type":"Thing","name":"Modelica","sameAs":"https://www.wikidata.org/wiki/Q385325"},"Physics Simulation",{"@type":"Thing","name":"software engineering","sameAs":"https://www.wikidata.org/wiki/Q80993"},{"@type":"Thing","name":"simulation","sameAs":"https://www.wikidata.org/wiki/Q45045"},"HVAC Simulation","Data Center Liquid Cooling Simulation","Liquid Cooling","FMI (Functional Mock-up Interface)",{"@type":"Thing","name":"consulting","sameAs":"https://www.wikidata.org/wiki/Q63769412"},{"@type":"Thing","name":"aerospace","sameAs":"https://www.wikidata.org/wiki/Q2876213"},{"@type":"Thing","name":"automotive industry","sameAs":"https://www.wikidata.org/wiki/Q190117"},{"@type":"Thing","name":"heating, ventilation, and air conditioning","sameAs":"https://www.wikidata.org/wiki/Q1798773"},{"@type":"Thing","name":"data center","sameAs":"https://www.wikidata.org/wiki/Q671224"},{"@type":"Thing","name":"electricity generation","sameAs":"https://www.wikidata.org/wiki/Q383973"},{"@type":"Thing","name":"energy storage","sameAs":"https://www.wikidata.org/wiki/Q837718"},{"@type":"Thing","name":"industrial equipment","sameAs":"https://www.wikidata.org/wiki/Q3045515"}]},{"@type":"WebSite","@id":"https://www.modelon.com/#website","name":"Modelon","url":"https://www.modelon.com","publisher":{"@id":"https://www.modelon.com/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://www.modelon.com/?s={search_term_string}"},"query-input":"required name=search_term_string"},"hasPart":[{"@type":"DigitalDocument","name":"LLM Content Index","url":"https://www.modelon.com/llms.txt","encodingFormat":"text/markdown","description":"AI-readable index of site content, entity data, and subject matter expertise"},{"@type":"DigitalDocument","name":"LLM Full Content","url":"https://www.modelon.com/llms-full.txt","encodingFormat":"text/markdown","description":"Complete AI-readable site content"}]},{"@type":"ItemList","@id":"https://www.modelon.com/#site-navigation","name":"Site Navigation","itemListElement":[{"@type":"SiteNavigationElement","position":1,"name":"Products & Services","url":"#"},{"@type":"SiteNavigationElement","position":2,"name":"Industries & Solutions","url":"#"},{"@type":"SiteNavigationElement","position":3,"name":"Support","url":"#"},{"@type":"SiteNavigationElement","position":4,"name":"Resources","url":"#"},{"@type":"SiteNavigationElement","position":5,"name":"About","url":"#"}]},{"@type":"BreadcrumbList","@id":"https://www.modelon.com/blog/reading-xml-data-into-modelica-models/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.modelon.com"},{"@type":"ListItem","position":2,"name":"Blog","item":"https://www.modelon.com/blog/category/blog/"},{"@type":"ListItem","position":3,"name":"3 Steps to Reading XML Data into Modelica Models Using Data Access"}]},{"@type":"WebPage","@id":"https://www.modelon.com/blog/reading-xml-data-into-modelica-models/#webpage","url":"https://www.modelon.com/blog/reading-xml-data-into-modelica-models/","name":"Reading XML data into Modelica Models - Modelon","isPartOf":{"@id":"https://www.modelon.com/#website"},"breadcrumb":{"@id":"https://www.modelon.com/blog/reading-xml-data-into-modelica-models/#breadcrumb"},"description":"Learn how to read XML data into Modelica models using Data Access, an easy-to-use capability that comes with all Modelon Library Suite products.","about":[{"@type":"Thing","name":"Aerospace &amp; Defense"},{"@type":"Thing","name":"Jet Propulsion Library"},{"@type":"Thing","name":"Modelica"},{"@type":"Thing","name":"Modelica Libraries"},{"@type":"Thing","name":"Tips &amp; Tricks"}],"headline":"3 Steps to Reading XML Data into Modelica Models Using Data Access","datePublished":"2018-07-10T21:00:28+00:00","dateModified":"2023-07-31T16:02:28+00:00","image":"https://www.modelon.com/wp-content/uploads/2022/06/Title-1280-x-600.jpg","author":{"@id":"https://www.modelon.com/blog/author/wpengine/#person"},"publisher":{"@id":"https://www.modelon.com/#organization"}},{"@type":"Person","@id":"https://www.modelon.com/blog/author/wpengine/#person","name":"wpengine","url":"https://www.modelon.com/blog/author/wpengine/"}]}
```
