Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ data/prob_dynamic_3_seg.bin.default
data/ram_air_kite_foil_cd_polar.csv
data/ram_air_kite_foil_cl_polar.csv
data/ram_air_kite_foil_cm_polar.csv
data/prob_dynamic_3_seg.jld2
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ DiscretePIDs = "c1363496-6848-4723-8758-079b737f6baf"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
KitePodModels = "9de5dc81-f971-414a-927b-652b2f41c539"
KiteUtils = "90980105-b163-44e5-ba9f-8b1c83bb0533"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down Expand Up @@ -60,6 +61,7 @@ DiscretePIDs = "0.1.5"
DocStringExtensions = "0.9.4"
Documenter = "1.10.1"
Interpolations = "0.15.1"
JLD2 = "0.5.12"
KitePodModels = "0.3.8"
KiteUtils = "0.10.2"
LaTeXStrings = "1.4.0"
Expand Down
16 changes: 10 additions & 6 deletions src/ram_air_kite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,14 @@ function init_sim!(s::RamAirKite, measure::Measurement; prn=true, precompile=fal
dt = SimFloat(1/s.set.sample_freq)
if prn
@info "Creating ODEProblem"
@time s.prob = ODEProblem(s.sys, defaults, (0.0, dt); guesses)
@time begin expr = ODEProblemExpr(s.sys, defaults, (0.0, dt); guesses); s.prob = eval(expr) end
else
s.prob = ODEProblem(s.sys, defaults, (0.0, dt); guesses)
expr = ODEProblemExpr(s.sys, defaults, (0.0, dt); guesses); s.prob = eval(expr)
end
serialize(prob_path, s.prob)
# serialize(prob_path, s.prob)
# ODEProblemExpr
save_prob(prob_path, expr)

s.integrator = nothing
end
prob_path = joinpath(KiteUtils.get_data_path(), get_prob_name(s.set; precompile))
Expand Down Expand Up @@ -458,7 +461,8 @@ function reinit!(s::RamAirKite, measure::Measurement; prn=true, reload=true, pre
prob_path = joinpath(KiteUtils.get_data_path(), get_prob_name(s.set; precompile))
!ispath(prob_path) && throw(ArgumentError("$prob_path not found. Run init_sim!(s::RamAirKite) first."))
try
s.prob = deserialize(prob_path)
# s.prob = deserialize(prob_path)
s.prob = load_prob(prob_path)
catch e
@warn "Failure to deserialize $prob_path !"
throw(e)
Expand Down Expand Up @@ -559,9 +563,9 @@ function get_prob_name(set::Settings; precompile=false)
suffix = ".default"
end
if set.quasi_static
return "prob_static_" * string(set.segments) * "_seg.bin" * suffix
return "prob_static_" * string(set.segments) * "_seg.jld2" * suffix
else
return "prob_dynamic_" * string(set.segments) * "_seg.bin" * suffix
return "prob_dynamic_" * string(set.segments) * "_seg.jld2" * suffix
end
end

Expand Down
Loading