FMI4cpp icon indicating copy to clipboard operation
FMI4cpp copied to clipboard

Handling of TypeDefinitions and UnitDefinitions

Open Arend-Abbing opened this issue 3 years ago • 4 comments
trafficstars

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

Arend-Abbing avatar Dec 20 '21 13:12 Arend-Abbing

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..

markaren avatar Dec 20 '21 14:12 markaren

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?

Arend-Abbing avatar Dec 20 '21 17:12 Arend-Abbing

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

markaren avatar Dec 20 '21 17:12 markaren

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

Arend-Abbing avatar Dec 21 '21 09:12 Arend-Abbing