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
Show more breadcrumbs
Cassiopée
jalhyd
Commits
dfe74e51
Commit
dfe74e51
authored
5 years ago
by
mathias.chouet
Browse files
Options
Downloads
Patches
Plain Diff
Completed TS boilerplate (with "/build" imports though)
parent
8494962d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
boilerplate/ts/src/boilerplate.ts
+70
-5
70 additions, 5 deletions
boilerplate/ts/src/boilerplate.ts
with
70 additions
and
5 deletions
boilerplate/ts/src/boilerplate.ts
+
70
−
5
View file @
dfe74e51
...
...
@@ -2,11 +2,76 @@
* JaLHyd must be compiled with "es2016" target and "commonjs" modules
* @see `npm run build-node` and `src/tsconfig.app.node.json`
*/
import
{
formattedValue
,
PabChute
,
PabChuteParams
}
from
"
jalhyd
"
;
import
{
CalculatorType
,
formattedValue
,
LoiDebit
,
Props
,
Session
}
from
"
jalhyd
"
;
// ---- example of simple modules setup and calculation ----
/**
* Not all calsses are exported through index.d.ts, prefer importing
* classes using full path
*/
import
{
Cloisons
}
from
"
jalhyd/build/pab/cloisons
"
;
import
{
PabChute
}
from
"
jalhyd/build/pab/pab_chute
"
;
import
{
PabDimension
}
from
"
jalhyd/build/pab/pab_dimension
"
;
import
{
PabNombre
}
from
"
jalhyd/build/pab/pab_nombre
"
;
import
{
PabPuissance
}
from
"
jalhyd/build/pab/pab_puissance
"
;
import
{
RectangularStructure
}
from
"
jalhyd/build/structure/rectangular_structure
"
;
// ---- example of modules setup and calculation : fish ladder ----
const
pabChute
=
new
PabChute
(
new
PabChuteParams
(
29.99
,
26.81
,
0
));
const
pabChute
=
Session
.
getInstance
().
createSessionNub
(
new
Props
({
calcType
:
CalculatorType
.
PabChute
})
)
as
PabChute
;
pabChute
.
prms
.
Z1
.
singleValue
=
29.99
;
pabChute
.
prms
.
Z2
.
singleValue
=
26.81
;
pabChute
.
calculatedParam
=
pabChute
.
prms
.
DH
;
const
res
=
pabChute
.
CalcSerie
();
console
.
log
(
"
RESULT :
"
,
formattedValue
(
res
.
vCalc
,
3
));
const
pabNombre
=
Session
.
getInstance
().
createSessionNub
(
new
Props
({
calcType
:
CalculatorType
.
PabNombre
})
)
as
PabNombre
;
pabNombre
.
prms
.
N
.
singleValue
=
14
;
pabNombre
.
calculatedParam
=
pabNombre
.
prms
.
DH
;
pabNombre
.
prms
.
DHT
.
defineReference
(
pabChute
,
"
DH
"
);
const
pabPuissance
=
Session
.
getInstance
().
createSessionNub
(
new
Props
({
calcType
:
CalculatorType
.
PabPuissance
})
)
as
PabPuissance
;
pabPuissance
.
prms
.
Q
.
singleValue
=
1.8
;
pabPuissance
.
prms
.
PV
.
singleValue
=
140
;
pabPuissance
.
calculatedParam
=
pabPuissance
.
prms
.
V
;
pabPuissance
.
prms
.
DH
.
defineReference
(
pabNombre
,
"
DH
"
);
const
pabDimension
=
Session
.
getInstance
().
createSessionNub
(
new
Props
({
calcType
:
CalculatorType
.
PabDimensions
})
)
as
PabDimension
;
pabDimension
.
prms
.
L
.
singleValue
=
5
;
pabDimension
.
prms
.
W
.
singleValue
=
3.6
;
pabDimension
.
calculatedParam
=
pabDimension
.
prms
.
Y
;
pabDimension
.
prms
.
V
.
defineReference
(
pabPuissance
,
"
V
"
);
const
resDim
=
pabDimension
.
CalcSerie
();
console
.
log
(
"
Water level in PAB:Dimension :
"
,
formattedValue
(
resDim
.
vCalc
,
3
));
const
cloisons
=
Session
.
getInstance
().
createSessionNub
(
new
Props
({
calcType
:
CalculatorType
.
Cloisons
})
)
as
Cloisons
;
const
struct
=
Session
.
getInstance
().
createNub
(
new
Props
({
calcType
:
CalculatorType
.
Structure
,
loiDebit
:
LoiDebit
.
WeirSubmergedLarinier
})
)
as
RectangularStructure
;
struct
.
prms
.
L
.
singleValue
=
0.5
;
struct
.
prms
.
CdWSL
.
singleValue
=
0.83
;
cloisons
.
addChild
(
struct
);
cloisons
.
calculatedParam
=
cloisons
.
structures
[
0
].
prms
.
h1
;
cloisons
.
prms
.
Z1
.
singleValue
=
30.14
;
cloisons
.
prms
.
LB
.
singleValue
=
4.5
;
cloisons
.
prms
.
PB
.
singleValue
=
2.5
;
cloisons
.
prms
.
Q
.
defineReference
(
pabPuissance
,
"
Q
"
);
cloisons
.
prms
.
BB
.
defineReference
(
pabDimension
,
"
W
"
);
cloisons
.
prms
.
DH
.
defineReference
(
pabNombre
,
"
DH
"
);
const
resC
=
cloisons
.
CalcSerie
();
console
.
log
(
"
Head in Cloisons :
"
,
formattedValue
(
resC
.
vCalc
,
3
));
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