-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make node ID unique to the node type (#1113)
Needed for #1110. Before node IDs were globally unique. If you had the ID, you could look up the type in the Node table. When designing #1110 we came to the conclusion that this was not the right choice. It requires you to be aware of the IDs that are used throughout the model, whereas with this you only need to make sure that `Pump #5` doesn't already exist. Most of the updates in this PR were to correct the tests. Some of the code and error messages became easier to read. If we talk about a node then we always know what the type is, there is no need to look it up first. Most tables stay the same, e.g. if you have a `Terminal / static` table with a `node_id` Int column, you know that this refers to a Terminal NodeID. Only when connecting to other nodes do we need to specify the type next to the ID. So the `Edge` table now gets `from_node_type` next to `from_node_id`, the `PidControl / static` gets `listen_node_type` next to `listen_node_id`, etc. These extra columns are currently automatically filled in by Ribasim-Python on model save, hence they don't require changing the test models. In terms of implementation, this basically adds the `type` field to `NodeID` and fixes the resulting errors. ```julia struct NodeID type::NodeType.T value::Int end ``` It does not yet test if models with the same node IDs (`Pump #1` and `Basin #1`) work, but this is hard to do right now with Ribasim Python, so best left for a later moment. --------- Co-authored-by: Hofer-Julian <[email protected]>
- Loading branch information
1 parent
bbd57ca
commit a39cc24
Showing
20 changed files
with
470 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.