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

Adding priorities to UserDemand / Time skips part of validation #1251

Closed
Huite opened this issue Mar 13, 2024 · 0 comments · Fixed by #1268
Closed

Adding priorities to UserDemand / Time skips part of validation #1251

Huite opened this issue Mar 13, 2024 · 0 comments · Fixed by #1268

Comments

@Huite
Copy link
Contributor

Huite commented Mar 13, 2024

This may essentially be a duplicate of #1250, but I'm reporting it anyway.

If I set a single priority (1) in the UserDemand table, but forget to include return flow edges, I get the (very useful) validation error:

❯ c:\bin\ribasim\bin\ribasim.exe ribasim.toml

┌ Info: Starting a Ribasim simulation.
│   cli.ribasim_version = "2024.4.0"
│   starttime = 2017-01-01T00:00:00
└   endtime = 2019-01-01T00:00:00
┌ Error: UserDemand #118 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #119 must have at least 1 flow inneighbor(s) (got 0).
┌ Error: UserDemand #121 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #122 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #123 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #124 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #125 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #126 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #127 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #128 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #129 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #130 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #131 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
┌ Error: UserDemand #132 must have at least 1 flow inneighbor(s) (got 0).
└ @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\validation.jl:443
ERROR: Invalid number of connections for certain node types.

Adding priorities [1, 2, 3] seems to result in skipping this validation step?

❯ c:\bin\ribasim\bin\ribasim.exe ribasim.toml

┌ Info: Starting a Ribasim simulation.
│   cli.ribasim_version = "2024.4.0"
│   starttime = 2017-01-01T00:00:00
└   endtime = 2019-01-01T00:00:00
ERROR: BoundsError: attempt to access 0-element Vector{Float64} at index [1]
Stacktrace:
  [1] getindex
    @ .\essentials.jl:13 [inlined]
  [2] get_scalar_interpolation(starttime::Dates.DateTime, t_end::Float64, time::StructArrays.StructVector{Ribasim.UserDemandTimeV1, @NamedTuple{node_id::Vector{Int64}, time::Vector{Dates.DateTime}, demand::Vector{Float64}, return_fa
ctor::Vector{Float64}, min_level::Vector{Float64}, priority::Vector{Int64}}, Int64}, node_id::Ribasim.NodeID, param::Symbol; default_value::Float64)
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\util.jl:215
  [3] Ribasim.UserDemand(db::SQLite.DB, config::Ribasim.config.Config)
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\read.jl:703
  [4] Ribasim.Parameters(db::SQLite.DB, config::Ribasim.config.Config)
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\read.jl:893
  [5] Ribasim.Model(config::Ribasim.config.Config)
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\model.jl:51
  [6] run(config::Ribasim.config.Config)
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\main.jl:11
  [7] (::Ribasim.var"#206#208"{Ribasim.config.Config})()
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\main.jl:66
  [8] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:515
  [9] with_logger
    @ Base.CoreLogging .\logging.jl:627 [inlined]
 [10] #205
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\main.jl:59 [inlined]
 [11] open(::Ribasim.var"#205#207"{Ribasim.config.Config}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
    @ Base .\io.jl:396
 [12] open
    @ Base .\io.jl:393 [inlined]
 [13] main(ARGS::Vector{String})
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\main.jl:56
 [14] main()
    @ Ribasim D:\buildAgent\work\ecd2b8f9b25b1609\ribasim\core\src\main.jl:24
 [15] top-level scope
    @ none:1
```
@github-project-automation github-project-automation bot moved this to To do in Ribasim Mar 13, 2024
@Huite Huite added allocation Allocation layer bug and removed allocation Allocation layer labels Mar 13, 2024
@Huite Huite changed the title Add priorities to UserDemand / Time skips part of validation Adding priorities to UserDemand / Time skips part of validation Mar 13, 2024
@elinenauta elinenauta moved this from To do to Sprint backlog in Ribasim Mar 14, 2024
@elinenauta elinenauta moved this from Sprint backlog to To do in Ribasim Mar 14, 2024
Huite pushed a commit that referenced this issue Mar 18, 2024
@github-project-automation github-project-automation bot moved this from To do to ✅ Done in Ribasim Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant