mirror of https://gitlab.com/pamhyr/pamhyr2
HS: Basic: Add CheckValve hydraulic structure and VAR export.
parent
793289dd80
commit
7fd6e4469b
|
|
@ -205,11 +205,13 @@ class CheckValve(BasicHS):
|
||||||
|
|
||||||
self._type = "CV"
|
self._type = "CV"
|
||||||
self._data = [
|
self._data = [
|
||||||
BHSValue("parameter_1", float, 0.0, status=status),
|
BHSValue("width", float, 0.0, status=status),
|
||||||
BHSValue("parameter_2", float, 0.0, status=status),
|
BHSValue("elevation", float, 0.0, status=status),
|
||||||
BHSValue("parameter_3", float, 0.0, status=status),
|
BHSValue("loading_elevation", float, 9999.999,
|
||||||
BHSValue("parameter_4", float, 0.0, status=status),
|
status=status),
|
||||||
BHSValue("parameter_5", float, 0.0, status=status),
|
BHSValue("discharge_coefficient", float, 0.4, status=status),
|
||||||
|
BHSValue("maximal_loading_elevation", float, 9999.999,
|
||||||
|
status=status),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -242,6 +244,6 @@ BHS_types = {
|
||||||
"V1": RectangularGate,
|
"V1": RectangularGate,
|
||||||
"V2": SimplifiedRectangularGate,
|
"V2": SimplifiedRectangularGate,
|
||||||
"BO": Borda,
|
"BO": Borda,
|
||||||
# "VC": CheckValve,
|
"CV": CheckValve,
|
||||||
"UD": UserDefined
|
"UD": UserDefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -458,6 +458,7 @@ class Mage(CommandLineSolver):
|
||||||
"ND": "*",
|
"ND": "*",
|
||||||
"S1": "D", "S2": "T", "S3": "T",
|
"S1": "D", "S2": "T", "S3": "T",
|
||||||
"OR": "O", "OC": "B", "OV": "F",
|
"OR": "O", "OC": "B", "OV": "F",
|
||||||
|
"CV": "O", # CheckValve
|
||||||
"V1": "V", "V2": "W",
|
"V1": "V", "V2": "W",
|
||||||
"BO": "A",
|
"BO": "A",
|
||||||
"UD": "X",
|
"UD": "X",
|
||||||
|
|
@ -496,10 +497,14 @@ class Mage(CommandLineSolver):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
name = bhs.name
|
||||||
|
if name == "":
|
||||||
|
name = f"HS_{bhs.id:>3}".replace(" ", "0")
|
||||||
|
|
||||||
f.write(
|
f.write(
|
||||||
f"{sin_dict[bhs._type]} " +
|
f"{sin_dict[bhs._type]} " +
|
||||||
f"{reach_id} {hs.input_kp:>12.3f} {param_str} " +
|
f"{reach_id} {hs.input_kp:>12.3f} {param_str} " +
|
||||||
f"{bhs.name}\n"
|
f"{name}\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
return files
|
return files
|
||||||
|
|
@ -517,7 +522,7 @@ class Mage(CommandLineSolver):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _export_SIN_parameters_5(self, bhs):
|
def _export_SIN_parameters_5(self, bhs):
|
||||||
# S2, OR, V1, V2, UD
|
# S2, OR, V1, V2, UD, CV
|
||||||
return [
|
return [
|
||||||
bhs._data[0].value,
|
bhs._data[0].value,
|
||||||
bhs._data[1].value,
|
bhs._data[1].value,
|
||||||
|
|
@ -562,6 +567,42 @@ class Mage(CommandLineSolver):
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@timer
|
||||||
|
def _export_VAR(self, study, repertory, qlog, name="0"):
|
||||||
|
files = []
|
||||||
|
|
||||||
|
hydraulic_structures = study.river.hydraulic_structures.lst
|
||||||
|
if len(hydraulic_structures) == 0:
|
||||||
|
return files
|
||||||
|
|
||||||
|
if qlog is not None:
|
||||||
|
qlog.put("Export VAR file")
|
||||||
|
|
||||||
|
with mage_file_open(os.path.join(repertory, f"{name}.VAR"), "w+") as f:
|
||||||
|
files.append(f"{name}.VAR")
|
||||||
|
|
||||||
|
for hs in hydraulic_structures:
|
||||||
|
if hs.input_reach is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not hs.input_reach.is_enable():
|
||||||
|
continue
|
||||||
|
|
||||||
|
for bhs in hs.basic_structures:
|
||||||
|
logger.info(bhs._type)
|
||||||
|
if bhs._type != "CV" :
|
||||||
|
continue
|
||||||
|
|
||||||
|
name = bhs.name
|
||||||
|
if name == "":
|
||||||
|
name = f"HS_{bhs.id:>3}".replace(" ", "0")
|
||||||
|
|
||||||
|
f.write(
|
||||||
|
f"${name} clapet"
|
||||||
|
)
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
def _export_DEV(self, study, repertory, qlog, name="0"):
|
def _export_DEV(self, study, repertory, qlog, name="0"):
|
||||||
files = []
|
files = []
|
||||||
|
|
@ -835,6 +876,7 @@ class Mage8(Mage):
|
||||||
files = files + self._export_RUG(study, repertory, qlog, name=name)
|
files = files + self._export_RUG(study, repertory, qlog, name=name)
|
||||||
files = files + self._export_INI(study, repertory, qlog, name=name)
|
files = files + self._export_INI(study, repertory, qlog, name=name)
|
||||||
files = files + self._export_SIN(study, repertory, qlog, name=name)
|
files = files + self._export_SIN(study, repertory, qlog, name=name)
|
||||||
|
files = files + self._export_VAR(study, repertory, qlog, name=name)
|
||||||
files = files + self._export_CAS(study, repertory, qlog, name=name)
|
files = files + self._export_CAS(study, repertory, qlog, name=name)
|
||||||
files = files + self._export_DEV(study, repertory, qlog, name=name)
|
files = files + self._export_DEV(study, repertory, qlog, name=name)
|
||||||
self._export_REP(study, repertory, files, qlog, name=name)
|
self._export_REP(study, repertory, files, qlog, name=name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue