Repository navigation
v0.13.0
KiteModels v0.13.0
Added
save_state(filename, ss)writes aSysStateto a human-readable YAML file under the keysys_state, without the fields that KPS3 and KPS4 do not use (keywordexclude;KiteModels.UNUSED_FIELDS_KPS3also leaves outside_slip,alpha3andalpha4, which KPS3 does not have, andaero_moment_KA_x/y/z, which is always zero for KPS3), and the dictionary passed as keywordmeta_dataunder the keymeta_data.examples/test_init_4p.jlandexamples/test_init_1p.jluse it to writeoutput/sys_state_<script name>.yamlafter 80 time steps, andexamples_3d/parking_wind_dir.jlafter 16 s simulation time, with the script name, the simulation time and the date and time of saving as meta data, and they fill int_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)andupdate_sys_state!(KPS3 and KPS4) store the internal state of the winch, the rate limited set speedwm.last_set_speedand the state of the brakewm.brake(0 or 1), in the free fieldsvar_13andvar_14, which areNaNwithout 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 writesvar_13orvar_14itself should use other fields.load_state(filename)reads a system state thatsave_statewrote and returns a newSysStateand 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 aSysState, for example one thatload_stateread: 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.jlcontinues from its saved state ifLOAD_SYS_STATEis true; if the file does not exist yet, it starts at zero and saves the state.SysState(s)andupdate_sys_state!(KPS3 and KPS4) fill the fieldspring_forcewith the forces of all springs fromspring_forces, including the damping force: the tether segments and, for KPS4, the springs of the kite. The new functionn_springs(s)returns their number.SysState(s)andupdate_sys_state!(KPS3 and KPS4) fill the fieldsaero_force_KA_x/y/zandaero_moment_KA_x/y/z, which were always zero: the total aerodynamic force and moment of the kite in theKAbody frame (aft-right-up). The moment is taken about the origin of theKAframe, 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)andupdate_sys_state!(KPS3 and KPS4) also fill the per-particle fieldsaero_force_x/y/z(the aerodynamic forces on the kite particles A, B, C and D) anddrag_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 inupdate_sys_state!with the new functionscalc_aero_forcesandcalc_drag_forces(KPS4) andcalc_drag_force(KPS3), whichcalc_aero_forces!,calc_particle_forces!andcalc_dragnow 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)andupdate_sys_state!(KPS3 and KPS4) fill the particle velocitiesVX,VYandVZ, which were always zero. For KPS3, they are taken from the state vector of the integrator.SysState(s)andupdate_sys_state!(KPS3 and KPS4) fill the fieldacc, 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 fieldacc_kiteofKPS3andKPS4once per time step; afterinit!it is zero.SysState(s)andupdate_sys_state!(KPS3 and KPS4) fill the fieldsturn_rate_x/y/z, which were always zero, with the angular velocity of the kite in theKAbody frame. The new functioncalc_turn_ratescalculates 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 ofupdate_sys_state!in an earlier time step. The previous orientation and its time are kept in the model, so a newSysStatein each time step gives the same turn rates as a reused one; they are zero on the first call.SysState(s)andupdate_sys_state!(KPS4) fill the fieldside_slip, which was always zero, with the side slip angle thatcalc_aero_forces!calculates from the apparent wind at the kite particle B. For KPS3, which has no kite frame, it isNaN.
Changed
- The lift and drag coefficients
calc_clandcalc_cdof KPS3 and KPS4 are now of the new typeKiteModels.CubicSpline, which evaluates the cubic spline fromDierckx.Spline1Din Julia instead of in Fortran: about 6 ns instead of 41 ns per call, with the same results (differences below 1e-15). This makesresidual!of KPS4, which needs six of these calls, about 16 % faster (976 ns instead of 1163 ns). ASpline1Dthat is assigned tocalc_clorcalc_cdis 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 keyworddamping, defaulttrue). 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 ofrel_compr_stiffness. The residual andspring_forcesnow use the same function,calc_spring_force.calc_pre_tensionleaves out the damping force.- Breaking:
SysState(s)(KPS3 and KPS4) creates aSysStatewithn_springs(s)segments instead of none, so thatspring_forcecan hold the spring forces.log!fails with aDimensionMismatchif theLoggerhas a different number of segments, so aLoggermust now be created withLogger(P, steps; segments=n_springs(s)); all examples do this.SysState(s; with_springs=false)creates the previousSysStatewithout spring forces, which fitsLogger(P, steps). SysState(s)andupdate_sys_state!(KPS3 and KPS4): the fieldturn_ratesis now the angular velocity of the kite in theKAbody frame fromcalc_turn_rates, the same asturn_rate_x/y/z. Before, only its z component was set, estimated asheading_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 inexamples_3d/parking_4p.jl, change accordingly. For KPS3,turn_ratesis the finite difference of the orientation, the same asturn_rate_x/y/z.bin/installruns the test suite only if the new option--testis passed. Before, it always ran the tests, including the benchmarks, which can take up to an hour.bin/update_default_manifestspasses--test, so a new default manifest is only written if all tests pass.bin/installhas 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_manifestis renamed tobin/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
examplesandtestprojects allow DSP 0.8 (#318).create_filterinexamples/filters.jl, used bycalc_spectrum.jlandplot_pitch_stability.jl, normalizes the cut-off frequency itself instead of passingfstoLowpass, 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)andupdate_sys_state!(KPS3): the fieldsalpha3,alpha4,set_force,bearingandattractor, which KPS3 does not have, are nowNaN, 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!callsDiffEqBase.initinstead ofOrdinaryDiffEqCore.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.defaulthides the inferred-type inlay hints of JETLS ([inlay_hint.types] enabled = false) and setsauto_instantiate = "never"instead of the legacy valuefalse, 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 changeddocs/**,src/**or a*.tomlfile in the root folder, so a fix elsewhere did not rebuild the documentation. - New regression tests
test/test-cubic-spline.jlcompareCubicSplinewithDierckx.Spline1Dat the knots, between them, at both ends and outside of both ends, and cover a spline with four samples, the conversion on assignment tocalc_clandcalc_cd(KPS3 and KPS4) and the rejection of splines of another degree or boundary condition. The tests ofinit!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_examplesandinstall_examples_3dcopied theProject.tomlof theexamplesandexamples_3dfolders 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 aProject.toml.calc_aero_forces!(KPS4) allocated 32 bytes per call with Julia 1.12, because an intermediateMVectorwas not elided, so the allocation tests oftest/bench4.jlforcalc_aero_forces!andresidual!failed.calc_aero_forcesnow 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 forazimuth_rateandheading_ratefrom theSysState. A newSysStatestarts with these values at zero, so creating one in each time step, likeSysState(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)andupdate_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 aSysStatecould 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, parameterc2_cor) needs, was never set, so the correction was always zero.next_step!now sets it tocalc_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: withsystem.yaml, gravity turns the kite towards the ground about 8 % slower than before. - KPS3:
s.v_apparentwas overwritten bycalc_dragwith the apparent wind of each tether segment, so afterresidual!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 andv_appofSysStatewere wrong. The simulation itself was not affected. - KPS3: for the top tether segment,
calc_respassed 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. Withsystem.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_kitewas the velocity of the tether particlesegments - 1instead of the velocity of the kite, becauseresidual!overwrote the correct value at its end. The simulation itself was not affected, becauseresidual!uses the correct value before overwriting it, but the outputs were:calc_courseand the fieldscourseandvel_kiteofSysState. find_steady_state!(s; trim=true)(KPS3 and KPS4) could accept a trim with the kite below the horizon. For example, KPS3 withsystem.yaml, a wind speed of 6 m/s, a tether length of 1000 m andset.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 anazimuth_rateand aheading_rateofInforNaN(and therefore alsoturn_rates) in the first call afterinit!, because the time step was zero; these rates are now zero in this case.examples_3d/parking_4p.jlinitialized 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)