NTNU-IHB / FMI4cpp

FMI 2.0 implementation written in modern C++.
MIT License
93 stars 34 forks source link

Handling of TypeDefinitions and UnitDefinitions #119

Open Arend-Abbing opened 2 years ago

Arend-Abbing commented 2 years ago

TypeDefinitions and UnitDefinitions specified in the modelDescription.xml file of an FMU are not handled by the fmi4cpp xml parsing software

markaren commented 2 years ago

Indeed, see also https://github.com/NTNU-IHB/FMI4cpp/issues/100 It has simply never been added and I don't have any immediate plans to do so either. I'm happy to receive a PR for it though..

Arend-Abbing commented 2 years ago

Thanks for the quick response. I'm wrapping FMU's in our hydrodynamics simulation software framework and I known from experience that it can be pretty helpful when the units are exposed to simulation engineers when searching for integration mistakes. Therefore, I added the processing of the TypeDefinitions to the model_description_parser.cpp. What shall I do with it?

markaren commented 2 years ago

model_description_base needs to be updated with the missing fields, and the parser then sets those during parsing. Ideally with a type safe API and a default value of std::optional<>

Something, something

Arend-Abbing commented 2 years ago

What I did for know is setting the unit field of a double scalar with the unit parameter of the corresponding TypeDefinition