debug SIN output

setup.py
Theophile Terraz 2023-12-12 15:39:43 +01:00
parent c253ad832d
commit d1c8e3e4f5
1 changed files with 18 additions and 3 deletions

View File

@ -440,6 +440,21 @@ class Mage(CommandLineSolver):
def _export_SIN(self, study, repertory, qlog, name="0"):
files = []
sin_dict = {
"ND":"*",
"S1":"D",
"S2":"T",
"S3":"T",
"OR":"D",
"OC":"B",
"OV":"F",
"V1":"V",
"V2":"W",
"BO":"A",
"UD":"X",
"PO":"P",
}
hydraulic_structures = study.river.hydraulic_structures.lst
if len(hydraulic_structures) == 0:
return files
@ -451,8 +466,8 @@ class Mage(CommandLineSolver):
files.append(f"{name}.SIN")
for hs in hydraulic_structures:
if hs.reach.is_enable:
reach_id = study.river.get_edge_id(hs.reach)
if hs.input_reach.is_enable:
reach_id = study.river.get_edge_id(hs.input_reach)
params = [
p.value for p in hs.basic_hydraulic_structure.param
]
@ -463,7 +478,7 @@ class Mage(CommandLineSolver):
]
)
f.write(
f"{hs.basic_hydraulic_structure.type} " +
f"{sin_dict[hs.basic_hydraulic_structure.type]} " +
f"{reach_id} {hs.kp:>12.3f} {params} " +
"{hs.name}\n"
)