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
c2d90098
Commit
c2d90098
authored
5 years ago
by
David Dorchies
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#116
parent
8a65b70e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
spec/pab/pab_puissance.spec.ts
+13
-12
13 additions, 12 deletions
spec/pab/pab_puissance.spec.ts
spec/structure/parallel_structure.spec.ts
+20
-1
20 additions, 1 deletion
spec/structure/parallel_structure.spec.ts
src/dichotomie.ts
+1
-1
1 addition, 1 deletion
src/dichotomie.ts
with
34 additions
and
14 deletions
spec/pab/pab_puissance.spec.ts
+
13
−
12
View file @
c2d90098
...
...
@@ -7,27 +7,28 @@ import { checkResult } from "../test_func";
function
PabPuissanceTest
(
varTest
:
string
)
{
describe
(
"
Calc():
"
,
()
=>
{
it
(
"
V should be 1
"
,
()
=>
{
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)
);
it
(
`
${
varTest
}
should be
${
prms
[
varTest
].
v
}
`
,
()
=>
{
prms
=
createPabPuisPrms
();
const
res
:
number
=
prms
[
varTest
].
v
;
const
nub
=
new
PabPuissance
(
prms
);
prms
[
varTest
].
v
=
undefined
;
checkResult
(
nub
.
Calc
(
varTest
,
1
e
-
9
),
res
);
});
});
}
function
createPabPuisPrms
():
PabPuissanceParams
{
return
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)
);
}
let
prms
:
PabPuissanceParams
=
createPabPuisPrms
();
describe
(
"
Class PabPuissance:
"
,
()
=>
{
// beforeEach(() => {
// });
// beforeAll(() => {
// });
PabPuissanceTest
(
"
DH
"
);
...
...
This diff is collapsed.
Click to expand it.
spec/structure/parallel_structure.spec.ts
+
20
−
1
View file @
c2d90098
...
...
@@ -6,10 +6,15 @@
*/
// import { describe, expect, it, xdescribe, xit } from "../mock_jasmine";
import
{
MessageCode
}
from
"
../../src/index
"
;
import
{
CalculatorType
}
from
"
../../src/compute-node
"
;
import
{
Props
}
from
"
../../src/props
"
;
import
{
Session
}
from
"
../../src/session
"
;
import
{
CreateStructure
}
from
"
../../src/structure/factory_structure
"
;
import
{
ParallelStructure
}
from
"
../../src/structure/parallel_structure
"
;
import
{
ParallelStructureParams
}
from
"
../../src/structure/parallel_structure_params
"
;
import
{
StructureKivi
,
StructureKiviParams
}
from
"
../../src/structure/structure_kivi
"
;
import
{
LoiDebit
}
from
"
../../src/structure/structure_props
"
;
import
{
MessageCode
}
from
"
../../src/util/message
"
;
import
{
Result
}
from
"
../../src/util/result
"
;
import
{
precDigits
}
from
"
../test_config
"
;
import
{
checkResult
}
from
"
../test_func
"
;
...
...
@@ -133,4 +138,18 @@ describe("Class ParallelStructure: ", () => {
expect
(
ps3
.
CalcSerie
().
vCalc
).
toBeCloseTo
(
101.57
,
2
);
});
});
describe
(
"
#116 Pas de calcul de Z2 sur loi dénoyée
"
,
()
=>
{
it
(
"
Calc(Z2) should return an error
"
,
()
=>
{
// Create Parallel Structure with default parameters
const
ps4
=
Session
.
getInstance
().
createNub
(
new
Props
({
calcType
:
CalculatorType
.
ParallelStructure
})
)
as
ParallelStructure
;
// Add Free flow weir
ps4
.
addChild
(
CreateStructure
(
LoiDebit
.
WeirFree
));
// Define Z2 to calculate
ps4
.
calculatedParam
=
ps4
.
prms
.
Z2
;
expect
(
ps4
.
CalcSerie
().
ok
).
toBeFalsy
();
});
});
});
This diff is collapsed.
Click to expand it.
src/dichotomie.ts
+
1
−
1
View file @
c2d90098
...
...
@@ -516,7 +516,7 @@ export class Dichotomie extends Debug {
tolAct
=
1
e
-
15
*
Math
.
abs
(
b
)
+
errorTol
/
2
;
newStep
=
(
c
-
b
)
/
2
;
if
(
Math
.
abs
(
newStep
)
<=
tolAct
||
fb
===
0
)
{
if
(
Math
.
abs
(
newStep
)
<=
tolAct
&&
Math
.
abs
(
fb
)
<
0.1
)
{
return
b
;
// Acceptable approx. is found
}
...
...
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