GithubHelp home page GithubHelp logo

ufechner7 / kitemodels.jl Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 3.0 12.28 MB

Kite and tether models for the simulation of kite power systems

Home Page: https://ufechner7.github.io/KiteModels.jl/

License: MIT License

Julia 97.09% Shell 2.91%
modeling models windenergy kitepower julia kite airborne airborne-wind-energy

kitemodels.jl's People

Contributors

1-bart-1 avatar dependabot[bot] avatar ufechner7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

kitemodels.jl's Issues

Use max_steering from configuration file

Currently the value of max_steering is hardcoded:

const KS = deg2rad(16.834)   # max steering in degrees 

Instead, the value of the settings file should be used.

Add example how to use the model from Python

An example how to use the model from Python would be useful for some users.

  • define the signature of the Python functions that shall be supported
  • create a new repo for the Python examples
  • create a Python project that uses PythonCall to provide the functions defined in the first step
  • add documentation (README.md)
  • add a basic example

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 .

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?

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).

Increase bridle stiffness

If you see that different wind speeds change the trim angle of the kite, have you tried increasing the stiffness only of the lines that would represent the bridle system?
That would constrain the kite structure in a more realistic way, I think.

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.

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.

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!

Add test case for steering sensitivity

The steering sensitivity depends on:

  • the polars
  • max_steering
  • alpha_ztip

all of them defined in settings.yaml.

Write a script that visualizes the result, e.g. the side force or torque as function of the steering input.

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

[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.

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

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 interface for torque controlled winch

Currently the kite model requires a winch model that has a set speed as input. Modern winches often have a set torque as input. Using such a winch model requires a new, optional interface.

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

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.

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.