ufechner7 / kitemodels.jl Goto Github PK
View Code? Open in Web Editor NEWKite and tether models for the simulation of kite power systems
Home Page: https://ufechner7.github.io/KiteModels.jl/
License: MIT License
Kite and tether models for the simulation of kite power systems
Home Page: https://ufechner7.github.io/KiteModels.jl/
License: MIT License
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 a non-allocating version of the function SysState(kps::AKM)
with the signature
update_sys_state!(sys_state, kps::AKM, zoom=1.0)
to reduce memory allocations
Current testing is happening only with a 6 segment tether which is not sufficient.
Add the 4 point model to the code base. Add a type hierarchy that makes it possible to swap the active model easily.
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
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 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).
@JuliaRegistrator register
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.
And function copy_examples()
It should not be required.
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 functions to calculate the heading and the course.
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.
Use vortex step method to characterize kite aerodynamically, lumping the forces into 3 nodes.
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!
Integrate the winch model to achieve a realistic dynamics when the reel out speed is not constant.
The winch model is implemented in a separate package: https://github.com/aenarete/WinchModels.jl
But it still has to be integrated here.
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 .
Add a page in the documentation how to use it.
If the latest version of system.yaml is not present in the folder data precompiling KiteModels fails.
Replace the code inside of this package with the functions from AtmosphericModels.
Add functions for KPS3 and KPS4 to determine the orientation of the kite.
The winch controller is already integrated in KPS4, but not yet in KPS3.
TODO:
Update the links at the bottom of
https://github.com/ufechner7/KiteModels.jl/edit/main/docs/src/index.md
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.