diff --git a/ext/KiteModelsControlPlotsExt.jl b/ext/KiteModelsControlPlotsExt.jl index 0e82a0a5..8e39f40a 100644 --- a/ext/KiteModelsControlPlotsExt.jl +++ b/ext/KiteModelsControlPlotsExt.jl @@ -44,4 +44,4 @@ function ControlPlots.plot(s::SymbolicAWEModel, reltime; kwargs...) plot(s.system_structure, reltime; s.set.l_tether, wing_pos, e_z, kwargs...) end -end \ No newline at end of file +end diff --git a/src/KPS4.jl b/src/KPS4.jl index a874bac4..c5dee9c6 100644 --- a/src/KPS4.jl +++ b/src/KPS4.jl @@ -389,7 +389,7 @@ Output: height = 0.5 * (pos[p1][3] + pos[p2][3]) rho = calc_rho(s.am, height) # if height <= -1000.0 - # println("Error: height: $height") + # println("Error: height: $height") # end @assert height > -1000 if height < 6 @@ -496,13 +496,12 @@ function residual!(res, yd, y::MVector{S, SimFloat}, s::KPS4, time) where S if !isnothing(s.sync_speed) && s.sync_speed == 0.0 use_brake = true end - # if !isnothing(s.sync_speed) - # res[end] = v_reel_outd - calc_acceleration(s.wm, v_reel_out, norm(s.forces[1]), s.sync_speed) - # else + if s.wm isa AsyncMachine + res[end] = v_reel_outd - calc_acceleration(s.wm, s.sync_speed, v_reel_out, norm(s.forces[1]), true) + else res[end] = v_reel_outd - calc_acceleration(s.wm, v_reel_out, norm(s.forces[1]); set_speed=s.sync_speed, set_torque=s.set_torque, use_brake) - # end - + end # copy and flatten result for i in 2:div(T,6)+1 for j in 1:3 diff --git a/src/KiteModels.jl b/src/KiteModels.jl index f55922d3..d6ec848d 100644 --- a/src/KiteModels.jl +++ b/src/KiteModels.jl @@ -760,4 +760,4 @@ end include("precompile.jl") -end \ No newline at end of file +end diff --git a/test/bench4.jl b/test/bench4.jl index 5fe4761f..1035b1e9 100644 --- a/test/bench4.jl +++ b/test/bench4.jl @@ -130,15 +130,16 @@ msg = String[] t = @benchmark residual!($res, $yd0, $y0, $kps4, $time) push!(msg, ("Mean time residual!: $(round(mean(t.times), digits=1)) ns")) # println("t.memory: ", t.memory) - @test t.memory <= 176 + @test t.memory <= 0 # time using Python/ Numba: 8.94 µs, time using Julia 1.7.2: 1.6µs, Julia 1.8.0: 1.244µs # Julia 1.9 on Ryzen: 816.1 ns # Julia 1.10 on Ryzen: 787.0 ns 6000 RAM - # Julia 1.10 on Laptop on battery: 1047 ns - # Julia 1.11 on Laptop on power: 1024..1090 ns - # Julia 1.11 on Laptop on battery: 1050..1197 ns - # Julia 1.11 on Desktop on main branch: 835..899 ns on June 15, 2025 after 14:12 + # Julia 1.10 on Laptop on battery: 1047ns + # Julia 1.11 on Laptop on battery: 1035ns + # Julia 1.11 on Laptop on battery, branch perf2: 1042ns + # Julia 1.11 on Desktop, branch perf2: 835..899 ns on June 15, 2025 after 13:12 + end printstyled("Benchmark results for KPS4:\n"; bold = true) for i in eachindex(msg)