Closed d2hydro closed 8 months ago
@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:
@visr, something is wrong with the control-state. Can you help me further? The model is here: https://we.tl/t-JMNBV65NWq
I ran this script to update the model, which is the upgrade code from https://github.com/Deltares/Ribasim/pull/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: https://github.com/Deltares/Ribasim/pull/903. Now the tables are sorted in ascending greater_than:
Check, for a full fix:
Model with Driel-control is uploaded to: https://deltares.thegood.cloud/f/62081
Issue closed with model-release: 2024.2.1: https://deltares.thegood.cloud/f/62174
Driel
Haringvlietsluizen