awegroup / MegAWES

Matlab/Simulink model of a megawatt-class airborne wind energy system based on rigid wing technology.
https://megawes.readthedocs.io/en/latest/
Apache License 2.0
17 stars 7 forks source link

Port simulation code to Julia #1

Open ufechner7 opened 3 years ago

ufechner7 commented 3 years ago

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 commented 3 years ago

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

tallakt commented 3 years ago

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 commented 3 years ago

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:

ufechner7 commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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.