Skip to content

v0.13.0

Choose a tag to compare

@github-actions github-actions released this 17 Oct 18:05
· 46 commits to main since this release

KiteModels v0.13.0

Diff since v0.12.1

Added

  • save_state(filename, ss) writes a SysState to a human-readable YAML file under the key sys_state, without the fields that KPS3 and KPS4 do not use (keyword exclude; KiteModels.UNUSED_FIELDS_KPS3 also leaves out side_slip, alpha3 and alpha4, which KPS3 does not have, and aero_moment_KA_x/y/z, which is always zero for KPS3), and the dictionary passed as keyword meta_data under the key meta_data. examples/test_init_4p.jl and examples/test_init_1p.jl use it to write output/sys_state_<script name>.yaml after 80 time steps, and examples_3d/parking_wind_dir.jl after 16 s simulation time, with the script name, the simulation time and the date and time of saving as meta data, and they fill in t_sim, the wall-clock time of the last time step. Strings, and keys of the meta data that are not plain identifiers, are written as quoted YAML strings.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) store the internal state of the winch, the rate limited set speed wm.last_set_speed and the state of the brake wm.brake (0 or 1), in the free fields var_13 and var_14, which are NaN without a winch model. init!(s; initial_state) restores them; saved while the winch ramps up the set speed, the tether length after one more second differs by less than 0.01 mm from the uninterrupted simulation (with a solver tolerance of 1e-6) instead of 0.5 m. Code that writes var_13 or var_14 itself should use other fields.
  • load_state(filename) reads a system state that save_state wrote and returns a new SysState and the dictionary of the meta data. The number of points and springs is taken from the file; fields that are not in the file keep their default values.
  • init!(s; initial_state) (KPS3 and KPS4) continues a simulation from a SysState, for example one that load_state read: the positions and velocities of the particles, the tether length, the reel-out speed, the set values and the internal state of the winch and the depower and steering of the KCU are taken from it, the accelerations are calculated from the residual, for KPS4 the pitch rate of the kite is calculated from the velocities of the particles instead of being set to zero, and the integrator continues at the time of the state. Saved after 40 steps and continued for 20 more, the positions stay within a millimetre of the uninterrupted simulation with a solver tolerance of about 1e-6, because the restarted solver takes different steps: with the default of 1e-3, a turning KPS3 is only accurate to about half a metre, and KPS4 differs by one to two millimetres, depending even on the last digit of the aerodynamic coefficients. examples_3d/parking_wind_dir.jl continues from its saved state if LOAD_SYS_STATE is true; if the file does not exist yet, it starts at zero and saves the state.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) fill the field spring_force with the forces of all springs from spring_forces, including the damping force: the tether segments and, for KPS4, the springs of the kite. The new function n_springs(s) returns their number.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) fill the fields aero_force_KA_x/y/z and aero_moment_KA_x/y/z, which were always zero: the total aerodynamic force and moment of the kite in the KA body frame (aft-right-up). The moment is taken about the origin of the KA frame, the centre between the kite particles C and D, and includes the pitch damping and steering couples. For KPS3, the force is the sum of the lift, drag and steering forces of the kite; the moment stays zero, because the kite is a point mass.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) also fill the per-particle fields aero_force_x/y/z (the aerodynamic forces on the kite particles A, B, C and D) and drag_force_x/y/z (the drag of the tether, the bridle lines and the KCU), both in ENU. For KPS3, the aerodynamic force acts on the last particle, and the drag forces are those of the tether and the bridle. Both are recomputed from the current state in update_sys_state! with the new functions calc_aero_forces and calc_drag_forces (KPS4) and calc_drag_force (KPS3), which calc_aero_forces!, calc_particle_forces! and calc_drag now use too, so the residual is not slower. Without the evaluation of the residual below, update_sys_state! would take about 3 µs instead of 1.4 µs.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) fill the particle velocities VX, VY and VZ, which were always zero. For KPS3, they are taken from the state vector of the integrator.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) fill the field acc, which was always zero, with the norm of the acceleration of the kite. next_step! copies the acceleration of the kite from the state derivative of the integrator to the new field acc_kite of KPS3 and KPS4 once per time step; after init! it is zero.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) fill the fields turn_rate_x/y/z, which were always zero, with the angular velocity of the kite in the KA body frame. The new function calc_turn_rates calculates it from the velocities of the kite particles B, C and D; it agrees with a finite difference of the orientation within 0.1 %. For KPS3, which has no rigid kite frame, they are the finite difference of the orientation since the last call of update_sys_state! in an earlier time step. The previous orientation and its time are kept in the model, so a new SysState in each time step gives the same turn rates as a reused one; they are zero on the first call.
  • SysState(s) and update_sys_state! (KPS4) fill the field side_slip, which was always zero, with the side slip angle that calc_aero_forces! calculates from the apparent wind at the kite particle B. For KPS3, which has no kite frame, it is NaN.

