Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tstops for more timeseries #1418

Merged
merged 3 commits into from
Apr 23, 2024
Merged
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
17 changes: 12 additions & 5 deletions core/src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@ function Model(config::Config)::Model
end

# tell the solver to stop when new data comes in
# TODO add all time tables here
time_flow_boundary = load_structvector(db, config, FlowBoundaryTimeV1)
tstops = Vector{Float64}[]
push!(tstops, get_tstops(time_flow_boundary.time, config.starttime))
time_user_demand = load_structvector(db, config, UserDemandTimeV1)
push!(tstops, get_tstops(time_user_demand.time, config.starttime))
for schema_version in [
FlowBoundaryTimeV1,
LevelBoundaryTimeV1,
UserDemandTimeV1,
LevelDemandTimeV1,
FlowDemandTimeV1,
TabulatedRatingCurveTimeV1,
PidControlTimeV1,
]
time_schema = load_structvector(db, config, schema_version)
push!(tstops, get_tstops(time_schema.time, config.starttime))
end

# use state
state = load_structvector(db, config, BasinStateV1)
Expand Down
3 changes: 1 addition & 2 deletions python/ribasim_testmodels/ribasim_testmodels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,14 @@ def outlet_model():
starttime="2020-01-01",
endtime="2021-01-01",
crs="EPSG:28992",
solver=ribasim.Solver(saveat=0),
)

# Set up the basins
model.basin.add(
Node(3, Point(2.0, 0.0)),
[
basin.Profile(area=[1000.0, 1000.0], level=[0.0, 1.0]),
basin.State(level=[1e-3]),
basin.State(level=[0.0]),
],
)

Expand Down
Loading