FMPy icon indicating copy to clipboard operation
FMPy copied to clipboard

[Feature Request] Expose function to write a model description

Open hanneskaeufler opened this issue 2 years ago • 4 comments

Seeing as this library already implements the functionality, it was somewhat pointless to reimplement the writing on the users side again.

This could be refactored out like https://github.com/CATIA-Systems/FMPy/pull/451/files#diff-f7a75463637f732e168728bf7998e4c8f8f683206aaf0cfa32867705ec0664edR207

hanneskaeufler avatar Sep 13 '22 14:09 hanneskaeufler

What would be the benefit of having this separate function?

t-sommer avatar Sep 20 '22 14:09 t-sommer

Writing model descriptions is a task I have to do sometimes. I find the FMPy abstractions to be reasonable, so I prefer to work with the ModelDescription, ScalarVariable types etc. However I don't want to have to implement a function to write a model descriptions based on those types again, seeing as this lib already does that but just doesn't expose it. So: Usage from application code is the benefit

Also: The function to write the container FMU could be factored better and would be easier to understand if it were split up into multiple functions.

hanneskaeufler avatar Sep 20 '22 14:09 hanneskaeufler

Something like

def modelDescription2XML(model_description: ModelDescription)
    ...

?

t-sommer avatar Sep 20 '22 14:09 t-sommer

Something like

def modelDescription2XML(model_description: ModelDescription)
    ...

?

Yes essentially 👍🏽

hanneskaeufler avatar Sep 20 '22 14:09 hanneskaeufler