Skip to content

Commit

Permalink
Document listen_feature_type in DiscreteControl / condition
Browse files Browse the repository at this point in the history
Also start requiring `listen_feature_type` since that is required by the code anyway
  • Loading branch information
Hofer-Julian committed Mar 5, 2024
1 parent a6c95ce commit 44f093c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/src/schema.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ end

@version DiscreteControlConditionV1 begin
node_id::Int
listen_feature_type::Union{Missing, String}
listen_feature_type::String
listen_feature_id::Int
variable::String
greater_than::Float64
Expand Down
15 changes: 8 additions & 7 deletions docs/core/usage.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,14 @@ DiscreteControl is implemented based on [VectorContinuousCallback](https://docs.

The condition schema defines conditions of the form 'the discrete_control node with this node id listens to whether the given variable of the node with the given listen feature id is grater than the given value'. If the condition variable comes from a time-series, a look ahead $\Delta t$ can be supplied.

column | type | unit | restriction
----------------- | -------- | ------- | -----------
node_id | Int | - | sorted
listen_feature_id | Int | - | sorted per node_id
variable | String | - | must be "level" or "flow_rate", sorted per listen_feature_id
greater_than | Float64 | various | sorted per variable
look_ahead | Float64 | $s$ | Only on transient boundary conditions, non-negative (optional, default 0)
column | type | unit | restriction
------------------- | -------- | ------- | -----------
node_id | Int | - | sorted
listen_feature_id | Int | - | sorted per node_id
listen_feature_type | String | - | known node type
variable | String | - | must be "level" or "flow_rate", sorted per listen_feature_id
greater_than | Float64 | various | sorted per variable
look_ahead | Float64 | $s$ | Only on transient boundary conditions, non-negative (optional, default 0)

## DiscreteControl / logic

Expand Down
Binary file added playground/output/database.gpkg
Binary file not shown.
5 changes: 5 additions & 0 deletions playground/output/ribasim.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
starttime = 2020-01-01 00:00:00
endtime = 2021-01-01 00:00:00
input_dir = "."
results_dir = "results"
ribasim_version = "2024.2.0"
2 changes: 1 addition & 1 deletion python/ribasim/ribasim/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BasinTimeSchema(_BaseSchema):

class DiscreteControlConditionSchema(_BaseSchema):
node_id: Series[int] = pa.Field(nullable=False)
listen_feature_type: Series[str] = pa.Field(nullable=True)
listen_feature_type: Series[str] = pa.Field(nullable=False)
listen_feature_id: Series[int] = pa.Field(nullable=False)
variable: Series[str] = pa.Field(nullable=False)
greater_than: Series[float] = pa.Field(nullable=False)
Expand Down

0 comments on commit 44f093c

Please sign in to comment.