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

Metaissue: Global demand and allocation callback (nested allocation) #14

Closed
visr opened this issue Oct 28, 2022 · 3 comments · Fixed by #663
Closed

Metaissue: Global demand and allocation callback (nested allocation) #14

visr opened this issue Oct 28, 2022 · 3 comments · Fixed by #663
Labels
allocation Allocation layer

Comments

@visr
Copy link
Member

visr commented Oct 28, 2022

Aggregate the demands of the districts and allocate the available water according to defined priorities.

Define bifurcation mechanisms that don't need explicit tables for each possible split.

Define use cases (including bidirectional flow channels).

@visr visr added the control Rule based control of physical layer label Oct 28, 2022
@gijsber gijsber added this to Ribasim Nov 14, 2022
@visr visr moved this to 🔲 Todo in Ribasim Nov 15, 2022
@gijsber gijsber changed the title global demand and allocation callback global demand and allocation callback (nested allocation) Nov 21, 2022
@gijsber gijsber added this to the Sprint 23.4 increment milestone Mar 1, 2023
@SnippenE SnippenE moved this from 🔲 Todo to 🏗 In progress in Ribasim May 1, 2023
@visr visr moved this from 🏗 In progress to 🔲 Todo in Ribasim May 1, 2023
@gijsber
Copy link
Contributor

gijsber commented May 12, 2023

try to make a decision layer (on top of the physical-oriented control layer) for the prioritization of abstractions. This layer would assess what abstactions could fit given the physical situation and reduce those abstractions that have lowest priority. then those reduced abstractions are given to the physical/control layer.

image

This global allocation layer would still work with a nested allocation mechanisms where regional networks calculate the aggregate demand (at inflow points) from the national netwerk, the national network allocates (ie makes decisions on how much the requested abstractions of each priority will be cut). These cuts are transfered back to the local user requests that become input for the physical based simulation step.

@Hofer-Julian Hofer-Julian changed the title global demand and allocation callback (nested allocation) Global demand and allocation callback (nested allocation) May 15, 2023
@visr visr mentioned this issue May 16, 2023
8 tasks
@SnippenE SnippenE moved this from To do to Sprint backlog in Ribasim May 16, 2023
@SnippenE SnippenE moved this from Sprint backlog to To do in Ribasim May 16, 2023
@gijsber
Copy link
Contributor

gijsber commented May 17, 2023

Per timestep this would result in the following processes:

Image

@gijsber
Copy link
Contributor

gijsber commented May 17, 2023

level control vs abstractions: how to manage priorities:

Image

Sldies can also be found on sharepoint: \DEL155 Oppervlaktewatermodule NHI - Documents\0. Deltares only\4_presentaties\achitecture_layer.pptx

@SnippenE SnippenE added the needs-refinement Issues that are too large and need refinement label May 17, 2023
@SnippenE SnippenE added allocation Allocation layer and removed control Rule based control of physical layer labels Jun 5, 2023
@SnippenE SnippenE added needs-refinement Issues that are too large and need refinement epic and removed needs-refinement Issues that are too large and need refinement labels Jun 20, 2023
@visr visr moved this from To do to 🏗 In progress in Ribasim Sep 28, 2023
@SnippenE SnippenE changed the title Global demand and allocation callback (nested allocation) Metaissue: Global demand and allocation callback (nested allocation) Sep 28, 2023
@visr visr closed this as completed in #663 Oct 19, 2023
visr added a commit that referenced this issue Oct 19, 2023
Fixes #632, fixes
#14, fixes
#349, using `JuMP.jl` and
`HiGHS`.

---------

Co-authored-by: Martijn Visser <[email protected]>
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Ribasim Oct 19, 2023
visr added a commit that referenced this issue Oct 25, 2023
Fixes #632, fixes
#14, fixes
#349, using `JuMP.jl` and
`HiGHS`.

---------

Co-authored-by: Martijn Visser <[email protected]>
visr added a commit that referenced this issue Jul 23, 2024
Fixes #1350

This is an example `ribasim.log`:

