Exported Functions

Reading config files

KiteUtils.set_data_pathFunction
set_data_path(data_path="")

Set the directory for log and config files.

If called without argument, use the data path of the package to obtain the default settings when calling se().

source
KiteUtils.load_settingsFunction
load_settings(project=PROJECT)

Load the project with the given file name.

The project must include the path and the suffix .yaml .

source
KiteUtils.copy_settingsFunction
copy_settings()

Copy the default settings.yaml and system.yaml files to the folder DATAPATH (it will be created if it doesn't exist).

source
KiteUtils.seFunction
se(project="system.yaml")

Getter function for the Settings struct.

The settings.yaml file to load is determined by the content of the file system.yaml .

source
KiteUtils.se_dictFunction
se_dict()

Getter function for the dictionary, representing the settings.yaml file.

Access to the dict is much slower than access to the setting struct, but more flexible.

Usage example: z0 = se_dict()["environment"]["z0"]

source

Also look at the default example: settings.yaml .

Creating test data

KiteUtils.demo_stateFunction
demo_state(P, height=6.0, time=0.0)

Create a demo state with a given height and time. P is the number of tether particles.

Returns a SysState instance.

source
KiteUtils.demo_state_4pFunction
demo_state_4p(P, height=6.0, time=0.0)

Create a demo state, using the 4 point kite model with a given height and time. P is the number of tether particles.

Returns a SysState instance.

source
KiteUtils.demo_syslogFunction
demo_syslog(P, name="Test flight"; duration=10)

Create a demo flight log with given name [String] and duration [s] as StructArray. P is the number of tether particles.

source
KiteUtils.demo_logFunction
demo_log(P, name="Test_flight"; duration=10)

Create an artifical SysLog struct for demonstration purposes. P is the number of tether particles.

source
KiteUtils.get_particlesFunction
get_particles(height_k, height_b, width, m_k, pos_pod= [ 75., 0., 129.90381057], vec_c=[-15., 0., -25.98076211], 
              v_app=[10.4855, 0, -3.08324])

Calculate the initial positions of the particels representing a 4-point kite, connected to a kite control unit (KCU).

Parameters:

  • height_k: height of the kite itself, not above ground [m]
  • height_b: height of the bridle [m]
  • width: width of the kite [m]
  • mk: relative nose distance
  • pos_pod: position of the control pod
  • vec_c: vector of the last tether segment
source

Loading, saving and converting log files

KiteUtils.log!Function
log!(logger::Logger, state::SysState)

Log a state in a logger object. Do nothing if the preallocated size would be exceeded. Returns the current number of elements of the log.

source
KiteUtils.save_logFunction
save_log(logger::Logger, name="sim_log", compress=true;
            colmeta = Dict(:var_01 => ["name" => "var_01"],
                           :var_02 => ["name" => "var_02"],
                           :var_03 => ["name" => "var_03"],
                           :var_04 => ["name" => "var_04"],
                           :var_05 => ["name" => "var_05"],
                           :var_06 => ["name" => "var_06"],
                           :var_07 => ["name" => "var_07"],
                           :var_08 => ["name" => "var_08"],
                           :var_09 => ["name" => "var_09"],
                           :var_10 => ["name" => "var_10"]
        ))

Save a fligh log from a logger as .arrow file. By default lz4 compression is used, if you use false as second parameter no compression is used.

source
save_log(flight_log::SysLog, compress=true; path="")

Save a fligh log of type SysLog as .arrow file. By default lz4 compression is used, if you use false as second parameter no compression is used.

source
KiteUtils.sys_logFunction
sys_log(logger::Logger, name="sim_log";
            colmeta = Dict(:var_01 => ["name" => "var_01"],
                           :var_02 => ["name" => "var_02"],
                           :var_03 => ["name" => "var_03"],
                           :var_04 => ["name" => "var_04"],
                           :var_05 => ["name" => "var_05"],
                           :var_06 => ["name" => "var_06"],
                           :var_07 => ["name" => "var_07"],
                           :var_08 => ["name" => "var_08"],
                           :var_09 => ["name" => "var_09"],
                           :var_10 => ["name" => "var_10"],
        ))

Converts the data of a Logger object into a SysLog object, containing a StructArray, a name and the column meta data.

source

The function set_data_path(data_path) can be used to set the directory for the log files.

Rotation matrices

KiteUtils.rot3dMethod
rot3d(ax, ay, az, bx, by, bz)

Calculate the rotation matrix that needs to be applied on the reference frame (ax, ay, az) to match the reference frame (bx, by, bz). All parameters must be 3-element vectors. Both refrence frames must be orthogonal, all vectors must already be normalized.

Source: TRIAD_Algorithm

source
KiteUtils.rotMethod
rot(pos_kite, pos_before, v_app)

Calculate the rotation matrix of the kite based on the position of the last two tether particles and the apparent wind speed vector.

source

Coordinate system transformations

KiteUtils.fromENU2EGFunction
fromENU2EG(pointENU)

Transform the position of the kite in the East North Up reference frame to the Earth Groundstation (North West Up) reference frame.

source
KiteUtils.fromEG2WFunction
fromEG2W(vector, down_wind_direction = pi/2.0)

Transform a vector (x,y,z) from Earth Groundstation to Wind reference frame.

source
KiteUtils.fromW2SEFunction
fromW2SE(vector, elevation, azimuth)

Transform a (velocity-) vector (x,y,z) from Wind to Small Earth reference frame .

source
KiteUtils.fromKS2EXFunction
fromKS2EX(vector, orientation)

Transform a vector (x,y,z) from KiteSensor to Earth Xsens reference frame.

  • orientation in Euler angles (roll, pitch, yaw)
source
KiteUtils.fromEX2EGFunction
fromEX2EG(vector)

Transform a vector (x,y,z) from EarthXsens to Earth Groundstation reference frame

source

Geometric calculations

Calculate the elevation angle, the azimuth angle and the ground distance based on the kite position. In addition, calculate the heading angle, the heading vector, the arc cos (safe version) and the initial kite reference frame.

KiteUtils.calc_azimuthFunction
calc_azimuth(azimuth_north, up_wind_direction = -π/2)

Calculate the azimuth in the wind reference frame. The upwinddirection is the direction the wind is coming from Zero is at north; clockwise positive. Default: Wind from west.

Returns:

  • Angle in radians. Zero straight downwind. Positive direction clockwise seen from above.
  • Valid range: -pi .. pi.
source
KiteUtils.calc_headingFunction
calc_heading(orientation, down_wind_direction = pi/2.0, respos=true)

Calculate the heading angle of the kite in radians. The heading is the direction the nose of the kite is pointing to. If respos is true the heading angle is defined in the range of 0 .. 2π, otherwise in the range -π .. π

source
KiteUtils.calc_courseFunction
calc_course(velocityENU, elevation, azimuth, down_wind_direction = π/2, respos=true)

Calculate the course angle in radian.

  • velocityENU: Kite velocity in EastNorthUp reference frame
  • downwinddirection: The direction the wind is going to; zero at north; clockwise positive from above; default: going to east.
  • respos: If true, the result is in the range 0 .. 2π, otherwis -π .. π
source
KiteUtils.calc_heading_wFunction
calc_heading_w(orientation, down_wind_direction = pi/2.0)

Calculate the heading vector in wind reference frame.

source
KiteUtils.azimuth_eastFunction
azimuth_east(vec)

Calculate the azimuth angle in radian from the kite position in ENU reference frame. Zero east. Positive direction clockwise seen from above. Valid range: -π .. π.

source
KiteUtils.ground_distFunction
ground_dist(vec)

Calculate the ground distance of the kite from the groundstation based on the kite position (x,y,z, z up).

source
KiteUtils.acos2Function
acos2(arg)

Calculate the acos of arg, but allow values slightly above one and below minus one to avoid exceptions in case of rounding errors. Returns an angle in radian.

source
KiteUtils.initial_kite_ref_frameFunction
initial_kite_ref_frame(vec_c, v_app)

Calculate the initial orientation of the kite based on the last tether segment and the apparent wind speed.

Parameters:

  • vec_c: (posn-2) - (posn-1) n: number of particles without the three kite particles that do not belong to the main thether (P1, P2 and P3).
  • v_app: vector of the apparent wind speed

Returns: x, y, z: the unit vectors of the kite reference frame in the ENU reference frame

source