diff --git a/Manifest.toml b/Manifest.toml index e5e063cf4..edd812975 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.0" manifest_format = "2.0" -project_hash = "22708fb864a341d70b001d75765852e92f1f5399" +project_hash = "122f7ec8a573942606ded1bed87e60f2356f603a" [[deps.ADTypes]] git-tree-sha1 = "016833eb52ba2d6bea9fcb50ca295980e728ee24" @@ -401,9 +401,9 @@ version = "6.149.0" [[deps.DiffEqCallbacks]] deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "a731383bbafb87d496fb5e66f60c40e4a5f8f726" +git-tree-sha1 = "173d6a313878635b6c764163f639ac2d5f201fdc" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "3.4.0" +version = "3.6.0" [deps.DiffEqCallbacks.weakdeps] OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" diff --git a/core/Project.toml b/core/Project.toml index 99f416650..0a383e394 100644 --- a/core/Project.toml +++ b/core/Project.toml @@ -56,7 +56,7 @@ DataInterpolations = "4.4" DataStructures = "0.18" Dates = "<0.0.1,1" Dictionaries = "0.3.25, 0.4" -DiffEqCallbacks = "=3.4.0" +DiffEqCallbacks = "3.6" Documenter = "0.27,1" EnumX = "1.0" FiniteDiff = "2.21" diff --git a/core/src/model.jl b/core/src/model.jl index 4aacb0417..241ba2ec6 100644 --- a/core/src/model.jl +++ b/core/src/model.jl @@ -44,6 +44,11 @@ function Model(config::Config)::Model TimerOutputs.enable_debug_timings(Ribasim) # causes recompilation (!) end + t_end = seconds_since(config.endtime, config.starttime) + if t_end <= 0 + error("Model starttime is not before endtime.") + end + # All data from the database that we need during runtime is copied into memory, # so we can directly close it again. db = SQLite.DB(db_path) @@ -108,7 +113,6 @@ function Model(config::Config)::Model # Integrals for PID control integral = zeros(length(parameters.pid_control.node_id)) u0 = ComponentVector{Float64}(; storage, integral) - t_end = seconds_since(config.endtime, config.starttime) # for Float32 this method allows max ~1000 year simulations without accuracy issues @assert eps(t_end) < 3600 "Simulation time too long" t0 = zero(t_end) diff --git a/core/test/allocation_test.jl b/core/test/allocation_test.jl index 262c4e736..f397920b8 100644 --- a/core/test/allocation_test.jl +++ b/core/test/allocation_test.jl @@ -309,8 +309,10 @@ end # lower the subnetwork demands @test subnetwork_demands[(NodeID(:Basin, 2), NodeID(:Pump, 11))] ≈ [3.1, 4.0, 0.0] atol = 1e-4 - @test subnetwork_demands[(NodeID(:Basin, 6), NodeID(:Pump, 24))] ≈ [0.004, 0.0, 0.0] - @test subnetwork_demands[(NodeID(:Basin, 10), NodeID(:Pump, 38))][1:2] ≈ [0.001, 0.001] + @test subnetwork_demands[(NodeID(:Basin, 6), NodeID(:Pump, 24))] ≈ [0.004, 0.0, 0.0] atol = + 1e-4 + @test subnetwork_demands[(NodeID(:Basin, 10), NodeID(:Pump, 38))][1:2] ≈ [0.001, 0.001] atol = + 1e-4 end @testitem "Allocation level control" begin