Commit d184d130 authored by Dorchies David's avatar Dorchies David
Browse files

#154 Add updated scilab scripts and jasmine tests which will fail now ;)

parent 6406bb79
......@@ -65,3 +65,4 @@ spec/test2.ts
spec/tsconfig-test.spec.json
spec/tsconfig-test2.spec.json
src/util/http.ts
/doc/matlabl_macro_rugo/*.mat
......@@ -61,7 +61,7 @@ guidata(hObject, handles);
%cd('E:\lcassan\Mes documents\macro_rugosite\cassiopee\gui_matlab')
%cd('D:\macrorugosite\cassiopee\gui_matlab')
if exist('data_precalcul_nat')==2
if exist('data_precalcul_nat.mat')==2
load data_precalcul_nat
......
......@@ -118,7 +118,7 @@ function [res]=find_Q_nat(Q,ks,D,h,Cd0,S,L,pf,C,sigma,bDbg)
U0a=(2*g.*S.*D.*(R)./(Cd.*C.*(1+N))).^0.5;
[u fval] = fminsearch(list(find_U0_complet, U0i,pf,C,D,sigma,Cd0,Cf,coeff_contraction,S), U0a, opt)
[u fval] = fminsearch(list(find_U0_complet, pf,C,D,sigma,Cd0,Cf,coeff_contraction,S), U0a, opt)
res=abs(U0-u);
......
function macrorugo_resultComp(z_amont, S, long, Q, L, pf, C, Cd, h, D)
g = 9.81
cote_bas=z_amont-S*long;
print_r("cote_bas");
......@@ -23,7 +23,7 @@ function macrorugo_resultComp(z_amont, S, long, Q, L, pf, C, Cd, h, D)
flowcond = 'immerge'
end
print_r("flowcond");
if pf/h>1.1
q_technique=0.955*(pf/h)^2.282*S^0.466*C^(-0.23)*(9.81*h)^0.5.*h*L;
else
......@@ -41,4 +41,7 @@ function macrorugo_resultComp(z_amont, S, long, Q, L, pf, C, Cd, h, D)
end
print_r("q_technique");
Strickler = Q /(pf*L*pf^(2/3)*S^(1/2));
print_r("Strickler");
endfunction
function macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
function [Q] = macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
printf("*** INPUT *** \n")
print_r("ks")
print_r("D")
......
......@@ -46,9 +46,10 @@ printf("\n*** JalHyd #85 ***\n")
// *****************************************************************************
k = 0.8
C = 0.2; // Concentration
Q = []
for h = 0.7:0.1:1.2
macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
Q = [Q, macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)]
end
disp Q
macrorugo_searchQ(ks, D, 0.5, 2, S, 2, 0.85, C, z_amont, long, bDbg)
......@@ -5,23 +5,26 @@ import { checkResult } from "../test_func";
/*
*** Emergent conditions Cd=1.5***
ks=0.010000
D=0.500000
k=0.700000
Cd0=1.500000
S=0.050000
B=1.000000
h=0.600000
C=0.130000
Q=0.493722 fVal=0.000000
ks = 0.010000
D = 0.500000
k = 0.700000
Cd0 = 1.500000
S = 0.050000
B = 1.000000
h = 0.600000
C = 0.130000
RESULTS:
find_Q_nat(0.901710)=0.679969
Q=0.493729 fVal=0.000000
cote_bas = 12.200000
Vdeb = 0.822870
Fr = 0.530417
P = 242.170537
Vdeb = 0.822881
Fr = 0.530425
P = 242.174003
flowcond = emergent
Vmax = 1.799472
Vmax = 1.799502
V_technique = 1.991299
q_technique = 0.561860
Strickler = 5.173107
*/
function macroRugoInstanceEmergentCd15(): MacroRugo {
......@@ -31,7 +34,7 @@ function macroRugoInstanceEmergentCd15(): MacroRugo {
6, // L
1, // B
0.05, // If
0.493722, // Q
0.493729, // Q
0.6, // h
0.01, // Ks
0.13, // C
......@@ -50,80 +53,89 @@ const macroRugoExtraResultEmergentCd15: { [key: string]: number|MacroRugoFlowTyp
V_GuideTech: 1.991299,
Vdeb: 0.822881,
Vmax: 1.799502,
Strickler: 5.173107,
ZF2: 12.2
};
/*
*** Emergent conditions Cd=2***
ks=0.010000
D=0.500000
k=0.700000
Cd0=2.000000
S=0.050000
B=1.000000
h=0.600000
C=0.130000
Q=0.376808 fVal=0.000000
ks = 0.010000
D = 0.500000
k = 0.700000
Cd0 = 2.000000
S = 0.050000
B = 1.000000
h = 0.600000
C = 0.130000
RESULTS:
find_Q_nat(0.768677)=0.653110
Q=0.376811 fVal=0.000000
cote_bas = 12.200000
Vdeb = 0.628013
Fr = 0.404814
P = 184.824088
Vdeb = 0.628018
Fr = 0.404817
P = 184.825731
flowcond = emergent
Vmax = 1.536115
Vmax = 1.536129
V_technique = 1.592932
q_technique = 0.414154
Strickler = 3.948084
*/
function macroRugoInstanceEmergentCd2(): MacroRugo {
const nub: MacroRugo = macroRugoInstanceEmergentCd15();
nub.prms.Cd0.singleValue = 2;
nub.prms.Q.singleValue = 0.376808;
nub.prms.Q.singleValue = 0.376811;
return nub;
}
const macroRugoExtraResultEmergentCd2: { [key: string]: number|MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
Fr: 0.404817,
PV: 184.825734,
PV: 184.825731,
Q_GuideTech: 0.414154,
V_GuideTech: 1.592932,
Vdeb: 0.628018,
Vmax: 1.536129,
Strickler: 3.948084,
ZF2: 12.2
};
/*
*** Submerged conditions ***
ks=0.010000
D=0.500000
k=0.700000
Cd0=1.500000
S=0.050000
B=1.000000
h=0.800000
C=0.130000
Q=0.908068 fVal=0.000000
ks = 0.010000
D = 0.500000
k = 0.700000
Cd0 = 1.500000
S = 0.050000
B = 1.000000
h = 0.800000
C = 0.130000
RESULTS:
find_Q_nat(1.202280)=0.112522
Q=1.112263 fVal=0.000000
cote_bas = 12.200000
Vdeb = 1.135085
Fr = 0.633645
P = 445.407266
Vdeb = 1.390328
Fr = 0.776130
P = 545.564782
flowcond = immerge
q_technique = 0.940450
Strickler = 7.215044
*/
function macroRugoInstanceSubmerged(): MacroRugo {
const nub: MacroRugo = macroRugoInstanceEmergentCd15();
nub.prms.Y.singleValue = 0.8;
nub.prms.Q.singleValue = 0.908068;
nub.prms.Q.singleValue = 1.112263;
return nub;
}
const macroRugoExtraResultSubmerged: { [key: string]: number|MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.SUBMERGED,
Fr: 0.633645,
PV: 445.407266,
Fr: 0.776130,
PV: 545.564782,
Q_GuideTech: 0.940450,
Vdeb: 1.135085,
Vdeb: 1.390328,
Strickler: 7.215044,
ZF2: 12.2
};
......@@ -191,8 +203,8 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt
describe("Class MacroRugo: ", () => {
testMacroRugoConfig("EmergentCd15", 0.901710, 0.379539, macroRugoExtraResultEmergentCd15);
testMacroRugoConfig("EmergentCd2", 0.768677, 0.418029, macroRugoExtraResultEmergentCd2);
testMacroRugoConfig("EmergentCd15", 0.901710, 0.679969, macroRugoExtraResultEmergentCd15);
testMacroRugoConfig("EmergentCd2", 0.768677, 0.653110, macroRugoExtraResultEmergentCd2);
// Le test passe en debug mais pas sous Jasmine !??
// describe(`Condition Submerged` , () => {
// it(`resolveAlpha_t(0.07) should be 0.074752`, () => {
......@@ -200,17 +212,17 @@ describe("Class MacroRugo: ", () => {
// expect(macroRugoInstanceSubmerged()["resolveAlpha_t"](0.07)).toBeCloseTo(0.074752, 5);
// });
// });
testMacroRugoConfig("Submerged", 1.202280, 0.145051, macroRugoExtraResultSubmerged);
testMacroRugoConfig("Submerged", 1.202280, 0.112522, macroRugoExtraResultSubmerged);
describe("JalHyd #85", () => {
it("CalcSerie Q should return the goog result :)", () => {
it("CalcSerie Q should return the good result :)", () => {
const nubMR = macroRugoInstanceEmergentCd2();
nubMR.prms.C.singleValue = 0.2;
nubMR.prms.PBH.singleValue = 0.8;
nubMR.calculatedParam = nubMR.prms.Q;
nubMR.prms.Y.setValues(0.7, 1.2, 0.1);
const aQ: number[] = [ 0.363679, 0.433841, 0.595482, 0.768310, 0.991123, 1.441876 ];
const aQ: number[] = [ 0.484255, 0.578363, 1.004229, 1.280269, 1.618937, 2.018687 ];
nubMR.CalcSerie();
for (let i = 0; i < aQ.length; i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment