Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jalhyd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
Cassiopée
jalhyd
Commits
43ac62b2
Commit
43ac62b2
authored
7 years ago
by
francois.grand
Browse files
Options
Downloads
Patches
Plain Diff
#46
ajout de la factory de Nub
parent
50558401
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/index.ts
+1
-1
1 addition, 1 deletion
src/index.ts
src/nub_factory.ts
+197
-0
197 additions, 0 deletions
src/nub_factory.ts
with
198 additions
and
1 deletion
src/index.ts
+
1
−
1
View file @
43ac62b2
...
...
@@ -5,8 +5,8 @@ export * from "./param/param-domain";
export
*
from
"
./param/params-equation
"
;
export
*
from
"
./param/param-values
"
;
export
*
from
"
./compute-node
"
;
export
*
from
"
./parameters
"
;
export
*
from
"
./nub
"
;
export
*
from
"
./nub_factory
"
;
export
*
from
"
./cond_distri
"
;
export
*
from
"
./dichotomie
"
;
export
*
from
"
./lechaptcalmon
"
;
...
...
This diff is collapsed.
Click to expand it.
src/nub_factory.ts
0 → 100644
+
197
−
0
View file @
43ac62b2
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
1
e
-
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`
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment