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

Support export of FMUs for cosimulation #10

Open
ufechner7 opened this issue May 7, 2022 · 8 comments
Open

Support export of FMUs for cosimulation #10

ufechner7 opened this issue May 7, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@ufechner7
Copy link

I would like to export my model https://github.com/ufechner7/KiteModels.jl to an FMU. How should I start?

@ThummeTo
Copy link
Owner

ThummeTo commented May 9, 2022

Dear @ufechner7,

export of CS-FMUs is work in progesss, one of our students is already on it. A nice tutorial is also WIP.

If model-exchange (ME) FMUs is also an option (almost any FMI-compliant modelling environement can handle ME- as well as CS-FMUs), you can have a look on the BouncingBall-Example in the "example"-folder - which exports a ME-FMU.

All you have to do for ME is basically to fill the four functions in the example with your Kite-Model's state space equations.

Please note, that this package is very fresh and we only tested it on some specific models from our use-cases.

Regards!

@ThummeTo ThummeTo added the enhancement New feature or request label May 2, 2023
@ThummeTo ThummeTo changed the title Support export of FMIs for cosimulation Support export of FMUs for cosimulation May 3, 2023
@ufechner7
Copy link
Author

Any update on this?

@ThummeTo
Copy link
Owner

Dear @ufechner7,
from a technical perspective, there is not that much to do, the most "complex" missing functions to be implemented is fmi2DoStep that must only trigger a fmiSimulateME (CS can be seen as ME with some extra steps). The only reason we haven't implemented it yet is that we have no application for it now. Do you have an urgent use case? Any way, this is on the todo list, but priority is low until it is needed somewhere.

@ufechner7
Copy link
Author

Well, I created a new model, a tether model, which is not possible to solve using Simulink solvers, we need the Julia solvers, they are at least 1000 times faster... Have a look at: https://github.com/ufechner7/Tethers.jl

I really would like to make this model available to my colleagues from the IEA workgroup "airborne wind energy" who still use Python or Simulink... Exporting this as FMU would be perfect...

@ufechner7
Copy link
Author

Perhaps you could give me some hints how to start this work... What would be the first step? Define the inputs, outputs, configuration struct and states of my model?

@ThummeTo
Copy link
Owner

Sure :)
From a technical perspective, one only needs to extend the template package for FMI2 FMUs in FMIBuild by the mandatory FMI2 functions for CS (see the FMI-spec), the most "complicated" function would be fmi2DoStep that would use the existing template functions (like FMU_FCT_EVALUATE defined for example here) to setup a DifferentialEquations.jl ODEProblem and do one simulation step. The biggest show stopper could be: I don't know if we can compile the entire DifferentialEquations.jl with PackageCompiler.jl - I did not test this yet. Also, binary sizes might be large, but there is (and was) a lot of progress in PackageCompiler regarding binary sizes.

@Xiuchanhun
Copy link

From test-0: stepping - Error test_fmi2DoStep: Current communication point ( 5.999999865889549255e-02 s) does not match last evaluation time ( 0.000000000000000000e+00 s) within tolerance 9.999999999999999547e-08. Time rollback is not allowed how to SLove this?

@ThummeTo
Copy link
Owner

Please always provide a (minimum) example, it's really hard to guess what is going on there. Also, I am not sure if this is related to this topic (see title) and the package FMIExport.jl - if this is a simulation issue it might be an issue for FMI.jl.

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

No branches or pull requests

3 participants