ufechner7 / KiteModels.jl

Kite and tether models for the simulation of kite power systems
https://ufechner7.github.io/KiteModels.jl/
MIT License
8 stars 2 forks source link

Use serialization to save and load pairs of integrators and abstract kite models. #53

Closed 1-Bart-1 closed 4 weeks ago

1-Bart-1 commented 1 month ago

Each time the simulator is initialized with the same settings, the same integrator is found. This branch will load and save such pairs of integrators and abstract kite models, as this is way faster than calculating the integrator again and again.

integrator_history = load_history()
# normal code
integrator = KiteModels.init_sim!(kps4, stiffness_factor=0.04, prn=false, integrator_history=integrator_history)
# normal code
save_history(integrator_history)

When using integrator_history, KiteModels.init_sim! is 10x faster than whithout using integrator_history.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 17.64706% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 66.60%. Comparing base (4f1b5b4) to head (172d521). Report is 51 commits behind head on main.

:exclamation: Current head 172d521 differs from pull request most recent head f2d282d

Please upload reports for the commit f2d282d to get more accurate results.

Files Patch % Lines
src/KiteModels.jl 17.64% 28 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #53 +/- ## =========================================== - Coverage 98.52% 66.60% -31.93% =========================================== Files 4 5 +1 Lines 746 1084 +338 =========================================== - Hits 735 722 -13 - Misses 11 362 +351 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ufechner7 commented 1 month ago

Is there any practical application where the time of executing init_sim!() limits the the overall performance?

1-Bart-1 commented 1 month ago

Yes, when automatically optimizing the KCU or when optimizing other control methods, the kite has to be reset often. I am optimizing a neural network for the kite, and have to reset the kite at the start of every episode. It can also be useful when optimizing a PID controller using optimizing methods. So in any situation where the simulation has to be reset often.

On Sat, May 25, 2024, 17:16 Uwe Fechner @.***> wrote:

Is there any practical application where the time of executing init_sim!() limits the the overall performance?

— Reply to this email directly, view it on GitHub https://github.com/ufechner7/KiteModels.jl/pull/53#issuecomment-2131306409, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIBR55B6OM57SAZMBESQTDTZECTLTAVCNFSM6AAAAABIIY3OEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZRGMYDMNBQHE . You are receiving this because you authored the thread.Message ID: @.***>

1-Bart-1 commented 4 weeks ago

found a bug, reset wasnt working properly

ufechner7 commented 3 weeks ago

One remark: For the four point model I suggest a stiffness-factor of 0.5. This save some time.