Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Nov 17, 2023
1 parent 68c66ae commit 4481046
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/contribute/addnode.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The parameters object (defined in `solve.jl`) passed to the ODE solver must be m

```julia
struct NewNodeType
node_id::Vector{Int}
node_id::Vector{NodeID}
# Other fields
end
```
Expand Down Expand Up @@ -57,7 +57,7 @@ function NewNodeType(db::DB, config::Config)::NewNodeType

# Unpack the fields of static as inputs for the NewNodeType constructor
return NewNodeType(
parsed_parameters.node_id,
NodeID.(parsed_parameters.node_id),
parsed_parameters.some_property,
parsed_parameters.control_mapping)
end
Expand Down Expand Up @@ -189,13 +189,13 @@ class NewNodeTypeStatic:

The new node type might have associated restrictions for a model with the new node type so that it behaves properly. Basic node ID and node type validation happens in `Model.validate_model` in `python/ribasim/ribasim/model.py`, which automatically considers all node types in the `node_types` module.

Connectivity validation happens in `valid_edges` and `valid_n_flow_neighbors` in `core/src/solve.jl`. Connectivity rules are specified in `core/src/validation.jl`. Allowed upstream and downstream neighbor types for `NewNodeType` in are specified as follows:
Connectivity validation happens in `valid_edges` and `valid_n_flow_neighbors` in `core/src/solve.jl`. Connectivity rules are specified in `core/src/validation.jl`. Allowed upstream and downstream neighbor types for `new_node_type` (the snake case version of `NewNodeType`) are specified as follows:

```julia
# set allowed downstream types
neighbortypes(::Val{:NewNodeType}) = Set((:Basin,))
neighbortypes(::Val{:new_node_type}) = Set((:basin,))
# add your newnodetype as acceptable downstream connection of other types
neighbortypes(::Val{:Pump}) = Set((:Basin, :NewNodeType))
neighbortypes(::Val{:pump}) = Set((:basin, :new_node_type))
```

The minimum and maximum allowed number of inneighbors and outneighbors for `NewNodeType` are specified as follows:
Expand Down

0 comments on commit 4481046

Please sign in to comment.