diff --git a/core/src/model.jl b/core/src/model.jl index 81c8f337f..6ca49230d 100644 --- a/core/src/model.jl +++ b/core/src/model.jl @@ -159,13 +159,13 @@ tsaves(model::Model)::Vector{Float64} = model.integrator.sol.t "Get all saved times as a Vector{DateTime}" function datetimes(model::Model)::Vector{DateTime} - return datetime_since.(tstops(model), model.config.starttime) + return datetime_since.(tsaves(model), model.config.starttime) end function Base.show(io::IO, model::Model) (; config, integrator) = model t = datetime_since(integrator.t, config.starttime) - nsaved = length(tstops(model)) + nsaved = length(tsaves(model)) println(io, "Model(ts: $nsaved, t: $t)") end diff --git a/core/test/equations_test.jl b/core/test/equations_test.jl index ff3f61aa6..9723a178e 100644 --- a/core/test/equations_test.jl +++ b/core/test/equations_test.jl @@ -25,7 +25,7 @@ @test successful_retcode(model) (; p) = model.integrator - t = Ribasim.tstops(model) + t = Ribasim.tsaves(model) storage = Ribasim.get_storages_and_levels(model).storage[1, :] A = p.basin.area[1][2] # needs to be constant u0 = A * 10.0 @@ -57,7 +57,7 @@ end @test successful_retcode(model) p = model.integrator.p - t = Ribasim.tstops(model) + t = Ribasim.tsaves(model) storage = Ribasim.get_storages_and_levels(model).storage[1, :] basin_area = p.basin.area[1][2] storage_min = 50.005 @@ -93,7 +93,7 @@ end p = model.integrator.p (; manning_resistance) = p - t = Ribasim.tstops(model) + t = Ribasim.tsaves(model) storage_both = Ribasim.get_storages_and_levels(model).storage storage = storage_both[1, :] storage_min = 50.005 @@ -131,7 +131,7 @@ end (; basin, pid_control) = p storage = Ribasim.get_storages_and_levels(model).storage[:] - t = Ribasim.tstops(model) + t = Ribasim.tsaves(model) SP = pid_control.target[1](0) K_p, K_i, K_d = pid_control.pid_params[1](0) @@ -168,7 +168,7 @@ end @testitem "MiscellaneousNodes" begin using PreallocationTools: get_tmp using SciMLBase: successful_retcode - using Ribasim: tstops, get_storages_and_levels + using Ribasim: tsaves, get_storages_and_levels toml_path = normpath(@__DIR__, "../../generated_testmodels/misc_nodes/ribasim.toml") @test ispath(toml_path) @@ -186,7 +186,7 @@ end frac = fractional_flow.fraction[1] storage_both = get_storages_and_levels(model).storage - t = tstops(model) + t = tsaves(model) tspan = model.integrator.sol.prob.tspan @test t ≈ range(tspan...; step = config.solver.saveat) @test storage_both[1, :] ≈ @. storage_both[1, 1] + t * (frac * q_boundary - q_pump)