From 97214a1534103b5ddb8a3ecca1a3d3a00aba5e92 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:30:45 +0200 Subject: [PATCH 01/27] TeamCity change in 'Ribasim / Linux' project: VCS roots of 'Os' build template were updated --- .teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml index 5fb92150b..5e73b1d7a 100644 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml +++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml @@ -4,6 +4,7 @@ Template for agent that uses Linux OS + From 5d640dbe520ed8cba431079fa93f855c89ee8e6c Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:32:42 +0200 Subject: [PATCH 02/27] TeamCity change in 'Ribasim / Linux' project: 'Build ribasim_cli' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Linux_BuildRibasimCli.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml index dc2bffb65..ecdc60598 100644 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml +++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml @@ -2,10 +2,9 @@ Build ribasim_cli - + @@ -70,3 +69,4 @@ pixi run build-ribasim-cli]]> + From 186b5091c0c9b2f425b153b77cb192d4c9bba8c4 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:33:10 +0200 Subject: [PATCH 03/27] TeamCity change in 'Ribasim / Linux' project: 'Test ribasim_api' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Linux_TestRibasimApi.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml index 56c94aaa9..91bb162e9 100644 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml +++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml @@ -2,12 +2,10 @@ Test ribasim_api - + @@ -49,7 +47,6 @@ pixi run test-ribasim-api]]> - From d7341a009becbb4b9e6b026219fad3b3cff1afe7 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:33:18 +0200 Subject: [PATCH 04/27] TeamCity change in 'Ribasim / Linux' project: 'Test ribasim_cli' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Linux_TestRibasimCli.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml index 1892b5879..39e00aba1 100644 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml +++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml @@ -2,12 +2,10 @@ Test ribasim_cli - + @@ -49,7 +47,6 @@ pixi run test-ribasim-cli]]> - From 4ba0d9a99dba6330609a689bd133411f9bfe849e Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:33:29 +0200 Subject: [PATCH 05/27] TeamCity change in 'Ribasim / Linux' project: 'Build libribasim' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Linux_BuildLibribasim.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml index f9ad518e0..1bca99252 100644 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml +++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml @@ -2,12 +2,10 @@ Build libribasim - + @@ -46,9 +44,7 @@ pixi run build-libribasim]]> - - - + From 3057347b6305dd055f1f3a5c3681b0de4b88c956 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:33:44 +0200 Subject: [PATCH 06/27] TeamCity change in 'Ribasim / Linux' project: 'Build' build template was removed --- .../buildTypes/Ribasim_Linux_Build.xml | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 .teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Build.xml diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Build.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Build.xml deleted file mode 100644 index 935189868..000000000 --- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Build.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - From c70a1e6478e23e07c093a4bb8ba191c763c34a0c Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:37:50 +0200 Subject: [PATCH 07/27] TeamCity change in 'Ribasim / Windows' project: 'Build libribasim' build configuration settings were updated --- .../buildTypes/Ribasim_Windows_BuildLibribasim.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml index 2f95b2615..2b3c25366 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml @@ -5,7 +5,6 @@ - From cd55be2d4c9094959a48d7bee3c70038e162da64 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:37:55 +0200 Subject: [PATCH 08/27] TeamCity change in 'Ribasim / Windows' project: 'Build libribasim' build configuration settings were updated --- .../buildTypes/Ribasim_Windows_BuildLibribasim.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml index 2b3c25366..e781aa589 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml @@ -5,7 +5,6 @@ - From e8b86ac5b9ab62acf4ff6034817568fbeda1eac5 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:38:10 +0200 Subject: [PATCH 09/27] TeamCity change in 'Ribasim / Windows' project: 'Build libribasim' build configuration was detached from 'Build' template --- .../Ribasim_Windows_BuildLibribasim.xml | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml index e781aa589..c5be9f380 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml @@ -2,17 +2,57 @@ Build libribasim - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a7e6dbe71affc430527c996519980964a3ae2d84 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:44:24 +0200 Subject: [PATCH 10/27] TeamCity change in 'Ribasim / Windows' project: 'Build' build template was removed --- .../buildTypes/Ribasim_Windows_Build.xml | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 .teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Build.xml diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Build.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Build.xml deleted file mode 100644 index d2d6be2b8..000000000 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Build.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - From d3f1c441bc297e006d8bc74aeb385e3d62e95c62 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:45:35 +0200 Subject: [PATCH 11/27] TeamCity change in 'Ribasim / Windows' project: 'Os' build template was created --- .../buildTypes/Ribasim_Windows_Os.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml new file mode 100644 index 000000000..f575b6919 --- /dev/null +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml @@ -0,0 +1,14 @@ + + + From 4f52f45a734122214d70a6984051a06d4ebae00e Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:45:53 +0200 Subject: [PATCH 12/27] TeamCity change in 'Ribasim / Windows' project: VCS roots of 'Os' build template were updated --- .teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml index f575b6919..a2a6b8f92 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml @@ -3,6 +3,9 @@ Os Template for agent that uses Windows OS + + From a1b205f6aba59c0ffaa43a99c73d2de231d7d272 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:46:26 +0200 Subject: [PATCH 13/27] TeamCity change in 'Ribasim / Windows' project: requirements of 'Os' build template were updated --- .teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml index a2a6b8f92..87b1a65fa 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_Os.xml @@ -9,7 +9,9 @@ - + + + From 4054219f79b2be62c8031db2a9e0632d1045aae8 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:53:27 +0200 Subject: [PATCH 14/27] TeamCity change in 'Ribasim / Windows' project: 'Build libribasim' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Windows_BuildLibribasim.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml index c5be9f380..d2249ca64 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml @@ -2,10 +2,9 @@ Build libribasim - + @@ -39,7 +38,6 @@ pixi run build-libribasim]]> - From 18d06ace41b0d35fe88c34aec70208676889f800 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:53:55 +0200 Subject: [PATCH 15/27] TeamCity change in 'Ribasim / Windows' project: 'Build ribasim_cli' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Windows_BuildRibasimCli.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml index f9c3f4f6a..0979e904c 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml @@ -2,10 +2,9 @@ Build ribasim_cli - + @@ -58,3 +57,4 @@ pixi run build-ribasim-cli]]> + From 941e68bdac37f5be2b5c44a8b0bba716c8fe5024 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:54:06 +0200 Subject: [PATCH 16/27] TeamCity change in 'Ribasim / Windows' project: 'Test ribasim_api' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Windows_TestRibasimApi.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml index bb6b05130..173949191 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml @@ -2,10 +2,9 @@ Test ribasim_api - + From 5e46eae86fa161a70c9342cb6fbadd8e720fc7d5 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 13:54:17 +0200 Subject: [PATCH 17/27] TeamCity change in 'Ribasim / Windows' project: 'Test ribasim_cli' build configuration was attached to 'Os' template --- .../buildTypes/Ribasim_Windows_TestRibasimCli.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml index 7edcc1961..b6de156b6 100644 --- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml +++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml @@ -2,10 +2,9 @@ Test ribasim_cli - + @@ -97,3 +96,4 @@ + From 184827a964fc5bed356f86e0fc2d367caf1c7d0b Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Tue, 16 Apr 2024 14:06:30 +0200 Subject: [PATCH 18/27] Run allocation first after BMI stop (#1390) This allows allocation over period `(t, t + dt)` to use variables set over BMI at time `t`. We no longer run allocation as a callback, but call it ourselves, such that we can control that BMI runs allocation first before running the physical layer. --- core/src/Ribasim.jl | 1 + core/src/bmi.jl | 7 +++--- core/src/callback.jl | 10 -------- core/src/main.jl | 7 +++--- core/src/model.jl | 56 ++++++++++++++++++++++++++++++++++++------ core/src/util.jl | 2 +- core/src/validation.jl | 11 +++++++++ 7 files changed, 67 insertions(+), 27 deletions(-) diff --git a/core/src/Ribasim.jl b/core/src/Ribasim.jl index 6d6128bb8..f8d027f63 100644 --- a/core/src/Ribasim.jl +++ b/core/src/Ribasim.jl @@ -56,6 +56,7 @@ using SciMLBase: solve!, step!, SciMLBase, + ReturnCode, successful_retcode, CallbackSet, ODEFunction, diff --git a/core/src/bmi.jl b/core/src/bmi.jl index 6595e6390..d598722f8 100644 --- a/core/src/bmi.jl +++ b/core/src/bmi.jl @@ -17,16 +17,15 @@ function BMI.update(model::Model)::Model return model end -function BMI.update_until(model::Model, time)::Model - integrator = model.integrator - t = integrator.t +function BMI.update_until(model::Model, time::Float64)::Model + (; t) = model.integrator dt = time - t if dt < 0 error("The model has already passed the given timestamp.") elseif dt == 0 return model else - step!(integrator, dt, true) + step!(model, dt) end return model end diff --git a/core/src/callback.jl b/core/src/callback.jl index bd94043a5..242c1eafa 100644 --- a/core/src/callback.jl +++ b/core/src/callback.jl @@ -51,16 +51,6 @@ function create_callbacks( ) push!(callbacks, tabulated_rating_curve_cb) - if config.allocation.use_allocation - allocation_cb = PeriodicCallback( - update_allocation!, - config.allocation.timestep; - initial_affect = false, - save_positions = (false, false), - ) - push!(callbacks, allocation_cb) - end - # If saveat is a vector which contains 0.0 this callback will still be called # at t = 0.0 despite save_start = false saveat = saveat isa Vector ? filter(x -> x != 0.0, saveat) : saveat diff --git a/core/src/main.jl b/core/src/main.jl index 78d4823ad..1e75e721f 100644 --- a/core/src/main.jl +++ b/core/src/main.jl @@ -54,8 +54,7 @@ function main(ARGS::Vector{String})::Cint config = Config(arg) mkpath(results_path(config, ".")) open(results_path(config, "ribasim.log"), "w") do io - logger = - Ribasim.setup_logger(; verbosity = config.logging.verbosity, stream = io) + logger = setup_logger(; verbosity = config.logging.verbosity, stream = io) with_logger(logger) do cli = (; ribasim_version = string(pkgversion(Ribasim))) (; starttime, endtime) = config @@ -63,13 +62,13 @@ function main(ARGS::Vector{String})::Cint @warn "The Ribasim version in the TOML config file does not match the used Ribasim CLI version." config.ribasim_version cli.ribasim_version end @info "Starting a Ribasim simulation." cli.ribasim_version starttime endtime - model = Ribasim.run(config) + model = run(config) if successful_retcode(model) @info "The model finished successfully" return 0 end - t = Ribasim.datetime_since(model.integrator.t, starttime) + t = datetime_since(model.integrator.t, starttime) retcode = model.integrator.sol.retcode @error "The model exited at model time $t with return code $retcode.\nSee https://docs.sciml.ai/DiffEqDocs/stable/basics/solution/#retcodes" return 1 diff --git a/core/src/model.jl b/core/src/model.jl index 241ba2ec6..7ac16aea1 100644 --- a/core/src/model.jl +++ b/core/src/model.jl @@ -29,6 +29,9 @@ end function Model(config_path::AbstractString)::Model config = Config(config_path) + if !valid_config(config) + error("Invalid configuration in TOML.") + end return Model(config) end @@ -44,11 +47,6 @@ 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) @@ -114,6 +112,7 @@ function Model(config::Config)::Model integral = zeros(length(parameters.pid_control.node_id)) u0 = ComponentVector{Float64}(; storage, integral) # for Float32 this method allows max ~1000 year simulations without accuracy issues + t_end = seconds_since(config.endtime, config.starttime) @assert eps(t_end) < 3600 "Simulation time too long" t0 = zero(t_end) timespan = (t0, t_end) @@ -188,10 +187,51 @@ function SciMLBase.successful_retcode(model::Model)::Bool end """ - solve!(model::Model)::ODESolution + step!(model::Model, dt::Float64)::Model + +Take Model timesteps until `t + dt` is reached exactly. +""" +function SciMLBase.step!(model::Model, dt::Float64)::Model + (; config, integrator) = model + (; t) = integrator + # If we are at an allocation time, run allocation before the next physical + # layer timestep. This allows allocation over period (t, t + dt) to use variables + # set over BMI at time t before calling this function. + # Also, don't run allocation at t = 0 since there are no flows yet (#1389). + ntimes = t / config.allocation.timestep + if t > 0 && round(ntimes) ≈ ntimes + update_allocation!(integrator) + end + step!(integrator, dt, true) + return model +end + +""" + solve!(model::Model)::Model Solve a Model until the configured `endtime`. """ -function SciMLBase.solve!(model::Model)::ODESolution - return solve!(model.integrator) +function SciMLBase.solve!(model::Model)::Model + (; config, integrator) = model + if config.allocation.use_allocation + (; tspan) = integrator.sol.prob + (; timestep) = config.allocation + allocation_times = timestep:timestep:(tspan[end] - timestep) + n_allocation_times = length(allocation_times) + # Don't run allocation at t = 0 since there are no flows yet (#1389). + step!(integrator, timestep, true) + for _ in 1:n_allocation_times + update_allocation!(integrator) + step!(integrator, timestep, true) + end + + if integrator.sol.retcode != ReturnCode.Default + return model + end + # TODO replace with `check_error!` https://github.com/SciML/SciMLBase.jl/issues/669 + integrator.sol = SciMLBase.solution_new_retcode(integrator.sol, ReturnCode.Success) + else + solve!(integrator) + end + return model end diff --git a/core/src/util.jl b/core/src/util.jl index 9f28670cf..46a3643b9 100644 --- a/core/src/util.jl +++ b/core/src/util.jl @@ -683,7 +683,7 @@ function get_Δt(integrator)::Float64 elseif isinf(saveat) t else - t_end = integrator.sol.prob.tspan[2] + t_end = integrator.sol.prob.tspan[end] if t_end - t > saveat saveat else diff --git a/core/src/validation.jl b/core/src/validation.jl index 202eec6a8..72fcb55ff 100644 --- a/core/src/validation.jl +++ b/core/src/validation.jl @@ -146,6 +146,17 @@ function sorted_table!( return table end +function valid_config(config::Config)::Bool + errors = false + + if config.starttime >= config.endtime + errors = true + @error "The model starttime must be before the endtime." + end + + return !errors +end + """ Test for each node given its node type whether the nodes that # are downstream ('down-edge') of this node are of an allowed type From 2a1adc3a66fe64d39450b70b748d42b1e9a7f596 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 14:06:39 +0200 Subject: [PATCH 19/27] TeamCity change in 'Ribasim / Linux' project: 'Os' build template was moved to 'Ribasim' project --- .../{Ribasim_Linux => Ribasim}/buildTypes/Ribasim_Linux_Os.xml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .teamcity/{Ribasim_Linux => Ribasim}/buildTypes/Ribasim_Linux_Os.xml (100%) diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml b/.teamcity/Ribasim/buildTypes/Ribasim_Linux_Os.xml similarity index 100% rename from .teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_Os.xml rename to .teamcity/Ribasim/buildTypes/Ribasim_Linux_Os.xml From d6c1a40cde5407cf47f02366a76e2abfd37108f6 Mon Sep 17 00:00:00 2001 From: feng Date: Tue, 16 Apr 2024 14:07:20 +0200 Subject: [PATCH 20/27] TeamCity change in 'Ribasim' project: general settings of 'Linux' build template were updated --- .../buildTypes/{Ribasim_Linux_Os.xml => Ribasim_Linux.xml} | 2 +- .../Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml | 2 +- .../Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml | 2 +- .../Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml | 2 +- .../Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename .teamcity/Ribasim/buildTypes/{Ribasim_Linux_Os.xml => Ribasim_Linux.xml} (97%) diff --git a/.teamcity/Ribasim/buildTypes/Ribasim_Linux_Os.xml b/.teamcity/Ribasim/buildTypes/Ribasim_Linux.xml similarity index 97% rename from .teamcity/Ribasim/buildTypes/Ribasim_Linux_Os.xml rename to .teamcity/Ribasim/buildTypes/Ribasim_Linux.xml index 5e73b1d7a..901a95ae3 100644 --- a/.teamcity/Ribasim/buildTypes/Ribasim_Linux_Os.xml +++ b/.teamcity/Ribasim/buildTypes/Ribasim_Linux.xml @@ -1,6 +1,6 @@