Changed

  • The lift and drag coefficients calc_cl and calc_cd of KPS3 and KPS4 are now of the new type KiteModels.CubicSpline, which evaluates the cubic spline from Dierckx.Spline1D in Julia instead of in Fortran: about 6 ns instead of 41 ns per call, with the same results (differences below 1e-15). This makes residual! of KPS4, which needs six of these calls, about 16 % faster (976 ns instead of 1163 ns). A Spline1D that is assigned to calc_cl or calc_cd is converted automatically.
  • residual! of KPS4 copies its result faster into the residual vector, which saves about 100 ns per call (872 ns instead of 970 ns).
  • spring_forces(s) (KPS3 and KPS4) returns the forces that the residual applies, including the damping force (new keyword damping, default true). Before, it returned only the elastic force, and for KPS4 it used a different stiffness under compression than the residual: the stiffness of tension for the tether segments instead of 10 % of it, and 25 % of it for the springs of the kite instead of rel_compr_stiffness. The residual and spring_forces now use the same function, calc_spring_force. calc_pre_tension leaves out the damping force.
  • Breaking: SysState(s) (KPS3 and KPS4) creates a SysState with n_springs(s) segments instead of none, so that spring_force can hold the spring forces. log! fails with a DimensionMismatch if the Logger has a different number of segments, so a Logger must now be created with Logger(P, steps; segments=n_springs(s)); all examples do this. SysState(s; with_springs=false) creates the previous SysState without spring forces, which fits Logger(P, steps).
  • SysState(s) and update_sys_state! (KPS3 and KPS4): the field turn_rates is now the angular velocity of the kite in the KA body frame from calc_turn_rates, the same as turn_rate_x/y/z. Before, only its z component was set, estimated as heading_rate - azimuth_rate * sin(elevation) (Erhard and Strauch, 2013), which in a steered flight could be off by a factor of 2.5 or have the wrong sign. Plots of the body turn rate, like in examples_3d/parking_4p.jl, change accordingly. For KPS3, turn_rates is the finite difference of the orientation, the same as turn_rate_x/y/z.
  • bin/install runs the test suite only if the new option --test is passed. Before, it always ran the tests, including the benchmarks, which can take up to an hour. bin/update_default_manifests passes --test, so a new default manifest is only written if all tests pass.
  • bin/install has the new option --version X.Y (or +X.Y), which uses Julia X.Y for this run without changing the juliaup default.
  • bin/update_default_manifest is renamed to bin/update_default_manifests. It no longer asks for a Julia version and no longer changes the juliaup default, but updates the default manifests for Julia 1.12 and 1.13 one after the other; it stops at the first version whose installation or tests fail.
  • The examples and test projects allow DSP 0.8 (#318). create_filter in examples/filters.jl, used by calc_spectrum.jl and plot_pitch_stability.jl, normalizes the cut-off frequency itself instead of passing fs to Lowpass, which DSP 0.8 removed; this works with DSP 0.7 and 0.8 and gives the same filter.
  • The default manifests for Julia 1.12 and 1.13 use DSP 0.8.6, Colors 0.13.3 and MatrixEquations 2.7.0.
  • the link checker no longer checks the Zenodo DOI, which often fails with 504 Gateway Timeout, and uses the default timeout of 20 s again
  • SysState(s) and update_sys_state! (KPS3): the fields alpha3, alpha4, set_force, bearing and attractor, which KPS3 does not have, are now NaN, like for KPS4 when they are not set. Before, they stayed zero, which looked like a real angle or bearing of 0.
  • KiteModels allows OrdinaryDiffEqCore 4 (#340), and therefore works with the SciMLBase 3 stack (OrdinaryDiffEqBDF 2, Sundials 6.7, NLsolve 5). init! calls DiffEqBase.init instead of OrdinaryDiffEqCore.init, which OrdinaryDiffEqCore 4 no longer exports; both are the same function (CommonSolve.init).
  • the documentation is no longer deployed as preview for pull requests by dependabot, because these runs have no write access to the repository.
  • .JETLSConfig.toml.default hides the inferred-type inlay hints of JETLS ([inlay_hint.types] enabled = false) and sets auto_instantiate = "never" instead of the legacy value false, which JETLS 2026.10.14 still accepts with the same meaning.
  • The Docs workflow can be started manually (gh workflow run Docs.yml --ref main). Before, it only ran on pushes that changed docs/**, src/** or a *.toml file in the root folder, so a fix elsewhere did not rebuild the documentation.
  • New regression tests test/test-cubic-spline.jl compare CubicSpline with Dierckx.Spline1D at the knots, between them, at both ends and outside of both ends, and cover a spline with four samples, the conversion on assignment to calc_cl and calc_cd (KPS3 and KPS4) and the rejection of splines of another degree or boundary condition. The tests of init! from a loaded state (KPS4, and during a winch ramp) use a solver tolerance of 1e-6, like for KPS3, because with the default of 1e-3 the result changed by more than the allowed millimetre with a change of the aerodynamic coefficients in the last digit.

Fixed

  • copy_examples, copy_examples_3d, install_examples and install_examples_3d copied the Project.toml of the examples and examples_3d folders into the project of the user. It loads KiteModels from the parent folder ([sources] KiteModels = {path = ".."}), which is only valid inside the KiteModels repository, and the examples activated it. Now this file is not copied, and the examples activate their own folder only if it contains a Project.toml.
  • calc_aero_forces! (KPS4) allocated 32 bytes per call with Julia 1.12, because an intermediate MVector was not elided, so the allocation tests of test/bench4.jl for calc_aero_forces! and residual! failed. calc_aero_forces now works on immutable copies of the positions, velocities and the wind vector.
  • update_sys_state! (KPS3 and KPS4) read the previous azimuth, heading and time for azimuth_rate and heading_rate from the SysState. A new SysState starts with these values at zero, so creating one in each time step, like SysState(s) in a loop, returned the angles divided by the simulation time instead of the rates. The previous angles and their time are now kept in the model, the rates use the time of the integrator, which the angles belong to, instead of the start time of the last step, and a further update in the same time step keeps the rates.
  • SysState(s) and update_sys_state! (KPS3 and KPS4) evaluate the residual for the accepted state of the integrator before reading the model. Before, the positions, velocities, forces and the apparent wind stored in the model came from the last residual evaluation of the solver, which can belong to a rejected trial state, so a SysState could combine the velocities of the accepted state with the forces of a trial state. This costs about 18 µs per call for KPS4; next_step! is not slower.
  • KPS3: the heading s.psi, which the correction of the influence of gravity on the turn rate (Eq. 30 of Fechner et al., 2015, parameter c2_cor) needs, was never set, so the correction was always zero. next_step! now sets it to calc_heading(s) once per time step, calculated from the accepted state of the integrator and the wind of the new time step; the positions and the apparent wind stored in the model would belong to the last trial state of the solver and to the previous wind, which after a change of the wind direction by 30° gave a heading that was 30° off. This changes the results of KPS3 when the kite flies sideways: with system.yaml, gravity turns the kite towards the ground about 8 % slower than before.
  • KPS3: s.v_apparent was overwritten by calc_drag with the apparent wind of each tether segment, so after residual! it held the apparent wind of the lowest segment instead of the apparent wind at the kite (for example 12.0 m/s instead of 13.3 m/s). The y-axis of the kite reference frame is calculated from it, so the orientation, calc_heading, the turn rates and v_app of SysState were wrong. The simulation itself was not affected.
  • KPS3: for the top tether segment, calc_res passed half of the drag of the bridle instead of half of the drag of the segment on to the particle below, because the drag of the bridle overwrote the drag of the segment first. With system.yaml, the bridle has a third of the drag area of a segment, so the drag of the tether was too low. This changes the results of KPS3: in the steady state at 70° elevation with a tether length of 392 m, the winch force increases from 301.2 N to 306.7 N and the lift decreases from 327.3 N to 315.8 N.
  • KPS3: vel_kite was the velocity of the tether particle segments - 1 instead of the velocity of the kite, because residual! overwrote the correct value at its end. The simulation itself was not affected, because residual! uses the correct value before overwriting it, but the outputs were: calc_course and the fields course and vel_kite of SysState.
  • find_steady_state!(s; trim=true) (KPS3 and KPS4) could accept a trim with the kite below the horizon. For example, KPS3 with system.yaml, a wind speed of 6 m/s, a tether length of 1000 m and set.elevation = 40° returned a trim at an elevation of -78°, with the tether hanging below the ground. Such a trim is now rejected like a trim in deep stall, so the solver restarts at other elevations; in this example it finds the natural elevation of 53.9°.
  • update_sys_state! returned an azimuth_rate and a heading_rate of Inf or NaN (and therefore also turn_rates) in the first call after init!, because the time step was zero; these rates are now zero in this case.
  • examples_3d/parking_4p.jl initialized the kite with an upwind direction of -90°, but simulated with -80°. The sudden change of the wind direction caused heading oscillations in the first 3 s and a drift of the heading before steering started; now the kite is initialized with the upwind direction of the simulation.

Merged pull requests:

  • Update OrdinaryDiffEqNonlinearSolve requirement from 1.6.1 to 1.6.1, 2.9 (#316) (@dependabot[bot])
  • Update OrdinaryDiffEqBDF requirement from 1.18.0 to 1.18.0, 2.4 (#317) (@dependabot[bot])
  • Update DSP requirement from 0.7.10 to 0.7.10, 0.8 (#318) (@dependabot[bot])
  • Update LinearSolve requirement from 3.59 to 3.59, 5.18 (#319) (@dependabot[bot])
  • Update DiffEqBase requirement from 6.161.0 to 6.161.0, 7.21 (#320) (@dependabot[bot])
  • Fill all SysState fields of KPS3 and KPS4, fix three KPS3 bugs (#335) (@ufechner7)
  • Add load_state and init!(s; initial_state) to continue a simulation (#336) (@ufechner7)
  • Update Sundials requirement from 4.24, 5.1 to 4.24, 5.1, 6.7 (#339) (@dependabot[bot])
  • Update JLD2 requirement from 0.5 to 0.5, 0.6 (#341) (@dependabot[bot])
  • Update SciMLBase requirement from 2 to 2, 3.57 (#342) (@dependabot[bot])
  • Update NLsolve requirement from 4.5 to 4.5, 5.0 (#343) (@dependabot[bot])
  • Support OrdinaryDiffEqCore 4 and the SciMLBase 3 stack (#344) (@ufechner7)
  • Speed up residual! of KPS4: cl/cd splines in Julia, faster copy of the result (#345) (@ufechner7)
  • CI: precompile only once per job, do not cache compiled files on Windows (#346) (@ufechner7)
  • Build the system image for the native CPU on Julia 1.13 too (#348) (@ufechner7)

Closed issues:

  • Allow initialization of full state (#270)