Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I find out the names and types of input/output variables of an FMU? #142

Closed
chiragr15 opened this issue Jan 29, 2024 · 4 comments
Closed

Comments

@chiragr15
Copy link

I have an FMU which is loaded as a Co-Sim model via fmi4cpp. I am able to access the model-description, but how do I get the names of variables and their types through model-description?

I have only the .fmu file and no model_description.xml(as present in the examples provided)

@markaren
Copy link
Member

The modelDescription.xml is located inside the FMU, which is just a ZIP archive.

@chiragr15
Copy link
Author

Thank you for your reply,
I apologize for not being clear with my doubt, I have a custom FMU that I am testing the fmi4cpp library on. I am currently able to load it as co-sim fmu and step through it. I want to access the variables inside the modelDescription using fmi4cpp as I do not know the names or reference values of the variables.

How do I do this?

@markaren
Copy link
Member

markaren commented Jan 29, 2024

The instance and fmu object should have a get_model_description() function that holds a model_variables field. You should be able to loop through this using indices or a foreach loop on the object itself.

But it's been a long time since I looked at this.

@chiragr15
Copy link
Author

Thank you for your reply.

@markaren markaren closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants