Commit c33425f6 authored by Dorchies David's avatar Dorchies David Committed by Mathias Chouet
Browse files

#112 Add time and speed at impact

Showing with 24 additions and 3 deletions
+24 -3
...@@ -3,7 +3,7 @@ import { JetParams } from "../../src/devalaison/jet_params"; ...@@ -3,7 +3,7 @@ import { JetParams } from "../../src/devalaison/jet_params";
function newJet(): Jet { function newJet(): Jet {
return new Jet( return new Jet(
new JetParams(5, 0.03, 77.87219452081568, 19.83704632206701), new JetParams(5, 0.03, 77.8803, 19.991),
false false
); );
} }
...@@ -20,7 +20,11 @@ fdescribe("Class Jet", () => { ...@@ -20,7 +20,11 @@ fdescribe("Class Jet", () => {
jet.calculatedParam = jet.getParameter(p.symbol); jet.calculatedParam = jet.getParameter(p.symbol);
const ref: number = p.currentValue; const ref: number = p.currentValue;
jet.calculatedParam.singleValue = jet.calculatedParam.singleValue / 10; jet.calculatedParam.singleValue = jet.calculatedParam.singleValue / 10;
expect(jet.CalcSerie().vCalc).toBeCloseTo(ref, 2); expect(jet.CalcSerie().vCalc).toBeCloseTo(ref, 3);
expect(jet.result.values.t).toBeCloseTo(4, 3);
expect(jet.result.values.Vx).toBeCloseTo(4.9978, 3);
expect(jet.result.values.Vz).toBeCloseTo(-39.0901, 3);
expect(jet.result.values.Vt).toBeCloseTo(39.4083, 3);
}); });
} }
} }
......
...@@ -12,12 +12,25 @@ export class Jet extends Nub { ...@@ -12,12 +12,25 @@ export class Jet extends Nub {
return this._prms as JetParams; return this._prms as JetParams;
} }
public Calc(sVarCalc: string, rInit?: number): Result {
this.currentResult = super.Calc(sVarCalc, rInit);
this.result.resultElement.values.t = this.prms.D.V / Math.cos(this.alpha) / this.prms.V0.V;
this.result.resultElement.values.Vx = this.prms.V0.V * Math.cos(this.alpha);
this.result.resultElement.values.Vz =
this.prms.V0.V * Math.sin(this.alpha) - this.result.resultElement.values.t * 9.81;
this.result.resultElement.values.Vt = Math.sqrt(
Math.pow(this.result.resultElement.values.Vx, 2)
+ Math.pow(this.result.resultElement.values.Vz, 2)
);
return this.result;
}
public Equation(sVarCalc: string): Result { public Equation(sVarCalc: string): Result {
const g: number = 9.81; const g: number = 9.81;
let alpha: number; let alpha: number;
if (sVarCalc !== "S") { if (sVarCalc !== "S") {
// Positive slope for negative angle // Positive slope for negative angle
alpha = Math.asin(-this.prms.S.v); alpha = this.alpha;
} }
let v: number; let v: number;
switch (sVarCalc) { switch (sVarCalc) {
...@@ -43,4 +56,8 @@ export class Jet extends Nub { ...@@ -43,4 +56,8 @@ export class Jet extends Nub {
this.prms.H.calculability = ParamCalculability.EQUATION; this.prms.H.calculability = ParamCalculability.EQUATION;
this.prms.D.calculability = ParamCalculability.EQUATION; this.prms.D.calculability = ParamCalculability.EQUATION;
} }
private get alpha(): number {
return Math.asin(this.prms.S.v);
}
} }
Supports Markdown
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