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

Control: add Driel and Haringvlietsluizen #57

Closed
3 tasks done
d2hydro opened this issue Jan 30, 2024 · 5 comments
Closed
3 tasks done

Control: add Driel and Haringvlietsluizen #57

d2hydro opened this issue Jan 30, 2024 · 5 comments

Comments

@d2hydro
Copy link
Contributor

d2hydro commented Jan 30, 2024

Driel

  • provide rating_curve for Lobith and Pannerdens kanaal
  • add fractional-nodes at Pannerdense kop and Ijsselkop

Haringvlietsluizen

  • outlet-flow_rate control by lobith flow-rate
@d2hydro d2hydro converted this from a draft issue Jan 30, 2024
@d2hydro
Copy link
Contributor Author

d2hydro commented Jan 30, 2024

@visr, following our discussion December, "fractional flow as to receive a flow_rate" I assume such flow-rate comes best from a Q(h) and not from a "gravitation node" (manning or linear resistance) as these nodes need a downstream level. Taken from HydroLogic example:

Image

@d2hydro d2hydro self-assigned this Jan 31, 2024
@d2hydro
Copy link
Contributor Author

d2hydro commented Feb 1, 2024

@visr, something is wrong with the control-state. Can you help me further? The model is here: https://we.tl/t-JMNBV65NWq

image

@visr
Copy link
Member

visr commented Feb 2, 2024

I ran this script to update the model, which is the upgrade code from Deltares/Ribasim#992, followed by a read-then-write using the latest version of Ribasim Python. After that it works.

import sqlite3

import pandas as pd

# Connect to the SQLite database
database_path = "database.gpkg"
conn = sqlite3.connect(database_path)

tables = ["TabulatedRatingCurve / static", "TabulatedRatingCurve / time"]

for table in tables:
    # Read the table into a pandas DataFrame
    try:
        df = pd.read_sql_query(f"SELECT * FROM '{table}'", conn)
    except:
        continue

    # Rename the column in the DataFrame
    df_renamed = df.rename(columns={"discharge": "flow_rate"})

    # Write the DataFrame back to the SQLite table
    df_renamed.to_sql(table, conn, if_exists="replace", index=False)

# Close the connection
conn.close()

# write
import ribasim

m = ribasim.Model(filepath="hws.toml")
m.write("hws.toml")

I suspect that the fix was the ordering of the tables: Deltares/Ribasim#903.
Now the tables are sorted in ascending greater_than:
image

@d2hydro
Copy link
Contributor Author

d2hydro commented Feb 2, 2024

Check, for a full fix:

  1. run the code above using ribasim from the main-branch
  2. download and use Ribasim 2024.01.1 CLI: https://github.com/Deltares/Ribasim/releases/tag/v2024.01.1

Model with Driel-control is uploaded to: https://deltares.thegood.cloud/f/62081

@d2hydro d2hydro mentioned this issue Feb 7, 2024
10 tasks
@d2hydro
Copy link
Contributor Author

d2hydro commented Feb 8, 2024

Issue closed with model-release: 2024.2.1: https://deltares.thegood.cloud/f/62174

@d2hydro d2hydro closed this as completed Feb 8, 2024
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Ribasim NL Feb 8, 2024
@d2hydro d2hydro removed their assignment Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

1 participant