This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Test and wrapper script for simulator core functions. | |
To recompile the C++ library type ! ./make.sh from the ipython console and restart | |
the ipython kernel. | |
""" | |
import os | |
import sys | |
path = os.path.dirname(os.path.realpath(__file__)) | |
sys.path.append(path + '/..') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
This file is part of GtkSourceView | |
Authors: Waldir Pimenta | |
Copyright (C) 2013 Waldir Pimenta <[email protected]> | |
GtkSourceView is free software; you can redistribute it and/or | |
modify it under the terms of the GNU Lesser General Public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
* This file is part of FreeKiteSim. | |
* | |
* FreeKiteSim -- A kite-power system power simulation software. | |
* Copyright (C) 2013 by Uwe Fechner, Delft University | |
* of Technology, The Netherlands. All rights reserved. | |
* | |
* FreeKiteSim is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# constants for accessing the array of scalars | |
ParamCD = 0 | |
ParamCL = 1 | |
Length = 2 # length of one tether segment at zero force | |
C_spring = 3 # spring constant of one tether segment | |
Damping = 4 # damping constant of one tether segment | |
Depower = 5 | |
Steering = 6 | |
Alpha_depower = 7 | |
Alpha_zero = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" Accessing record arrays with numba 0.17 is 10 times slower than using two dimensional arrays. """ | |
from numba import jit | |
import numpy as np | |
import time | |
V_WIND = 8.0 | |
V_wind = 0 # (westwind, downwind direction to the east) | |
V_wind_gnd = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Demo code, showing the problem with using record arrays with Numba 0.18. | |
I replaced just three of the elements of vec3 with a record array with three elements. The execution time | |
increases from 22us to 45 us. | |
Model of a kite-power system in implicit form: residual = f(y, yd, sw) | |
This model implements a 3D mass-spring system with reel-out. It uses five tether segments (the number can be | |
configured in the file Settings.py). The kite is modelled as additional mass at the end of the tether. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Winston | |
const SIMUL_DUR = 10.0 # simulation time in seconds | |
const PeriodTime = 20e-3 # period time for the simulation in seconds | |
const workload = 20000 # workload in vector additions/ multiplications per simulation step | |
const vec_size = 3 | |
const cpu_usage = zeros(round(Int, SIMUL_DUR / PeriodTime)) # data array to log the cpu usage | |
const vec = zeros(vec_size, workload) # preallocate data array of 3D vectors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function check_sleep(amount) | |
start = time() | |
sleep(amount) | |
final = time() | |
delta = final - start | |
return delta | |
end | |
sum = 0.0 | |
abs(check_sleep(0.020)-0.020) # precompile check_sleep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import time | |
def check_sleep(amount): | |
start = datetime.now() | |
time.sleep(amount) | |
end = datetime.now() | |
delta = end-start | |
return delta.seconds + delta.microseconds/1000000. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom type, that can store scalars of vectors in Julia | |
NumberOrVector = Union{Number, Vector} | |
# input data | |
type Project | |
p_el_nom::NumberOrVector # electrical generator power in kW | |
rel_drum_diameter::NumberOrVector # ratio of the drum diameter and the tether diameter | |
rpm_generator::NumberOrVector # nominal speed of the electrical machine | |
z_ref::NumberOrVector # reference height for wind profile law |
OlderNewer