Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import { ComputeNodeType, CalculatorType } from "./compute-node"
import { Nub } from "./nub"
import { ConduiteDistribParams, ConduiteDistrib } from "./cond_distri";
import { LechaptCalmonParams, LechaptCalmon } from "./lechaptcalmon";
import { acSection } from "./section/section_type";
import { ParamsSectionTrapez, cSnTrapez } from "./section/section_trapez";
import { ParamsSectionRectang, cSnRectang } from "./section/section_rectang";
import { ParamsSectionCirc, cSnCirc } from "./section/section_circulaire";
import { ParamsSectionPuiss, cSnPuiss } from "./section/section_puissance";
import { SectionParametree } from "./section/section_nub";
import { RegimeUniforme } from "./regime_uniforme";
import { CourbeRemousParams, MethodeResolution, CourbeRemous } from "./remous";
import { PabDimensionParams, PabDimension } from "./pab/pab_dimension";
import { PabPuissance, PabPuissanceParams } from "./pab/pab_puissance";
import { CreateStructure, StructureType, LoiDebit } from "./structure/factory_structure";
import { Structure } from "./structure/structure";
import { ParallelStructure } from "./structure/parallel_structure";
import { ParallelStructureParams } from "./structure/parallel_structure_params";
import { RectangularStructureParams } from "./structure/structure_cem88d";
export class NubFactory {
private _defaultPrecision: number = 0.001;
private static _instance: NubFactory; // instance pour le pattern singleton
private constructor() { }
public static getInstance() {
if (NubFactory._instance == undefined)
NubFactory._instance = new NubFactory();
return NubFactory._instance;
}
public setDefaultPrecision(p: number) {
this._defaultPrecision = p;
}
/**
* créé un Nub
* @param calcType type de Nub
* @param nodeType sous type de Nub
* @param params paramètres supplémentaires spécifiques
*/
public createNub(calcType: CalculatorType, nodeType: ComputeNodeType, params?: any): Nub {
switch (calcType) {
case CalculatorType.ConduiteDistributrice:
{
const prms = new ConduiteDistribParams(3, // débit Q
1.2, // diamètre D
0.6, // perte de charge J
100, // Longueur de la conduite Lg
1e-6, // Viscosité dynamique Nu
);
return new ConduiteDistrib(prms);
}
case CalculatorType.LechaptCalmon:
{
const prms = new LechaptCalmonParams(3, // débit
1.2, // diamètre
0.6, /// perte de charge
100, // longueur du toyo
1.863, // paramètre L du matériau
2, // paramètre M du matériau
5.33// paramètre N du matériau
);
return new LechaptCalmon(prms);
}
case CalculatorType.SectionParametree:
return new SectionParametree(this.createSection(nodeType));
case CalculatorType.RegimeUniforme:
const sect: acSection = this.createSection(nodeType);
const ru = new RegimeUniforme(sect);
return ru;
case CalculatorType.CourbeRemous:
{
const sect: acSection = this.createSection(nodeType);
const prms = new CourbeRemousParams(sect, 0.15, // Yamont = tirant amont
0.4, // Yaval = tirant aval
100, // Long= Longueur du bief
5, // Dx=Pas d'espace
MethodeResolution.EulerExplicite
);
return new CourbeRemous(prms);
}
case CalculatorType.PabDimensions:
{
const prms = new PabDimensionParams(
2, // Longueur L
1, // Largeur W
0.5, // Tirant d'eau Y
2 // Volume V
);
return new PabDimension(prms);
}
case CalculatorType.PabPuissance:
{
const prms = new PabPuissanceParams(
0.3, // Chute entre bassins DH (m)
0.1, // Débit Q (m3/s)
0.5, // Volume V (m3)
588.6 // Puissance dissipée Pv (W/m3)
);
return new PabPuissance(prms);
}
case CalculatorType.Structure:
const structType: StructureType = params.structureType;
const loiDebit: LoiDebit = params.loiDebit;
return CreateStructure(structType, loiDebit);
case CalculatorType.ParallelStructure:
{
const prms = new ParallelStructureParams(0.5, // Q
102, // Z1
101.5 // Z2
);
return new ParallelStructure(prms);
}
default:
throw new Error(`NubFactory.createNub() : calculatrice '${CalculatorType[calcType]}' / noeud de calcul '${ComputeNodeType[nodeType]}' non pris en charge`);
}
}
private createSection(nt: ComputeNodeType): acSection {
switch (nt) {
case ComputeNodeType.None: // pour les paramètres communs, n'importe quelle section convient
case ComputeNodeType.SectionTrapeze:
{
const prms = new ParamsSectionTrapez(2.5, // largeur de fond
0.56, // fruit
0.8, // tirant d'eau
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
this._defaultPrecision, // précision
1, // YB= hauteur de berge
);
return new cSnTrapez(prms);
}
case ComputeNodeType.SectionRectangle:
{
const prms = new ParamsSectionRectang(0.8, // tirant d'eau
2.5, // largeur de fond
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
this._defaultPrecision, // précision
1 // YB=hauteur de berge
);
return new cSnRectang(prms);
}
case ComputeNodeType.SectionCercle:
{
const prms = new ParamsSectionCirc(2, // diamètre
0.8, // tirant d'eau
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
this._defaultPrecision, // précision
1, // YB= hauteur de berge
);
return new cSnCirc(prms);
}
case ComputeNodeType.SectionPuissance:
{
const prms = new ParamsSectionPuiss(0.5, // coefficient
0.8, // tirant d'eau
4, // largeur de berge
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
this._defaultPrecision, // précision
1, // YB= hauteur de berge
);
return new cSnPuiss(prms);
}
default:
throw new Error(`type de section ${ComputeNodeType[nt]} non pris en charge`);
}
}
}