Giter VIP home page Giter VIP logo

kitemodels.jl's People

Contributors

ufechner7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

1-bart-1 josbert1

kitemodels.jl's Issues

Add field version::Int64

Add a field version to both KPS3 and KPS4.
Version 1 shall be compatible with the original Python code, version 2 shall include bug fixes and improvements.

Add 4 point Model

Add the 4 point model to the code base. Add a type hierarchy that makes it possible to swap the active model easily.

Export model as FMI for Co-Simulation

If exported as functional mockup unit (FMU) using the FMI for Co-Simulation interface, then the model could also be used in other simulation environments like Simulink or OpenModellica. An FMU is a zip file which contains a dll/.so file and an interface description in XML format.

At some point in time this should be possible using the Julia package https://github.com/ThummeTo/FMIExport.jl , but this type of export is not yet supported. See: ThummeTo/FMIExport.jl#10

Add section Quickstart

  • explain installation without git, bash and vscode
  • add paragraph that explains creation of a project without bash
  • add Quickstart page
  • explain how to use the example simulate.jl

Make use of solver setting from settings.yaml

Use these values instead of hard-coded values.

initial:
    ...
    depower:   25.0        # initial depower settings    [%]
solver:
    abs_tol: 0.0006        # absolute tolerance of the DAE solver [m, m/s]
    rel_tol: 0.001         # relative tolerance of the DAE solver [-]
    max_iter:  200         # max number of iterations of the steady-state-solver

Add constructor for SysState

Add a constructor SysState(s::AKM).

A SysState object is needed for easy display of the state in KiteViewers.

The requires to calculate the orientation as quaternion. Perhaps first add a function orient(s::AKM).

Understanding the state initialization process

Some things are not clear to me regarding the state initializations in Kitemodels.jl . In find_steady_state!, why do we have s.stiffness_factor=stiffness_factor and then s.stiffness_factor=1.0 ?
Also I do not really get why find_steady_state_inner is called twice ?

Thanks in advance for your help.

Three-wire-kite

Is there any possibility to simulate a kite that has 3 wires going from the ground to the kite, so using three ground-based motors, instead of using a control pod in the air? If so, how could one implement this?

[IDAS ERROR] IDACalcIC Newton/Linesearch algorithm failed to converge.

When running the reset() and get_next_step() functions I very rarely get the error:
[IDAS ERROR] IDACalcIC
Newton/Linesearch algorithm failed to converge.

This is happening while Reinforcement Learning. So I run the reset once, and then run get_next_step until the kite crashes (around 285 times). That is one episode, and this is repeated x times.
I get the error for the first time after around 76 episodes (each running reset once, and get_next_step 285 times on average).

One episode pseudocode:

reset()
while not crashed:
    get_next_step(action)

Output.txt containing the rollout of one episode and the first occurrance error:

---------------------------------
| rollout/           |          |
|    ep_len_mean     | 285      |
|    ep_rew_mean     | -200     |
| time/              |          |
|    episodes        | 76       |
|    fps             | 456      |
|    time_elapsed    | 84       |
|    total_timesteps | 38448    |
| train/             |          |
|    actor_loss      | 4.3e+11  |
|    critic_loss     | 3.32e+23 |
|    ent_coef        | 2.06e+10 |
|    ent_coef_loss   | -437     |
|    learning_rate   | 0.0456   |
|    n_updates       | 768      |
---------------------------------

[IDAS ERROR]  IDACalcIC
  Newton/Linesearch algorithm failed to converge.

Environment.jl:

module Environment

using Timers; tic()
using KiteModels
using KiteUtils
# using PyCall #removed pycall!!
# using Plots


const Model = KPS4

set_data_path(joinpath(@__DIR__, "../../Simulator/data"))
kcu = KCU(se());
kps4 = Model(kcu);
dt = 1/se().sample_freq
steps = 1000
step = 0
logger = Logger(se().segments + 5, steps) 

GC.gc();
toc();

integrator = KiteModels.init_sim!(kps4, stiffness_factor=0.04);

function get_next_step(depower, steering)
    global step
    depower = Float32(depower)
    steering = Float32(steering)

    v_ro = 0.0

    if depower < 0.22; depower = 0.22; end
    set_depower_steering(kps4.kcu, depower, steering)

    t_sim = 0.0
    open("next_step_io.txt", "w") do io
        redirect_stdout(io) do
            t_sim = @elapsed KiteModels.next_step!(kps4, integrator, v_ro=v_ro, dt=dt)
        end
    end

    GC.gc(false)
    
    sys_state = SysState(kps4)
    step += 1

    return sys_state.orient[1], sys_state.orient[2], sys_state.orient[3], sys_state.orient[4], sys_state.force
end

function reset()
    global kcu
    global kps4
    global integrator
    global step
    global sys_state
    update_settings()
    save_log(logger)
    kcu = KCU(se());
    kps4 = Model(kcu);
    integrator = KiteModels.init_sim!(kps4, stiffness_factor=0.04)
    step = 0
    sys_state = SysState(kps4)
    GC.gc();
    return sys_state.orient[1], sys_state.orient[2], sys_state.orient[3], sys_state.orient[4], sys_state.force
end

function render()
    global sys_state, logger, step, steps
    if(step < steps)
        log!(logger, SysState(kps4))
    end
end


end

System:
I am running the code on IDUN High Performance Computing: https://www.hpc.ntnu.no/idun/
inside an apptainer ubuntu container.
I made a system image with Environment as a precompiled package.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Implement find_steady_state() for four point model

This is a bit more involved then for the 3 point model because not for all particles the y position is zero. Two particles have a y position that is not zero, but they must be symmetric which means y_C=-y_D .

Integrate winch controller with 1 point model

The winch controller is already integrated in KPS4, but not yet in KPS3.

TODO:

  • add length and v_reelout to the vector y, parameter of the function residual!() in KPS3.jl
  • fix bench3.jl
  • fix example/reel_out for 1p kite model
  • document the reel-out examples for 1p and 4p model

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.