```
┌ Info: Starting a Ribasim simulation.
│   cli.ribasim_version = 2024.9.0
│   starttime = 2020-01-01T00:00:00
│   endtime = 2020-12-01T00:00:00
└ @ Ribasim D:\repo\ribasim\Ribasim\core\src\main.jl:42
┌ Error: Invalid edge type 'foo' for edge #0 from node #1 to node #2.
└ @ Ribasim D:\repo\ribasim\Ribasim\core\src\validation.jl:520
┌ Error: Invalid edge type 'bar' for edge #1 from node #2 to node #3.
└ @ Ribasim D:\repo\ribasim\Ribasim\core\src\validation.jl:520
ERROR: Invalid edge types found.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] Ribasim.Model(config::Ribasim.config.Config)
    @ Ribasim D:\repo\ribasim\Ribasim\core\src\model.jl:59
  [3] run(config::Ribasim.config.Config)
    @ Ribasim D:\repo\ribasim\Ribasim\core\src\main.jl:11
  [4] (::Ribasim.var"#215#217"{IOStream, Ribasim.config.Config})()
    @ Ribasim D:\repo\ribasim\Ribasim\core\src\main.jl:45
  [5] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:515
  [6] with_logger
    @ .\logging.jl:627 [inlined]
  [7] #214
    @ D:\repo\ribasim\Ribasim\core\src\main.jl:36 [inlined]
  [8] open(::Ribasim.var"#214#216"{Ribasim.config.Config}, ::String, ::Vararg{String}; kwargs::@kwargs{})
    @ Base .\io.jl:396
  [9] open
    @ .\io.jl:393 [inlined]
 [10] main(toml_path::String)
    @ Ribasim D:\repo\ribasim\Ribasim\core\src\main.jl:34
 [11] (::Main.var"##227".var"#1#2")()
    @ Main.var"##227" d:\repo\ribasim\Ribasim\core\test\main_test.jl:42
 [12] (::IOCapture.var"#5#9"{DataType, Main.var"##227".var"#1#2", IOContext{Base.PipeEndpoint}, IOContext{Base.PipeEndpoint}, Base.PipeEndpoint, Base.PipeEndpoint})()
    @ IOCapture C:\Users\visser_mn\.julia\packages\IOCapture\Y5rEA\src\IOCapture.jl:170
 [13] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:515
 [14] with_logger
    @ .\logging.jl:627 [inlined]
 [15] capture(f::Main.var"##227".var"#1#2"; rethrow::Type, color::Bool, passthrough::Bool, capture_buffer::IOBuffer, io_context::Vector{Any})
    @ IOCapture C:\Users\visser_mn\.julia\packages\IOCapture\Y5rEA\src\IOCapture.jl:167
 [16] capture(f::Function)
    @ IOCapture C:\Users\visser_mn\.julia\packages\IOCapture\Y5rEA\src\IOCapture.jl:100
 [17] top-level scope
    @ d:\repo\ribasim\Ribasim\core\test\main_test.jl:41
 [18] eval
    @ .\boot.jl:385 [inlined]
 [19] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:2076
 [20] include_string(m::Module, txt::String, fname::String)
    @ Base .\loading.jl:2086
 [21] #invokelatest#2
    @ .\essentials.jl:892 [inlined]
 [22] invokelatest
    @ .\essentials.jl:889 [inlined]
 [23] #8
    @ c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:115 [inlined]
 [24] withpath(f::VSCodeTestServer.var"#8#10"{UInt64, String, String, Module}, path::String)
    @ VSCodeTestServer c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:20
 [25] run_testitem_handler(conn::VSCodeTestServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::VSCodeTestServer.TestserverRunTestitemRequestParams)
    @ VSCodeTestServer c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:114
 [26] dispatch_msg(x::VSCodeTestServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeTestServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
    @ VSCodeTestServer.JSONRPC c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\JSONRPC\src\typed.jl:67
 [27] serve_in_env(conn::Base.PipeEndpoint)
    @ VSCodeTestServer c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:215
 [28] #14
    @ c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:234 [inlined]
 [29] (::VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}})()
    @ VSCodeTestServer.TestEnv c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\TestEnv\src\julia-1.9\activate_do.jl:19
 [30] withenv(::VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}}, ::Pair{String, String}, ::Vararg{Pair{String}})
    @ Base .\env.jl:257
 [31] (::Pkg.Operations.var"#117#122"{String, Bool, Bool, Bool, VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations C:\Users\visser_mn\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1825
 [32] with_temp_env(fn::Pkg.Operations.var"#117#122"{String, Bool, Bool, Bool, VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations C:\Users\visser_mn\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1706
 [33] (::Pkg.Operations.var"#115#120"{Nothing, Bool, Bool, Bool, VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String})(tmp::String)
    @ Pkg.Operations C:\Users\visser_mn\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1795
 [34] mktempdir(fn::Pkg.Operations.var"#115#120"{Nothing, Bool, Bool, Bool, VSCodeTestServer.TestEnv.var"#3#4"{VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, Pkg.Types.Project, String}, parent::String; prefix::String)
    @ Base.Filesystem .\file.jl:766
 [35] mktempdir(fn::Function, parent::String)
    @ Base.Filesystem .\file.jl:762
 [36] mktempdir
    @ .\file.jl:762 [inlined]
 [37] sandbox(fn::Function, ctx::Pkg.Types.Context, target::Pkg.Types.PackageSpec, target_path::String, sandbox_path::String, sandbox_project_override::Pkg.Types.Project; preferences::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
    @ Pkg.Operations C:\Users\visser_mn\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1753
 [38] sandbox
    @ C:\Users\visser_mn\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Operations.jl:1744 [inlined]
 [39] activate(f::VSCodeTestServer.var"#14#16"{Base.PipeEndpoint}, pkg::String; allow_reresolve::Bool)
    @ VSCodeTestServer.TestEnv c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\TestEnv\src\julia-1.9\activate_do.jl:17
 [40] activate
    @ c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\TestEnv\src\julia-1.9\activate_do.jl:12 [inlined]
 [41] serve(conn::Base.PipeEndpoint, project_path::String, package_path::String, package_name::String; is_dev::Bool, crashreporting_pipename::Nothing)
    @ VSCodeTestServer c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:233
 [42] serve(conn::Base.PipeEndpoint, project_path::String, package_path::String, package_name::String)
    @ VSCodeTestServer c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\packages\VSCodeTestServer\src\VSCodeTestServer.jl:219
 [43] top-level scope
    @ c:\Users\visser_mn\.vscode\extensions\julialang.language-julia-1.83.2\scripts\testserver\testserver_main.jl:17
 [44] include(mod::Module, _path::String)
    @ Base .\Base.jl:495
 [45] exec_options(opts::Base.JLOptions)
    @ Base .\client.jl:318
 [46] _start()
    @ Base .\client.jl:552
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allocation Allocation layer
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants