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

Port simulation code to Julia #1

Open
ufechner7 opened this issue Jun 26, 2021 · 6 comments
Open

Port simulation code to Julia #1

ufechner7 opened this issue Jun 26, 2021 · 6 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@ufechner7
Copy link

This is a very nice simulation framework!

But using a closed source language like Matlab/Simulink for an open source project is not a good choice.
Only academics in rich western countries can use it.

So I suggest to port this code to Julia (see: https://julialang.org/ )

Example for a generic flight simulation framework in Julia: https://github.com/JinraeKim/FlightSims.jl

Example for a kite power system model in Julia: https://github.com/ufechner7/KiteViewer/tree/sim/src

Porting Matlab to Julia should be easy, porting Simulink to Julia is more involved. But Julia has differential equation solvers that are orders of magnitude faster and more stable than Simulink.

@rschmehl
Copy link
Member

You are welcome to contribute a port of this code to Julia!

@DylanEij DylanEij added the help wanted Extra attention is needed label Jun 28, 2021
@tallakt
Copy link

tallakt commented Jun 30, 2021

I did an inhouse sim for Kitemill using Julia. The DifferentialEquations package could replace the integration part of Simulink.

I agree one should not create Matlab open source when Julia exists and is so good. I guess Python may also be a nice option though I dont like it much.

Even in Norway, we cant afford a €4k license for every user, making the Matlab users involuntary «priests» in charge of running code.

As a teaser my Julia sim runs a full loop in a few ms. It would be interesting to compare benchmarks. In my opinion this is important because a simulation run often must be run multiple times to automatically determine eg C_L and reel out speed to match tether max tension requirements. One these things are added, processing time adds up. I can generate a full power curve in seconds. My experience with simulink tells me this may not be possible with MegAWES.

@ufechner7
Copy link
Author

ufechner7 commented Jun 30, 2021

I guess Python may also be a nice option though I dont like it much.

I implemented FreeKiteSim in Python/ Numba, and it was not a very pleasant experiance.

Advantages of Julia compared to Python/ Numba:

  • better readability of the code
  • one language instead of two (Numba is a subset of Python which is really different from normal Python)
  • much better package manager; a lot less C/C++/Fortran libraries required, and those that are required exists in compiled form for Windows/ Linux/ Mac
  • StaticArrays.jl, a library that makes small arrays (up to about 100 elements) much faster and non-allocating while allowing the same linear algebra operations as for conventional arrays...

@ufechner7
Copy link
Author

You are welcome to contribute a port of this code to Julia!

I consider to port at least the controllers from Sebastian Rapp to Julia later this year. But I can work on this only during my spare time, and it might be more effective if I support a researcher or student do do this port than doing it all myself...

@ufechner7
Copy link
Author

My Julia code for soft kites is working fine now (see: https://github.com/aenarete/KiteSimulators.jl) and is also used by two researchers in Belgium and one company in the US... And I am now able to run this code using Matlab home...
Next step: Adding a fixed wing model to KiteModels.jl ...

@DylanEij
Copy link
Member

DylanEij commented Sep 8, 2022

Great to hear the Julia code for soft kites is working fine now.
Of course there is a big advantage of using free languages over Matlab but this work was based on different projects performed in advance (in Matlab). Therefore, it was not possible in the given time to port everything and do my own work, forcing me to stick with Matlab and Simulink.

There is one big advantage though in my opinion using simulink in open-source projects which is the graphical representation of connections between simulation modules. This is much easier to read than code itself.

Nevertheless, a Julia (or Python) version is definitely a great addition to the community. Having the controllers from Sebastian Rapp in Julia would be a great first step to have the entire framework in a more accessible language.

@DylanEij DylanEij closed this as completed Sep 8, 2022
@DylanEij DylanEij reopened this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants