Skip to content

Commit 6a4f588

Browse files
authored
Améliorations conversions g1.2/g1.3 et couverture TU (#9)
1 parent 6fb4459 commit 6a4f588

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+4478
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Journal des modifications
22
=========================
33

44
## [X.X] en cours
5+
- Prise en compte du déplacement de Pm_TolStQ du CCM vers le OPTI pour les initialisations de type Saint-Venant (g1.3)
56
- Amélioration performances lecture binaire en utilisant `np.frombuffer` (au lieu de struct)
67
- Correction plantage lecture RCAL si aucun résultat aux branches
78

crue10/data/1.2/templates/dcsp.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@
129129
{%- else %}
130130
<DonCalcSansPrtCasiers/>
131131
{%- endif %}
132-
</DCSP>
132+
</DCSP>

crue10/data/1.2/templates/dptg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@
100100
{%- else %}
101101
<DonPrtGeoBranches/>
102102
{%- endif %}
103-
</DPTG>
103+
</DPTG>

crue10/data/1.2/templates/dpti.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
{%- else %}
5050
<DonPrtCIniBranches/>
5151
{%- endif %}
52-
</DPTI>
52+
</DPTI>

crue10/data/1.2/templates/drso.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@
108108
{%- else %}
109109
<Branches/>
110110
{%- endif %}
111-
</DRSO>
111+
</DRSO>

crue10/data/1.2/templates/etu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@
101101
</Scenario>
102102
{%- endfor %}
103103
</Scenarios>
104-
</ETU>
104+
</ETU>

crue10/data/1.3/templates/dptg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@
100100
{%- else %}
101101
<DonPrtGeoBranches/>
102102
{%- endif %}
103-
</DPTG>
103+
</DPTG>

crue10/data/1.3/templates/dpti.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
{%- else %}
5050
<DonPrtCIniBranches/>
5151
{%- endif %}
52-
</DPTI>
52+
</DPTI>

crue10/data/1.3/templates/drso.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@
108108
{%- else %}
109109
<Branches/>
110110
{%- endif %}
111-
</DRSO>
111+
</DRSO>

crue10/data/1.3/templates/etu.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@
102102
</Scenario>
103103
{%- endfor %}
104104
</Scenarios>
105-
</ETU>
105+
</ETU>

crue10/modele.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
from crue10.emh.branche import Branche, BrancheOrifice, BrancheBarrageFilEau, BrancheBarrageGenerique
1414
from crue10.emh.section import SectionIdem, SectionProfil, LimiteGeom, LitNumerote
1515
from crue10.utils import check_isinstance, check_preffix, DATA_FOLDER_ABSPATH, duration_iso8601_to_seconds, \
16-
duration_seconds_to_iso8601, get_xml_root_from_file, logger, PREFIX, write_default_xml_file, write_xml_from_tree
16+
duration_seconds_to_iso8601, float2str, get_xml_root_from_file, logger, \
17+
PREFIX, write_default_xml_file, write_xml_from_tree
18+
from crue10.utils.crueconfigmetier import DEFAULT_Pm_TolStQ
1719
from crue10.utils.graph_1d_model import *
1820
from crue10.sous_modele import SousModele
1921

@@ -755,13 +757,35 @@ def changer_version_grammaire(self, version_grammaire, shallow=False):
755757
:type shallow: bool
756758
"""
757759
if version_grammaire == '1.3': # HARDCODED to support g1.2
760+
interpol_st_venant = self.xml_trees['opti'].find(PREFIX + 'MethodeInterpol') \
761+
.find(PREFIX + 'InterpolSaintVenant')
762+
if interpol_st_venant is not None:
763+
# Fix indentation (add 2 whitespaces)
764+
elt_Pm_TolNdZ = interpol_st_venant.find(PREFIX + 'Pm_TolNdZ')
765+
elt_Pm_TolNdZ.tail += ' '
766+
# Parameter `Pm_TolStQ` is added (it was in CCM before)
767+
elt_Pm_TolStQ = etree.SubElement(interpol_st_venant, PREFIX + 'Pm_TolStQ')
768+
elt_Pm_TolStQ.text = float2str(DEFAULT_Pm_TolStQ)
769+
elt_Pm_TolStQ.tail = '\n '
770+
758771
if 'dreg' not in self.xml_trees:
759772
# Add dreg in self.xml_trees if missing (because is from grammar v1.2)
760773
xml_path = os.path.join(DATA_FOLDER_ABSPATH, version_grammaire, 'fichiers_vierges', 'default.dreg.xml')
761774
root = get_xml_root_from_file(xml_path)
762775
self.xml_trees['dreg'] = root
763776
self.files['dreg'] = os.path.join(os.path.dirname(self.files['optr']), self.id[3:] + '.dreg.xml')
764777

778+
elif version_grammaire == '1.2': # HARDCODED to support g1.2
779+
interpol_st_venant = self.xml_trees['opti'].find(PREFIX + 'MethodeInterpol') \
780+
.find(PREFIX + 'InterpolSaintVenant')
781+
if interpol_st_venant is not None:
782+
# Fix indentation (remove 2 whitespaces)
783+
elt_Pm_TolNdZ = interpol_st_venant.find(PREFIX + 'Pm_TolNdZ')
784+
if elt_Pm_TolNdZ.tail.endswith(' '):
785+
elt_Pm_TolNdZ.tail = elt_Pm_TolNdZ.tail[:-2]
786+
# Parameter `Pm_TolStQ` removed as it was in CCM before
787+
interpol_st_venant.remove(interpol_st_venant.find(PREFIX + 'Pm_TolStQ'))
788+
765789
if not shallow:
766790
for sous_modele in self.liste_sous_modeles:
767791
sous_modele.changer_version_grammaire(version_grammaire)
Binary file not shown.
Binary file not shown.

crue10/tests/data/in/1.2/Etu3-6_grammaire/CONFIG/SM_M3-6_C10/branches.prj

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

crue10/tests/data/in/1.2/Etu3-6_grammaire/CONFIG/SM_M3-6_C10/casiers.prj

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

crue10/tests/data/in/1.2/Etu3-6_grammaire/CONFIG/SM_M3-6_C10/noeuds.prj

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

crue10/tests/data/in/1.2/Etu3-6_grammaire/CONFIG/SM_M3-6_C10/tracesSections.prj

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ETU xmlns="http://www.fudaa.fr/xsd/crue" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fudaa.fr/xsd/crue http://www.fudaa.fr/xsd/crue/etu-1.2.xsd">
3+
<Commentaire>Etu3-6 : étude basée sur Etu3-0</Commentaire>
4+
<AuteurCreation>BALAYN_P</AuteurCreation>
5+
<DateCreation>2012-05-30T12:00:00.000</DateCreation>
6+
<AuteurDerniereModif>DURON</AuteurDerniereModif>
7+
<DateDerniereModif>2024-09-27T15:17:57.547</DateDerniereModif>
8+
<ScenarioCourant NomRef="Sc_M3-6_c10"/>
9+
<Repertoires>
10+
<Repertoire Nom="CONFIG">
11+
<path>CONFIG</path>
12+
</Repertoire>
13+
<Repertoire Nom="FICHETUDES">
14+
<path>.</path>
15+
</Repertoire>
16+
<Repertoire Nom="RAPPORTS">
17+
<path>RAPPORTS</path>
18+
</Repertoire>
19+
<Repertoire Nom="RUNS">
20+
<path>RUNS</path>
21+
</Repertoire>
22+
</Repertoires>
23+
<FichEtudes>
24+
<FichEtude Nom="M3-6_c10.dclm.xml" Chemin=".\" Type="DCLM"/>
25+
<FichEtude Nom="M3-6_c10.dcsp.xml" Chemin=".\" Type="DCSP"/>
26+
<FichEtude Nom="M3-6_c10.dfrt.xml" Chemin=".\" Type="DFRT"/>
27+
<FichEtude Nom="M3-6_c10.dlhy.xml" Chemin=".\" Type="DLHY"/>
28+
<FichEtude Nom="M3-6_c10.dptg.xml" Chemin=".\" Type="DPTG"/>
29+
<FichEtude Nom="M3-6_c10.dpti.xml" Chemin=".\" Type="DPTI"/>
30+
<FichEtude Nom="M3-6_c10.drso.xml" Chemin=".\" Type="DRSO"/>
31+
<FichEtude Nom="M3-6_c10.ocal.xml" Chemin=".\" Type="OCAL"/>
32+
<FichEtude Nom="M3-6_c10.optg.xml" Chemin=".\" Type="OPTG"/>
33+
<FichEtude Nom="M3-6_c10.opti.xml" Chemin=".\" Type="OPTI"/>
34+
<FichEtude Nom="M3-6_c10.optr.xml" Chemin=".\" Type="OPTR"/>
35+
<FichEtude Nom="M3-6_c10.ores.xml" Chemin=".\" Type="ORES"/>
36+
<FichEtude Nom="M3-6_c10.pcal.xml" Chemin=".\" Type="PCAL"/>
37+
<FichEtude Nom="M3-6_c10.pnum.xml" Chemin=".\" Type="PNUM"/>
38+
</FichEtudes>
39+
<SousModeles>
40+
<SousModele Nom="Sm_M3-6_c10">
41+
<Type>Crue10</Type>
42+
<IsActive>true</IsActive>
43+
<Commentaire>Sc_M3-6_c9 converti en CRUE10
44+
45+
Régimes permanents seuls. CLimM : Qapp, Zimp, Ouv --&gt; incompatible avec c10m9</Commentaire>
46+
<AuteurCreation>gressier</AuteurCreation>
47+
<DateCreation>2017-06-23T09:06:14.245</DateCreation>
48+
<AuteurDerniereModif>DURON</AuteurDerniereModif>
49+
<DateDerniereModif>2024-09-27T15:17:57.542</DateDerniereModif>
50+
<SousModele-FichEtudes>
51+
<DRSO NomRef="M3-6_c10.drso.xml"/>
52+
<DCSP NomRef="M3-6_c10.dcsp.xml"/>
53+
<DPTG NomRef="M3-6_c10.dptg.xml"/>
54+
<DFRT NomRef="M3-6_c10.dfrt.xml"/>
55+
</SousModele-FichEtudes>
56+
</SousModele>
57+
</SousModeles>
58+
<Modeles>
59+
<Modele Nom="Mo_M3-6_c10">
60+
<Type>Crue10</Type>
61+
<IsActive>true</IsActive>
62+
<Commentaire>Sc_M3-6_c9 converti en CRUE10
63+
64+
Régimes permanents seuls. CLimM : Qapp, Zimp, Ouv --&gt; incompatible avec c10m9</Commentaire>
65+
<AuteurCreation>gressier</AuteurCreation>
66+
<DateCreation>2017-06-23T09:06:14.245</DateCreation>
67+
<AuteurDerniereModif>DURON</AuteurDerniereModif>
68+
<DateDerniereModif>2024-09-27T15:17:57.542</DateDerniereModif>
69+
<Modele-FichEtudes>
70+
<OPTR NomRef="M3-6_c10.optr.xml"/>
71+
<OPTG NomRef="M3-6_c10.optg.xml"/>
72+
<OPTI NomRef="M3-6_c10.opti.xml"/>
73+
<PNUM NomRef="M3-6_c10.pnum.xml"/>
74+
<DPTI NomRef="M3-6_c10.dpti.xml"/>
75+
</Modele-FichEtudes>
76+
<Modele-SousModeles>
77+
<Modele-SousModele NomRef="Sm_M3-6_c10"/>
78+
</Modele-SousModeles>
79+
</Modele>
80+
</Modeles>
81+
<Scenarios>
82+
<Scenario Nom="Sc_M3-6_c10">
83+
<Type>Crue10</Type>
84+
<IsActive>true</IsActive>
85+
<Commentaire>Régimes permanents seuls. CLimM : Qapp, Zimp, Ouv --&gt; incompatible avec c10m9</Commentaire>
86+
<AuteurCreation>gressier</AuteurCreation>
87+
<DateCreation>2017-06-23T09:06:14.245</DateCreation>
88+
<AuteurDerniereModif>DURON</AuteurDerniereModif>
89+
<DateDerniereModif>2024-09-27T15:17:57.542</DateDerniereModif>
90+
<Scenario-FichEtudes>
91+
<OCAL NomRef="M3-6_c10.ocal.xml"/>
92+
<ORES NomRef="M3-6_c10.ores.xml"/>
93+
<PCAL NomRef="M3-6_c10.pcal.xml"/>
94+
<DCLM NomRef="M3-6_c10.dclm.xml"/>
95+
<DLHY NomRef="M3-6_c10.dlhy.xml"/>
96+
</Scenario-FichEtudes>
97+
<Scenario-Modeles>
98+
<Scenario-Modele NomRef="Mo_M3-6_c10"/>
99+
</Scenario-Modeles>
100+
</Scenario>
101+
</Scenarios>
102+
</ETU>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<DCLM xmlns="http://www.fudaa.fr/xsd/crue" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fudaa.fr/xsd/crue http://www.fudaa.fr/xsd/crue/dclm-1.2.xsd">
3+
<Commentaire>CrueX - Structuration des données
4+
5+
Modèle de test utilisant les éléments de modélisation hydraulique les plus courants
6+
7+
PBa Mai2012 sur la base de M3-0</Commentaire>
8+
<CalcPseudoPerm Nom="Cc_P01">
9+
<Commentaire>Calcul pseudo-permanent 1</Commentaire>
10+
<CalcPseudoPermNoeudQapp NomRef="Nd_N1">
11+
<IsActive>true</IsActive>
12+
<Qapp>100.0</Qapp>
13+
</CalcPseudoPermNoeudQapp>
14+
<CalcPseudoPermNoeudNiveauContinuZimp NomRef="Nd_N5">
15+
<IsActive>true</IsActive>
16+
<Zimp>2.0</Zimp>
17+
</CalcPseudoPermNoeudNiveauContinuZimp>
18+
<CalcPseudoPermBrancheOrificeManoeuvre NomRef="Br_B8">
19+
<IsActive>true</IsActive>
20+
<SensOuv>OuvVersHaut</SensOuv>
21+
<Ouv>100.0</Ouv>
22+
</CalcPseudoPermBrancheOrificeManoeuvre>
23+
</CalcPseudoPerm>
24+
<CalcPseudoPerm Nom="Cc_P02">
25+
<Commentaire>Calcul pseudo-permanent 2</Commentaire>
26+
<CalcPseudoPermNoeudQapp NomRef="Nd_N1">
27+
<IsActive>true</IsActive>
28+
<Qapp>100.0</Qapp>
29+
</CalcPseudoPermNoeudQapp>
30+
<CalcPseudoPermNoeudNiveauContinuZimp NomRef="Nd_N5">
31+
<IsActive>true</IsActive>
32+
<Zimp>1.5</Zimp>
33+
</CalcPseudoPermNoeudNiveauContinuZimp>
34+
<CalcPseudoPermBrancheOrificeManoeuvre NomRef="Br_B8">
35+
<IsActive>true</IsActive>
36+
<SensOuv>OuvVersHaut</SensOuv>
37+
<Ouv>90.0</Ouv>
38+
</CalcPseudoPermBrancheOrificeManoeuvre>
39+
</CalcPseudoPerm>
40+
</DCLM>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<DCSP xmlns="http://www.fudaa.fr/xsd/crue" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fudaa.fr/xsd/crue http://www.fudaa.fr/xsd/crue/dcsp-1.2.xsd">
3+
<Commentaire></Commentaire>
4+
<DonCalcSansPrtBranches>
5+
<DonCalcSansPrtBrancheSaintVenant NomRef="Br_B1">
6+
<CoefBeta>1.0</CoefBeta>
7+
<CoefRuisQdm>0.0</CoefRuisQdm>
8+
<CoefRuis>0.0</CoefRuis>
9+
</DonCalcSansPrtBrancheSaintVenant>
10+
<DonCalcSansPrtBrancheSaintVenant NomRef="Br_B2">
11+
<CoefBeta>1.0</CoefBeta>
12+
<CoefRuisQdm>0.0</CoefRuisQdm>
13+
<CoefRuis>0.0</CoefRuis>
14+
</DonCalcSansPrtBrancheSaintVenant>
15+
<DonCalcSansPrtBrancheSeuilTransversal NomRef="Br_B3">
16+
<FormulePdc>Borda</FormulePdc>
17+
<ElemSeuilAvecPdc>
18+
<Largeur>20.0</Largeur>
19+
<Zseuil>0.6</Zseuil>
20+
<CoefD>0.9</CoefD>
21+
<CoefPdc>1.0</CoefPdc>
22+
</ElemSeuilAvecPdc>
23+
<ElemSeuilAvecPdc>
24+
<Largeur>8.0</Largeur>
25+
<Zseuil>2.2</Zseuil>
26+
<CoefD>0.9</CoefD>
27+
<CoefPdc>1.0</CoefPdc>
28+
</ElemSeuilAvecPdc>
29+
</DonCalcSansPrtBrancheSeuilTransversal>
30+
<DonCalcSansPrtBrancheSaintVenant NomRef="Br_B4">
31+
<CoefBeta>1.0</CoefBeta>
32+
<CoefRuisQdm>0.0</CoefRuisQdm>
33+
<CoefRuis>0.0</CoefRuis>
34+
</DonCalcSansPrtBrancheSaintVenant>
35+
<DonCalcSansPrtBrancheSeuilLateral NomRef="Br_B5">
36+
<FormulePdc>Borda</FormulePdc>
37+
<ElemSeuilAvecPdc>
38+
<Largeur>100.0</Largeur>
39+
<Zseuil>3.78</Zseuil>
40+
<CoefD>0.9</CoefD>
41+
<CoefPdc>1.0</CoefPdc>
42+
</ElemSeuilAvecPdc>
43+
<ElemSeuilAvecPdc>
44+
<Largeur>100.0</Largeur>
45+
<Zseuil>3.82</Zseuil>
46+
<CoefD>0.9</CoefD>
47+
<CoefPdc>1.0</CoefPdc>
48+
</ElemSeuilAvecPdc>
49+
</DonCalcSansPrtBrancheSeuilLateral>
50+
<DonCalcSansPrtBrancheBarrageFilEau NomRef="Br_B8">
51+
<QLimInf>-1.0E30</QLimInf>
52+
<QLimSup>1.0E30</QLimSup>
53+
<ElemSeuil>
54+
<Largeur>10.0</Largeur>
55+
<Zseuil>1.234</Zseuil>
56+
<CoefD>0.6</CoefD>
57+
</ElemSeuil>
58+
<ElemSeuil>
59+
<Largeur>12.0</Largeur>
60+
<Zseuil>5.678</Zseuil>
61+
<CoefD>0.3</CoefD>
62+
</ElemSeuil>
63+
<RegimeDenoye Nom="LoiQpilZam_B8" Type="LoiQpilZam">
64+
<Commentaire></Commentaire>
65+
<EvolutionFF>
66+
<PointFF>0.0 -15.0</PointFF>
67+
</EvolutionFF>
68+
</RegimeDenoye>
69+
</DonCalcSansPrtBrancheBarrageFilEau>
70+
</DonCalcSansPrtBranches>
71+
<DonCalcSansPrtCasiers>
72+
<DonCalcSansPrtCasierProfil NomRef="Ca_N7">
73+
<CoefRuis>0.0</CoefRuis>
74+
</DonCalcSansPrtCasierProfil>
75+
<DonCalcSansPrtCasierProfil NomRef="Ca_N6">
76+
<CoefRuis>0.0</CoefRuis>
77+
</DonCalcSansPrtCasierProfil>
78+
</DonCalcSansPrtCasiers>
79+
</DCSP>

0 commit comments

Comments
 (0)