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

Compatibile with torch, numpy etc ? #66

Open
kasarmic opened this issue Jan 23, 2025 · 1 comment
Open

Compatibile with torch, numpy etc ? #66

kasarmic opened this issue Jan 23, 2025 · 1 comment

Comments

@kasarmic
Copy link

Hello,

im currenly developing dynamincs model for fixedWing UAV and im utilizing torch, because we plan to utilize some neural network predictions in the model. Is it even possible to create FMU utilizing this project, with dependencies on these libraries ?

My model is currently parametrized in .py files, the neural prediction could be technically be inserted as a parameter too although is quite large torch tensor.

Thanks for reply in advance.

@sagilar
Copy link
Contributor

sagilar commented Jan 28, 2025

Hi @kasarmic,

Yes, you can mix UniFMU with other Python applications. Please be aware that the performance may change, and you need to adapt the functionality to the FMIDoStep calls.

How to proceed:
You can create a UniFMU with Python with the command:
./unifmu generate python your_project_name. Add other flags if needed.
Update the logic in model.py in the resources folder and include your dependencies at the very top. If you have other local Python modules, you can also add them to the resources folder, and import them from model.py.
Please notice that you need to adapt other resources in the FMU, such as the ModelDescription.xml and the attributes in model.py for it to work as a proper FMU and it should be orchestrated from a master FMI co-simulation algorithm like FMPy or Maestro.

I hope it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants