factory_structure.ts 7.62 KB
Newer Older
1
2
import { ParallelStructure } from "./parallel_structure";

Dorchies David's avatar
Dorchies David committed
3
// Classes générales sur les structures
4
5
import { RectangularStructureParams } from "./rectangular_structure_params";
import { Structure } from "./structure";
Mathias Chouet's avatar
Mathias Chouet committed
6
import { LoiDebit } from "./structure_props";
Dorchies David's avatar
Dorchies David committed
7
8

// Equations de débit
9
10
11
12
13
import { StructureGateCem88d } from "./structure_gate_cem88d";
import { StructureGateCem88v } from "./structure_gate_cem88v";
import { StructureGateCunge80 } from "./structure_gate_cunge80";
import { StructureKivi } from "./structure_kivi";
import { StructureKiviParams } from "./structure_kivi_params";
Mathias Chouet's avatar
Mathias Chouet committed
14
15
import { StructureOrificeFree } from "./structure_orifice_free";
import { StructureOrificeFreeParams } from "./structure_orifice_free_params";
16
17
import { StructureOrificeSubmerged } from "./structure_orifice_submerged";
import { StructureOrificeSubmergedParams } from "./structure_orifice_submerged_params";
Dorchies David's avatar
Dorchies David committed
18
19
import { StructureRectangularOrificeFree } from "./structure_rectangular_orifice_free";
import { StructureRectangularOrificeSubmerged } from "./structure_rectangular_orifice_submerged";
20
21
22
23
24
25
26
27
28
29
import { StructureTriangularTruncWeirFree } from "./structure_triangular_trunc_weir";
import { TriangularTruncStructureParams } from "./structure_triangular_trunc_weir_params";
import { StructureTriangularWeir } from "./structure_triangular_weir";
import { TriangularStructureParams } from "./structure_triangular_weir_params";
import { StructureVanLevLarinier } from "./structure_vanlev_larinier";
import { StructureVanLevParams } from "./structure_vanlev_params";
import { StructureVanLevVillemonte } from "./structure_vanlev_villemonte";
import { StructureWeirCem88d } from "./structure_weir_cem88d";
import { StructureWeirCem88v } from "./structure_weir_cem88v";
import { StructureWeirCunge80 } from "./structure_weir_cunge80";
30
import { StructureWeirFree } from "./structure_weir_free";
31
import { StructureWeirSubmerged } from "./structure_weir_submerged";
32
import { StructureWeirSubmergedLarinier } from "./structure_weir_submerged_larinier";
33
import { StructureWeirVillemonte } from "./structure_weir_villemonte";
34

Mathias Chouet's avatar
Mathias Chouet committed
35
export function CreateStructure(loiDebit: LoiDebit, parentNub?: ParallelStructure,
Dorchies David's avatar
Dorchies David committed
36
                                dbg: boolean = false
37
38
): Structure {
    let ret: Structure;
39
    const oCd: { [s: string]: number } = { SeuilR: 0.4, VanneR: 0.6, SeuilT: 1.36 };
Dorchies David's avatar
Dorchies David committed
40
41
42
43
44
45
    const rectStructPrms: RectangularStructureParams = new RectangularStructureParams(
        0,  // Q
        100,        // ZDV
        102,        // Z1
        101.5,      // Z2
        2,          // L
46
47
        oCd.SeuilR, // Cd de seuil par défaut
        0.5 // W (pour les seuils réglé automatiquement à infinity par w.visible = false)
Dorchies David's avatar
Dorchies David committed
48
    );
Dorchies David's avatar
Dorchies David committed
49
50
51
52
53
54
55
56
57
58
59
    const vanLevPrms: StructureVanLevParams = new StructureVanLevParams(
        0,
        100,
        102,
        101.5,
        0.4,
        0.4,
        0.5,
        99.5,
        100.5
    );
60

61
62
    // Cd pour une vanne rectangulaire
    rectStructPrms.CdGR.singleValue = oCd.VanneR;
Dorchies David's avatar
Dorchies David committed
63
    // Instanciation of the equation
Grand Francois's avatar
Grand Francois committed
64
    switch (loiDebit) {
65
        case LoiDebit.WeirCem88d:
66
            ret = new StructureWeirCem88d(rectStructPrms, dbg);
67
            break;
68
69

        case LoiDebit.WeirCem88v:
70
            ret = new StructureWeirCem88v(rectStructPrms, dbg);
71
            break;
72
73

        case LoiDebit.GateCem88d:
74
            ret = new StructureGateCem88d(rectStructPrms, dbg);
75
            break;
Grand Francois's avatar
Grand Francois committed
76

77
        case LoiDebit.GateCem88v:
78
            ret = new StructureGateCem88v(rectStructPrms, dbg);
79
            break;
Grand Francois's avatar
Grand Francois committed
80

Dorchies David's avatar
Dorchies David committed
81
82
83
84
85
86
        case LoiDebit.GateCunge80:
            ret = new StructureGateCunge80(rectStructPrms, dbg);
            break;

        case LoiDebit.WeirCunge80:
            ret = new StructureWeirCunge80(rectStructPrms, dbg);
87
            break;
Grand Francois's avatar
Grand Francois committed
88

Dorchies David's avatar
Dorchies David committed
89
        case LoiDebit.RectangularOrificeFree:
90
            ret = new StructureRectangularOrificeFree(rectStructPrms, dbg);
91
            break;
Grand Francois's avatar
Grand Francois committed
92

Dorchies David's avatar
Dorchies David committed
93
        case LoiDebit.RectangularOrificeSubmerged:
94
            ret = new StructureRectangularOrificeSubmerged(rectStructPrms, dbg);
95
            break;
Grand Francois's avatar
Grand Francois committed
96
97

        case LoiDebit.WeirFree:
98
            ret = new StructureWeirFree(rectStructPrms, dbg);
99
            break;
100

101
        case LoiDebit.WeirSubmergedLarinier:
Dorchies David's avatar
Dorchies David committed
102
            rectStructPrms.L.singleValue = 0.2;
103
            rectStructPrms.CdWSL.singleValue = 0.65;
Dorchies David's avatar
Dorchies David committed
104
105
            rectStructPrms.ZDV.singleValue = 101;
            rectStructPrms.h1.singleValue = 1;
106
            ret = new StructureWeirSubmergedLarinier(rectStructPrms, dbg);
107
            break;
108

109
110
111
112
113
        case LoiDebit.WeirSubmerged:
            rectStructPrms.CdWS.singleValue = 0.9;
            ret = new StructureWeirSubmerged(rectStructPrms, dbg);
            break;

Dorchies David's avatar
Dorchies David committed
114
115
        case LoiDebit.KIVI:
            const structKiviPrm: StructureKiviParams = new StructureKiviParams(
116
                8.516,      // Q
Dorchies David's avatar
Dorchies David committed
117
                101.5,        // ZDV
118
119
120
121
122
123
                103,        // Z1
                102,        // Z2
                2,          // L
                oCd.SeuilR, // alpha
                0.001,      // béta
                100);       // ZRAM : cote Radier Amont
124
            structKiviPrm.h1.singleValue = 1.5;
125
            ret = new StructureKivi(structKiviPrm, dbg);
126
127
            break;

Dorchies David's avatar
Dorchies David committed
128
        case LoiDebit.TriangularWeirFree:
129
130
131
132
            const structTriangPrms: TriangularStructureParams = new TriangularStructureParams(
                0,          // Q
                100,        // ZDV
                102,        // Z1
133
                100,        // Z2
134
135
136
137
                45,         // Alpha2
                oCd.SeuilT  // Cd pour un seuil triangulaire
                // W = Infinity par défaut pour un seuil
            );
138
            ret = new StructureTriangularWeir(structTriangPrms, dbg);
139
140
            break;

Dorchies David's avatar
Dorchies David committed
141
        case LoiDebit.TriangularTruncWeirFree:
142
143
            const structTriTruncPrms: TriangularTruncStructureParams = new TriangularTruncStructureParams(
                0,          // Q
Dorchies David's avatar
Dorchies David committed
144
                100.1,        // ZDV
145
                102,        // Z1
146
                100.1,        // Z2
147
148
149
                0.9,        // BT
                101,        // ZT
                oCd.SeuilT  // Cd pour un seuil triangulaire
150
151
                // W = Infinity par défaut pour un seuil
            );
152
            ret = new StructureTriangularTruncWeirFree(structTriTruncPrms, dbg);
153
154
            break;

Dorchies David's avatar
Dorchies David committed
155
        case LoiDebit.OrificeSubmerged:
156
            ret = new StructureOrificeSubmerged(
Dorchies David's avatar
Dorchies David committed
157
158
159
160
161
162
163
164
165
                new StructureOrificeSubmergedParams(
                    0,      // Q
                    102,    // Z1
                    101.5,  // Z2
                    0.7,    // Cd
                    0.1     // S
                ),
                dbg
            );
166
            break;
167

Mathias Chouet's avatar
Mathias Chouet committed
168
169
170
171
172
173
174
175
        case LoiDebit.OrificeFree:
            ret = new StructureOrificeFree(
                new StructureOrificeFreeParams(
                    0,      // Q
                    102,    // Z1
                    101.5,  // Z2
                    0.7,    // Cd
                    0.1,    // S
Mathias Chouet's avatar
Mathias Chouet committed
176
                    101     // Zco
Mathias Chouet's avatar
Mathias Chouet committed
177
178
179
180
181
                ),
                dbg
            );
            break;

182
183
184
185
        case LoiDebit.WeirVillemonte:
            ret = new StructureWeirVillemonte(rectStructPrms, dbg);
            break;

Dorchies David's avatar
Dorchies David committed
186
187
188
189
190
        case LoiDebit.VanLevVillemonte:
            ret = new StructureVanLevVillemonte(vanLevPrms, dbg);
            break;

        case LoiDebit.VanLevLarinier:
191
            vanLevPrms.CdWSL.singleValue = 0.65;
Dorchies David's avatar
Dorchies David committed
192
193
194
            ret = new StructureVanLevLarinier(vanLevPrms, dbg);
            break;

Dorchies David's avatar
Dorchies David committed
195
196
        default:
            throw new Error(`type de LoiDebit ${LoiDebit[loiDebit]} non pris en charge`);
197
    }
198
199
200
201
202
203
204

    // set reference to parent
    if (parentNub) {
        ret.parent = parentNub;
    }

    return ret;
205
}