Skip to content

Commit

Permalink
Bump KiteModels to 0.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Aug 23, 2024
1 parent a669263 commit 061c0c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
KiteModels = "0.6.1"
KiteModels = "0.6.5"
KitePodModels = "0.3.3"
julia = "~1.10"
17 changes: 11 additions & 6 deletions src/model_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ kcu::Union{KCU, Nothing} = nothing
kps4::Union{KPS4, Nothing} = nothing

ex = nothing
integrator = nothing

mutable struct StepParams
set_speed::Union{Float64, Nothing}
Expand Down Expand Up @@ -57,8 +58,12 @@ function init()
global kcu, kps4, integrator
kcu = KCU(set)
kps4 = KPS4(kcu)
integrator = KiteModels.init_sim!(kps4, stiffness_factor=0.5, prn=false)
nothing
integrator = KiteModels.init_sim!(kps4; delta=0.03, stiffness_factor=0.05, prn=false)
if isnothing(integrator)
return "Error: finding the initial state failed"
else
return "OK"
end
end

function start_server(log=true)
Expand All @@ -77,13 +82,13 @@ function start_server(log=true)
end

@get "/init" function(req::HTTP.Request)
init()
return json("OK")
msg = init()
return json(msg)
end

@post "/step" function(req::HTTP.Request)
local res
if isnothing(kcu) || isnothing(kps4)
if isnothing(kcu) || isnothing(kps4) || isnothing(integrator)
return "\"Error: system not initialized\""
end
p = json(req, StepParams)
Expand Down Expand Up @@ -165,4 +170,4 @@ end

start_server(false) # use start_server(false) to disable logging
# state = test()
nothing
nothing

0 comments on commit 061c0c1

Please sign in to comment.